/
snap
/
lxd
/
current
/
share
/
lxd-ui
/
assets
/
File Upload :
llllll
Current File: //snap/lxd/current/share/lxd-ui/assets/DeleteStoragePoolBtn-BRw8z49I.js
import{u as x,af as u,x as j,c as p,d as o,r as S,l as D,j as t,t as P,m as d,cA as v,q as C}from"./index-dL2n30-Z.js";const B=()=>{const{isFineGrained:s}=x();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=j(),m=p(),f=o.useNotify(),g=o.useToastNotification(),[l,r]=S.useState(!1),h=D(),{canDeletePool:y}=B(),b=()=>{r(!0),v(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:P("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