PageSourceSearch

https://blacksheepbi.com/assets/StorageExport-BcP6MMxx.js

js blacksheepbi.com collected 2026-09-30 08:26:52 UTC 4,994 bytes, 2 lines download raw bytes

1import{r as o,j as e}from"./ui-CPW3-RCR.js";import{B as c,L as f,D as v,a5 as B,y,Y as U,C as $,ab as z,s as g,d}from"./index-BraPXa8T.js";import"./supabase-B2z4OhLQ.js";import"./charts-DCB9_QAo.js";import"./vendor-CIXof4MH.js";const u=["ai-brain-files","avatars","campaign-creatives","campaigner-reports","client-files","client-logos","client-report-files","josephs-uploads","landing-media","meeting-recordings","office-chat-files","pixel-recordings","support-chat-attachments","task-audio","task-files"];function j(r){return r?r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:r<1024*1024*1024?`${(r/1024/1024).toFixed(1)} MB`:`${(r/1024/1024/1024).toFixed(2)} GB`:"—"}function F(){const[r,x]=o.useState(u.map(s=>({bucket:s,status:"pending"}))),[l,m]=o.useState(!1),[h,N]=o.useState(null),n=(s,t)=>x(a=>a.map(i=>i.bucket===s?{...i,...t}:i)),w=async()=>{const s=crypto.randomUUID().replace(/-/g,"");N(s),m(!0),x(u.map(t=>({bucket:t,status:"pending"})));for(const t of u){n(t,{status:"running"});try{const{data:a,error:i}=await g.functions.invoke("export-storage-bucket",{body:{bucket:t,run_id:s}});if(i)throw new Error(i.message);if(a!=null&&a.error)throw new Error(a.error);n(t,{status:"done",fileCount:a.fileCount,failedCount:a.failedCount,zipBytes:a.zipBytes,signedUrl:a.signedUrl,durationMs:a.durationMs})}catch(a){n(t,{status:"failed",error:a.message}),d.error(`${t}: ${a.message}`)}}m(!1),d.success("הייצוא הסתיים")},C=async s=>{if(h){n(s,{status:"running",error:void 0});try{const{data:t,error:a}=await g.functions.invoke("export-storage-bucket",{body:{bucket:s,run_id:h}});if(a)throw new Error(a.message);if(t!=null&&t.error)throw new Error(t.error);n(s,{status:"done",fileCount:t.fileCount,failedCount:t.failedCount,zipBytes:t.zipBytes,signedUrl:t.signedUrl,durationMs:t.durationMs})}catch(t){n(s,{status:"failed",error:t.message})}}},k=async()=>{const s=r.filter(t=>t.signedUrl).map(t=>`- **${t.bucket}** (${t.fileCount} files, ${j(t.zipBytes)}): ${t.signedUrl}`).join(`
2`);await navigator.clipboard.writeText(s),d.success("הקישורים הועתקו")},p=r.filter(s=>s.status==="done").length,b=r.filter(s=>s.status==="failed").length;return e.jsxs("div",{className:"container mx-auto p-6 max-w-5xl",dir:"rtl",children:[e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"ייצוא Storage Buckets"}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["מייצא כל אחד מ-15 ה-buckets ל-ZIP נפרד ב-bucket פרטי ",e.jsx("code",{children:"storage-exports"}),". קישורי ההורדה תקפים ל-7 ימים. דרוש תפקיד viral_admin."]}),e.jsxs("div",{className:"flex gap-3 mb-6 items-center",children:[e.jsxs(c,{onClick:w,disabled:l,size:"lg",children:[l?e.jsx(f,{className:"ml-2 h-4 w-4 animate-spin"}):e.jsx(v,{className:"ml-2 h-4 w-4"}),l?"מייצא...":"התחל ייצוא"]}),e.jsxs(c,{onClick:k,variant:"outline",disabled:p===0,children:[e.jsx(B,{className:"ml-2 h-4 w-4"}),"העתק את כל הקישורים"]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[p,"/",r.length," הושלמו · ",b," נכשלו"]})]}),e.jsx(y,{className:"overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted/50 text-xs uppercase",children:e.jsxs("tr",{children:[e.jsx("th",{className:"p-3 text-right",children:"Bucket"}),e.jsx("th",{className:"p-3 text-right",children:"סטטוס"}),e.jsx("th",{className:"p-3 text-right",children:"קבצים"}),e.jsx("th",{className:"p-3 text-right",children:"גודל ZIP"}),e.jsx("th",{className:"p-3 text-right",children:"זמן"}),e.jsx("th",{className:"p-3 text-right",children:"פעולה"})]})}),e.jsx("tbody",{children:r.map(s=>{var t;return e.jsxs("tr",{className:"border-t",children:[e.jsx("td",{className:"p-3 font-mono text-xs",children:s.bucket}),e.jsxs("td",{className:"p-3",children:[s.status==="pending"&&e.jsx(U,{className:"h-4 w-4 text-muted-foreground"}),s.status==="running"&&e.jsx(f,{className:"h-4 w-4 animate-spin text-primary"}),s.status==="done"&&e.jsx($,{className:"h-4 w-4 text-green-600"}),s.status==="failed"&&e.jsxs("span",{className:"flex items-center gap-1 text-destructive text-xs",title:s.error,children:[e.jsx(z,{className:"h-4 w-4"})," ",(t=s.error)==null?void 0:t.slice(0,60)]})]}),e.jsxs("td",{className:"p-3 text-xs",children:[s.fileCount??"—",s.failedCount?e.jsxs("span",{className:"text-destructive",children:[" (",s.failedCount," fail)"]}):null]}),e.jsx("td",{className:"p-3 text-xs",children:j(s.zipBytes)}),e.jsx("td",{className:"p-3 text-xs",children:s.durationMs?`${(s.durationMs/1e3).toFixed(1)}s`:"—"}),e.jsx("td",{className:"p-3",children:s.signedUrl?e.jsx("a",{href:s.signedUrl,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline text-xs",children:"הורד"}):s.status==="failed"?e.jsx(c,{size:"sm",variant:"ghost",onClick:()=>C(s.bucket),children:"נסה שוב"}):null})]},s.bucket)})})]})})]})}export{F as default};

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.