Your IP : 216.73.216.189


Current Path : /proc/thread-self/root/snap/lxd/current/share/lxd-ui/assets/
Upload File :
Current File : //proc/thread-self/root/snap/lxd/current/share/lxd-ui/assets/CustomIsoList-CwCbbqke.js

import{d as t,t as y,O as I,al as N,j as e,v as f,R as g,w as C,r as v,I as w,y as L,L as O,an as P,a0 as U,p as T,M as R}from"./index-BFGypnt-.js";import{D as _}from"./DeleteStorageVolumeBtn-DIlt1DOO.js";import{C as z}from"./CreateInstanceFromImageBtn-D60qjybc.js";import{U as B}from"./UploadCustomIso-CFeOJaFW.js";import{u as F}from"./projects-DAlFlfjH.js";import{u as M}from"./useSortTableData-DMPSUVcX.js";import{P as l}from"./PageHeader-DZVSTM6q.js";import{H as K}from"./HelpLink-l4aaXUp-.js";import{u as k}from"./useVolumes-CXLHz-Wc.js";import"./storage-volumes-CNe_c3nC.js";import"./ProgressBar-BgH9rTvH.js";import"./StoragePoolSelector-CIzPJc24.js";import"./useStoragePools-qBtKr1j9.js";import"./useClusterMembers-B29_ixY7.js";import"./cluster-members-CG6XHzn4.js";import"./StoragePoolSize-ChYxPd_8.js";import"./Meter-VGEmUMfL.js";import"./images-C6WqBeZG.js";const b=({className:u,projectName:n})=>{const d=t.useToastNotification(),{openPortal:o,closePortal:a,isOpen:p,Portal:h}=t.usePortal(),x=y(),i=I(),{data:c}=N(n),{canCreateStorageVolumes:m}=F(),r=()=>{a()},j=s=>{d.success(e.jsxs(e.Fragment,{children:["Custom ISO"," ",e.jsx(f,{to:`${g}/ui/project/${encodeURIComponent(n)}/storage/custom-isos`,type:"iso-volume",value:s})," ","uploaded successfully."]})),x.invalidateQueries({queryKey:[C.isoVolumes]}),a()};return e.jsxs(e.Fragment,{children:[e.jsxs(t.Button,{appearance:"positive",onClick:o,className:u,hasIcon:!i,disabled:!m(c),title:m(c)?"Upload custom ISO":"You do not have permission to create custom ISOs in this project.",children:[!i&&e.jsx(t.Icon,{name:"upload",light:!0}),e.jsx("span",{children:"Upload custom ISO"})]}),p&&e.jsx(h,{children:e.jsx(t.Modal,{close:a,title:"Upload custom ISO",children:e.jsx(B,{onCancel:r,onFinish:j})})})]})},ae=()=>{const u=t.useToastNotification(),[n,d]=v.useState(""),{project:o}=w();if(!o)return e.jsx(e.Fragment,{children:"Missing project"});const{data:a=[],isLoading:p}=k(o),h=[{content:"Name",sortKey:"name"},{content:"Storage pool",sortKey:"storagePool",className:"pool"},{content:"Upload date",sortKey:"uploadedAt",className:"uploaded_at"},{content:"Size",sortKey:"size",className:"u-align--right size"},{content:"Used by",sortKey:"usedBy",className:"u-align--right used_by"},{"aria-label":"Actions",className:"actions"}],i=a.filter(s=>!n||s.aliases.toLowerCase().includes(n.toLowerCase())).map(s=>{const S=s.volume&&e.jsx(t.List,{inline:!0,className:"actions-list u-no-margin--bottom",items:[e.jsx(z,{projectName:o,image:s},"launch"),e.jsx(_,{volume:s.volume,project:o,onFinish:()=>u.success(e.jsxs(e.Fragment,{children:["Custom iso"," ",e.jsx(L,{bold:!0,type:"iso-volume",value:s.aliases})," ","deleted."]}))},"delete")]});return{key:s.fingerprint,columns:[{content:s.aliases,role:"rowheader","aria-label":"Name"},{content:e.jsx("div",{className:"u-truncate",title:s.pool,children:e.jsx(O,{to:`${g}/ui/project/${encodeURIComponent(o)}/storage/pool/${encodeURIComponent(s.pool??"")}`,children:s.pool})}),role:"cell","aria-label":"Storage pool",className:"pool"},{content:P(new Date(s.created_at).toISOString()),role:"cell","aria-label":"Uploaded at",className:"uploaded_at"},{content:s.volume?.config.size&&U(+s.volume.config.size),role:"cell","aria-label":"Size",className:"u-align--right size"},{content:s.volume?.used_by?.length??0,role:"cell","aria-label":"Used by",className:"u-align--right used_by"},{content:S,role:"cell","aria-label":"Actions",className:"u-align--right actions"}],sortData:{name:s.aliases.toLowerCase(),storagePool:s.pool?.toLowerCase(),size:+(s.volume?.config.size??0),uploadedAt:s.created_at,usedBy:s.volume?.used_by?.length??0}}}),{rows:c,updateSort:m}=M({rows:i});if(p)return e.jsx(t.Spinner,{className:"u-loader",text:"Loading...",isMainComponent:!0});const r=a.length!==0,j=r?e.jsx("div",{className:"custom-iso-list",children:e.jsx(t.ScrollableTable,{dependencies:[a],tableId:"custom-iso-table",belowIds:["status-bar"],children:e.jsx(t.TablePagination,{data:c,id:"pagination",itemName:"custom ISO",className:"u-no-margin--top","aria-label":"Table pagination control",children:e.jsx(t.MainTable,{id:"custom-iso-table",headers:h,sortable:!0,className:"custom-iso-table",onUpdateSort:m,emptyStateMsg:"No custom ISOs found matching this search"})})})}):e.jsxs(t.EmptyState,{className:"empty-state",image:e.jsx(t.Icon,{name:"iso",className:"empty-state-icon"}),title:"No custom ISOs found in this project",children:[e.jsx("p",{children:"Custom ISOs will appear here"}),e.jsx("p",{children:e.jsx(R,{docPath:"/howto/instances_create/#instances-create-iso",hasExternalIcon:!0,children:"Learn how to create a VM that boots from an ISO"})}),e.jsx(b,{className:"empty-state-button",projectName:o})]});return e.jsxs(t.CustomLayout,{mainClassName:"custom-iso-list",header:e.jsxs(l,{children:[e.jsxs(l.Left,{children:[e.jsx(l.Title,{children:e.jsx(K,{docPath:"/howto/instances_create/#instances-create-iso",title:"Learn how to create a VM that boots from an ISO",children:"Custom ISOs"})}),r&&e.jsx(l.Search,{children:e.jsx("div",{className:"search-box-wrapper",children:e.jsx(t.SearchBox,{name:"search-snapshot",className:"search-box margin-right--large u-no-margin--bottom",type:"text",onChange:s=>{d(s)},placeholder:"Search for custom ISOs",value:n,"aria-label":"Search for custom ISOs"})})})]}),r&&e.jsx(l.BaseActions,{children:e.jsx(b,{className:"u-float-right u-no-margin--bottom",projectName:o})})]}),children:[e.jsx(T,{}),e.jsx(t.Row,{children:j})]})};export{ae as default};