/
snap
/
lxd
/
current
/
share
/
lxd-ui
/
assets
/
File Upload :
llllll
Current File: //snap/lxd/current/share/lxd-ui/assets/DeleteStoragePoolBtn-DgrSzU4b.js
import{u as j,ah as u,y as p,c as x,d as o,r as S,l as v,j as t,v as D,n as d,cU as P,q as C}from"./index-B3cgCbnJ.js";const B=()=>{const{isFineGrained:s}=j();return{canDeletePool:e=>u(s,"can_delete",e==null?void 0:e.access_entitlements),canEditPool:e=>u(s,"can_edit",e==null?void 0:e.access_entitlements)}},N=({pool:s,project:i,shouldExpand:n=!1})=>{const e=p(),m=x(),f=o.useNotify(),g=o.useToastNotification(),[l,r]=S.useState(!1),h=v(),{canDeletePool:y}=B(),b=()=>{r(!0),P(s.name).then(()=>{h.invalidateQueries({queryKey:[C.storage]}),m(`/ui/project/${encodeURIComponent(i)}/storage/pools`),g.success(t.jsxs(t.Fragment,{children:["Storage pool ",t.jsx(d,{bold:!0,type:"pool",value:s.name})," ","deleted."]}))}).catch(a=>{r(!1),f.failure("Storage pool deletion failed",a)})},c=()=>{var a;if(!y(s))return"You do not have permission to delete this storage pool";if(((a=s.used_by)==null?void 0:a.length)??!1)return"Storage pool is in use"};return t.jsxs(o.ConfirmationButton,{confirmationModalProps:{title:"Confirm delete",children:t.jsxs("p",{children:["This will permanently delete storage pool"," ",t.jsx(d,{type:"pool",value:s.name,bold:!0}),".",t.jsx("br",{}),"This action cannot be undone, and can result in data loss."]}),confirmButtonLabel:"Delete pool",onConfirm:b,message:"Delete storage"},appearance:n?"default":"base",className:D("u-no-margin--bottom",{"is-dense":!n,"has-icon":!e}),loading:l,shiftClickEnabled:!0,showShiftClickHint:!0,disabled:!!c()||l,onHoverText:c(),children:[(!e||!n)&&t.jsx(o.Icon,{name:"delete"}),n&&t.jsx("span",{children:"Delete pool"})]})};export{N as D,B as u};
Copyright ©2k19 -
Hexid
|
Tex7ure