PageSourceSearch

https://ytprompt.ai/assets/AdminStorage-kxwvE127.js

js ytprompt.ai collected 2026-10-05 14:48:33 UTC 13,619 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-markdown-Bj2spg3f.js";import{r as a}from"./vendor-react-B-0p-RVf.js";import{b as E}from"./index-45gJDKBt.js";import{O as C,u as O,be as T,b7 as I,ae as H,ag as P,ab as A,I as w,Z as Y,_ as q,V as D,N as Z,X,U as _}from"./vendor-icons-D-5f6XKt.js";import"./vendor-misc-D0V4jby4.js";import"./vendor-i18n-D8j9R6P3.js";const c=l=>{if(l===0)return"0 B";const g=1024,y=["B","KB","MB","GB","TB"],u=Math.floor(Math.log(l)/Math.log(g));return`${(l/Math.pow(g,u)).toFixed(u>=2?2:0)} ${y[u]}`},B=[{group:"Project Files",color:"#6366F1",items:[{key:"projects",label:"Projects",desc:"Generated video project folders",icon:e.jsx(w,{size:14})},{key:"generated",label:"Generated",desc:"Auto-generated project assets",icon:e.jsx(Y,{size:14})},{key:"uploads",label:"Uploads",desc:"User-uploaded files",icon:e.jsx(q,{size:14})}]},{group:"Tool Outputs",color:"#8B5CF6",items:[{key:"video_studio",label:"Video Studio",desc:"Video Studio project outputs",icon:e.jsx(w,{size:14})},{key:"bulk_videos",label:"Bulk Videos",desc:"Bulk video generation outputs",icon:e.jsx(D,{size:14})},{key:"tts",label:"Text-to-Speech",desc:"TTS audio outputs",icon:e.jsx(Z,{size:14})},{key:"bulk_images",label:"Bulk Images",desc:"Bulk image generation outputs",icon:e.jsx(X,{size:14})},{key:"first_last_video",label:"First/Last Video",desc:"First & last frame video outputs",icon:e.jsx(D,{size:14})},{key:"bulk_img_to_video",label:"Image to Video",desc:"Image-to-video tool outputs",icon:e.jsx(w,{size:14})},{key:"ugc_ads",label:"UGC Ads",desc:"UGC ad generation outputs",icon:e.jsx(_,{size:14})},{key:"character_videos",label:"Character Videos",desc:"Character video outputs",icon:e.jsx(_,{size:14})}]}],J=B.flatMap(l=>l.items.map(g=>g.key));function ie(){const[l,g]=a.useState(null),[y,u]=a.useState(!0),[x,M]=a.useState(2),[o,h]=a.use
1State(new Set),[v,R]=a.useState(!1),[j,W]=a.useState(null),[F,S]=a.useState(null),[V,z]=a.useState(!1),f=a.useCallback(async()=>{u(!0);try{const t=await E.get("/api/admin/storage-breakdown");g(t.data)}catch{S("Failed to load storage data")}finally{u(!1)}},[]);a.useEffect(()=>{f()},[f]);const L=t=>{h(r=>{const i=new Set(r);return i.has(t)?i.delete(t):i.add(t),i})},N=t=>{const r=t.items.map(p=>p.key),i=r.every(p=>o.has(p));h(p=>{const s=new Set(p);return i?r.forEach(n=>s.delete(n)):r.forEach(n=>s.add(n)),s})},U=()=>h(new Set(J)),G=()=>h(new Set),$=async()=>{if(!(o.size===0||x<1)){z(!1),R(!0),W(null),S(null);try{const t=await E.post("/api/admin/cleanup-custom",{days:Number(x),types:Array.from(o)});W(t.data.result),await f()}catch(t){S(t.response?.data?.detail||"Cleanup failed")}finally{R(!1)}}},d=l?.disk,m=l?.folders||{},b=t=>m[t]?.size||0,K=t=>m[t]?.runs??m[t]?.files??0,k=Array.from(o).reduce((t,r)=>t+b(r),0);return e.jsxs("div",{style:{padding:"24px",maxWidth:1100,margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:24,gap:12,flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:22,fontWeight:700,color:"var(--text)",margin:0},children:"Storage Manager"}),e.jsx("p",{style:{fontSize:13,color:"var(--text-muted)",margin:"4px 0 0"},children:"View disk usage and clean up old data by type and age"})]}),e.jsxs("button",{onClick:f,disabled:y,style:{display:"flex",alignItems:"center",gap:6,padding:"8px 16px",borderRadius:8,border:"1px solid var(--border)",background:"var(--card-bg)",color:"var(--text)",cursor:"pointer",fontSize:13,fontWeight:600},children:[e.jsx(C,{size:14,className:y?"spin":""})," Refresh"]})]}),y&&!l?e.jsxs("div",{style:{textAlign:"center",padding:60,color:"var(--text-muted)"},children:[e.jsx(C,{size:32,className:"spin",style:{marginBottom:12,color:"var(--primary)"}}),e.jsx("p",{children:"Loading storage data..."})]}):e.jsxs(e.Fragment,{children:[d&&e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:16,marginBottom:28},children:[e.jsxs("div",{style:{background:"var(--card-bg)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx("div",{style:{background:"rgba(99,102,241,0.15)",borderRadius:8,padding:8},children:e.jsx(O,{size:18,style:{color:"#6366F1"}})}),e.jsx("span",{style:{fontSize:14,fontWeight:600,color:"var(--text)"},children:"Disk Usage"})]}),e.jsx("div",{style:{fontSize:28,fontWeight:800,color:"var(--text)",lineHeight:1},children:c(d.used)}),e.jsxs("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:4},children:[c(d.free)," free / ",c(d.total)," total"]}),e.jsx("div",{style:{marginTop:10,height:8,background:"var(--bg-tertiary)",borderRadius:4,overflow:"hidden"},children:e.jsx("div",{style:{width:`${d.percent}%`,height:"100%",background:d.percent>85?"#EF4444":d.percent>65?"#F59E0B":"#6366F1",borderRadius:4,transition:"width 0.4s ease"}})}),e.jsxs("div",{style:{fontSize:11,color:d.percent>85?"#EF4444":"var(--text-muted)",marginTop:4},children:[d.percent,"% used"]})]}),B.flatMap(t=>t.items).map(t=>{const r=b(t.key),i=K(t.key);return e.jsxs("div",{style:{background:"var(--card-bg)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10},children:[e.jsx("div",{style:{background:"rgba(139,92,246,0.12)",borderRadius:6,padding:6,color:"#8B5CF6"},children:t.icon}),e.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--text)"},children:t.label})]}),e.jsx("div",{style:{fontSize:22,fontWeight:700,color:"var(--text)"},children:c(r)}),e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:2},children:[i," ",m[t.key]?.runs!==void 0?"runs":"files"]})]},t.key)})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 340px",gap:20,alignItems:"start"},children:[e.jsxs("div",{style:{background:"var(--card-bg)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16},children:[e.jsx("h2",{style:{fontSize:15,fontWeight:700,color:"var(--text)",margin:0},children:"Select Data to Clean"}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{onClick:U,style:{fontSize:11,padding:"4px 10px",borderRadius:6,border:"1px solid var(--border)",background:"none",color:"var(--primary)",cursor:"pointer",fontWeight:600},children:"All"}),e.jsx("button",{onClick:G,style:{fontSize:11,padding:"4px 10px",borderRadius:6,border:"1px solid var(--border)",background:"none",color:"var(--text-muted)",cursor:"pointer",fontWeight:600},children:"None"})]})]}),B.map(t=>{const r=t.items.map(s=>s.key),i=r.every(s=>o.has(s)),p=r.some(s=>o.has(s));return e.jsxs("div",{style:{marginBottom:20},children:[e.jsxs("div",{onClick:()=>N(t),style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer",marginBottom:10,userSelect:"none"},children:[e.jsx("span",{style:{color:i||p?t.color:"var(--text-muted)",opacity:p?1:.5},children:i?e.jsx(T,{size:16}):e.jsx(I,{size:16})}),e.jsx("span",{style:{fontSize:13,fontWeight:700,color:"var(--text)"},children:t.group}),e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)",marginLeft:"auto"},children:c(r.reduce((s,n)=>s+b(n),0))})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8,paddingLeft:4},children:t.items.map(s=>{const n=o.has(s.key);return e.jsxs("label",{onClick:()=>
1L(s.key),style:{display:"flex",alignItems:"flex-start",gap:10,padding:"10px 12px",borderRadius:8,cursor:"pointer",border:`1px solid ${n?t.color+"60":"var(--border)"}`,background:n?`${t.color}10`:"var(--bg-secondary)",transition:"all 0.15s",userSelect:"none"},children:[e.jsx("span",{style:{color:n?t.color:"var(--text-muted)",marginTop:1,flexShrink:0},children:n?e.jsx(T,{size:15}):e.jsx(I,{size:15})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:"var(--text)"},children:s.label}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:1},children:s.desc}),e.jsx("div",{style:{fontSize:11,fontWeight:600,color:n?t.color:"var(--text-muted)",marginTop:2},children:c(b(s.key))})]})]},s.key)})})]},t.group)})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{style:{background:"var(--card-bg)",border:"1px solid var(--border)",borderRadius:12,padding:20},children:[e.jsx("h2",{style:{fontSize:15,fontWeight:700,color:"var(--text)",margin:"0 0 16px"},children:"Cleanup Settings"}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:{fontSize:12,fontWeight:600,color:"var(--text-muted)",display:"block",marginBottom:6},children:"Delete data older than"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("input",{type:"number",min:1,max:365,value:x,onChange:t=>M(Math.max(1,parseInt(t.target.value)||1)),style:{width:80,padding:"8px 10px",borderRadius:8,border:"1px solid var(--border)",background:"var(--bg-secondary)",color:"var(--text)",fontSize:16,fontWeight:700,textAlign:"center"}}),e.jsxs("span",{style:{fontSize:14,color:"var(--text)",fontWeight:600},children:["day",x!==1?"s":""]})]}),e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:6},children:["Files modified before ",new Date(Date.now()-x*864e5).toLocaleDateString()," will be deleted"]})]}),e.jsxs("div",{style:{padding:"12px",background:"var(--bg-secondary)",borderRadius:8,marginBottom:16},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:6},children:[e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"Types selected"}),e.jsx("span",{style:{fontSize:12,fontWeight:700,color:"var(--text)"},children:o.size})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"Est. size to free"}),e.jsxs("span",{style:{fontSize:12,fontWeight:700,color:k>0?"#EF4444":"var(--text)"},children:["~",c(k)]})]})]}),o.size>0&&x>=1?e.jsx("button",{onClick:()=>z(!0),disabled:v,style:{width:"100%",padding:"10px",borderRadius:8,border:"none",background:"linear-gradient(135deg, #EF4444, #DC2626)",color:"white",fontSize:13,fontWeight:700,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:6,opacity:v?.7:1},children:v?e.jsxs(e.Fragment,{children:[e.jsx(C,{size:14,className:"spin"})," Running..."]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{size:14})," Run Cleanup"]})}):e.jsx("button",{disabled:!0,style:{width:"100%",padding:"10px",borderRadius:8,border:"none",background:"var(--bg-tertiary)",color:"var(--text-muted)",fontSize:13,fontWeight:700,cursor:"not-allowed"},children:"Select types above"})]}),j&&e.jsxs("div",{style:{background:"rgba(34,197,94,0.1)",border:"1px solid rgba(34,197,94,0.3)",borderRadius:12,padding:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:10},children:[e.jsx(P,{size:16,style:{color:"#22C55E"}}),e.jsx("span",{style:{fontSize:13,fontWeight:700,color:"#22C55E"},children:"Cleanup Complete"})]}),e.jsxs("div",{style:{fontSize:12,color:"var(--text)",display:"flex",flexDirection:"column",gap:4},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[e.jsx("span",{style:{color:"var(--text-muted)"},children:"Items deleted"}),e.jsx("span",{style:{fontWeight:700},children:j.deleted})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[e.jsx("span",{style:{color:"var(--text-muted)"},children:"Space freed"}),e.jsx("span",{style:{fontWeight:700,color:"#22C55E"},children:c(j.freed_bytes)})]})]})]}),F&&e.jsx("div",{style:{background:"rgba(239,68,68,0.1)",border:"1px solid rgba(239,68,68,0.3)",borderRadius:12,padding:16},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx(A,{size:14,style:{color:"#EF4444"}}),e.jsx("span",{style:{fontSize:12,color:"#EF4444"},children:F})]})})]})]})]}),V&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.6)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{style:{background:"var(--card-bg)",border:"1px solid var(--border)",borderRadius:16,padding:28,maxWidth:420,width:"90%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:14},children:[e.jsx("div",{style:{background:"rgba(239,68,68,0.15)",borderRadius:8,padding:8},children:e.jsx(A,{size:20,style:{color:"#EF4444"}})}),e.jsx("h3",{style:{fontSize:16,fontWeight:700,color:"var(--text)",margin:0},children:"Confirm Deletion"})]}),e.jsxs("p",{style:{fontSize:13,color:"var(--text-muted)",marginBottom:8,lineHeight:1.5},children:["You're about to permanently delete ",e.jsxs("strong",{style:{color:"var(--text)"},children:[o.size," type",o.size!==1?"s":""]})," of data older than ",e.jsxs("strong",{style:{color:"var(--text)"},children:[x," day",x!==1?"s":""]}),"."]}),e.jsxs("p",{style:{fontSize:13,color:"#EF4444",marginBottom:18},children:["Estimated size: ~",c(k),". This cannot be undone."]}),e.jsxs("div",{style:{display:"flex",gap:10},children:[e.jsx("button",{onClick:()=>z(!1),style:{flex:1,padding:"9px",borderRadius:8,border:"1px solid var(--border)",background:"none",color:"var(--text)",cursor:"pointer",fontWeight:600,fontSize:13},children:"Cancel"}),e.jsx("button",{onClick:$,style:{flex:1,padding:"9px",borderRadius:8,border:"none",background:"#EF4444",color:"white",cursor:"pointer",fontWeight:700,fontSize:13},children:"Delete Now"})]})]})})]})}export{ie 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.