fix: frontend error handling

This commit is contained in:
Julian Sommer
2026-02-03 12:19:39 +10:00
parent 2de2899724
commit 10ded4608b
40 changed files with 327 additions and 199 deletions
+1 -1
View File
@@ -1 +1 @@
import{c as k,aI as v,aJ as $,aF as B,j as s,aE as K,aK as P,aL as y,L as C}from"./index.js";import{u as F}from"./useSuspenseQuery.js";import{B as L}from"./back-link.js";import{F as S,O as E,U as I}from"./upload-button.js";import"./alert-dialog.js";import"./s3.js";import"./useMutation.js";import"./download.js";import"./trash-2.js";function z(){const e=k.c(20),{bucket:n,_splat:b}=v.useParams(),a=$(b||""),{data:o}=F(B(n,a));let c;e[0]!==o.Contents?(c=o.Contents||[],e[0]=o.Contents,e[1]=c):c=e[1];const r=c;let h;e[2]!==o.CommonPrefixes?(h=o.CommonPrefixes||[],e[2]=o.CommonPrefixes,e[3]=h):h=e[3];const i=h,x=a.split("/").filter(Boolean),N=[{name:n,path:`/s3/ls/${n}`},...x.map((t,l)=>{const m=`${x.slice(0,l+1).join("/")}/`;return{name:t,path:`/s3/ls/${n}/${m}`}})],g=x.length>1?`/s3/ls/${n}/${x.slice(0,-1).join("/")}/`:`/s3/ls/${n}`;let d;e[4]!==g?(d=s.jsx(L,{to:g,children:"Back"}),e[4]=g,e[5]=d):d=e[5];let f;e[6]!==n||e[7]!==a?(f=s.jsx(I,{bucket:n,prefix:a}),e[6]=n,e[7]=a,e[8]=f):f=e[8];let p;e[9]!==n||e[10]!==i||e[11]!==a?(p=i.length>0&&s.jsxs("div",{className:"mb-6",children:[s.jsx("h2",{className:"mb-3 font-semibold text-lg",children:"Folders"}),s.jsx("div",{className:"space-y-2",children:i.map(t=>{if(!t.Prefix)return null;const l=K(P(t.Prefix,a)),m=y(t.Prefix,a);return s.jsx(S,{bucketName:n,folderName:l,fullPrefix:m},t.Prefix)})})]}),e[9]=n,e[10]=i,e[11]=a,e[12]=p):p=e[12];let u;e[13]!==n||e[14]!==r||e[15]!==a?(u=r.length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("h2",{className:"mb-3 font-semibold text-lg",children:"Objects"}),r.map(t=>{if(!t.Key)return null;const l=P(t.Key,a),m=y(t.Key,a);return s.jsx(E,{bucketName:n,displayName:l,fullKey:m,object:t},t.Key)})]}),e[13]=n,e[14]=r,e[15]=a,e[16]=u):u=e[16];let j;return e[17]!==i.length||e[18]!==r.length?(j=r.length===0&&i.length===0&&s.jsx("p",{className:"text-muted-foreground",children:"No objects found in this folder."}),e[17]=i.length,e[18]=r.length,e[19]=j):j=e[19],s.jsxs(s.Fragment,{children:[d,s.jsx("div",{className:"mb-6",children:s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("div",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:N.map((t,l)=>s.jsxs("div",{className:"flex items-center gap-2",children:[l>0&&s.jsx("span",{children:"/"}),l===N.length-1?s.jsx("span",{className:"text-foreground",children:t.name}):s.jsx(C,{className:"hover:text-foreground",to:t.path,children:t.name})]},t.path))}),f]})}),p,u,j]})}export{z as component};
import{c as B,aH as $,aI as K,aE as C,j as s,aD as F,aJ as b,aK as k,L as E}from"./index.js";import{u as L}from"./useSuspenseQuery.js";import{B as O}from"./back-link.js";import{E as S}from"./error-banner.js";import{a as U}from"./s3.js";import{U as A,F as I,O as R}from"./upload-button.js";import"./alert-dialog.js";import"./download.js";import"./trash-2.js";function G(){const e=B.c(24),{bucket:n,_splat:v}=$.useParams(),a=K(v||""),{data:m}=L(C(n,a)),r=U();let d;e[0]!==m.Contents?(d=m.Contents||[],e[0]=m.Contents,e[1]=d):d=e[1];const o=d;let p;e[2]!==m.CommonPrefixes?(p=m.CommonPrefixes||[],e[2]=m.CommonPrefixes,e[3]=p):p=e[3];const i=p,u=a.split("/").filter(Boolean),y=[{name:n,path:`/s3/ls/${n}`},...u.map((t,l)=>{const c=`${u.slice(0,l+1).join("/")}/`;return{name:t,path:`/s3/ls/${n}/${c}`}})],P=u.length>1?`/s3/ls/${n}/${u.slice(0,-1).join("/")}/`:`/s3/ls/${n}`;let f;e[4]!==P?(f=s.jsx(O,{to:P,children:"Back"}),e[4]=P,e[5]=f):f=e[5];let x;e[6]!==n||e[7]!==a||e[8]!==r.isPending||e[9]!==r.mutateAsync?(x=s.jsx(A,{bucket:n,isPending:r.isPending,onUpload:r.mutateAsync,prefix:a}),e[6]=n,e[7]=a,e[8]=r.isPending,e[9]=r.mutateAsync,e[10]=x):x=e[10];let h;e[11]!==r.error?(h=r.error&&s.jsx(S,{error:r.error,msg:"Failed to upload object"}),e[11]=r.error,e[12]=h):h=e[12];let g;e[13]!==n||e[14]!==i||e[15]!==a?(g=i.length>0&&s.jsxs("div",{className:"mb-6",children:[s.jsx("h2",{className:"mb-3 font-semibold text-lg",children:"Folders"}),s.jsx("div",{className:"space-y-2",children:i.map(t=>{if(!t.Prefix)return null;const l=F(b(t.Prefix,a)),c=k(t.Prefix,a);return s.jsx(I,{bucketName:n,folderName:l,fullPrefix:c},t.Prefix)})})]}),e[13]=n,e[14]=i,e[15]=a,e[16]=g):g=e[16];let j;e[17]!==n||e[18]!==o||e[19]!==a?(j=o.length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("h2",{className:"mb-3 font-semibold text-lg",children:"Objects"}),o.map(t=>{if(!t.Key)return null;const l=b(t.Key,a),c=k(t.Key,a);return s.jsx(R,{bucketName:n,displayName:l,fullKey:c,object:t},t.Key)})]}),e[17]=n,e[18]=o,e[19]=a,e[20]=j):j=e[20];let N;return e[21]!==i.length||e[22]!==o.length?(N=o.length===0&&i.length===0&&s.jsx("p",{className:"text-muted-foreground",children:"No objects found in this folder."}),e[21]=i.length,e[22]=o.length,e[23]=N):N=e[23],s.jsxs(s.Fragment,{children:[f,s.jsx("div",{className:"mb-6",children:s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("div",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:y.map((t,l)=>s.jsxs("div",{className:"flex items-center gap-2",children:[l>0&&s.jsx("span",{children:"/"}),l===y.length-1?s.jsx("span",{className:"text-foreground",children:t.name}):s.jsx(E,{className:"hover:text-foreground",to:t.path,children:t.name})]},t.path))}),x]})}),h,g,j,N]})}export{G as component};
+1 -1
View File
@@ -1 +1 @@
import{c as O,bq as T,u as D,br as J,j as s,bs as K,B as Q}from"./index.js";import{a as U,u as W,I as X,F as Y,b as Z,c as ee}from"./field.js";import{u as se}from"./useSuspenseQuery.js";import{B as q}from"./back-link.js";import{E as te}from"./error-banner.js";import{P as ie}from"./page-heading.js";import{d as re}from"./ec2.js";import"./useMutation.js";function fe(){const e=O.c(58),{id:R}=T.useParams(),o=D();let S;e[0]!==R?(S=K(R),e[0]=R,e[1]=S):S=e[1];const{data:H}=se(S),A=H.Volumes?.[0],t=A?.VolumeId,r=re(),i=A?.Size??1;let a;e[2]!==i?(a=U(J.refine(l=>l.size>i,{message:`New size must be greater than current size (${i} GiB)`,path:["size"]})),e[2]=i,e[3]=a):a=e[3];let n;e[4]!==i?(n={size:i},e[4]=i,e[5]=n):n=e[5];let B;e[6]!==a||e[7]!==n?(B={resolver:a,defaultValues:n},e[6]=a,e[7]=n,e[8]=B):B=e[8];const{handleSubmit:k,register:E,formState:L}=W(B),{errors:V,isSubmitting:$}=L;if(!t){let l;return e[9]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs(s.Fragment,{children:[s.jsx(q,{to:"/ec2/describe-volumes",children:"Back to volumes"}),s.jsx("p",{className:"text-muted-foreground",children:"Volume not found."})]}),e[9]=l):l=e[9],l}let F;e[10]!==r||e[11]!==o||e[12]!==t?(F=async l=>{await r.mutateAsync({...l,volumeId:t}),o({to:"/ec2/describe-volumes/$id",params:{id:t}})},e[10]=r,e[11]=o,e[12]=t,e[13]=F):F=e[13];const w=F;let m,c;e[14]!==t?(m=s.jsx(q,{params:{id:t},to:"/ec2/describe-volumes/$id",children:"Back to volume"}),c=s.jsx(ie,{subtitle:t,title:"Resize Volume"}),e[14]=t,e[15]=m,e[16]=c):(m=e[15],c=e[16]);let u;e[17]!==r.error?(u=r.error&&s.jsx(te,{error:r.error,msg:"Failed to resize volume"}),e[17]=r.error,e[18]=u):u=e[18];let d;e[19]!==k||e[20]!==w?(d=k(w),e[19]=k,e[20]=w,e[21]=d):d=e[21];let f;e[22]!==i?(f=s.jsx("div",{className:"space-y-2",children:s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Current size: ",i," GiB"]})}),e[22]=i,e[23]=f):f=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(Z,{children:s.jsx("label",{htmlFor:"size",children:"New size (GiB)"})}),e[24]=N):N=e[24];const I=!!V.size,_=i+1;let p;e[25]!==E?(p=E("size",{valueAsNumber:!0}),e[25]=E,e[26]=p):p=e[26];let x;e[27]!==I||e[28]!==_||e[29]!==p?(x=s.jsx(X,{"aria-invalid":I,id:"size",min:_,type:"number",...p}),e[27]=I,e[28]=_,e[29]=p,e[30]=x):x=e[30];let b;e[31]!==V.size?(b=s.jsx(Y,{errors:[V.size]}),e[31]=V.size,e[32]=b):b=e[32];let h;e[33]!==x||e[34]!==b?(h=s.jsxs(ee,{children:[N,x,b]}),e[33]=x,e[34]=b,e[35]=h):h=e[35];const C=$||r.isPending;let j;e[36]!==o||e[37]!==t?(j=()=>o({to:"/ec2/describe-volumes/$id",params:{id:t}}),e[36]=o,e[37]=t,e[38]=j):j=e[38];let z;e[39]!==C||e[40]!==j?(z=s.jsx(Q,{disabled:C,onClick:j,type:"button",variant:"outline",children:"Cancel"}),e[39]=C,e[40]=j,e[41]=z):z=e[41];const G=$||r.isPending,M=$||r.isPending?"Resizing…":"Resize Volume";let g;e[42]!==G||e[43]!==M?(g=s.jsx(Q,{disabled:G,type:"submit",children:M}),e[42]=G,e[43]=M,e[44]=g):g=e[44];let v;e[45]!==z||e[46]!==g?(v=s.jsxs("div",{className:"flex gap-2",children:[z,g]}),e[45]=z,e[46]=g,e[47]=v):v=e[47];let y;e[48]!==f||e[49]!==h||e[50]!==v||e[51]!==d?(y=s.jsxs("form",{className:"max-w-4xl space-y-6",onSubmit:d,children:[f,h,v]}),e[48]=f,e[49]=h,e[50]=v,e[51]=d,e[52]=y):y=e[52];let P;return e[53]!==y||e[54]!==m||e[55]!==c||e[56]!==u?(P=s.jsxs(s.Fragment,{children:[m,c,u,y]}),e[53]=y,e[54]=m,e[55]=c,e[56]=u,e[57]=P):P=e[57],P}export{fe as component};
import{c as O,bp as T,u as D,bq as J,j as s,br as K,B as Q}from"./index.js";import{a as U,u as W,I as X,F as Y,b as Z,c as ee}from"./field.js";import{u as se}from"./useSuspenseQuery.js";import{B as q}from"./back-link.js";import{E as te}from"./error-banner.js";import{P as ie}from"./page-heading.js";import{d as le}from"./ec2.js";function de(){const e=O.c(58),{id:R}=T.useParams(),o=D();let S;e[0]!==R?(S=K(R),e[0]=R,e[1]=S):S=e[1];const{data:H}=se(S),A=H.Volumes?.[0],t=A?.VolumeId,l=le(),i=A?.Size??1;let a;e[2]!==i?(a=U(J.refine(r=>r.size>i,{message:`New size must be greater than current size (${i} GiB)`,path:["size"]})),e[2]=i,e[3]=a):a=e[3];let n;e[4]!==i?(n={size:i},e[4]=i,e[5]=n):n=e[5];let B;e[6]!==a||e[7]!==n?(B={resolver:a,defaultValues:n},e[6]=a,e[7]=n,e[8]=B):B=e[8];const{handleSubmit:k,register:E,formState:L}=W(B),{errors:V,isSubmitting:$}=L;if(!t){let r;return e[9]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs(s.Fragment,{children:[s.jsx(q,{to:"/ec2/describe-volumes",children:"Back to volumes"}),s.jsx("p",{className:"text-muted-foreground",children:"Volume not found."})]}),e[9]=r):r=e[9],r}let F;e[10]!==l||e[11]!==o||e[12]!==t?(F=async r=>{await l.mutateAsync({...r,volumeId:t}),o({to:"/ec2/describe-volumes/$id",params:{id:t}})},e[10]=l,e[11]=o,e[12]=t,e[13]=F):F=e[13];const w=F;let m,c;e[14]!==t?(m=s.jsx(q,{params:{id:t},to:"/ec2/describe-volumes/$id",children:"Back to volume"}),c=s.jsx(ie,{subtitle:t,title:"Resize Volume"}),e[14]=t,e[15]=m,e[16]=c):(m=e[15],c=e[16]);let u;e[17]!==l.error?(u=l.error&&s.jsx(te,{error:l.error,msg:"Failed to resize volume"}),e[17]=l.error,e[18]=u):u=e[18];let d;e[19]!==k||e[20]!==w?(d=k(w),e[19]=k,e[20]=w,e[21]=d):d=e[21];let f;e[22]!==i?(f=s.jsx("div",{className:"space-y-2",children:s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Current size: ",i," GiB"]})}),e[22]=i,e[23]=f):f=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(Z,{children:s.jsx("label",{htmlFor:"size",children:"New size (GiB)"})}),e[24]=N):N=e[24];const I=!!V.size,_=i+1;let p;e[25]!==E?(p=E("size",{valueAsNumber:!0}),e[25]=E,e[26]=p):p=e[26];let x;e[27]!==I||e[28]!==_||e[29]!==p?(x=s.jsx(X,{"aria-invalid":I,id:"size",min:_,type:"number",...p}),e[27]=I,e[28]=_,e[29]=p,e[30]=x):x=e[30];let b;e[31]!==V.size?(b=s.jsx(Y,{errors:[V.size]}),e[31]=V.size,e[32]=b):b=e[32];let h;e[33]!==x||e[34]!==b?(h=s.jsxs(ee,{children:[N,x,b]}),e[33]=x,e[34]=b,e[35]=h):h=e[35];const C=$||l.isPending;let j;e[36]!==o||e[37]!==t?(j=()=>o({to:"/ec2/describe-volumes/$id",params:{id:t}}),e[36]=o,e[37]=t,e[38]=j):j=e[38];let z;e[39]!==C||e[40]!==j?(z=s.jsx(Q,{disabled:C,onClick:j,type:"button",variant:"outline",children:"Cancel"}),e[39]=C,e[40]=j,e[41]=z):z=e[41];const G=$||l.isPending,M=$||l.isPending?"Resizing…":"Resize Volume";let g;e[42]!==G||e[43]!==M?(g=s.jsx(Q,{disabled:G,type:"submit",children:M}),e[42]=G,e[43]=M,e[44]=g):g=e[44];let v;e[45]!==z||e[46]!==g?(v=s.jsxs("div",{className:"flex gap-2",children:[z,g]}),e[45]=z,e[46]=g,e[47]=v):v=e[47];let y;e[48]!==f||e[49]!==h||e[50]!==v||e[51]!==d?(y=s.jsxs("form",{className:"max-w-4xl space-y-6",onSubmit:d,children:[f,h,v]}),e[48]=f,e[49]=h,e[50]=v,e[51]=d,e[52]=y):y=e[52];let P;return e[53]!==y||e[54]!==m||e[55]!==c||e[56]!==u?(P=s.jsxs(s.Fragment,{children:[m,c,u,y]}),e[53]=y,e[54]=m,e[55]=c,e[56]=u,e[57]=P):P=e[57],P}export{de as component};
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
import{c as O,bE as Q,u as L,r as M,bC as V,j as t,bF as $,B as q}from"./index.js";import{u as G}from"./useSuspenseQuery.js";import{B as R}from"./back-link.js";import{D as x,a as j}from"./detail-row.js";import{P as J}from"./page-heading.js";import{b as U,c as W,d as X,h as Y,a as Z,e as ee,f as te,g as se}from"./alert-dialog.js";import{f as ie}from"./ec2.js";import{T as ae}from"./trash-2.js";import"./useMutation.js";function he(){const e=O.c(54),{id:a}=Q.useParams(),S=L();let K;e[0]!==a?(K=$(a),e[0]=a,e[1]=K):K=e[1];const{data:z}=G(K),s=z.KeyPairs?.[0],i=ie(),[F,H]=M.useState(!1);let D;e[2]!==i||e[3]!==a||e[4]!==S?(D=async()=>{await i.mutateAsync(a),S({to:"/ec2/describe-key-pairs"})},e[2]=i,e[3]=a,e[4]=S,e[5]=D):D=e[5];const w=D;if(!s?.KeyPairId){let v;return e[6]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsxs(t.Fragment,{children:[t.jsx(R,{to:"/ec2/describe-key-pairs",children:"Back to key pairs"}),t.jsx("p",{className:"text-muted-foreground",children:"Key pair not found."})]}),e[6]=v):v=e[6],v}let b;e[7]!==s.CreateTime?(b=V(s.CreateTime),e[7]=s.CreateTime,e[8]=b):b=e[8];const B=b;let P;e[9]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(R,{to:"/ec2/describe-key-pairs",children:"Back to key pairs"}),e[9]=P):P=e[9];let T;e[10]===Symbol.for("react.memo_cache_sentinel")?(T=()=>H(!0),e[10]=T):T=e[10];let C;e[11]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsxs(q,{onClick:T,size:"sm",variant:"destructive",children:[t.jsx(ae,{className:"size-4"}),"Delete"]}),e[11]=C):C=e[11];const I=s.KeyName??"";let l;e[12]!==I?(l=t.jsx(J,{actions:C,subtitle:"EC2 Key Pair Details",title:I}),e[12]=I,e[13]=l):l=e[13];let _;e[14]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(x.Header,{children:"Key Pair Information"}),e[14]=_):_=e[14];let r;e[15]!==s.KeyName?(r=t.jsx(j,{label:"Key Name",value:s.KeyName}),e[15]=s.KeyName,e[16]=r):r=e[16];let n;e[17]!==s.KeyPairId?(n=t.jsx(j,{label:"Key Pair ID",value:s.KeyPairId}),e[17]=s.KeyPairId,e[18]=n):n=e[18];let o;e[19]!==s.KeyType?(o=t.jsx(j,{label:"Key Type",value:s.KeyType}),e[19]=s.KeyType,e[20]=o):o=e[20];let c;e[21]!==s.KeyFingerprint?(c=t.jsx(j,{label:"Key Fingerprint",value:s.KeyFingerprint}),e[21]=s.KeyFingerprint,e[22]=c):c=e[22];let m;e[23]!==B?(m=t.jsx(j,{label:"Creation Date",value:B}),e[23]=B,e[24]=m):m=e[24];let y;e[25]!==n||e[26]!==o||e[27]!==c||e[28]!==m||e[29]!==r?(y=t.jsxs(x,{children:[_,t.jsxs(x.Content,{children:[r,n,o,c,m]})]}),e[25]=n,e[26]=o,e[27]=c,e[28]=m,e[29]=r,e[30]=y):y=e[30];let d;e[31]!==s.Tags?(d=s.Tags&&s.Tags.length>0&&t.jsxs(x,{children:[t.jsx(x.Header,{children:"Tags"}),t.jsx(x.Content,{children:s.Tags.map(le)})]}),e[31]=s.Tags,e[32]=d):d=e[32];let f;e[33]!==y||e[34]!==d||e[35]!==l?(f=t.jsxs("div",{className:"space-y-6",children:[l,y,d]}),e[33]=y,e[34]=d,e[35]=l,e[36]=f):f=e[36];let k;e[37]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(Z,{children:"Delete Key Pair"}),e[37]=k):k=e[37];let p;e[38]!==s.KeyName?(p=t.jsxs(U,{children:[k,t.jsxs(W,{children:['Are you sure you want to delete the key pair "',s.KeyName,'"? This action cannot be undone. Any instances using this key pair will no longer be able to be accessed with it.']})]}),e[38]=s.KeyName,e[39]=p):p=e[39];let A;e[40]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(ee,{children:"Cancel"}),e[40]=A):A=e[40];const E=i.isPending?"Deleting…":"Delete";let h;e[41]!==i.isPending||e[42]!==w||e[43]!==E?(h=t.jsxs(X,{children:[A,t.jsx(Y,{disabled:i.isPending,onClick:w,children:E})]}),e[41]=i.isPending,e[42]=w,e[43]=E,e[44]=h):h=e[44];let u;e[45]!==p||e[46]!==h?(u=t.jsxs(te,{children:[p,h]}),e[45]=p,e[46]=h,e[47]=u):u=e[47];let g;e[48]!==F||e[49]!==u?(g=t.jsx(se,{onOpenChange:H,open:F,children:u}),e[48]=F,e[49]=u,e[50]=g):g=e[50];let N;return e[51]!==f||e[52]!==g?(N=t.jsxs(t.Fragment,{children:[P,f,g]}),e[51]=f,e[52]=g,e[53]=N):N=e[53],N}function le(e){return t.jsx(j,{label:e.Key||"",value:e.Value},e.Key)}export{he as component};
import{c as Q,bD as L,u as M,r as V,bB as $,j as t,bE as q,B as G}from"./index.js";import{u as J}from"./useSuspenseQuery.js";import{B as z}from"./back-link.js";import{D as j,a as K}from"./detail-row.js";import{E as U}from"./error-banner.js";import{P as W}from"./page-heading.js";import{b as X,c as Y,d as Z,h as ee,a as te,e as se,f as ae,g as ie}from"./alert-dialog.js";import{f as le}from"./ec2.js";import{T as re}from"./trash-2.js";function ge(){const e=Q.c(57),{id:i}=L.useParams(),B=M();let D;e[0]!==i?(D=q(i),e[0]=i,e[1]=D):D=e[1];const{data:O}=J(D),s=O.KeyPairs?.[0],a=le(),[F,R]=V.useState(!1);let b;e[2]!==a||e[3]!==i||e[4]!==B?(b=async()=>{await a.mutateAsync(i),B({to:"/ec2/describe-key-pairs"})},e[2]=a,e[3]=i,e[4]=B,e[5]=b):b=e[5];const w=b;if(!s?.KeyPairId){let S;return e[6]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsxs(t.Fragment,{children:[t.jsx(z,{to:"/ec2/describe-key-pairs",children:"Back to key pairs"}),t.jsx("p",{className:"text-muted-foreground",children:"Key pair not found."})]}),e[6]=S):S=e[6],S}let P;e[7]!==s.CreateTime?(P=$(s.CreateTime),e[7]=s.CreateTime,e[8]=P):P=e[8];const E=P;let T;e[9]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx(z,{to:"/ec2/describe-key-pairs",children:"Back to key pairs"}),e[9]=T):T=e[9];let l;e[10]!==a.error?(l=a.error&&t.jsx(U,{error:a.error,msg:"Failed to delete key pair"}),e[10]=a.error,e[11]=l):l=e[11];let k;e[12]===Symbol.for("react.memo_cache_sentinel")?(k=()=>R(!0),e[12]=k):k=e[12];let _;e[13]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsxs(G,{onClick:k,size:"sm",variant:"destructive",children:[t.jsx(re,{className:"size-4"}),"Delete"]}),e[13]=_):_=e[13];const I=s.KeyName??"";let r;e[14]!==I?(r=t.jsx(W,{actions:_,subtitle:"EC2 Key Pair Details",title:I}),e[14]=I,e[15]=r):r=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(j.Header,{children:"Key Pair Information"}),e[16]=C):C=e[16];let n;e[17]!==s.KeyName?(n=t.jsx(K,{label:"Key Name",value:s.KeyName}),e[17]=s.KeyName,e[18]=n):n=e[18];let o;e[19]!==s.KeyPairId?(o=t.jsx(K,{label:"Key Pair ID",value:s.KeyPairId}),e[19]=s.KeyPairId,e[20]=o):o=e[20];let c;e[21]!==s.KeyType?(c=t.jsx(K,{label:"Key Type",value:s.KeyType}),e[21]=s.KeyType,e[22]=c):c=e[22];let m;e[23]!==s.KeyFingerprint?(m=t.jsx(K,{label:"Key Fingerprint",value:s.KeyFingerprint}),e[23]=s.KeyFingerprint,e[24]=m):m=e[24];let y;e[25]!==E?(y=t.jsx(K,{label:"Creation Date",value:E}),e[25]=E,e[26]=y):y=e[26];let d;e[27]!==n||e[28]!==o||e[29]!==c||e[30]!==m||e[31]!==y?(d=t.jsxs(j,{children:[C,t.jsxs(j.Content,{children:[n,o,c,m,y]})]}),e[27]=n,e[28]=o,e[29]=c,e[30]=m,e[31]=y,e[32]=d):d=e[32];let f;e[33]!==s.Tags?(f=s.Tags&&s.Tags.length>0&&t.jsxs(j,{children:[t.jsx(j.Header,{children:"Tags"}),t.jsx(j.Content,{children:s.Tags.map(ne)})]}),e[33]=s.Tags,e[34]=f):f=e[34];let p;e[35]!==d||e[36]!==f||e[37]!==r?(p=t.jsxs("div",{className:"space-y-6",children:[r,d,f]}),e[35]=d,e[36]=f,e[37]=r,e[38]=p):p=e[38];let A;e[39]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(te,{children:"Delete Key Pair"}),e[39]=A):A=e[39];let h;e[40]!==s.KeyName?(h=t.jsxs(X,{children:[A,t.jsxs(Y,{children:['Are you sure you want to delete the key pair "',s.KeyName,'"? This action cannot be undone. Any instances using this key pair will no longer be able to be accessed with it.']})]}),e[40]=s.KeyName,e[41]=h):h=e[41];let N;e[42]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(se,{children:"Cancel"}),e[42]=N):N=e[42];const H=a.isPending?"Deleting…":"Delete";let u;e[43]!==a.isPending||e[44]!==w||e[45]!==H?(u=t.jsxs(Z,{children:[N,t.jsx(ee,{disabled:a.isPending,onClick:w,children:H})]}),e[43]=a.isPending,e[44]=w,e[45]=H,e[46]=u):u=e[46];let g;e[47]!==h||e[48]!==u?(g=t.jsxs(ae,{children:[h,u]}),e[47]=h,e[48]=u,e[49]=g):g=e[49];let x;e[50]!==F||e[51]!==g?(x=t.jsx(ie,{onOpenChange:R,open:F,children:g}),e[50]=F,e[51]=g,e[52]=x):x=e[52];let v;return e[53]!==p||e[54]!==x||e[55]!==l?(v=t.jsxs(t.Fragment,{children:[T,l,p,x]}),e[53]=p,e[54]=x,e[55]=l,e[56]=v):v=e[56],v}function ne(e){return t.jsx(K,{label:e.Key||"",value:e.Value},e.Key)}export{ge as component};
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
import{c as g,cb as u,j as s,bS as p}from"./index.js";import{u as x}from"./useSuspenseQuery.js";import{B as d}from"./back-link.js";import{P as I}from"./page-heading.js";import{B as j}from"./badge.js";import{A as h}from"./ami-details.js";import"./detail-row.js";function E(){const e=g.c(14),{id:c}=u.useParams();let o;e[0]!==c?(o=p(c),e[0]=c,e[1]=o):o=e[1];const{data:f}=x(o),t=f?.Images?.[0];if(!t?.ImageId){let n;return e[2]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs(s.Fragment,{children:[s.jsx(d,{to:"/ec2/describe-images",children:"Back to images"}),s.jsx("p",{className:"text-muted-foreground",children:"Image not found."})]}),e[2]=n):n=e[2],n}let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(d,{to:"/ec2/describe-images",children:"Back to images"}),e[3]=r):r=e[3];let a;e[4]!==t.State?(a=t.State?s.jsx(j,{variant:t.State==="available"?"default":"outline",children:t.State}):void 0,e[4]=t.State,e[5]=a):a=e[5];let i;e[6]!==t.ImageId||e[7]!==a?(i=s.jsx(I,{actions:a,subtitle:"EC2 Image Details",title:t.ImageId}),e[6]=t.ImageId,e[7]=a,e[8]=i):i=e[8];let m;e[9]!==t?(m=s.jsx(h,{image:t,showExtendedDetails:!0}),e[9]=t,e[10]=m):m=e[10];let l;return e[11]!==i||e[12]!==m?(l=s.jsxs(s.Fragment,{children:[r,s.jsxs("div",{className:"space-y-6",children:[i,m]})]}),e[11]=i,e[12]=m,e[13]=l):l=e[13],l}export{E as component};
import{c as g,ca as u,j as a,bR as p}from"./index.js";import{u as x}from"./useSuspenseQuery.js";import{B as d}from"./back-link.js";import{P as I}from"./page-heading.js";import{B as j}from"./badge.js";import{A as h}from"./ami-details.js";import"./detail-row.js";function E(){const e=g.c(14),{id:c}=u.useParams();let o;e[0]!==c?(o=p(c),e[0]=c,e[1]=o):o=e[1];const{data:f}=x(o),t=f?.Images?.[0];if(!t?.ImageId){let n;return e[2]===Symbol.for("react.memo_cache_sentinel")?(n=a.jsxs(a.Fragment,{children:[a.jsx(d,{to:"/ec2/describe-images",children:"Back to images"}),a.jsx("p",{className:"text-muted-foreground",children:"Image not found."})]}),e[2]=n):n=e[2],n}let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=a.jsx(d,{to:"/ec2/describe-images",children:"Back to images"}),e[3]=r):r=e[3];let s;e[4]!==t.State?(s=t.State?a.jsx(j,{variant:t.State==="available"?"default":"outline",children:t.State}):void 0,e[4]=t.State,e[5]=s):s=e[5];let i;e[6]!==t.ImageId||e[7]!==s?(i=a.jsx(I,{actions:s,subtitle:"EC2 Image Details",title:t.ImageId}),e[6]=t.ImageId,e[7]=s,e[8]=i):i=e[8];let m;e[9]!==t?(m=a.jsx(h,{image:t,showExtendedDetails:!0}),e[9]=t,e[10]=m):m=e[10];let l;return e[11]!==i||e[12]!==m?(l=a.jsxs(a.Fragment,{children:[r,a.jsxs("div",{className:"space-y-6",children:[i,m]})]}),e[11]=i,e[12]=m,e[13]=l):l=e[13],l}export{E as component};
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
import{c as S,bC as M,j as t}from"./index.js";import{D as T,a}from"./detail-row.js";function B(i){const e=S.c(55),{image:l,showExtendedDetails:P}=i,s=P===void 0?!1:P;let y;e[0]!==l.CreationDate?(y=M(l.CreationDate),e[0]=l.CreationDate,e[1]=y):y=e[1];const V=y,R=s?"AMI Information":"AMI Details";let o;e[2]!==R?(o=t.jsx(T.Header,{children:R}),e[2]=R,e[3]=o):o=e[3];let r;e[4]!==l.ImageId?(r=t.jsx(a,{label:"AMI ID",value:l.ImageId}),e[4]=l.ImageId,e[5]=r):r=e[5];let c;e[6]!==l.Name?(c=t.jsx(a,{label:"AMI Name",value:l.Name}),e[6]=l.Name,e[7]=c):c=e[7];let n;e[8]!==l.Description?(n=t.jsx(a,{label:"Description",value:l.Description}),e[8]=l.Description,e[9]=n):n=e[9];let u;e[10]!==l.Architecture?(u=t.jsx(a,{label:"Architecture",value:l.Architecture}),e[10]=l.Architecture,e[11]=u):u=e[11];let D;e[12]!==l.VirtualizationType?(D=t.jsx(a,{label:"Virtualization Type",value:l.VirtualizationType}),e[12]=l.VirtualizationType,e[13]=D):D=e[13];const A=l.Platform||"Linux";let v;e[14]!==A?(v=t.jsx(a,{label:"Platform",value:A}),e[14]=A,e[15]=v):v=e[15];let m;e[16]!==l.PlatformDetails?(m=t.jsx(a,{label:"Platform Details",value:l.PlatformDetails}),e[16]=l.PlatformDetails,e[17]=m):m=e[17];let x;e[18]!==l.ImageType?(x=t.jsx(a,{label:"Image Type",value:l.ImageType}),e[18]=l.ImageType,e[19]=x):x=e[19];let b;e[20]!==l.RootDeviceType?(b=t.jsx(a,{label:"Root Device Type",value:l.RootDeviceType}),e[20]=l.RootDeviceType,e[21]=b):b=e[21];let f;e[22]!==l.RootDeviceName?(f=t.jsx(a,{label:"Root Device Name",value:l.RootDeviceName}),e[22]=l.RootDeviceName,e[23]=f):f=e[23];let j;e[24]!==l.OwnerId?(j=t.jsx(a,{label:"Owner",value:l.OwnerId}),e[24]=l.OwnerId,e[25]=j):j=e[25];let d;e[26]!==l.State?(d=t.jsx(a,{label:"State",value:l.State}),e[26]=l.State,e[27]=d):d=e[27];let I;e[28]!==V||e[29]!==l.Public||e[30]!==s?(I=s&&t.jsxs(t.Fragment,{children:[t.jsx(a,{label:"Creation Date",value:V}),t.jsx(a,{label:"Public",value:l.Public?"Yes":"No"})]}),e[28]=V,e[29]=l.Public,e[30]=s,e[31]=I):I=e[31];let h;e[32]!==v||e[33]!==m||e[34]!==x||e[35]!==b||e[36]!==f||e[37]!==j||e[38]!==d||e[39]!==I||e[40]!==r||e[41]!==c||e[42]!==n||e[43]!==u||e[44]!==D?(h=t.jsxs(T.Content,{children:[r,c,n,u,D,v,m,x,b,f,j,d,I]}),e[32]=v,e[33]=m,e[34]=x,e[35]=b,e[36]=f,e[37]=j,e[38]=d,e[39]=I,e[40]=r,e[41]=c,e[42]=n,e[43]=u,e[44]=D,e[45]=h):h=e[45];let N;e[46]!==h||e[47]!==o?(N=t.jsxs(T,{children:[o,h]}),e[46]=h,e[47]=o,e[48]=N):N=e[48];let p;e[49]!==l.BlockDeviceMappings||e[50]!==s?(p=s&&l.BlockDeviceMappings&&l.BlockDeviceMappings.length>0&&l.BlockDeviceMappings.map(C),e[49]=l.BlockDeviceMappings,e[50]=s,e[51]=p):p=e[51];let E;return e[52]!==N||e[53]!==p?(E=t.jsxs(t.Fragment,{children:[N,p]}),e[52]=N,e[53]=p,e[54]=E):E=e[54],E}function C(i){return t.jsxs(T,{children:[t.jsxs(T.Header,{children:["Block Device: ",i.DeviceName]}),t.jsxs(T.Content,{children:[t.jsx(a,{label:"Device Name",value:i.DeviceName}),i.Ebs&&t.jsxs(t.Fragment,{children:[t.jsx(a,{label:"Volume Size",value:i.Ebs.VolumeSize?`${i.Ebs.VolumeSize} GB`:void 0}),t.jsx(a,{label:"Volume Type",value:i.Ebs.VolumeType}),t.jsx(a,{label:"Delete On Termination",value:i.Ebs.DeleteOnTermination?"Yes":"No"}),t.jsx(a,{label:"Encrypted",value:i.Ebs.Encrypted?"Yes":"No"}),i.Ebs.SnapshotId&&t.jsx(a,{label:"Snapshot ID",value:i.Ebs.SnapshotId})]}),i.VirtualName&&t.jsx(a,{label:"Virtual Name",value:i.VirtualName})]})]},i.DeviceName)}export{B as A};
import{c as S,bB as M,j as t}from"./index.js";import{D as T,a}from"./detail-row.js";function C(i){const e=S.c(55),{image:l,showExtendedDetails:P}=i,s=P===void 0?!1:P;let y;e[0]!==l.CreationDate?(y=M(l.CreationDate),e[0]=l.CreationDate,e[1]=y):y=e[1];const V=y,R=s?"AMI Information":"AMI Details";let o;e[2]!==R?(o=t.jsx(T.Header,{children:R}),e[2]=R,e[3]=o):o=e[3];let r;e[4]!==l.ImageId?(r=t.jsx(a,{label:"AMI ID",value:l.ImageId}),e[4]=l.ImageId,e[5]=r):r=e[5];let c;e[6]!==l.Name?(c=t.jsx(a,{label:"AMI Name",value:l.Name}),e[6]=l.Name,e[7]=c):c=e[7];let n;e[8]!==l.Description?(n=t.jsx(a,{label:"Description",value:l.Description}),e[8]=l.Description,e[9]=n):n=e[9];let u;e[10]!==l.Architecture?(u=t.jsx(a,{label:"Architecture",value:l.Architecture}),e[10]=l.Architecture,e[11]=u):u=e[11];let D;e[12]!==l.VirtualizationType?(D=t.jsx(a,{label:"Virtualization Type",value:l.VirtualizationType}),e[12]=l.VirtualizationType,e[13]=D):D=e[13];const A=l.Platform||"Linux";let v;e[14]!==A?(v=t.jsx(a,{label:"Platform",value:A}),e[14]=A,e[15]=v):v=e[15];let m;e[16]!==l.PlatformDetails?(m=t.jsx(a,{label:"Platform Details",value:l.PlatformDetails}),e[16]=l.PlatformDetails,e[17]=m):m=e[17];let x;e[18]!==l.ImageType?(x=t.jsx(a,{label:"Image Type",value:l.ImageType}),e[18]=l.ImageType,e[19]=x):x=e[19];let b;e[20]!==l.RootDeviceType?(b=t.jsx(a,{label:"Root Device Type",value:l.RootDeviceType}),e[20]=l.RootDeviceType,e[21]=b):b=e[21];let f;e[22]!==l.RootDeviceName?(f=t.jsx(a,{label:"Root Device Name",value:l.RootDeviceName}),e[22]=l.RootDeviceName,e[23]=f):f=e[23];let j;e[24]!==l.OwnerId?(j=t.jsx(a,{label:"Owner",value:l.OwnerId}),e[24]=l.OwnerId,e[25]=j):j=e[25];let d;e[26]!==l.State?(d=t.jsx(a,{label:"State",value:l.State}),e[26]=l.State,e[27]=d):d=e[27];let I;e[28]!==V||e[29]!==l.Public||e[30]!==s?(I=s&&t.jsxs(t.Fragment,{children:[t.jsx(a,{label:"Creation Date",value:V}),t.jsx(a,{label:"Public",value:l.Public?"Yes":"No"})]}),e[28]=V,e[29]=l.Public,e[30]=s,e[31]=I):I=e[31];let h;e[32]!==v||e[33]!==m||e[34]!==x||e[35]!==b||e[36]!==f||e[37]!==j||e[38]!==d||e[39]!==I||e[40]!==r||e[41]!==c||e[42]!==n||e[43]!==u||e[44]!==D?(h=t.jsxs(T.Content,{children:[r,c,n,u,D,v,m,x,b,f,j,d,I]}),e[32]=v,e[33]=m,e[34]=x,e[35]=b,e[36]=f,e[37]=j,e[38]=d,e[39]=I,e[40]=r,e[41]=c,e[42]=n,e[43]=u,e[44]=D,e[45]=h):h=e[45];let N;e[46]!==h||e[47]!==o?(N=t.jsxs(T,{children:[o,h]}),e[46]=h,e[47]=o,e[48]=N):N=e[48];let p;e[49]!==l.BlockDeviceMappings||e[50]!==s?(p=s&&l.BlockDeviceMappings&&l.BlockDeviceMappings.length>0&&l.BlockDeviceMappings.map(B),e[49]=l.BlockDeviceMappings,e[50]=s,e[51]=p):p=e[51];let E;return e[52]!==N||e[53]!==p?(E=t.jsxs(t.Fragment,{children:[N,p]}),e[52]=N,e[53]=p,e[54]=E):E=e[54],E}function B(i){return t.jsxs(T,{children:[t.jsxs(T.Header,{children:["Block Device: ",i.DeviceName]}),t.jsxs(T.Content,{children:[t.jsx(a,{label:"Device Name",value:i.DeviceName}),i.Ebs&&t.jsxs(t.Fragment,{children:[t.jsx(a,{label:"Volume Size",value:i.Ebs.VolumeSize?`${i.Ebs.VolumeSize} GB`:void 0}),t.jsx(a,{label:"Volume Type",value:i.Ebs.VolumeType}),t.jsx(a,{label:"Delete On Termination",value:i.Ebs.DeleteOnTermination?"Yes":"No"}),t.jsx(a,{label:"Encrypted",value:i.Ebs.Encrypted?"Yes":"No"}),i.Ebs.SnapshotId&&t.jsx(a,{label:"Snapshot ID",value:i.Ebs.SnapshotId})]}),i.VirtualName&&t.jsx(a,{label:"Virtual Name",value:i.VirtualName})]})]},i.DeviceName)}export{C as A};
+1 -1
View File
@@ -1 +1 @@
import{c as g,a8 as f,a as b,bA as p,cc as m}from"./index.js";const h=p("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-full border border-transparent px-2 py-0.5 font-medium text-[0.625rem] transition-all transition-colors focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-2.5!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border bg-input/20 text-foreground dark:bg-input/30 [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function y(d){const e=g.c(13);let t,i,a,s,r;if(e[0]!==d){const{className:l,variant:u,render:c,...v}=d;t=c,r=u===void 0?"default":u,s=m,i="span",a=f({className:b(h({className:l,variant:r}))},v),e[0]=d,e[1]=t,e[2]=i,e[3]=a,e[4]=s,e[5]=r}else t=e[1],i=e[2],a=e[3],s=e[4],r=e[5];let n;e[6]!==r?(n={slot:"badge",variant:r},e[6]=r,e[7]=n):n=e[7];let o;return e[8]!==t||e[9]!==i||e[10]!==a||e[11]!==n?(o={defaultTagName:i,props:a,render:t,state:n},e[8]=t,e[9]=i,e[10]=a,e[11]=n,e[12]=o):o=e[12],s(o)}export{y as B};
import{c as g,a7 as b,a as f,bz as p,cb as m}from"./index.js";const h=p("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-full border border-transparent px-2 py-0.5 font-medium text-[0.625rem] transition-all transition-colors focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-2.5!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border bg-input/20 text-foreground dark:bg-input/30 [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function y(d){const e=g.c(13);let t,i,a,s,r;if(e[0]!==d){const{className:l,variant:u,render:v,...c}=d;t=v,r=u===void 0?"default":u,s=m,i="span",a=b({className:f(h({className:l,variant:r}))},c),e[0]=d,e[1]=t,e[2]=i,e[3]=a,e[4]=s,e[5]=r}else t=e[1],i=e[2],a=e[3],s=e[4],r=e[5];let n;e[6]!==r?(n={slot:"badge",variant:r},e[6]=r,e[7]=n):n=e[7];let o;return e[8]!==t||e[9]!==i||e[10]!==a||e[11]!==n?(o={defaultTagName:i,props:a,render:t,state:n},e[8]=t,e[9]=i,e[10]=a,e[11]=n,e[12]=o):o=e[12],s(o)}export{y as B};
+1 -1
View File
@@ -1 +1 @@
import{o as M,f as $,c as I,u as R,j as t,B as E}from"./index.js";import{a as A,u as H,I as L,F as O,b as T,c as V}from"./field.js";import{B as q}from"./back-link.js";import{E as D}from"./error-banner.js";import{P as G}from"./page-heading.js";import{u as J}from"./s3.js";import"./useMutation.js";const K=M({bucketName:$().min(3,"Bucket name must be at least 3 characters").max(63,"Bucket name must be at most 63 characters").regex(/^[a-z0-9][a-z0-9.-]*[a-z0-9]$/,"Must start and end with a lowercase letter or number").regex(/^[a-z0-9.-]+$/,"Only lowercase letters, numbers, hyphens, and periods allowed").refine(e=>!e.includes(".."),"Must not contain consecutive periods").refine(e=>!(e.includes(".-")||e.includes("-.")),"Must not contain adjacent period and hyphen")});function te(){const e=I.c(40),a=R(),s=J();let k;e[0]===Symbol.for("react.memo_cache_sentinel")?(k={resolver:A(K),defaultValues:{bucketName:""}},e[0]=k):k=e[0];const{handleSubmit:y,register:N,formState:P}=H(k),{errors:p,isSubmitting:S}=P;let x;e[1]!==s||e[2]!==a?(x=async z=>{await s.mutateAsync(z),a({to:"/s3/ls"})},e[1]=s,e[2]=a,e[3]=x):x=e[3];const F=x;let h,j;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(q,{to:"/s3/ls",children:"Back to buckets"}),j=t.jsx(G,{title:"Create Bucket"}),e[4]=h,e[5]=j):(h=e[4],j=e[5]);let r;e[6]!==s.error?(r=s.error&&t.jsx(D,{error:s.error,msg:"Failed to create bucket"}),e[6]=s.error,e[7]=r):r=e[7];let i;e[8]!==y||e[9]!==F?(i=y(F),e[8]=y,e[9]=F,e[10]=i):i=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(T,{children:t.jsx("label",{htmlFor:"bucketName",children:"Bucket Name"})}),e[11]=g):g=e[11];const v=!!p.bucketName;let l;e[12]!==N?(l=N("bucketName"),e[12]=N,e[13]=l):l=e[13];let n;e[14]!==v||e[15]!==l?(n=t.jsx(L,{"aria-invalid":v,id:"bucketName",placeholder:"my-bucket",type:"text",...l}),e[14]=v,e[15]=l,e[16]=n):n=e[16];let c;e[17]!==p.bucketName?(c=t.jsx(O,{errors:[p.bucketName]}),e[17]=p.bucketName,e[18]=c):c=e[18];let o;e[19]!==n||e[20]!==c?(o=t.jsxs(V,{children:[g,n,c]}),e[19]=n,e[20]=c,e[21]=o):o=e[21];const C=S||s.isPending;let m;e[22]!==a?(m=()=>a({to:"/s3/ls"}),e[22]=a,e[23]=m):m=e[23];let u;e[24]!==C||e[25]!==m?(u=t.jsx(E,{disabled:C,onClick:m,type:"button",variant:"outline",children:"Cancel"}),e[24]=C,e[25]=m,e[26]=u):u=e[26];const w=S||s.isPending,_=S||s.isPending?"Creating…":"Create Bucket";let d;e[27]!==w||e[28]!==_?(d=t.jsx(E,{disabled:w,type:"submit",children:_}),e[27]=w,e[28]=_,e[29]=d):d=e[29];let f;e[30]!==u||e[31]!==d?(f=t.jsxs("div",{className:"flex gap-2",children:[u,d]}),e[30]=u,e[31]=d,e[32]=f):f=e[32];let b;e[33]!==o||e[34]!==f||e[35]!==i?(b=t.jsxs("form",{className:"max-w-4xl space-y-6",onSubmit:i,children:[o,f]}),e[33]=o,e[34]=f,e[35]=i,e[36]=b):b=e[36];let B;return e[37]!==b||e[38]!==r?(B=t.jsxs(t.Fragment,{children:[h,j,r,b]}),e[37]=b,e[38]=r,e[39]=B):B=e[39],B}export{te as component};
import{c as R,u as A,j as t,f as H,B as P}from"./index.js";import{a as L,u as M,I as T,F as $,b as q,c as z}from"./field.js";import{B as D}from"./back-link.js";import{E as G}from"./error-banner.js";import{P as J}from"./page-heading.js";import{u as K}from"./s3.js";function Y(){const e=R.c(40),r=A(),s=K();let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x={resolver:L(H)},e[0]=x):x=e[0];const{handleSubmit:N,register:y,formState:w}=M(x),{errors:k,isSubmitting:S}=w;let p;e[1]!==s||e[2]!==r?(p=async I=>{await s.mutateAsync(I),r({to:"/s3/ls"})},e[1]=s,e[2]=r,e[3]=p):p=e[3];const F=p;let h,j;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(D,{to:"/s3/ls",children:"Back to buckets"}),j=t.jsx(J,{title:"Create Bucket"}),e[4]=h,e[5]=j):(h=e[4],j=e[5]);let i;e[6]!==s.error?(i=s.error&&t.jsx(G,{error:s.error,msg:"Failed to create bucket"}),e[6]=s.error,e[7]=i):i=e[7];let l;e[8]!==N||e[9]!==F?(l=N(F),e[8]=N,e[9]=F,e[10]=l):l=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(q,{children:t.jsx("label",{htmlFor:"bucketName",children:"Bucket Name"})}),e[11]=g):g=e[11];const C=!!k.bucketName;let a;e[12]!==y?(a=y("bucketName"),e[12]=y,e[13]=a):a=e[13];let o;e[14]!==C||e[15]!==a?(o=t.jsx(T,{"aria-invalid":C,id:"bucketName",placeholder:"my-bucket",type:"text",...a}),e[14]=C,e[15]=a,e[16]=o):o=e[16];let c;e[17]!==k.bucketName?(c=t.jsx($,{errors:[k.bucketName]}),e[17]=k.bucketName,e[18]=c):c=e[18];let n;e[19]!==o||e[20]!==c?(n=t.jsxs(z,{children:[g,o,c]}),e[19]=o,e[20]=c,e[21]=n):n=e[21];const v=S||s.isPending;let m;e[22]!==r?(m=()=>r({to:"/s3/ls"}),e[22]=r,e[23]=m):m=e[23];let u;e[24]!==v||e[25]!==m?(u=t.jsx(P,{disabled:v,onClick:m,type:"button",variant:"outline",children:"Cancel"}),e[24]=v,e[25]=m,e[26]=u):u=e[26];const _=S||s.isPending,E=S||s.isPending?"Creating…":"Create Bucket";let f;e[27]!==_||e[28]!==E?(f=t.jsx(P,{disabled:_,type:"submit",children:E}),e[27]=_,e[28]=E,e[29]=f):f=e[29];let d;e[30]!==u||e[31]!==f?(d=t.jsxs("div",{className:"flex gap-2",children:[u,f]}),e[30]=u,e[31]=f,e[32]=d):d=e[32];let b;e[33]!==n||e[34]!==d||e[35]!==l?(b=t.jsxs("form",{className:"max-w-4xl space-y-6",onSubmit:l,children:[n,d]}),e[33]=n,e[34]=d,e[35]=l,e[36]=b):b=e[36];let B;return e[37]!==b||e[38]!==i?(B=t.jsxs(t.Fragment,{children:[h,j,i,b]}),e[37]=b,e[38]=i,e[39]=B):B=e[39],B}export{Y as component};
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
import{c as $,u as q,g as D,j as t,B as I}from"./index.js";import{a as J,u as K,I as R,F as G,b as H,c as L}from"./field.js";import{B as O}from"./back-link.js";import{E as Q}from"./error-banner.js";import{P as U}from"./page-heading.js";import{u as W}from"./ec2.js";import"./useMutation.js";function ae(){const e=$.c(52),s=q(),i=W();let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={resolver:J(D),defaultValues:{size:1,availabilityZone:""}},e[0]=g):g=e[0];const{handleSubmit:C,register:a,formState:M}=K(g),{errors:l,isSubmitting:V}=M;let S;e[1]!==i||e[2]!==s?(S=async T=>{await i.mutateAsync(T),s({to:"/ec2/describe-volumes"})},e[1]=i,e[2]=s,e[3]=S):S=e[3];const E=S;let z,F;e[4]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx(O,{to:"/ec2/describe-volumes",children:"Back to volumes"}),F=t.jsx(U,{title:"Create Volume"}),e[4]=z,e[5]=F):(z=e[4],F=e[5]);let r;e[6]!==i.error?(r=i.error&&t.jsx(Q,{error:i.error,msg:"Failed to create volume"}),e[6]=i.error,e[7]=r):r=e[7];let o;e[8]!==C||e[9]!==E?(o=C(E),e[8]=C,e[9]=E,e[10]=o):o=e[10];let Z;e[11]===Symbol.for("react.memo_cache_sentinel")?(Z=t.jsx(H,{children:t.jsx("label",{htmlFor:"size",children:"Size (GiB)"})}),e[11]=Z):Z=e[11];const P=!!l.size;let n;e[12]!==a?(n=a("size",{valueAsNumber:!0}),e[12]=a,e[13]=n):n=e[13];let c;e[14]!==P||e[15]!==n?(c=t.jsx(R,{"aria-invalid":P,id:"size",max:16384,min:1,type:"number",...n}),e[14]=P,e[15]=n,e[16]=c):c=e[16];let m;e[17]!==l.size?(m=t.jsx(G,{errors:[l.size]}),e[17]=l.size,e[18]=m):m=e[18];let u;e[19]!==c||e[20]!==m?(u=t.jsxs(L,{children:[Z,c,m]}),e[19]=c,e[20]=m,e[21]=u):u=e[21];let _;e[22]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(H,{children:t.jsx("label",{htmlFor:"availabilityZone",children:"Availability Zone"})}),e[22]=_):_=e[22];const k=!!l.availabilityZone;let f;e[23]!==a?(f=a("availabilityZone"),e[23]=a,e[24]=f):f=e[24];let d;e[25]!==k||e[26]!==f?(d=t.jsx(R,{"aria-invalid":k,id:"availabilityZone",placeholder:"ap-southeast-2a",type:"text",...f}),e[25]=k,e[26]=f,e[27]=d):d=e[27];let b;e[28]!==l.availabilityZone?(b=t.jsx(G,{errors:[l.availabilityZone]}),e[28]=l.availabilityZone,e[29]=b):b=e[29];let x;e[30]!==d||e[31]!==b?(x=t.jsxs(L,{children:[_,d,b]}),e[30]=d,e[31]=b,e[32]=x):x=e[32];const N=V||i.isPending;let h;e[33]!==s?(h=()=>s({to:"/ec2/describe-volumes"}),e[33]=s,e[34]=h):h=e[34];let v;e[35]!==N||e[36]!==h?(v=t.jsx(I,{disabled:N,onClick:h,type:"button",variant:"outline",children:"Cancel"}),e[35]=N,e[36]=h,e[37]=v):v=e[37];const A=V||i.isPending,w=V||i.isPending?"Creating…":"Create Volume";let p;e[38]!==A||e[39]!==w?(p=t.jsx(I,{disabled:A,type:"submit",children:w}),e[38]=A,e[39]=w,e[40]=p):p=e[40];let j;e[41]!==v||e[42]!==p?(j=t.jsxs("div",{className:"flex gap-2",children:[v,p]}),e[41]=v,e[42]=p,e[43]=j):j=e[43];let y;e[44]!==u||e[45]!==x||e[46]!==j||e[47]!==o?(y=t.jsxs("form",{className:"max-w-4xl space-y-6",onSubmit:o,children:[u,x,j]}),e[44]=u,e[45]=x,e[46]=j,e[47]=o,e[48]=y):y=e[48];let B;return e[49]!==y||e[50]!==r?(B=t.jsxs(t.Fragment,{children:[z,F,r,y]}),e[49]=y,e[50]=r,e[51]=B):B=e[51],B}export{ae as component};
import{c as $,u as q,g as D,j as t,B as I}from"./index.js";import{a as J,u as K,I as R,F as G,b as H,c as L}from"./field.js";import{B as O}from"./back-link.js";import{E as Q}from"./error-banner.js";import{P as U}from"./page-heading.js";import{u as W}from"./ec2.js";function se(){const e=$.c(52),s=q(),i=W();let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={resolver:J(D),defaultValues:{size:1,availabilityZone:""}},e[0]=g):g=e[0];const{handleSubmit:C,register:a,formState:M}=K(g),{errors:l,isSubmitting:V}=M;let S;e[1]!==i||e[2]!==s?(S=async T=>{await i.mutateAsync(T),s({to:"/ec2/describe-volumes"})},e[1]=i,e[2]=s,e[3]=S):S=e[3];const E=S;let z,F;e[4]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx(O,{to:"/ec2/describe-volumes",children:"Back to volumes"}),F=t.jsx(U,{title:"Create Volume"}),e[4]=z,e[5]=F):(z=e[4],F=e[5]);let r;e[6]!==i.error?(r=i.error&&t.jsx(Q,{error:i.error,msg:"Failed to create volume"}),e[6]=i.error,e[7]=r):r=e[7];let o;e[8]!==C||e[9]!==E?(o=C(E),e[8]=C,e[9]=E,e[10]=o):o=e[10];let Z;e[11]===Symbol.for("react.memo_cache_sentinel")?(Z=t.jsx(H,{children:t.jsx("label",{htmlFor:"size",children:"Size (GiB)"})}),e[11]=Z):Z=e[11];const P=!!l.size;let n;e[12]!==a?(n=a("size",{valueAsNumber:!0}),e[12]=a,e[13]=n):n=e[13];let c;e[14]!==P||e[15]!==n?(c=t.jsx(R,{"aria-invalid":P,id:"size",max:16384,min:1,type:"number",...n}),e[14]=P,e[15]=n,e[16]=c):c=e[16];let m;e[17]!==l.size?(m=t.jsx(G,{errors:[l.size]}),e[17]=l.size,e[18]=m):m=e[18];let u;e[19]!==c||e[20]!==m?(u=t.jsxs(L,{children:[Z,c,m]}),e[19]=c,e[20]=m,e[21]=u):u=e[21];let _;e[22]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(H,{children:t.jsx("label",{htmlFor:"availabilityZone",children:"Availability Zone"})}),e[22]=_):_=e[22];const k=!!l.availabilityZone;let f;e[23]!==a?(f=a("availabilityZone"),e[23]=a,e[24]=f):f=e[24];let d;e[25]!==k||e[26]!==f?(d=t.jsx(R,{"aria-invalid":k,id:"availabilityZone",placeholder:"ap-southeast-2a",type:"text",...f}),e[25]=k,e[26]=f,e[27]=d):d=e[27];let b;e[28]!==l.availabilityZone?(b=t.jsx(G,{errors:[l.availabilityZone]}),e[28]=l.availabilityZone,e[29]=b):b=e[29];let x;e[30]!==d||e[31]!==b?(x=t.jsxs(L,{children:[_,d,b]}),e[30]=d,e[31]=b,e[32]=x):x=e[32];const N=V||i.isPending;let h;e[33]!==s?(h=()=>s({to:"/ec2/describe-volumes"}),e[33]=s,e[34]=h):h=e[34];let v;e[35]!==N||e[36]!==h?(v=t.jsx(I,{disabled:N,onClick:h,type:"button",variant:"outline",children:"Cancel"}),e[35]=N,e[36]=h,e[37]=v):v=e[37];const A=V||i.isPending,w=V||i.isPending?"Creating…":"Create Volume";let j;e[38]!==A||e[39]!==w?(j=t.jsx(I,{disabled:A,type:"submit",children:w}),e[38]=A,e[39]=w,e[40]=j):j=e[40];let p;e[41]!==v||e[42]!==j?(p=t.jsxs("div",{className:"flex gap-2",children:[v,j]}),e[41]=v,e[42]=j,e[43]=p):p=e[43];let y;e[44]!==u||e[45]!==x||e[46]!==p||e[47]!==o?(y=t.jsxs("form",{className:"max-w-4xl space-y-6",onSubmit:o,children:[u,x,p]}),e[44]=u,e[45]=x,e[46]=p,e[47]=o,e[48]=y):y=e[48];let B;return e[49]!==y||e[50]!==r?(B=t.jsxs(t.Fragment,{children:[z,F,r,y]}),e[49]=y,e[50]=r,e[51]=B):B=e[51],B}export{se as component};
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
import{c as o,j as m}from"./index.js";function n(l){const e=o.c(7),{msg:r,error:c}=l;let t;e[0]!==r?(t=r&&m.jsx("h2",{className:"text-destructive text-sm",children:r}),e[0]=r,e[1]=t):t=e[1];let s;e[2]!==c?(s=c&&m.jsx("p",{className:"text-destructive text-sm",children:c.message}),e[2]=c,e[3]=s):s=e[3];let i;return e[4]!==t||e[5]!==s?(i=m.jsxs("div",{className:"mb-6 max-w-4xl rounded-md border border-destructive bg-destructive/10 p-4",children:[t,s]}),e[4]=t,e[5]=s,e[6]=i):i=e[6],i}export{n as E};
import{c3 as d,c4 as m,c5 as u,c6 as p,c7 as c,bo as b,r as a,c8 as v,c9 as f,c as y,j as h}from"./index.js";var x=class extends d{#s;#i=void 0;#t;#e;constructor(s,t){super(),this.#s=s,this.setOptions(t),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(s){const t=this.options;this.options=this.#s.defaultMutationOptions(s),m(this.options,t)||this.#s.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),t?.mutationKey&&this.options.mutationKey&&u(t.mutationKey)!==u(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(s){this.#r(),this.#o(s)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#o()}mutate(s,t){return this.#e=t,this.#t?.removeObserver(this),this.#t=this.#s.getMutationCache().build(this.#s,this.options),this.#t.addObserver(this),this.#t.execute(s)}#r(){const s=this.#t?.state??p();this.#i={...s,isPending:s.status==="pending",isSuccess:s.status==="success",isError:s.status==="error",isIdle:s.status==="idle",mutate:this.mutate,reset:this.reset}}#o(s){c.batch(()=>{if(this.#e&&this.hasListeners()){const t=this.#i.variables,r=this.#i.context,i={client:this.#s,meta:this.options.meta,mutationKey:this.options.mutationKey};if(s?.type==="success"){try{this.#e.onSuccess?.(s.data,t,r,i)}catch(e){Promise.reject(e)}try{this.#e.onSettled?.(s.data,null,t,r,i)}catch(e){Promise.reject(e)}}else if(s?.type==="error"){try{this.#e.onError?.(s.error,t,r,i)}catch(e){Promise.reject(e)}try{this.#e.onSettled?.(void 0,s.error,t,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(t=>{t(this.#i)})})}};function g(s,t){const r=b(),[i]=a.useState(()=>new x(r,s));a.useEffect(()=>{i.setOptions(s)},[i,s]);const e=a.useSyncExternalStore(a.useCallback(n=>i.subscribe(c.batchCalls(n)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),o=a.useCallback((n,l)=>{i.mutate(n,l).catch(v)},[i]);if(e.error&&f(i.options.throwOnError,[e.error]))throw e.error;return{...e,mutate:o,mutateAsync:e.mutate}}function E(s){const t=y.c(7),{msg:r,error:i}=s;let e;t[0]!==r?(e=r&&h.jsx("h2",{className:"text-destructive text-sm",children:r}),t[0]=r,t[1]=e):e=t[1];let o;t[2]!==i?(o=i&&h.jsx("p",{className:"text-destructive text-sm",children:i.message}),t[2]=i,t[3]=o):o=t[3];let n;return t[4]!==e||t[5]!==o?(n=h.jsxs("div",{className:"mb-6 max-w-4xl rounded-md border border-destructive bg-destructive/10 p-4",children:[e,o]}),t[4]=e,t[5]=o,t[6]=n):n=t[6],n}export{E,g as u};
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
import{c as O,u as $,i as q,j as t,B as H}from"./index.js";import{a as G,u as J,I as U,F as Q,b as R,c as z}from"./field.js";import{B as V}from"./back-link.js";import{E as W}from"./error-banner.js";import{P as X}from"./page-heading.js";import{T as Y}from"./textarea.js";import{a as Z}from"./ec2.js";import"./useMutation.js";function ce(){const e=O.c(53),s=$(),i=Z();let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={resolver:G(q)},e[0]=g):g=e[0];const{handleSubmit:_,register:l,formState:D}=J(g),{errors:r,isSubmitting:M}=D;let A;e[1]!==i||e[2]!==s?(A=async L=>{await i.mutateAsync(L),s({to:"/ec2/describe-key-pairs"})},e[1]=i,e[2]=s,e[3]=A):A=e[3];const v=A;let K,N;e[4]===Symbol.for("react.memo_cache_sentinel")?(K=t.jsx(V,{to:"/ec2/describe-key-pairs",children:"Back to key pairs"}),N=t.jsx(X,{title:"Import Key Pair"}),e[4]=K,e[5]=N):(K=e[4],N=e[5]);let a;e[6]!==i.error?(a=i.error&&t.jsx(W,{error:i.error,msg:"Failed to import key pair"}),e[6]=i.error,e[7]=a):a=e[7];let o;e[8]!==_||e[9]!==v?(o=_(v),e[8]=_,e[9]=v,e[10]=o):o=e[10];let P;e[11]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(R,{children:t.jsx("label",{htmlFor:"keyName",children:"Key Pair Name"})}),e[11]=P):P=e[11];const I=!!r.keyName;let c;e[12]!==l?(c=l("keyName"),e[12]=l,e[13]=c):c=e[13];let n;e[14]!==I||e[15]!==c?(n=t.jsx(U,{"aria-invalid":I,id:"keyName",placeholder:"my-key-pair…",...c}),e[14]=I,e[15]=c,e[16]=n):n=e[16];let m;e[17]!==r.keyName?(m=t.jsx(Q,{errors:[r.keyName]}),e[17]=r.keyName,e[18]=m):m=e[18];let p;e[19]!==n||e[20]!==m?(p=t.jsxs(z,{children:[P,n,m]}),e[19]=n,e[20]=m,e[21]=p):p=e[21];let S,B;e[22]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(R,{children:t.jsx("label",{htmlFor:"publicKeyMaterial",children:"Public Key"})}),B=t.jsx("p",{className:"text-muted-foreground text-xs",id:"publicKey-description",children:"Paste your OpenSSH public key (e.g. the contents of id_rsa.pub)"}),e[22]=S,e[23]=B):(S=e[22],B=e[23]);const E=!!r.publicKeyMaterial;let d;e[24]!==l?(d=l("publicKeyMaterial"),e[24]=l,e[25]=d):d=e[25];let y;e[26]!==E||e[27]!==d?(y=t.jsx(Y,{"aria-invalid":E,id:"publicKeyMaterial",placeholder:"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC…",rows:8,...d}),e[26]=E,e[27]=d,e[28]=y):y=e[28];let f;e[29]!==r.publicKeyMaterial?(f=t.jsx(Q,{errors:[r.publicKeyMaterial]}),e[29]=r.publicKeyMaterial,e[30]=f):f=e[30];let u;e[31]!==y||e[32]!==f?(u=t.jsxs(z,{children:[S,B,y,f]}),e[31]=y,e[32]=f,e[33]=u):u=e[33];const C=M||i.isPending;let x;e[34]!==s?(x=()=>s({to:"/ec2/describe-key-pairs"}),e[34]=s,e[35]=x):x=e[35];let b;e[36]!==C||e[37]!==x?(b=t.jsx(H,{disabled:C,onClick:x,type:"button",variant:"outline",children:"Cancel"}),e[36]=C,e[37]=x,e[38]=b):b=e[38];const w=M||i.isPending,T=M||i.isPending?"Importing…":"Import Key Pair";let h;e[39]!==w||e[40]!==T?(h=t.jsx(H,{disabled:w,type:"submit",children:T}),e[39]=w,e[40]=T,e[41]=h):h=e[41];let j;e[42]!==b||e[43]!==h?(j=t.jsxs("div",{className:"flex gap-2",children:[b,h]}),e[42]=b,e[43]=h,e[44]=j):j=e[44];let k;e[45]!==p||e[46]!==u||e[47]!==j||e[48]!==o?(k=t.jsxs("form",{className:"max-w-4xl space-y-6",onSubmit:o,children:[p,u,j]}),e[45]=p,e[46]=u,e[47]=j,e[48]=o,e[49]=k):k=e[49];let F;return e[50]!==k||e[51]!==a?(F=t.jsxs(t.Fragment,{children:[K,N,a,k]}),e[50]=k,e[51]=a,e[52]=F):F=e[52],F}export{ce as component};
import{c as O,u as $,i as q,j as t,B as H}from"./index.js";import{a as G,u as J,I as U,F as Q,b as R,c as z}from"./field.js";import{B as V}from"./back-link.js";import{E as W}from"./error-banner.js";import{P as X}from"./page-heading.js";import{T as Y}from"./textarea.js";import{a as Z}from"./ec2.js";function oe(){const e=O.c(53),s=$(),i=Z();let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={resolver:G(q)},e[0]=g):g=e[0];const{handleSubmit:_,register:l,formState:D}=J(g),{errors:r,isSubmitting:M}=D;let A;e[1]!==i||e[2]!==s?(A=async L=>{await i.mutateAsync(L),s({to:"/ec2/describe-key-pairs"})},e[1]=i,e[2]=s,e[3]=A):A=e[3];const v=A;let K,N;e[4]===Symbol.for("react.memo_cache_sentinel")?(K=t.jsx(V,{to:"/ec2/describe-key-pairs",children:"Back to key pairs"}),N=t.jsx(X,{title:"Import Key Pair"}),e[4]=K,e[5]=N):(K=e[4],N=e[5]);let a;e[6]!==i.error?(a=i.error&&t.jsx(W,{error:i.error,msg:"Failed to import key pair"}),e[6]=i.error,e[7]=a):a=e[7];let o;e[8]!==_||e[9]!==v?(o=_(v),e[8]=_,e[9]=v,e[10]=o):o=e[10];let P;e[11]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(R,{children:t.jsx("label",{htmlFor:"keyName",children:"Key Pair Name"})}),e[11]=P):P=e[11];const I=!!r.keyName;let c;e[12]!==l?(c=l("keyName"),e[12]=l,e[13]=c):c=e[13];let n;e[14]!==I||e[15]!==c?(n=t.jsx(U,{"aria-invalid":I,id:"keyName",placeholder:"my-key-pair…",...c}),e[14]=I,e[15]=c,e[16]=n):n=e[16];let m;e[17]!==r.keyName?(m=t.jsx(Q,{errors:[r.keyName]}),e[17]=r.keyName,e[18]=m):m=e[18];let p;e[19]!==n||e[20]!==m?(p=t.jsxs(z,{children:[P,n,m]}),e[19]=n,e[20]=m,e[21]=p):p=e[21];let S,B;e[22]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(R,{children:t.jsx("label",{htmlFor:"publicKeyMaterial",children:"Public Key"})}),B=t.jsx("p",{className:"text-muted-foreground text-xs",id:"publicKey-description",children:"Paste your OpenSSH public key (e.g. the contents of id_rsa.pub)"}),e[22]=S,e[23]=B):(S=e[22],B=e[23]);const E=!!r.publicKeyMaterial;let d;e[24]!==l?(d=l("publicKeyMaterial"),e[24]=l,e[25]=d):d=e[25];let y;e[26]!==E||e[27]!==d?(y=t.jsx(Y,{"aria-invalid":E,id:"publicKeyMaterial",placeholder:"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC…",rows:8,...d}),e[26]=E,e[27]=d,e[28]=y):y=e[28];let f;e[29]!==r.publicKeyMaterial?(f=t.jsx(Q,{errors:[r.publicKeyMaterial]}),e[29]=r.publicKeyMaterial,e[30]=f):f=e[30];let u;e[31]!==y||e[32]!==f?(u=t.jsxs(z,{children:[S,B,y,f]}),e[31]=y,e[32]=f,e[33]=u):u=e[33];const C=M||i.isPending;let x;e[34]!==s?(x=()=>s({to:"/ec2/describe-key-pairs"}),e[34]=s,e[35]=x):x=e[35];let b;e[36]!==C||e[37]!==x?(b=t.jsx(H,{disabled:C,onClick:x,type:"button",variant:"outline",children:"Cancel"}),e[36]=C,e[37]=x,e[38]=b):b=e[38];const w=M||i.isPending,T=M||i.isPending?"Importing…":"Import Key Pair";let h;e[39]!==w||e[40]!==T?(h=t.jsx(H,{disabled:w,type:"submit",children:T}),e[39]=w,e[40]=T,e[41]=h):h=e[41];let j;e[42]!==b||e[43]!==h?(j=t.jsxs("div",{className:"flex gap-2",children:[b,h]}),e[42]=b,e[43]=h,e[44]=j):j=e[44];let k;e[45]!==p||e[46]!==u||e[47]!==j||e[48]!==o?(k=t.jsxs("form",{className:"max-w-4xl space-y-6",onSubmit:o,children:[p,u,j]}),e[45]=p,e[46]=u,e[47]=j,e[48]=o,e[49]=k):k=e[49];let F;return e[50]!==k||e[51]!==a?(F=t.jsxs(t.Fragment,{children:[K,N,a,k]}),e[50]=k,e[51]=a,e[52]=F):F=e[52],F}export{oe as component};
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
import{cn as z,co as x}from"./index.js";class T{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:a,serializer:n,deserializer:o,serdeContext:m,defaultContentType:y}){this.marshaller=a,this.serializer=n,this.deserializer=o,this.serdeContext=m,this.defaultContentType=y}async serializeEventStream({eventStream:a,requestSchema:n,initialRequest:o}){const m=this.marshaller,y=n.getEventStreamMember(),p=n.getMemberSchema(y),d=this.serializer,f=this.defaultContentType,h=Symbol("initialRequestMarker"),S={async*[Symbol.asyncIterator](){if(o){const r={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:f}};d.write(n,o);const t=d.flush();yield{[h]:!0,headers:r,body:t}}for await(const r of a)yield r}};return m.serialize(S,r=>{if(r[h])return{headers:r.headers,body:r.body};const t=Object.keys(r).find(s=>s!=="__type")??"",{additionalHeaders:e,body:i,eventType:l,explicitPayloadContentType:c}=this.writeEventBody(t,p,r);return{headers:{":event-type":{type:"string",value:l},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:c??f},...e},body:i}})}async deserializeEventStream({response:a,responseSchema:n,initialResponseContainer:o}){const m=this.marshaller,y=n.getEventStreamMember(),d=n.getMemberSchema(y).getMemberSchemas(),f=Symbol("initialResponseMarker"),h=m.deserialize(a.body,async t=>{const e=Object.keys(t).find(l=>l!=="__type")??"",i=t[e].body;if(e==="initial-response"){const l=await this.deserializer.read(n,i);return delete l[y],{[f]:!0,...l}}else if(e in d){const l=d[e];if(l.isStructSchema()){const c={};let u=!1;for(const[s,g]of l.structIterator()){const{eventHeader:v,eventPayload:w}=g.getMergedTraits();if(u=u||!!(v||w),w)g.isBlobSchema()?c[s]=i:g.isStringSchema()?c[s]=(this.serdeContext?.utf8Encoder??z)(i):g.isStructSchema()&&(c[s]=await this.deserializer.read(g,i));else if(v){const b=t[e].headers[s]?.value;b!=null&&(g.isNumericSchema()?b&&typeof b=="object"&&"bytes"in b?c[s]=BigInt(b.toString()):c[s]=Number(b):c[s]=b)}}if(u)return{[e]:c};if(i.byteLength===0)return{[e]:{}}}return{[e]:await this.deserializer.read(l,i)}}else return{$unknown:t}}),S=h[Symbol.asyncIterator](),r=await S.next();if(r.done)return h;if(r.value?.[f]){if(!n)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(const[t,e]of Object.entries(r.value))o[t]=e}return{async*[Symbol.asyncIterator](){for(r?.value?.[f]||(yield r.value);;){const{done:t,value:e}=await S.next();if(t)break;yield e}}}}writeEventBody(a,n,o){const m=this.serializer;let y=a,p=null,d;const f=n.getSchema()[4].includes(a),h={};if(f){const t=n.getMemberSchema(a);if(t.isStructSchema()){for(const[e,i]of t.structIterator()){const{eventHeader:l,eventPayload:c}=i.getMergedTraits();if(c)p=e;else if(l){const u=o[a][e];let s="binary";i.isNumericSchema()?(-2)**31<=u&&u<=2**31-1?s="integer":s="long":i.isTimestampSchema()?s="timestamp":i.isStringSchema()?s="string":i.isBooleanSchema()&&(s="boolean"),u!=null&&(h[e]={type:s,value:u},delete o[a][e])}}if(p!==null){const e=t.getMemberSchema(p);e.isBlobSchema()?d="application/octet-stream":e.isStringSchema()&&(d="text/plain"),m.write(e,o[a][p])}else m.write(t,o[a])}else throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}else{const[t,e]=o[a];y=t,m.write(15,e)}const S=m.flush();return{body:typeof S=="string"?(this.serdeContext?.utf8Decoder??x)(S):S,eventType:y,explicitPayloadContentType:d,additionalHeaders:h}}}export{T as EventStreamSerde};
import{cm as z,cn as x}from"./index.js";class T{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:a,serializer:n,deserializer:o,serdeContext:m,defaultContentType:y}){this.marshaller=a,this.serializer=n,this.deserializer=o,this.serdeContext=m,this.defaultContentType=y}async serializeEventStream({eventStream:a,requestSchema:n,initialRequest:o}){const m=this.marshaller,y=n.getEventStreamMember(),p=n.getMemberSchema(y),d=this.serializer,f=this.defaultContentType,h=Symbol("initialRequestMarker"),S={async*[Symbol.asyncIterator](){if(o){const r={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:f}};d.write(n,o);const t=d.flush();yield{[h]:!0,headers:r,body:t}}for await(const r of a)yield r}};return m.serialize(S,r=>{if(r[h])return{headers:r.headers,body:r.body};const t=Object.keys(r).find(s=>s!=="__type")??"",{additionalHeaders:e,body:i,eventType:l,explicitPayloadContentType:c}=this.writeEventBody(t,p,r);return{headers:{":event-type":{type:"string",value:l},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:c??f},...e},body:i}})}async deserializeEventStream({response:a,responseSchema:n,initialResponseContainer:o}){const m=this.marshaller,y=n.getEventStreamMember(),d=n.getMemberSchema(y).getMemberSchemas(),f=Symbol("initialResponseMarker"),h=m.deserialize(a.body,async t=>{const e=Object.keys(t).find(l=>l!=="__type")??"",i=t[e].body;if(e==="initial-response"){const l=await this.deserializer.read(n,i);return delete l[y],{[f]:!0,...l}}else if(e in d){const l=d[e];if(l.isStructSchema()){const c={};let u=!1;for(const[s,g]of l.structIterator()){const{eventHeader:v,eventPayload:w}=g.getMergedTraits();if(u=u||!!(v||w),w)g.isBlobSchema()?c[s]=i:g.isStringSchema()?c[s]=(this.serdeContext?.utf8Encoder??z)(i):g.isStructSchema()&&(c[s]=await this.deserializer.read(g,i));else if(v){const b=t[e].headers[s]?.value;b!=null&&(g.isNumericSchema()?b&&typeof b=="object"&&"bytes"in b?c[s]=BigInt(b.toString()):c[s]=Number(b):c[s]=b)}}if(u)return{[e]:c};if(i.byteLength===0)return{[e]:{}}}return{[e]:await this.deserializer.read(l,i)}}else return{$unknown:t}}),S=h[Symbol.asyncIterator](),r=await S.next();if(r.done)return h;if(r.value?.[f]){if(!n)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(const[t,e]of Object.entries(r.value))o[t]=e}return{async*[Symbol.asyncIterator](){for(r?.value?.[f]||(yield r.value);;){const{done:t,value:e}=await S.next();if(t)break;yield e}}}}writeEventBody(a,n,o){const m=this.serializer;let y=a,p=null,d;const f=n.getSchema()[4].includes(a),h={};if(f){const t=n.getMemberSchema(a);if(t.isStructSchema()){for(const[e,i]of t.structIterator()){const{eventHeader:l,eventPayload:c}=i.getMergedTraits();if(c)p=e;else if(l){const u=o[a][e];let s="binary";i.isNumericSchema()?(-2)**31<=u&&u<=2**31-1?s="integer":s="long":i.isTimestampSchema()?s="timestamp":i.isStringSchema()?s="string":i.isBooleanSchema()&&(s="boolean"),u!=null&&(h[e]={type:s,value:u},delete o[a][e])}}if(p!==null){const e=t.getMemberSchema(p);e.isBlobSchema()?d="application/octet-stream":e.isStringSchema()&&(d="text/plain"),m.write(e,o[a][p])}else m.write(t,o[a])}else throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}else{const[t,e]=o[a];y=t,m.write(15,e)}const S=m.flush();return{body:typeof S=="string"?(this.serdeContext?.utf8Decoder??x)(S):S,eventType:y,explicitPayloadContentType:d,additionalHeaders:h}}}export{T as EventStreamSerde};
+1 -1
View File
@@ -1 +1 @@
import{c as g,aD as b,j as s,aE as P,aF as y}from"./index.js";import{u as k}from"./useSuspenseQuery.js";import{B as N}from"./back-link.js";import{P as B}from"./page-heading.js";import{F as C,O,U as F}from"./upload-button.js";import"./alert-dialog.js";import"./s3.js";import"./useMutation.js";import"./download.js";import"./trash-2.js";function D(){const e=g.c(26),{bucket:t}=b.useParams();let u;e[0]!==t?(u=y(t),e[0]=t,e[1]=u):u=e[1];const{data:i}=k(u);let x;e[2]!==i.Contents?(x=i.Contents||[],e[2]=i.Contents,e[3]=x):x=e[3];const n=x;let d;e[4]!==i.CommonPrefixes?(d=i.CommonPrefixes||[],e[4]=i.CommonPrefixes,e[5]=d):d=e[5];const o=d;let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(N,{to:"/s3/ls",children:"Back to buckets"}),e[6]=h):h=e[6];let r;e[7]!==t?(r=s.jsx(F,{bucket:t}),e[7]=t,e[8]=r):r=e[8];let m;e[9]!==t||e[10]!==r?(m=s.jsx(B,{actions:r,title:t}),e[9]=t,e[10]=r,e[11]=m):m=e[11];let a;e[12]!==t||e[13]!==o?(a=o.length>0&&s.jsxs("div",{className:"mb-6",children:[s.jsx("h2",{className:"mb-3 font-semibold text-lg",children:"Folders"}),s.jsx("div",{className:"space-y-2",children:o.map(l=>{if(!l.Prefix)return null;const j=P(l.Prefix);return s.jsx(C,{bucketName:t,folderName:j,fullPrefix:l.Prefix},l.Prefix)})})]}),e[12]=t,e[13]=o,e[14]=a):a=e[14];let c;e[15]!==t||e[16]!==n?(c=n.length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("h2",{className:"mb-3 font-semibold text-lg",children:"Objects"}),n.map(l=>l.Key?s.jsx(O,{bucketName:t,displayName:l.Key,fullKey:l.Key,object:l},l.Key):null)]}),e[15]=t,e[16]=n,e[17]=c):c=e[17];let f;e[18]!==o.length||e[19]!==n.length?(f=n.length===0&&o.length===0&&s.jsx("p",{className:"text-muted-foreground",children:"No objects found in this bucket."}),e[18]=o.length,e[19]=n.length,e[20]=f):f=e[20];let p;return e[21]!==m||e[22]!==a||e[23]!==c||e[24]!==f?(p=s.jsxs(s.Fragment,{children:[h,m,a,c,f]}),e[21]=m,e[22]=a,e[23]=c,e[24]=f,e[25]=p):p=e[25],p}export{D as component};
import{c as b,aC as y,j as s,aD as k,aE as N}from"./index.js";import{u as B}from"./useSuspenseQuery.js";import{B as C}from"./back-link.js";import{E as O}from"./error-banner.js";import{P as E}from"./page-heading.js";import{a as F}from"./s3.js";import{U as K,F as v,O as U}from"./upload-button.js";import"./alert-dialog.js";import"./download.js";import"./trash-2.js";function T(){const e=b.c(31),{bucket:t}=y.useParams();let x;e[0]!==t?(x=N(t),e[0]=t,e[1]=x):x=e[1];const{data:i}=B(x),r=F();let p;e[2]!==i.Contents?(p=i.Contents||[],e[2]=i.Contents,e[3]=p):p=e[3];const o=p;let h;e[4]!==i.CommonPrefixes?(h=i.CommonPrefixes||[],e[4]=i.CommonPrefixes,e[5]=h):h=e[5];const l=h;let g;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(C,{to:"/s3/ls",children:"Back to buckets"}),e[6]=g):g=e[6];let a;e[7]!==t||e[8]!==r.isPending||e[9]!==r.mutateAsync?(a=s.jsx(K,{bucket:t,isPending:r.isPending,onUpload:r.mutateAsync}),e[7]=t,e[8]=r.isPending,e[9]=r.mutateAsync,e[10]=a):a=e[10];let m;e[11]!==t||e[12]!==a?(m=s.jsx(E,{actions:a,title:t}),e[11]=t,e[12]=a,e[13]=m):m=e[13];let c;e[14]!==r.error?(c=r.error&&s.jsx(O,{error:r.error,msg:"Failed to upload object"}),e[14]=r.error,e[15]=c):c=e[15];let u;e[16]!==t||e[17]!==l?(u=l.length>0&&s.jsxs("div",{className:"mb-6",children:[s.jsx("h2",{className:"mb-3 font-semibold text-lg",children:"Folders"}),s.jsx("div",{className:"space-y-2",children:l.map(n=>{if(!n.Prefix)return null;const P=k(n.Prefix);return s.jsx(v,{bucketName:t,folderName:P,fullPrefix:n.Prefix},n.Prefix)})})]}),e[16]=t,e[17]=l,e[18]=u):u=e[18];let f;e[19]!==t||e[20]!==o?(f=o.length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("h2",{className:"mb-3 font-semibold text-lg",children:"Objects"}),o.map(n=>n.Key?s.jsx(U,{bucketName:t,displayName:n.Key,fullKey:n.Key,object:n},n.Key):null)]}),e[19]=t,e[20]=o,e[21]=f):f=e[21];let d;e[22]!==l.length||e[23]!==o.length?(d=o.length===0&&l.length===0&&s.jsx("p",{className:"text-muted-foreground",children:"No objects found in this bucket."}),e[22]=l.length,e[23]=o.length,e[24]=d):d=e[24];let j;return e[25]!==m||e[26]!==c||e[27]!==u||e[28]!==f||e[29]!==d?(j=s.jsxs(s.Fragment,{children:[g,m,c,u,f,d]}),e[25]=m,e[26]=c,e[27]=u,e[28]=f,e[29]=d,e[30]=j):j=e[30],j}export{T as component};
+1 -1
View File
@@ -1 +1 @@
import{c as l,aG as n,j as t,L as m,B as u}from"./index.js";import{u as c}from"./useSuspenseQuery.js";import{L as d}from"./list-card.js";import{P as p}from"./page-heading.js";import{B as f}from"./badge.js";function b(){const e=l.c(5),{data:r}=c(n);let s;e[0]!==r.Volumes?(s=r.Volumes||[],e[0]=r.Volumes,e[1]=s):s=e[1];const o=s;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(p,{actions:t.jsx(m,{to:"/ec2/create-volume",children:t.jsx(u,{children:"Create Volume"})}),title:"EC2 Volumes"}),e[2]=a):a=e[2];let i;return e[3]!==o?(i=t.jsxs(t.Fragment,{children:[a,o.length>0?t.jsx("div",{className:"space-y-4",children:o.map(x)}):t.jsx("p",{className:"text-muted-foreground",children:"No volumes found."})]}),e[3]=o,e[4]=i):i=e[4],i}function x(e){return e.VolumeId?t.jsx(d,{badge:e.State?t.jsx(f,{variant:e.State==="available"?"default":"outline",children:e.State}):void 0,params:{id:e.VolumeId},subtitle:`${e.Size} GiB • ${e.VolumeType}`,title:e.VolumeId,to:"/ec2/describe-volumes/$id"},e.VolumeId):null}export{b as component};
import{c as l,aF as n,j as t,L as m,B as u}from"./index.js";import{u as c}from"./useSuspenseQuery.js";import{L as d}from"./list-card.js";import{P as p}from"./page-heading.js";import{B as f}from"./badge.js";function b(){const e=l.c(5),{data:r}=c(n);let s;e[0]!==r.Volumes?(s=r.Volumes||[],e[0]=r.Volumes,e[1]=s):s=e[1];const o=s;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(p,{actions:t.jsx(m,{to:"/ec2/create-volume",children:t.jsx(u,{children:"Create Volume"})}),title:"EC2 Volumes"}),e[2]=a):a=e[2];let i;return e[3]!==o?(i=t.jsxs(t.Fragment,{children:[a,o.length>0?t.jsx("div",{className:"space-y-4",children:o.map(x)}):t.jsx("p",{className:"text-muted-foreground",children:"No volumes found."})]}),e[3]=o,e[4]=i):i=e[4],i}function x(e){return e.VolumeId?t.jsx(d,{badge:e.State?t.jsx(f,{variant:e.State==="available"?"default":"outline",children:e.State}):void 0,params:{id:e.VolumeId},subtitle:`${e.Size} GiB • ${e.VolumeType}`,title:e.VolumeId,to:"/ec2/describe-volumes/$id"},e.VolumeId):null}export{b as component};
+1 -1
View File
@@ -1 +1 @@
import{c as m,aA as l,j as t,L as n,B as c}from"./index.js";import{u as p}from"./useSuspenseQuery.js";import{L as d}from"./list-card.js";import{P as y}from"./page-heading.js";function P(){const e=m.c(4),{data:r}=p(l);let s;if(e[0]!==r.KeyPairs){const a=[...r.KeyPairs||[]].sort(f);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(n,{to:"/ec2/import-key-pair",children:t.jsx(c,{variant:"outline",children:"Import Key Pair"})}),e[2]=i):i=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(y,{actions:t.jsxs("div",{className:"flex gap-2",children:[i,t.jsx(n,{to:"/ec2/create-key-pair",children:t.jsx(c,{children:"Create Key Pair"})})]}),title:"EC2 Key Pairs"}),e[3]=o):o=e[3],s=t.jsxs(t.Fragment,{children:[o,a.length>0?t.jsx("div",{className:"space-y-4",children:a.map(u)}):t.jsx("p",{className:"text-muted-foreground",children:"No key pairs found."})]}),e[0]=r.KeyPairs,e[1]=s}else s=e[1];return s}function u(e){return e.KeyPairId?t.jsx(d,{params:{id:e.KeyPairId},subtitle:`${e.KeyPairId} • ${e.KeyType}`,title:e.KeyName??"",to:"/ec2/describe-key-pairs/$id"},e.KeyPairId):null}function f(e,r){const s=e.KeyName?.toLowerCase()??"",a=r.KeyName?.toLowerCase()??"";return s.localeCompare(a)}export{P as component};
import{c as m,az as l,j as t,L as n,B as c}from"./index.js";import{u as p}from"./useSuspenseQuery.js";import{L as d}from"./list-card.js";import{P as y}from"./page-heading.js";function P(){const e=m.c(4),{data:r}=p(l);let s;if(e[0]!==r.KeyPairs){const a=[...r.KeyPairs||[]].sort(f);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(n,{to:"/ec2/import-key-pair",children:t.jsx(c,{variant:"outline",children:"Import Key Pair"})}),e[2]=i):i=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(y,{actions:t.jsxs("div",{className:"flex gap-2",children:[i,t.jsx(n,{to:"/ec2/create-key-pair",children:t.jsx(c,{children:"Create Key Pair"})})]}),title:"EC2 Key Pairs"}),e[3]=o):o=e[3],s=t.jsxs(t.Fragment,{children:[o,a.length>0?t.jsx("div",{className:"space-y-4",children:a.map(u)}):t.jsx("p",{className:"text-muted-foreground",children:"No key pairs found."})]}),e[0]=r.KeyPairs,e[1]=s}else s=e[1];return s}function u(e){return e.KeyPairId?t.jsx(d,{params:{id:e.KeyPairId},subtitle:`${e.KeyPairId} • ${e.KeyType}`,title:e.KeyName??"",to:"/ec2/describe-key-pairs/$id"},e.KeyPairId):null}function f(e,r){const s=e.KeyName?.toLowerCase()??"",a=r.KeyName?.toLowerCase()??"";return s.localeCompare(a)}export{P as component};
+1 -1
View File
@@ -1 +1 @@
import{c as o,aH as c,j as t,L as i,B as m}from"./index.js";import{u as d}from"./useSuspenseQuery.js";import{L as u}from"./list-card.js";import{P as l}from"./page-heading.js";import{S as p}from"./state-badge.js";function y(){const e=o.c(3),{data:a}=d(c);let s;if(e[0]!==a.Reservations){const r=a.Reservations?.flatMap(I)||[];let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(l,{actions:t.jsx(i,{to:"/ec2/run-instances",children:t.jsx(m,{children:"Run Instances"})}),title:"EC2 Instances"}),e[2]=n):n=e[2],s=t.jsxs(t.Fragment,{children:[n,r.length>0?t.jsx("div",{className:"space-y-4",children:r.map(f)}):t.jsx("p",{className:"text-muted-foreground",children:"No instances found."})]}),e[0]=a.Reservations,e[1]=s}else s=e[1];return s}function f(e){return e.InstanceId?t.jsx(u,{badge:t.jsx(p,{state:e.State?.Name}),params:{id:e.InstanceId},subtitle:`${e.InstanceType} • ${e.ImageId}`,title:e.InstanceId,to:"/ec2/describe-instances/$id"},e.InstanceId):null}function I(e){return e.Instances||[]}export{y as component};
import{c as o,aG as c,j as t,L as i,B as m}from"./index.js";import{u as d}from"./useSuspenseQuery.js";import{L as u}from"./list-card.js";import{P as l}from"./page-heading.js";import{S as p}from"./state-badge.js";function y(){const e=o.c(3),{data:a}=d(c);let s;if(e[0]!==a.Reservations){const r=a.Reservations?.flatMap(I)||[];let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(l,{actions:t.jsx(i,{to:"/ec2/run-instances",children:t.jsx(m,{children:"Run Instances"})}),title:"EC2 Instances"}),e[2]=n):n=e[2],s=t.jsxs(t.Fragment,{children:[n,r.length>0?t.jsx("div",{className:"space-y-4",children:r.map(f)}):t.jsx("p",{className:"text-muted-foreground",children:"No instances found."})]}),e[0]=a.Reservations,e[1]=s}else s=e[1];return s}function f(e){return e.InstanceId?t.jsx(u,{badge:t.jsx(p,{state:e.State?.Name}),params:{id:e.InstanceId},subtitle:`${e.InstanceType} • ${e.ImageId}`,title:e.InstanceId,to:"/ec2/describe-instances/$id"},e.InstanceId):null}function I(e){return e.Instances||[]}export{y as component};
+1 -1
View File
@@ -1 +1 @@
import{c as n,az as i,j as t}from"./index.js";import{u as l}from"./useSuspenseQuery.js";import{L as c}from"./list-card.js";import{P as d}from"./page-heading.js";import{B as u}from"./badge.js";function h(){const e=n.c(5),{data:m}=l(i);let s;e[0]!==m.Images?(s=m.Images||[],e[0]=m.Images,e[1]=s):s=e[1];const a=s;let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(d,{title:"EC2 Images"}),e[2]=r):r=e[2];let o;return e[3]!==a?(o=t.jsxs(t.Fragment,{children:[r,a.length>0?t.jsx("div",{className:"space-y-4",children:a.map(p)}):t.jsx("p",{className:"text-muted-foreground",children:"No images found."})]}),e[3]=a,e[4]=o):o=e[4],o}function p(e){return e.ImageId?t.jsx(c,{badge:e.State?t.jsx(u,{variant:e.State==="available"?"default":"outline",children:e.State}):void 0,params:{id:e.ImageId},subtitle:e.Name,title:e.ImageId,to:"/ec2/describe-images/$id"},e.ImageId):null}export{h as component};
import{c as n,ay as i,j as t}from"./index.js";import{u as l}from"./useSuspenseQuery.js";import{L as c}from"./list-card.js";import{P as d}from"./page-heading.js";import{B as u}from"./badge.js";function h(){const e=n.c(5),{data:m}=l(i);let s;e[0]!==m.Images?(s=m.Images||[],e[0]=m.Images,e[1]=s):s=e[1];const a=s;let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(d,{title:"EC2 Images"}),e[2]=r):r=e[2];let o;return e[3]!==a?(o=t.jsxs(t.Fragment,{children:[r,a.length>0?t.jsx("div",{className:"space-y-4",children:a.map(p)}):t.jsx("p",{className:"text-muted-foreground",children:"No images found."})]}),e[3]=a,e[4]=o):o=e[4],o}function p(e){return e.ImageId?t.jsx(c,{badge:e.State?t.jsx(u,{variant:e.State==="available"?"default":"outline",children:e.State}):void 0,params:{id:e.ImageId},subtitle:e.Name,title:e.ImageId,to:"/ec2/describe-images/$id"},e.ImageId):null}export{h as component};
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 +0,0 @@
import{c4 as l,c5 as d,c6 as a,c7 as p,c8 as h,bp as b,r as o,c9 as m,ca as v}from"./index.js";var y=class extends l{#s;#i=void 0;#t;#e;constructor(t,s){super(),this.#s=t,this.setOptions(s),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const s=this.options;this.options=this.#s.defaultMutationOptions(t),d(this.options,s)||this.#s.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),s?.mutationKey&&this.options.mutationKey&&a(s.mutationKey)!==a(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#o(t)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#o()}mutate(t,s){return this.#e=s,this.#t?.removeObserver(this),this.#t=this.#s.getMutationCache().build(this.#s,this.options),this.#t.addObserver(this),this.#t.execute(t)}#r(){const t=this.#t?.state??p();this.#i={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){h.batch(()=>{if(this.#e&&this.hasListeners()){const s=this.#i.variables,r=this.#i.context,e={client:this.#s,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#e.onSuccess?.(t.data,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(t.data,null,s,r,e)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#e.onError?.(t.error,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(void 0,t.error,s,r,e)}catch(i){Promise.reject(i)}}}this.listeners.forEach(s=>{s(this.#i)})})}};function O(t,s){const r=b(),[e]=o.useState(()=>new y(r,t));o.useEffect(()=>{e.setOptions(t)},[e,t]);const i=o.useSyncExternalStore(o.useCallback(n=>e.subscribe(h.batchCalls(n)),[e]),()=>e.getCurrentResult(),()=>e.getCurrentResult()),u=o.useCallback((n,c)=>{e.mutate(n,c).catch(m)},[e]);if(i.error&&v(e.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:u,mutateAsync:i.mutate}}export{O as u};
File diff suppressed because one or more lines are too long
+7 -1
View File
@@ -8,7 +8,13 @@ import { SidebarProvider } from "@/components/ui/sidebar"
import { routeTree } from "./routeTree.gen"
import "./styles.css"
const queryClient = new QueryClient()
const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 5000,
},
},
})
const router = createRouter({
routeTree,
@@ -33,10 +33,14 @@ export function useStartInstance() {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (instanceId: string) => {
const command = new StartInstancesCommand({
InstanceIds: [instanceId],
})
return await getEc2Client().send(command)
try {
const command = new StartInstancesCommand({
InstanceIds: [instanceId],
})
return await getEc2Client().send(command)
} catch {
throw new Error("Failed to start instance")
}
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["ec2", "instances"] })
@@ -48,10 +52,14 @@ export function useStopInstance() {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (instanceId: string) => {
const command = new StopInstancesCommand({
InstanceIds: [instanceId],
})
return await getEc2Client().send(command)
try {
const command = new StopInstancesCommand({
InstanceIds: [instanceId],
})
return await getEc2Client().send(command)
} catch {
throw new Error("Failed to stop instance")
}
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["ec2", "instances"] })
@@ -63,10 +71,14 @@ export function useTerminateInstance() {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (instanceId: string) => {
const command = new TerminateInstancesCommand({
InstanceIds: [instanceId],
})
return await getEc2Client().send(command)
try {
const command = new TerminateInstancesCommand({
InstanceIds: [instanceId],
})
return await getEc2Client().send(command)
} catch {
throw new Error("Failed to terminate instance")
}
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["ec2", "instances"] })
@@ -78,10 +90,14 @@ export function useRebootInstance() {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (instanceId: string) => {
const command = new RebootInstancesCommand({
InstanceIds: [instanceId],
})
return await getEc2Client().send(command)
try {
const command = new RebootInstancesCommand({
InstanceIds: [instanceId],
})
return await getEc2Client().send(command)
} catch {
throw new Error("Failed to reboot instance")
}
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["ec2", "instances"] })
@@ -93,16 +109,20 @@ export function useCreateInstance() {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (params: CreateInstanceParams) => {
const command = new RunInstancesCommand({
ImageId: params.imageId,
InstanceType: params.instanceType as _InstanceType,
KeyName: params.keyName,
MinCount: params.count,
MaxCount: params.count,
SecurityGroupIds: params.securityGroupIds,
SubnetId: params.subnetId,
})
return await getEc2Client().send(command)
try {
const command = new RunInstancesCommand({
ImageId: params.imageId,
InstanceType: params.instanceType as _InstanceType,
KeyName: params.keyName,
MinCount: params.count,
MaxCount: params.count,
SecurityGroupIds: params.securityGroupIds,
SubnetId: params.subnetId,
})
return await getEc2Client().send(command)
} catch {
throw new Error("Failed to create instance")
}
},
onSuccess: async (data) => {
await queryClient.cancelQueries(ec2InstancesQueryOptions)
@@ -135,11 +155,15 @@ export function useCreateKeyPair() {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (params: CreateKeyPairData) => {
const command = new CreateKeyPairCommand({
KeyName: params.keyName,
KeyType: "rsa",
})
return await getEc2Client().send(command)
try {
const command = new CreateKeyPairCommand({
KeyName: params.keyName,
KeyType: "rsa",
})
return await getEc2Client().send(command)
} catch {
throw new Error("Failed to create key pair")
}
},
onSuccess: () => {
queryClient.invalidateQueries(ec2KeyPairsQueryOptions)
@@ -151,15 +175,19 @@ export function useImportKeyPair() {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (params: ImportKeyPairData) => {
// remove optional comment from ssh key as it breaks the import
const keyParts = params.publicKeyMaterial.trim().split(WHITESPACE_REGEX)
const cleanedKey = keyParts.slice(0, 2).join(" ")
try {
// remove optional comment from ssh key as it breaks the import
const keyParts = params.publicKeyMaterial.trim().split(WHITESPACE_REGEX)
const cleanedKey = keyParts.slice(0, 2).join(" ")
const command = new ImportKeyPairCommand({
KeyName: params.keyName,
PublicKeyMaterial: new TextEncoder().encode(cleanedKey),
})
return await getEc2Client().send(command)
const command = new ImportKeyPairCommand({
KeyName: params.keyName,
PublicKeyMaterial: new TextEncoder().encode(cleanedKey),
})
return await getEc2Client().send(command)
} catch {
throw new Error("Failed to import key pair")
}
},
onSuccess: () => {
queryClient.invalidateQueries(ec2KeyPairsQueryOptions)
@@ -171,10 +199,14 @@ export function useDeleteKeyPair() {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (keyPairId: string) => {
const command = new DeleteKeyPairCommand({
KeyPairId: keyPairId,
})
return await getEc2Client().send(command)
try {
const command = new DeleteKeyPairCommand({
KeyPairId: keyPairId,
})
return await getEc2Client().send(command)
} catch {
throw new Error("Failed to delete key pair")
}
},
onSuccess: () => {
queryClient.invalidateQueries(ec2KeyPairsQueryOptions)
@@ -186,12 +218,16 @@ export function useCreateVolume() {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (params: CreateVolumeFormData) => {
const command = new CreateVolumeCommand({
Size: params.size,
AvailabilityZone: params.availabilityZone,
VolumeType: "gp3",
})
return await getEc2Client().send(command)
try {
const command = new CreateVolumeCommand({
Size: params.size,
AvailabilityZone: params.availabilityZone,
VolumeType: "gp3",
})
return await getEc2Client().send(command)
} catch {
throw new Error("Failed to create volume")
}
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["ec2", "volumes"] })
@@ -203,11 +239,15 @@ export function useModifyVolume() {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (params: ModifyVolumeParams) => {
const command = new ModifyVolumeCommand({
VolumeId: params.volumeId,
Size: params.size,
})
return await getEc2Client().send(command)
try {
const command = new ModifyVolumeCommand({
VolumeId: params.volumeId,
Size: params.size,
})
return await getEc2Client().send(command)
} catch {
throw new Error("Failed to modify volume")
}
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["ec2", "volumes"] })
@@ -219,10 +259,14 @@ export function useDeleteVolume() {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (volumeId: string) => {
const command = new DeleteVolumeCommand({
VolumeId: volumeId,
})
return await getEc2Client().send(command)
try {
const command = new DeleteVolumeCommand({
VolumeId: volumeId,
})
return await getEc2Client().send(command)
} catch {
throw new Error("Failed to delete volume")
}
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["ec2", "volumes"] })
@@ -16,17 +16,21 @@ export function useUploadObject() {
return useMutation({
mutationFn: async ({ bucket, key, file }: UploadObjectParams) => {
const upload = new Upload({
client: getS3Client(),
params: {
Bucket: bucket,
Key: key,
Body: file,
ContentType: file.type,
},
})
try {
const upload = new Upload({
client: getS3Client(),
params: {
Bucket: bucket,
Key: key,
Body: file,
ContentType: file.type,
},
})
return await upload.done()
return await upload.done()
} catch {
throw new Error("Failed to upload object")
}
},
onSuccess: (_, variables) => {
queryClient.invalidateQueries({
@@ -41,11 +45,15 @@ export function useCreateBucket() {
return useMutation({
mutationFn: async ({ bucketName }: CreateBucketFormData) => {
const command = new CreateBucketCommand({
Bucket: bucketName,
})
try {
const command = new CreateBucketCommand({
Bucket: bucketName,
})
return await getS3Client().send(command)
return await getS3Client().send(command)
} catch {
throw new Error("Failed to create bucket")
}
},
onSuccess: () => {
queryClient.invalidateQueries({
@@ -60,12 +68,16 @@ export function useDeleteObject() {
return useMutation({
mutationFn: async ({ bucket, key }: { bucket: string; key: string }) => {
const command = new DeleteObjectCommand({
Bucket: bucket,
Key: key,
})
try {
const command = new DeleteObjectCommand({
Bucket: bucket,
Key: key,
})
return await getS3Client().send(command)
return await getS3Client().send(command)
} catch {
throw new Error("Failed to delete object")
}
},
onSuccess: (_, variables) => {
queryClient.invalidateQueries({
@@ -20,7 +20,6 @@ export const ec2InstancesQueryOptions = queryOptions({
throw new Error("Failed to fetch EC2 instances")
}
},
staleTime: 5000,
})
export const ec2InstanceQueryOptions = (instanceId: string) =>
@@ -36,7 +35,6 @@ export const ec2InstanceQueryOptions = (instanceId: string) =>
throw new Error("Failed to fetch EC2 instance")
}
},
staleTime: 5000,
})
export const ec2InstanceTypesQueryOptions = queryOptions({
@@ -56,7 +54,6 @@ export const ec2InstanceTypesQueryOptions = queryOptions({
throw new Error("Failed to fetch EC2 instance types")
}
},
staleTime: 5000,
})
export const ec2ImagesQueryOptions = queryOptions({
@@ -69,7 +66,6 @@ export const ec2ImagesQueryOptions = queryOptions({
throw new Error("Failed to fetch EC2 images")
}
},
staleTime: 300_000,
})
export const ec2ImageQueryOptions = (imageId: string | undefined) =>
@@ -88,7 +84,6 @@ export const ec2ImageQueryOptions = (imageId: string | undefined) =>
throw new Error("Failed to fetch EC2 image")
}
},
staleTime: 300_000,
})
export const ec2KeyPairsQueryOptions = queryOptions({
@@ -101,7 +96,6 @@ export const ec2KeyPairsQueryOptions = queryOptions({
throw new Error("Failed to fetch key pairs")
}
},
staleTime: 300_000,
})
export const ec2KeyPairQueryOptions = (keyPairId: string) =>
@@ -117,7 +111,6 @@ export const ec2KeyPairQueryOptions = (keyPairId: string) =>
throw new Error("Failed to fetch key pair")
}
},
staleTime: 300_000,
})
export const ec2RegionsQueryOptions = queryOptions({
@@ -143,7 +136,6 @@ export const ec2VolumesQueryOptions = queryOptions({
throw new Error("Failed to fetch volumes")
}
},
staleTime: 5000,
})
export const ec2VolumeQueryOptions = (volumeId: string) =>
@@ -159,5 +151,4 @@ export const ec2VolumeQueryOptions = (volumeId: string) =>
throw new Error("Failed to fetch volume")
}
},
staleTime: 5000,
})
@@ -13,7 +13,6 @@ export const s3BucketsQueryOptions = queryOptions({
throw new Error("Failed to fetch S3 buckets")
}
},
staleTime: 5000,
})
export const s3BucketObjectsQueryOptions = (
@@ -34,5 +33,4 @@ export const s3BucketObjectsQueryOptions = (
throw new Error("Failed to fetch S3 bucket objects")
}
},
staleTime: 5000,
})
@@ -6,6 +6,7 @@ import { useState } from "react"
import { BackLink } from "@/components/back-link"
import { DetailCard } from "@/components/detail-card"
import { DetailRow } from "@/components/detail-row"
import { ErrorBanner } from "@/components/error-banner"
import { PageHeading } from "@/components/page-heading"
import {
AlertDialog,
@@ -68,6 +69,13 @@ function KeyPairDetail() {
<>
<BackLink to="/ec2/describe-key-pairs">Back to key pairs</BackLink>
{deleteMutation.error && (
<ErrorBanner
error={deleteMutation.error}
msg="Failed to delete key pair"
/>
)}
<div className="space-y-6">
<PageHeading
actions={
@@ -6,6 +6,7 @@ import { useState } from "react"
import { BackLink } from "@/components/back-link"
import { DetailCard } from "@/components/detail-card"
import { DetailRow } from "@/components/detail-row"
import { ErrorBanner } from "@/components/error-banner"
import { PageHeading } from "@/components/page-heading"
import {
AlertDialog,
@@ -71,6 +72,13 @@ function VolumeDetail() {
<>
<BackLink to="/ec2/describe-volumes">Back to volumes</BackLink>
{deleteMutation.error && (
<ErrorBanner
error={deleteMutation.error}
msg="Failed to delete volume"
/>
)}
<div className="space-y-6">
<PageHeading
actions={
@@ -1,5 +1,6 @@
import { Pause, Play, RotateCw, Trash2 } from "lucide-react"
import { ErrorBanner } from "@/components/error-banner"
import { Button } from "@/components/ui/button"
import {
useRebootInstance,
@@ -52,6 +53,27 @@ export function InstanceActions({ instanceId, state }: InstanceActionsProps) {
return (
<div className="rounded-lg border bg-card p-4">
<h2 className="mb-4 font-semibold">Instance Actions</h2>
{startMutation.error && (
<ErrorBanner
error={startMutation.error}
msg="Failed to start instance"
/>
)}
{stopMutation.error && (
<ErrorBanner error={stopMutation.error} msg="Failed to stop instance" />
)}
{rebootMutation.error && (
<ErrorBanner
error={rebootMutation.error}
msg="Failed to reboot instance"
/>
)}
{terminateMutation.error && (
<ErrorBanner
error={terminateMutation.error}
msg="Failed to terminate instance"
/>
)}
<div className="flex flex-wrap gap-2">
{state === "stopped" && (
<Button
@@ -3,6 +3,7 @@ import { GetObjectCommand } from "@aws-sdk/client-s3"
import { Download, File, Trash2 } from "lucide-react"
import { useState } from "react"
import { ErrorBanner } from "@/components/error-banner"
import {
AlertDialog,
AlertDialogAction,
@@ -67,61 +68,66 @@ export function ObjectListItem({
}
return (
<div
className="flex items-center justify-between rounded-lg border bg-card p-4"
key={object.Key}
>
<div className="flex items-center gap-3">
<File className="size-5 text-muted-foreground" />
<div>
<h3 className="font-medium">{displayName}</h3>
{object.LastModified && (
<p className="text-muted-foreground text-sm">
Last Modified: {object.LastModified.toLocaleString()}
</p>
)}
<div key={object.Key}>
{deleteMutation.error && (
<ErrorBanner
error={deleteMutation.error}
msg="Failed to delete object"
/>
)}
<div className="flex items-center justify-between rounded-lg border bg-card p-4">
<div className="flex items-center gap-3">
<File className="size-5 text-muted-foreground" />
<div>
<h3 className="font-medium">{displayName}</h3>
{object.LastModified && (
<p className="text-muted-foreground text-sm">
Last Modified: {object.LastModified.toLocaleString()}
</p>
)}
</div>
</div>
</div>
<div className="flex items-center gap-3">
<div className="text-muted-foreground text-sm">
{formatSize(object.Size || 0)}
<div className="flex items-center gap-3">
<div className="text-muted-foreground text-sm">
{formatSize(object.Size || 0)}
</div>
<button
className="rounded-md p-2 transition-colors hover:bg-accent"
onClick={downloadObject}
type="button"
>
<Download className="size-4" />
</button>
<button
className="rounded-md p-2 text-destructive transition-colors hover:bg-accent"
onClick={() => setShowDeleteDialog(true)}
type="button"
>
<Trash2 className="size-4" />
</button>
</div>
<button
className="rounded-md p-2 transition-colors hover:bg-accent"
onClick={downloadObject}
type="button"
>
<Download className="size-4" />
</button>
<button
className="rounded-md p-2 text-destructive transition-colors hover:bg-accent"
onClick={() => setShowDeleteDialog(true)}
type="button"
>
<Trash2 className="size-4" />
</button>
</div>
<AlertDialog onOpenChange={setShowDeleteDialog} open={showDeleteDialog}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete Object</AlertDialogTitle>
<AlertDialogDescription>
Are you sure you want to delete <strong>{displayName}</strong>?
This action cannot be undone.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction
className="bg-destructive hover:bg-destructive/90"
onClick={handleDelete}
>
{deleteMutation.isPending ? "Deleting…" : "Delete"}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
<AlertDialog onOpenChange={setShowDeleteDialog} open={showDeleteDialog}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete Object</AlertDialogTitle>
<AlertDialogDescription>
Are you sure you want to delete <strong>{displayName}</strong>?
This action cannot be undone.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction
className="bg-destructive hover:bg-destructive/90"
onClick={handleDelete}
>
{deleteMutation.isPending ? "Deleting…" : "Delete"}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
</div>
)
}
@@ -2,16 +2,25 @@ import { Upload } from "lucide-react"
import { useRef } from "react"
import { Button } from "@/components/ui/button"
import { useUploadObject } from "@/mutations/s3"
interface UploadButtonProps {
bucket: string
prefix?: string
isPending: boolean
onUpload: (params: {
bucket: string
key: string
file: File
}) => Promise<unknown>
}
export function UploadButton({ bucket, prefix = "" }: UploadButtonProps) {
export function UploadButton({
bucket,
prefix = "",
isPending,
onUpload,
}: UploadButtonProps) {
const fileInputRef = useRef<HTMLInputElement>(null)
const uploadMutation = useUploadObject()
async function handleFileSelect(event: React.ChangeEvent<HTMLInputElement>) {
const files = event.target.files
@@ -23,11 +32,7 @@ export function UploadButton({ bucket, prefix = "" }: UploadButtonProps) {
await Promise.all(
Array.from(files).map((file) => {
const key = `${prefix}${file.name}`
return uploadMutation.mutateAsync({
bucket,
key,
file,
})
return onUpload({ bucket, key, file })
}),
)
} finally {
@@ -50,12 +55,12 @@ export function UploadButton({ bucket, prefix = "" }: UploadButtonProps) {
type="file"
/>
<Button
disabled={uploadMutation.isPending}
disabled={isPending}
onClick={() => fileInputRef.current?.click()}
size="sm"
>
<Upload className="mr-2 size-4" />
{uploadMutation.isPending ? "Uploading…" : "Upload Files"}
{isPending ? "Uploading…" : "Upload Files"}
</Button>
</>
)
@@ -3,12 +3,14 @@ import { useSuspenseQuery } from "@tanstack/react-query"
import { createFileRoute, Link } from "@tanstack/react-router"
import { BackLink } from "@/components/back-link"
import { ErrorBanner } from "@/components/error-banner"
import {
buildFullS3Key,
ensureTrailingSlash,
extractDisplayName,
removeTrailingSlash,
} from "@/lib/utils"
import { useUploadObject } from "@/mutations/s3"
import { s3BucketObjectsQueryOptions } from "@/queries/s3"
import { FolderListItem } from "@/routes/_auth/s3/-components/folder-list-item"
import { ObjectListItem } from "@/routes/_auth/s3/-components/object-list-item"
@@ -40,6 +42,7 @@ function BucketObjectsWithPrefix() {
const prefix = ensureTrailingSlash(_splat || "")
const { data } = useSuspenseQuery(s3BucketObjectsQueryOptions(bucket, prefix))
const uploadMutation = useUploadObject()
const objects = data.Contents || []
const commonPrefixes = data.CommonPrefixes || []
@@ -83,9 +86,20 @@ function BucketObjectsWithPrefix() {
</div>
))}
</div>
<UploadButton bucket={bucket} prefix={prefix} />
<UploadButton
bucket={bucket}
isPending={uploadMutation.isPending}
onUpload={uploadMutation.mutateAsync}
prefix={prefix}
/>
</div>
</div>
{uploadMutation.error && (
<ErrorBanner
error={uploadMutation.error}
msg="Failed to upload object"
/>
)}
{commonPrefixes.length > 0 && (
<div className="mb-6">
<h2 className="mb-3 font-semibold text-lg">Folders</h2>
@@ -3,8 +3,10 @@ import { useSuspenseQuery } from "@tanstack/react-query"
import { createFileRoute } from "@tanstack/react-router"
import { BackLink } from "@/components/back-link"
import { ErrorBanner } from "@/components/error-banner"
import { PageHeading } from "@/components/page-heading"
import { removeTrailingSlash } from "@/lib/utils"
import { useUploadObject } from "@/mutations/s3"
import { s3BucketObjectsQueryOptions } from "@/queries/s3"
import { FolderListItem } from "@/routes/_auth/s3/-components/folder-list-item"
import { ObjectListItem } from "@/routes/_auth/s3/-components/object-list-item"
@@ -29,6 +31,7 @@ export const Route = createFileRoute("/_auth/s3/ls/$bucket/")({
function BucketObjects() {
const { bucket: bucketName } = Route.useParams()
const { data } = useSuspenseQuery(s3BucketObjectsQueryOptions(bucketName))
const uploadMutation = useUploadObject()
const objects = data.Contents || []
const commonPrefixes = data.CommonPrefixes || []
@@ -37,9 +40,21 @@ function BucketObjects() {
<>
<BackLink to="/s3/ls">Back to buckets</BackLink>
<PageHeading
actions={<UploadButton bucket={bucketName} />}
actions={
<UploadButton
bucket={bucketName}
isPending={uploadMutation.isPending}
onUpload={uploadMutation.mutateAsync}
/>
}
title={bucketName}
/>
{uploadMutation.error && (
<ErrorBanner
error={uploadMutation.error}
msg="Failed to upload object"
/>
)}
{commonPrefixes.length > 0 && (
<div className="mb-6">
<h2 className="mb-3 font-semibold text-lg">Folders</h2>