/
proc
/
3430793
/
root
/
snap
/
lxd
/
current
/
share
/
lxd-ui
/
assets
/
File Upload :
llllll
Current File: //proc/3430793/root/snap/lxd/current/share/lxd-ui/assets/DeleteStorageVolumeBtn-BooO3e9W.js
import{u as x,af as r,d as l,r as _,l as S,j as s,t as D,m as E,q as i}from"./index-dL2n30-Z.js";import{h as j}from"./storage-volumes-DY5ibnP4.js";const q=()=>{const{isFineGrained:n}=x();return{canDeleteVolume:e=>r(n,"can_delete",e==null?void 0:e.access_entitlements),canEditVolume:e=>r(n,"can_edit",e==null?void 0:e.access_entitlements),canManageStorageVolumeSnapshots:e=>r(n,"can_manage_snapshots",e==null?void 0:e.access_entitlements),canManageVolumeBackups:e=>r(n,"can_manage_backups",e==null?void 0:e.access_entitlements)}},k=({project:n,volume:t,onFinish:d,appearance:u="base",hasIcon:c=!0,label:e,classname:f,onClose:y})=>{const b=l.useNotify(),[h,m]=_.useState(!1),o=S(),{canDeleteVolume:p}=q(),g=(()=>{var a;if(t.name.includes("/"))return"Go to the instance detail page, to remove this snapshot";if(t.type==="container")return"Go to the instance detail page, to remove this container";if(t.type==="virtual-machine")return"Go to the instance detail page, to remove this virtual-machine";if(t.type==="image")return"Go to the image list, to remove this image";if(t.type!=="custom")return"Only custom volumes can be deleted";if(((a=t.used_by)==null?void 0:a.length)??0)return"Remove all usages of the volume to delete it"})(),V=()=>{m(!0),j(t.name,t.pool,n,t.location).then(d).catch(a=>{b.failure("Storage volume deletion failed",a)}).finally(()=>{m(!1),o.invalidateQueries({queryKey:[i.isoVolumes]}),o.invalidateQueries({queryKey:[i.projects,n]}),o.invalidateQueries({queryKey:[i.storage,t.pool,i.volumes,n,t.location]}),o.invalidateQueries({predicate:a=>a.queryKey[0]===i.volumes})})};return s.jsxs(l.ConfirmationButton,{loading:h,confirmationModalProps:{close:y,title:"Confirm delete",children:s.jsxs("p",{children:["This will permanently delete volume"," ",s.jsx(E,{type:"volume",value:t.name,bold:!0}),".",s.jsx("br",{}),"This action cannot be undone, and can result in data loss."]}),confirmButtonLabel:"Delete",onConfirm:V},appearance:u,className:D("u-no-margin--bottom",f,{"has-icon":c}),shiftClickEnabled:!0,showShiftClickHint:!0,disabled:!p(t)||!!g||h,onHoverText:p(t)?g:"You do not have permission to delete this volume.",children:[c&&s.jsx(l.Icon,{name:"delete"}),e&&s.jsx("span",{children:e})]})};export{k as D,q as u};
Copyright ©2k19 -
Hexid
|
Tex7ure