1import{_ as A}from"./D1rskEr1.js";import{_ as C}from"./D_2T0Eue.js";import{_ as N}from"./CZ338Qb7.js";import{_ as T}from"./BqYtrRpR.js";import{h as b}from"./Ck2Un7LD.js";import{$ as k}from"./CdmMCMFi.js";import{a as M,d as U,Z as F,p as Y,c as f,g as _,e,w as P,r as h,o as g,k as $,O as j,P as H,b as v,t as m,n as O,f as R}from"./0HEb7xC4.js";import{u as B}from"./D9P2zy62.js";import{u as V}from"./BBcsJ7wl.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new n.Error().stack;d&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[d]="9a27e7e3-5d1f-4a13-a6a0-8a20f776b070",n._sentryDebugIdIdentifier="sentry-dbid-9a27e7e3-5d1f-4a13-a6a0-8a20f776b070")}catch{}})();const z=()=>{const n=M("softwarePackageExportList",()=>[]);return{softwarePackageExportList:n,getSoftwarePackageExportList:async(i=10,t=1)=>{const l=new URLSearchParams,c={pagination:"id",limit:i.toString(),offset:((t-1)*i).toString()},p=`/v2/software-package/export/list?${l.toString()}`;try{const r=await k(p,{headers:c,method:"GET"});return n.value=r.data,r}catch(r){return console.error("Error fetching software package export list:",r),{data:[],total:0}}},downloadExportFile:async i=>{try{const t=await k(`/v2/software-package/export/download/${i}`,{method:"POST"});if(t.error||!t.file||!t.filename){console.error("Download failed or invalid response:",t),alert("â ï¸ The file is not ready or missing. Please try again later.");return}const l=atob(t.file),c=new Array(l.length);for(let o=0;o<l.length;o++)c[o]=l.charCodeAt(o);const p=new Uint8Array(c),r=t.filename.split(".").pop()?.toLowerCase();let u="text/csv";r==="xlsx"&&(u="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),r==="zip"&&(u="application/zip"),r==="json"&&(u="application/json");const y=new Blob([p],{type:u}),w=window.URL.createObjectURL(y),s=document.createElement("a");s.href=w,s.download=t.filename,document.body.appendChild(s),s.click(),s.remove(),window.URL.revokeObjectURL(w),console.log("â
File downloaded successfully:",t.filename)}catch(t){console.error("â Download error:",t),alert("Download failed. Please check the console for details.")}}}},G={class:"bg-white rounded-lg border border-gray-200 shadow-sm overflow-hidden p-4 space-y-4"},K={class:"flex justify-end"},W={class:"inline-flex items-center justify-center p-2 text-sm font-medium text-gray-500 rounded-lg bg-gray-50 hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:bg-gray-800 dark:hover:bg-gray-700 dark:hover:text-white"},X={class:"shadow-md"},Z={class:"sm:rounded-lg"},q={class:"relative overflow-x-auto"},J={class:"divide-y divide-gray-200 w-full text-left text-gray-500"},Q={class:"bg-white divide-y divide-gray-200 text-sm text-gray-500"},I={class:"px-6 py-3 font-medium"},ee={class:"px-6 py-3"},te={class:"px-6 py-3"},ae={class:"px-6 py-3"},oe={class:"px-6 py-3"},se={class:"px-6 py-3"},re=["onClick"],ne={key:1,class:"text-gray-400"},ie={key:0},le={class:"p-4 border-b border-t border-gray-200 transition-colors"},he=U({__name:"list",setup(n){F({title:"Software Package management - MyScale",meta:[{name:"description",content:"Manage Software Package list"}]}),B("group");const d=V(),x={1:"PENDING",2:"FINISHED",3:"FAILED"},i=h(!0),t=h(1),l=h(10),c=h(0),{softwarePackageExportList:p,getSoftwarePackageExportList:r,downloadExportFile:u}=z(),y=async()=>{i.value=!0;try{const s=await r(l.value,t.value);c.value=s.total}catch(s){console.error("Failed to fetch export list:",s)}finally{i.value=!1}},w=async s=>{s.id&&await u(s.id)};return Y(async()=>{d.value&&parseInt(d.value.page)!==t.value&&(t.value=parseInt(d.value.page)),await y()}),(s,o)=>{const E=A,S=C,L=N,D=T;return g(),f("div",null,[_(E,{title:"[Admin] Export Software Package management",description:"Manage Export Software Package List"}),e("div",G,[e("div",K,[e("div",W,[_(S,{to:"/admin/software-package",class:"w-full"},{default:P(()=>[...o[1]||(o[1]=[$(" Software Package List ",-1)])]),_:1}),o[2]||(o[2]=e("svg",{class:"w-4 h-4 ms-2 rtl:rotate-180","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 10"},[e("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M1 5h12m0 0L9 1m4 4L9 9"})],-1))])]),e("div",X,[e("div",Z,[_(D,{show:i.value},{default:P(()=>[e("div",q,[e("table",J,[o[4]||(o[4]=e("thead",{class:"text-xs bg-gray-100 uppercase font-bold"},[e("tr",null,[e("th",{class:"px-6 py-3"},"ID"),e("th",{class:"px-6 py-3"},"User"),e("th",{class:"px-6 py-3"},"Status"),e("th",{class:"px-6 py-3"},"Created At"),e("th",{class:"px-6 py-3"},"Updated At"),e("th",{class:"px-6 py-3"},"Actions")])],-1)),e("tbody",Q,[(g(!0),f(j,null,H(v(p),a=>(g(),f("tr",{key:a.id},[e("td",I,m(a.id),1),e("td",ee,m(a.user.firstname+" "+a.user.lastname||a.user?.id||a.user||"-"),1),e("td",te,[e("span",{class:O({"text-yellow-600":a.status===1,"text-green-600":a.status===2,"text-red-600":a.status===3})},m(x[a.status]||"UNKNOWN"),3)]),e("td",ae,m(v(b)(a.created_at).format("YYYY-MM-DD HH:mm:ss")),1),e("td",oe,m(a.updated_at?v(b)(a.updated_at).format("YYYY-MM-DD HH:mm:ss"):"-"),1),e("td",se,[a.status===2?(g(),f("button",{key:0,class:"text-blue-600 hover:text-blue-800 font-medium",onClick:de=>w(a)}," Download ",8,re)):(g(),f("span",ne,m(a.status===1?"Processing...":"N/A"),1))])]))),128)),!i.value&&v(p).length===0?(g(),f("tr",ie,[...o[3]||(o[3]=[e("td",{colspan:"6",class:"px-6 py-4 text-center text-gray-500"}
1," No export records found. ",-1)])])):R("",!0)])])]),e("div",le,[_(L,{"total-item":c.value,"current-page":t.value,"item-per-page":l.value,"onUpdate:currentPage":o[0]||(o[0]=async a=>{t.value=a,await y()})},null,8,["total-item","current-page","item-per-page"])])]),_:1},8,["show"])])])])])}}});export{he 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.