fix: use .split

This commit is contained in:
Julian Sommer
2026-08-18 13:33:41 +10:00
parent 235403e309
commit 36657bdb63
13 changed files with 13 additions and 32 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
import{a as e,n as t,r as n,t as r}from"./compiler-runtime.js";import{t as i}from"./useSuspenseQuery.js";import{t as a}from"./link.js";import{t as o}from"./button.js";import{o as s}from"./ecs.js";import{a as c}from"./ecs2.js";import{t as l}from"./error-banner.js";import{t as u}from"./page-heading.js";import{t as d}from"./delete-confirmation-dialog.js";import{t as f}from"./ecs-section-nav.js";var p=r(),m=e(n(),1),h=t();function g(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function _(e){let t=(0,p.c)(24),{clusterName:n}=e,{data:r}=i(s),u=c(),[f,_]=(0,m.useState)(null),v;t[0]!==u||t[1]!==f?(v=function(){f&&u.mutate(f,{onSuccess:()=>_(null)})},t[0]=u,t[1]=f,t[2]=v):v=t[2];let y=v,b=n??``,x;t[3]===b?x=t[4]:(x={cluster:b},t[3]=b,t[4]=x);let S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,h.jsx)(o,{size:`sm`,children:`Register task definition`}),t[5]=S):S=t[5];let C;t[6]===x?C=t[7]:(C=(0,h.jsx)(`div`,{className:`mb-4 flex justify-end`,children:(0,h.jsx)(a,{search:x,to:`/ecs/register-task-definition`,children:S})}),t[6]=x,t[7]=C);let w;t[8]!==u.error||t[9]!==u.isError?(w=u.isError&&(0,h.jsx)(l,{error:u.error instanceof Error?u.error:void 0,msg:`Failed to deregister task definition.`}),t[8]=u.error,t[9]=u.isError,t[10]=w):w=t[10];let T;t[11]===r?T=t[12]:(T=r.length===0?(0,h.jsx)(`p`,{className:`text-muted-foreground`,children:`No task definitions found.`}):(0,h.jsx)(`div`,{className:`overflow-x-auto rounded-lg border bg-card`,children:(0,h.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{className:`border-b text-left text-muted-foreground`,children:[(0,h.jsx)(`th`,{className:`px-4 py-2 font-medium`,children:`Family : Revision`}),(0,h.jsx)(`th`,{className:`px-4 py-2 font-medium`,children:(0,h.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,h.jsx)(`tbody`,{children:r.map(e=>{let t=g(e);return(0,h.jsxs)(`tr`,{className:`border-b last:border-0`,children:[(0,h.jsx)(`td`,{className:`px-4 py-2 font-mono text-xs`,children:t}),(0,h.jsx)(`td`,{className:`px-4 py-2 text-right`,children:(0,h.jsx)(o,{onClick:()=>_(t),size:`sm`,variant:`destructive`,children:`Deregister`})})]},e)})})]})}),t[11]=r,t[12]=T);let E=`This marks task definition "${f}" INACTIVE. Existing tasks keep running; no new tasks can use it.`,D;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>!e&&_(null),t[13]=D):D=t[13];let O=f!==null,k;t[14]!==u.isPending||t[15]!==y||t[16]!==O||t[17]!==E?(k=(0,h.jsx)(d,{confirmLabel:`Deregister`,description:E,isPending:u.isPending,onConfirm:y,onOpenChange:D,open:O,pendingLabel:`Deregistering…`,title:`Deregister task definition`}),t[14]=u.isPending,t[15]=y,t[16]=O,t[17]=E,t[18]=k):k=t[18];let A;return t[19]!==k||t[20]!==C||t[21]!==w||t[22]!==T?(A=(0,h.jsxs)(h.Fragment,{children:[C,w,T,k]}),t[19]=k,t[20]=C,t[21]=w,t[22]=T,t[23]=A):A=t[23],A}function v(){let e=(0,p.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(u,{title:`Task definitions`}),(0,h.jsx)(f,{}),(0,h.jsx)(_,{})]}),e[0]=t):t=e[0],t}var y=v;export{y as component};
import{a as e,n as t,r as n,t as r}from"./compiler-runtime.js";import{t as i}from"./useSuspenseQuery.js";import{t as a}from"./link.js";import{t as o}from"./button.js";import{o as s}from"./ecs.js";import{a as c}from"./ecs2.js";import{t as l}from"./error-banner.js";import{t as u}from"./page-heading.js";import{t as d}from"./delete-confirmation-dialog.js";import{t as f}from"./ecs-section-nav.js";var p=r(),m=e(n(),1),h=t();function g(e){return e.split(`/`).at(-1)??e}function _(e){let t=(0,p.c)(24),{clusterName:n}=e,{data:r}=i(s),u=c(),[f,_]=(0,m.useState)(null),v;t[0]!==u||t[1]!==f?(v=function(){f&&u.mutate(f,{onSuccess:()=>_(null)})},t[0]=u,t[1]=f,t[2]=v):v=t[2];let y=v,b=n??``,x;t[3]===b?x=t[4]:(x={cluster:b},t[3]=b,t[4]=x);let S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,h.jsx)(o,{size:`sm`,children:`Register task definition`}),t[5]=S):S=t[5];let C;t[6]===x?C=t[7]:(C=(0,h.jsx)(`div`,{className:`mb-4 flex justify-end`,children:(0,h.jsx)(a,{search:x,to:`/ecs/register-task-definition`,children:S})}),t[6]=x,t[7]=C);let w;t[8]!==u.error||t[9]!==u.isError?(w=u.isError&&(0,h.jsx)(l,{error:u.error instanceof Error?u.error:void 0,msg:`Failed to deregister task definition.`}),t[8]=u.error,t[9]=u.isError,t[10]=w):w=t[10];let T;t[11]===r?T=t[12]:(T=r.length===0?(0,h.jsx)(`p`,{className:`text-muted-foreground`,children:`No task definitions found.`}):(0,h.jsx)(`div`,{className:`overflow-x-auto rounded-lg border bg-card`,children:(0,h.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{className:`border-b text-left text-muted-foreground`,children:[(0,h.jsx)(`th`,{className:`px-4 py-2 font-medium`,children:`Family : Revision`}),(0,h.jsx)(`th`,{className:`px-4 py-2 font-medium`,children:(0,h.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,h.jsx)(`tbody`,{children:r.map(e=>{let t=g(e);return(0,h.jsxs)(`tr`,{className:`border-b last:border-0`,children:[(0,h.jsx)(`td`,{className:`px-4 py-2 font-mono text-xs`,children:t}),(0,h.jsx)(`td`,{className:`px-4 py-2 text-right`,children:(0,h.jsx)(o,{onClick:()=>_(t),size:`sm`,variant:`destructive`,children:`Deregister`})})]},e)})})]})}),t[11]=r,t[12]=T);let E=`This marks task definition "${f}" INACTIVE. Existing tasks keep running; no new tasks can use it.`,D;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>!e&&_(null),t[13]=D):D=t[13];let O=f!==null,k;t[14]!==u.isPending||t[15]!==y||t[16]!==O||t[17]!==E?(k=(0,h.jsx)(d,{confirmLabel:`Deregister`,description:E,isPending:u.isPending,onConfirm:y,onOpenChange:D,open:O,pendingLabel:`Deregistering…`,title:`Deregister task definition`}),t[14]=u.isPending,t[15]=y,t[16]=O,t[17]=E,t[18]=k):k=t[18];let A;return t[19]!==k||t[20]!==C||t[21]!==w||t[22]!==T?(A=(0,h.jsxs)(h.Fragment,{children:[C,w,T,k]}),t[19]=k,t[20]=C,t[21]=w,t[22]=T,t[23]=A):A=t[23],A}function v(){let e=(0,p.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(u,{title:`Task definitions`}),(0,h.jsx)(f,{}),(0,h.jsx)(_,{})]}),e[0]=t):t=e[0],t}var y=v;export{y as component};
@@ -29,8 +29,7 @@ import { elbv2TargetGroupsQueryOptions } from "@/queries/elbv2"
import { createServiceSchema, type CreateServiceFormData } from "@/types/ecs"
function familyRevision(arn: string): string {
const idx = arn.lastIndexOf("/")
return idx === -1 ? arn : arn.slice(idx + 1)
return arn.split("/").at(-1) ?? arn
}
export function CreateServicePage({ cluster }: { cluster: string }) {
@@ -29,8 +29,7 @@ import { runTaskSchema, type RunTaskFormData } from "@/types/ecs"
// familyRevision turns a task definition ARN into its "family:revision" id.
function familyRevision(arn: string): string {
const idx = arn.lastIndexOf("/")
return idx === -1 ? arn : arn.slice(idx + 1)
return arn.split("/").at(-1) ?? arn
}
export function RunTaskPage({ cluster }: { cluster: string }) {
@@ -17,11 +17,7 @@ import { ecsServicesQueryOptions, ecsTasksQueryOptions } from "@/queries/ecs"
// shortArn renders the trailing resource segment of an ARN, falling back to the
// whole string when there is no slash.
function shortArn(arn: string | undefined): string {
if (!arn) {
return ""
}
const idx = arn.lastIndexOf("/")
return idx === -1 ? arn : arn.slice(idx + 1)
return arn?.split("/").at(-1) ?? ""
}
function attachmentDetail(task: Task, name: string): string | undefined {
@@ -9,11 +9,7 @@ import { ecsServicesQueryOptions } from "@/queries/ecs"
// shortArn renders the trailing resource segment of an ARN (the part after the
// final "/"), falling back to the whole string when there is no slash.
function shortArn(arn: string | undefined): string {
if (!arn) {
return ""
}
const idx = arn.lastIndexOf("/")
return idx === -1 ? arn : arn.slice(idx + 1)
return arn?.split("/").at(-1) ?? ""
}
export function ServicesTab({ clusterName }: { clusterName: string }) {
@@ -11,8 +11,7 @@ import { ecsTaskDefinitionsQueryOptions } from "@/queries/ecs"
// familyRevision extracts the "family:revision" identifier from a task
// definition ARN; DeregisterTaskDefinition requires that explicit form.
function familyRevision(arn: string): string {
const idx = arn.lastIndexOf("/")
return idx === -1 ? arn : arn.slice(idx + 1)
return arn.split("/").at(-1) ?? arn
}
// TaskDefinitionsList renders the account-scoped task definitions. clusterName,
@@ -11,11 +11,7 @@ import { ecsTasksQueryOptions } from "@/queries/ecs"
// shortArn renders the trailing resource segment of an ARN, falling back to the
// whole string when there is no slash.
function shortArn(arn: string | undefined): string {
if (!arn) {
return ""
}
const idx = arn.lastIndexOf("/")
return idx === -1 ? arn : arn.slice(idx + 1)
return arn?.split("/").at(-1) ?? ""
}
function attachmentDetail(
@@ -11,11 +11,7 @@ import { useStopTask } from "@/mutations/ecs"
import { ecsTasksQueryOptions } from "@/queries/ecs"
function taskId(arn: string | undefined): string {
if (!arn) {
return ""
}
const idx = arn.lastIndexOf("/")
return idx === -1 ? arn : arn.slice(idx + 1)
return arn?.split("/").at(-1) ?? ""
}
export function TasksTab({ clusterName }: { clusterName: string }) {