PageSourceSearch

https://layerproof.app/assets/asset-collection-imports-Drng2XRj.js

js layerproof.app collected 2026-10-04 21:18:03 UTC 5,220 bytes, 1 lines download raw bytes

1import{y as i,f,b as I,r as N,j as t,W as u,K as r}from"./index-B51y0p7v.js";import{B as y}from"./badge-DG9UyA28.js";import{C as j}from"./card-BfHQW8Bu.js";import{S as C}from"./spinner-DfDeD07i.js";import{R as b}from"./refresh-cw-BDEQeMie.js";import"./loader-circle-CxlJu6Dl.js";const d="/api/v1/admin/asset-collection",g={async dispatchImport(e){return(await i.post(`${d}/import/batch`,e)).data},async listImports(e){return(await i.post(`${d}/import/list`,{status:e==null?void 0:e.status,offset:(e==null?void 0:e.offset)??0,limit:(e==null?void 0:e.limit)??20})).data},async getImportJob(e){return(await i.get(`${d}/import/job`,{params:{importId:e}})).data}},v=["PENDING","RUNNING"],_=4e3;function A(e){return f({queryKey:["asset-collection-imports",(e==null?void 0:e.status)??"all",(e==null?void 0:e.offset)??0,e==null?void 0:e.limit],queryFn:()=>g.listImports(e),refetchInterval:s=>{var a;return(((a=s.state.data)==null?void 0:a.items)??[]).some(n=>v.includes(n.status))?_:!1},placeholderData:s=>s})}const E=[{key:"all",labelKey:"_shared.common.all"},{key:"RUNNING",labelKey:"_shared.assetCollectionImports.statusWorking"},{key:"COMPLETED",labelKey:"_shared.assetCollectionImports.statusFinished"},{key:"PARTIAL",labelKey:"_shared.assetCollectionImports.statusPartial"},{key:"FAILED",labelKey:"_shared.assetCollectionImports.statusError"}];function T(e){switch(e){case"PENDING":return{variant:"secondary",label:r("_shared.assetCollectionImports.statusQueued")};case"RUNNING":return{variant:"warning",label:r("_shared.assetCollectionImports.statusWorking")};case"COMPLETED":return{variant:"success",label:r("_shared.assetCollectionImports.statusFinished")};case"PARTIAL":return{variant:"warning",label:r("_shared.assetCollectionImports.statusPartial")};case"FAILED":return{variant:"destructive",label:r("_shared.assetCollectionImports.statusError")};default:return{variant:"outline",label:e}}}function h(e){const s=new Date(e);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(s)}function w({item:e}){const s=T(e.status);return t.jsxs("tr",{className:"border-border/30 border-b",children:[t.jsx("td",{className:"px-4 py-2.5 font-mono text-xs",children:e.id.slice(0,8)}),t.jsx("td",{className:"px-4 py-2.5",children:t.jsx(y,{variant:s.variant,children:s.label})}),t.jsxs("td",{className:"px-4 py-2.5 text-sm",children:[t.jsx("span",{className:"text-green-600 dark:text-green-400",children:e.importedCount})," / ",t.jsx("span",{className:e.failedCount>0?"text-destructive":"text-muted-foreground",children:e.failedCount})," / ",t.jsx("span",{className:"text-muted-foreground",children:e.totalCount})]}),t.jsx("td",{className:"text-muted-foreground px-4 py-2.5 text-sm",children:h(e.createdAt)}),t.jsx("td",{className:"text-muted-foreground px-4 py-2.5 text-sm",children:h(e.updatedAt)})]})}function S(){const{t:e}=I("_shared"),[s,c]=N.useState("all"),{data:l,isLoading:a,isError:n,refetch:p,isFetching:m}=A({status:s==="all"?void 0:s,limit:50}),x=(l==null?void 0:l.items)??[];return t.jsxs("div",{className:"mx-auto w-full max-w-5xl px-6 py-8",children:[t.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-semibold",children:e("_shared.assetCollectionImports.title")}),t.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:e("_shared.assetCollectionImports.description")})]}),t.jsxs(u,{variant:"outline",size:"sm",onClick:()=>p(),disabled:m,children:[t.jsx(b,{className:`mr-2 h-4 w-4 ${m?"animate-spin":""}`}),e("_shared.assetCollectionImports.refresh")]})]}),t.jsx("div",{className:"mb-4 flex flex-wrap gap-2",children:E.map(o=>t.jsx(u,{variant:s===o.key?"default":"outline",size:"sm",onClick:()=>c(o.key),children:e(o.labelKey)},o.key))}),t.jsx(j,{className:"overflow-hidden",children:a?t.jsx("div",{className:"flex items-center justify-center py-16",children:t.jsx(C,{})}):n?t.jsx("div",{className:"text-destructive py-16 text-center text-sm",children:e("_shared.assetCollectionImports.failedToLoad")}):x.length===0?t.jsx("div",{className:"text-muted-foreground py-16 text-center text-sm",children:e("_shared.assetCollectionImports.noImportsYet")}):t.jsxs("table",{className:"w-full border-collapse",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"bg-muted/50 border-border/60 border-b",children:[t.jsx("th",{className:"text-muted-foreground px-4 py-2.5 text-left text-xs font-medium",children:e("_shared.assetCollectionImports.colImport")}),t.jsx("th",{className:"text-muted-foreground px-4 py-2.5 text-left text-xs font-medium",children:e("_shared.assetCollectionImports.colStatus")}),t.jsx("th",{className:"text-muted-foreground px-4 py-2.5 text-left text-xs font-medium",children:e("_shared.assetCollectionImports.colImportedFailedTotal")}),t.jsx("th",{className:"text-muted-foreground px-4 py-2.5 text-left text-xs font-medium",children:e("_shared.assetCollectionImports.colCreated")}),t.jsx("th",{className:"text-muted-foreground px-4 py-2.5 text-left text-xs font-medium",children:e("_shared.assetCollectionImports.colUpdated")})]})}),t.jsx("tbody",{children:x.map(o=>t.jsx(w,{item:o},o.id))})]})})]})}const K=S;export{K as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.