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.178
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/41172/share/lxd-ui/assets/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /snap/lxd/41172/share/lxd-ui/assets/StorageBucketDetail-4TuN3oyO.js
import{j as e,L as Q,R as U,r as S,d as s,cs as V,w as Y,V as K,s as P,J as E,t as k,B as v,E as O,o as R,G as _,e as z,f as J,h as $,H as G,aP as W}from"./index-H4PaR1Ay.js";import{f as X,u as T,g as Z,h as ee,b as te,i as ae,S as q,j as se,k as ne,l as oe,E as re}from"./EditStorageBucketPanel-DFCghaIn.js";import{R as ie}from"./RenameHeader-DLx2_niW.js";import{I as le}from"./ItemName-COo4SMvJ.js";import{S as ce}from"./SelectableMainTable-DVpI1gAH.js";import{S as de}from"./SelectedTableNotification-BiyTngX2.js";import{u as ue}from"./useSortTableData-Dpr3aigs.js";import{u as me}from"./projects-CsVQvwvI.js";import{u as w,a as A,p as L}from"./useEscCallback-zQN3vs8-.js";import{R as C}from"./ResourceLabel-BMIFVwPY.js";import{B as pe}from"./BulkDeleteButton-B0G_6fsa.js";import{g as ye}from"./promises-DrIa_NWl.js";import{R as N}from"./ResourceLink-uXW9L0Ar.js";import{g as D,a as ge}from"./storageBucket-B7LHuAXl.js";import{u as he}from"./useBulkDetails-DSAq8m1i.js";import{A as je}from"./AutoExpandingTextArea-BxIWUale.js";import"./StoragePoolSelector-CJRwrd1Y.js";import"./useStoragePools-R3ZOO4pU.js";import"./useClusterMembers-7DaTUHV4.js";import"./cluster-members-LZARpnVy.js";import"./StoragePoolSize-lekZ0CbT.js";import"./Meter-Bmiz6lct.js";import"./DiskSizeSelector-97sBb-TL.js";import"./StoragePoolExplanationTooltip-75F5PHZT.js";import"./ExplanationTooltip-BtzkKEJm.js";import"./Breadcrumb-1nP3kv9p.js";const xe=({bucket:t,project:a})=>e.jsx(ie,{name:t.name,parentItems:[e.jsx(Q,{to:`${U}/ui/project/${encodeURIComponent(a)}/storage/buckets`,children:"Storage buckets"},1)],controls:t?e.jsx(X,{bucket:t,isDetailPage:!0}):null,isLoaded:!0,renameDisabledReason:"Storage buckets cannot be renamed"}),ke=({password:t})=>{const[a,l]=S.useState(!1);return t?e.jsxs("div",{className:"password-output-toggle u-flex",children:[e.jsxs("span",{title:a?t:void 0,className:"password-output-toggle-value u-truncate",children:[e.jsx("span",{"aria-hidden":!a,children:a?t:"•".repeat(35)}),e.jsx("span",{className:"u-off-screen",children:a?"Password is revealed":"Password is hidden"})]}),e.jsx(s.List,{inline:!0,className:"u-no-margin--bottom password-output-toggle-actions-list",items:[e.jsx(s.Button,{appearance:"base",className:"u-no-margin--bottom",dense:!0,hasIcon:!0,onClick:()=>{l(i=>!i)},"aria-label":a?"Hide password":"Show password",type:"button",children:e.jsx(s.Icon,{name:a?"hide":"show"})},"reveal"),e.jsx(V,{value:t,tooltipMessage:"Copy password"},"copy")]})]}):null},I=({className:t})=>{const a=Y(),{canCreateStorageBuckets:l}=me(),{project:i}=K(),o=w();return e.jsxs(s.Button,{appearance:"positive",hasIcon:!a,onClick:()=>{o.openCreateStorageBucketKey(i?.name||"")},className:t,disabled:!l(i),title:l(i)?"Create bucket key":"You do not have permission to create keys for this bucket",children:[!a&&e.jsx(s.Icon,{name:"plus",light:!0}),e.jsx("span",{children:"Create key"})]})},fe=({bucket:t,bucketKey:a})=>{const l=s.useNotify(),[i,o]=S.useState(!1),d=P(),{canEditBucket:u}=T(),{project:h}=K(),j=h?.name||"",m=s.useToastNotification(),c=E(),g=()=>{d.invalidateQueries({queryKey:[k.storage,t.pool,h?.name??"",k.buckets,t.name,k.keys]})},b=()=>{g(),o(!1),m.success(e.jsxs(e.Fragment,{children:["Key ",e.jsx(C,{bold:!0,type:"bucket-key",value:a.name})," ","deleted for storage bucket"," ",e.jsx(C,{bold:!0,type:"bucket",value:t.name}),"."]}))},f=r=>{g(),o(!1),l.failure(`Deletion of key ${a.name} for storage bucket ${t.name} failed`,r)},x=()=>{o(!0),Z(t.name,a.name,t.pool,j).then(r=>{m.info(e.jsxs(e.Fragment,{children:["Deletion of key"," ",e.jsx(C,{bold:!0,type:"bucket-key",value:a.name})," for"," ","storage bucket"," ",e.jsx(C,{bold:!0,type:"bucket",value:t.name})," has started."]})),c.set(r.metadata.id,()=>{b()},p=>{f(new Error(p))})}).catch(f)};return e.jsx(s.ConfirmationButton,{loading:i,confirmationModalProps:{title:"Confirm delete",children:e.jsxs("p",{children:["This will permanently delete key"," ",e.jsx(C,{type:"bucket-key",value:a.name,bold:!0}),".",e.jsx("br",{}),"This action cannot be undone, and can result in data loss."]}),confirmButtonLabel:"Delete",onConfirm:x},appearance:"base",className:"has-icon",shiftClickEnabled:!0,showShiftClickHint:!0,disabled:!u(t),onHoverText:u(t)?"Delete bucket key":"You do not have permission to delete this key.",children:e.jsx(s.Icon,{name:"delete"})})},be=({bucket:t,bucketKey:a})=>{const l=w(),{canEditBucket:i}=T();return e.jsx(s.Button,{className:"has-icon",appearance:"base",hasIcon:!0,onClick:()=>{l.openEditStorageBucketKey(a.name)},title:i(t)?"Edit bucket key":"You do not have permission to edit this bucket key",children:e.jsx(s.Icon,{name:"edit"})})},Se=({bucketKey:t,bucket:a})=>{const l=[e.jsx(be,{bucketKey:t,bucket:a},"edit"),e.jsx(fe,{bucketKey:t,bucket:a},"delete")];return e.jsx(s.List,{inline:!0,className:"u-no-margin--bottom actions-list",items:l})},Ne=({keys:t,bucket:a,onStart:l,onFinish:i})=>{const o=s.useToastNotification(),d=P(),[u,h]=S.useState(!1),j=he(),{project:m}=K(),c=m?.name||"",g=t.length,b=`Delete ${t.length} ${v("key",t.length)}`,f=()=>{h(!0),l();const x=e.jsxs(e.Fragment,{children:[t.length," ",v("key",t.length)," deleted for bucket"," ",e.jsx(N,{type:"bucket",value:a.name,to:D(a.name,a.pool,m?.name??"")}),"."]});ee(a,t,c).then(r=>{const{fulfilledCount:p,rejectedCount:n}=ye(r);p===g?o.success(x,j(r)):n===g?o.failure("Key bulk deletion failed",void 0,e.jsxs(e.Fragment,{children:[e.jsx("b",{children:g})," ",v("key",g)," could not be deleted."]}),j(r)):o.failure("Key bulk deletion partially failed",void 0,e.jsxs(e.Fragment,{children:[e.jsx("b",{children:p})," ",v("key",p)," ","deleted.",e.jsx("br",{}),e.jsx("b",{children:n})," ",v("key",n)," could not be deleted."]}),j(r)),d.invalidateQueries({queryKey:[k.storage,a.pool,m?.name??"",k.buckets,a.name,k.keys]}),h(!1),i()}).catch(r=>{h(!1),o.failure(`Key bulk deletion failed for storage bucket ${a.name}`,r)})};return e.jsx(pe,{entities:t,deletableEntities:t,entityType:"key",onDelete:f,disabledReason:g===0?`You do not have permission to delete the selected ${v("key",t.length)}`:void 0,confirmationButtonProps:{disabled:u||g===0,loading:u},buttonLabel:b})},ve=({bucket:t})=>{const[a,l]=S.useState(""),i=s.useNotify(),[o,d]=S.useState([]),[u,h]=S.useState([]),{project:j}=K(),{data:m=[]}=te(t,j?.name??"");S.useEffect(()=>{const n=new Set(m?.map(B=>B.name)),y=o.filter(B=>n.has(B));y.length!==o.length&&d(y)},[m]);const c=m?.filter(n=>{if(a){const y=a.toLowerCase();return n.name.toLowerCase().includes(y)||n.role.toLowerCase().includes(y)||n.description.toLowerCase().includes(y)||n["access-key"].toLowerCase().includes(y)||n["secret-key"].toLowerCase().includes(y)}return!0})??[],g=m&&m.length>0,b=[{content:"Name",sortKey:"name",className:"name"},{content:"Role",sortKey:"role",className:"role"},{content:"Description",sortKey:"description",className:"description"},{content:"Access key",className:"access-key",sortKey:"access-key"},{content:"Secret key",className:"secret-key",sortKey:"secret-key"},{"aria-label":"Actions",className:"actions"}],f=c.map(n=>({key:n.name,className:"u-row",name:n.name,columns:[{content:e.jsx("div",{className:"u-truncate",title:`Key ${n.name}`,children:e.jsx(le,{item:n})}),role:"rowheader","aria-label":"Name",className:"name"},{content:O(n.role),role:"cell","aria-label":"Role",className:"role"},{content:n.description||"-",title:n.description,role:"cell","aria-label":"Description",className:"description u-truncate"},{content:n["access-key"],role:"cell","aria-label":"Access key",className:"access-key"},{content:e.jsx(ke,{password:n["secret-key"]}),role:"cell","aria-label":"Secret key",className:"secret-key"},{content:e.jsx(Se,{bucketKey:n,bucket:t}),role:"cell","aria-label":"Actions",className:"u-align--right actions"}],sortData:{name:n.name.toLowerCase(),role:n.role,description:n.description.toLowerCase(),"access-key":n["access-key"],"secret-key":n["secret-key"]}})),x=m.filter(n=>o.includes(n.name)),{rows:r,updateSort:p}=ue({rows:f,defaultSort:"name",defaultSortDirection:"ascending"});return e.jsxs("div",{className:"storage-bucket-key-list",children:[g&&e.jsx("div",{className:"upper-controls-bar",children:o.length===0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"search-box-wrapper",children:e.jsx(s.SearchBox,{name:"search-snapshot",className:"search-box margin-right--large",type:"text",onChange:n=>{l(n)},placeholder:"Search for keys",value:a,"aria-label":"Search for keys"})}),e.jsx(I,{})]}):e.jsx("div",{className:"p-panel__controls",children:e.jsx(Ne,{keys:x,bucket:t,onStart:()=>{h(o)},onFinish:()=>{h([])}})})}),e.jsx(R,{}),g?e.jsx(e.Fragment,{children:e.jsx(s.ScrollableTable,{dependencies:[c,i.notification],tableId:"buckets-key-table",belowIds:["status-bar"],children:e.jsx(s.TablePagination,{data:r,id:"pagination",itemName:"key",className:"u-no-margin--top","aria-label":"Table pagination control",description:o.length>0&&e.jsx(de,{totalCount:m?.length??0,itemName:"key",parentName:"bucket",selectedNames:o,setSelectedNames:d,filteredNames:c.map(n=>n.name)}),children:e.jsx(ce,{id:"buckets-key-table",headers:b,rows:r,sortable:!0,emptyStateMsg:"No key found matching this search",itemName:"key",parentName:"bucket",selectedNames:o,setSelectedNames:d,disabledNames:u,filteredNames:c.map(n=>n.name),onUpdateSort:p,defaultSort:"name",defaultSortDirection:"ascending",responsive:!0})})})}):e.jsxs(s.EmptyState,{className:"empty-state",image:e.jsx(s.Icon,{name:"private-key",className:"empty-state-icon"}),title:"No keys",children:[e.jsx("p",{children:"This storage bucket does not contain any keys."}),e.jsx("p",{children:e.jsx(_,{docPath:"/howto/storage_buckets/#manage-storage-bucket-keys",hasExternalIcon:!0,children:"Learn how to manage storage bucket keys"})}),e.jsx(I,{})]})]})},M=({formik:t,bucket:a})=>{const{canEditBucket:l}=T(),i=u=>({id:u,name:u,onBlur:t.handleBlur,onChange:t.handleChange,value:t.values[u]??"",error:t.touched[u]?t.errors[u]:null,placeholder:`Enter ${u.replaceAll("-"," ")}`}),o=!!a,d=!o||l(a)?"":"You do not have permission to edit this bucket";return e.jsxs(s.Form,{onSubmit:t.handleSubmit,className:"bucket-create-form",children:[e.jsx(s.Input,{type:"submit",hidden:!0,value:"Hidden input"}),e.jsx(s.Input,{...i("name"),type:"text",label:"Name",required:!0,autoFocus:!0,disabled:!!d||o,title:d}),e.jsx(s.Select,{id:"bucketKey",label:"Role",onChange:u=>{t.setFieldValue("role",u.target.value)},value:t.values.role,options:[{label:"Admin",value:"admin"},{label:"Read-only",value:"read-only"}]}),e.jsx(je,{...i("description"),label:"Description",disabled:!!d,title:d}),e.jsx(s.Input,{...i("access-key"),type:"text",label:"Access Key",disabled:!!d,title:d,help:o?void 0:"Leave empty to generate an access key automatically."}),e.jsx(s.PasswordToggle,{...i("secret-key"),label:"Secret Key",disabled:!!d,title:d,help:o?void 0:"Leave empty to generate a secret key automatically."})]})},Ce=({bucket:t})=>{const a=w(),{project:l}=K(),i=s.useNotify(),o=s.useToastNotification(),d=P(),u=S.useState(null),h=E(),j=()=>{a.clear(),i.clear()};A(j);const m=D(t.name,t.pool,l?.name??""),c=z().shape({name:J().test(...ge(a.project,t,u)).required("Key name is required")}),g=()=>{d.invalidateQueries({queryKey:[k.storage,t.pool,a.project,k.buckets,t.name,k.keys]})},b=r=>{g(),o.success(e.jsxs(e.Fragment,{children:["Key ",e.jsx(N,{type:"bucket-key",value:r,to:m})," ","created for storage bucket"," ",e.jsx(N,{type:"bucket",value:t.name,to:m}),"."]})),j()},f=(r,p)=>{g(),x.setSubmitting(!1),i.failure(`Creation of key ${r} failed`,p)},x=$({initialValues:{name:"",role:"read-only"},validationSchema:c,onSubmit:r=>{const p={name:r.name,role:r.role,description:r.description,"access-key":r["access-key"],"secret-key":r["secret-key"]};ae(JSON.stringify(p),a.project,t.pool,t.name).then(n=>{o.info(e.jsxs(e.Fragment,{children:["Creation of key"," ",e.jsx(C,{bold:!0,type:"bucket-key",value:r.name})," for storage bucket"," ",e.jsx(N,{type:"bucket",value:t.name,to:m}),"has started."]})),h.set(n.metadata.id,()=>{b(r.name)},y=>{f(r.name,new Error(y))})}).catch(n=>{f(r.name,n)})}});return e.jsx(e.Fragment,{children:e.jsxs(s.SidePanel,{children:[e.jsx(s.SidePanel.Header,{children:e.jsx(s.SidePanel.HeaderTitle,{children:e.jsx(q,{children:"Create key"})})}),e.jsx(R,{className:"u-no-padding"}),e.jsx(s.SidePanel.Content,{className:"u-no-padding",children:e.jsx(s.ScrollableContainer,{dependencies:[i.notification],belowIds:["panel-footer"],children:e.jsx(M,{formik:x})})}),e.jsxs(s.SidePanel.Footer,{className:"u-align--right",children:[e.jsx(s.Button,{appearance:"base",onClick:j,className:"u-no-margin--bottom",children:"Cancel"}),e.jsx(s.ActionButton,{appearance:"positive",loading:x.isSubmitting,onClick:()=>{x.submitForm()},className:"u-no-margin--bottom",disabled:!x.isValid||x.isSubmitting||!x.values.name,children:"Create key"})]})]})})},Be=({bucket:t})=>{const a=w(),{project:l,key:i}=a,o=s.useNotify(),d=s.useToastNotification(),u=P(),h=E(),j=()=>{a.clear(),o.clear()};A(j);const m=D(t.name,t.pool,l),{data:c,error:g,isLoading:b}=se(t,i??"",l),f=()=>{u.invalidateQueries({queryKey:[k.storage,t.pool,l,k.buckets,t.name,k.keys]}),u.invalidateQueries({queryKey:[k.storage,t.pool,l,k.buckets,t.name,k.keys,c?.name]})},x=y=>{f(),d.success(e.jsxs(e.Fragment,{children:["Key"," ",e.jsx(N,{type:"bucket-key",value:c?.name??"",to:m})," ","updated for storage bucket"," ",e.jsx(N,{type:"bucket",value:y?.name??"",to:m}),"."]})),j()},r=y=>{f(),p.setSubmitting(!1),o.failure(`Update of key ${c?.name??""} for storage bucket ${t?.name??""} failed`,y)},p=$({initialValues:{name:c?.name??"",role:c?.role,description:c?.description,"access-key":c?.["access-key"]??"","secret-key":c?.["secret-key"]??""},enableReinitialize:!0,onSubmit:y=>{const B={name:y.name,role:y.role,description:y.description,"access-key":y["access-key"],"secret-key":y["secret-key"]};ne(t.name,B,t.pool,l||"").then(F=>{d.info(e.jsxs(e.Fragment,{children:["Update of key"," ",e.jsx(N,{type:"bucket-key",value:c?.name??"",to:m})," ","for storage bucket"," ",e.jsx(N,{type:"bucket",value:t?.name??"",to:m}),"has started."]})),h.set(F.metadata.id,()=>{x(t)},H=>{r(new Error(H))})}).catch(F=>{r(F)})}});if(!l)return e.jsx(e.Fragment,{children:"Missing project"});if(!i)return e.jsx(e.Fragment,{children:"Missing key"});if(g&&o.failure("Loading key failed",g),b)return e.jsx(s.Spinner,{className:"u-loader",text:"Loading...",isMainComponent:!0});if(!c)return e.jsx(e.Fragment,{children:"Loading key failed"});const n=(p.values.description!==c.description?1:0)+(p.values.role!==c.role?1:0)+(p.values["access-key"]!==c["access-key"]?1:0)+(p.values["secret-key"]!==c["secret-key"]?1:0);return e.jsx(e.Fragment,{children:e.jsxs(s.SidePanel,{children:[e.jsx(s.SidePanel.Header,{children:e.jsx(s.SidePanel.HeaderTitle,{children:e.jsxs(q,{children:["Edit key ",c.name]})})}),e.jsx(R,{className:"u-no-padding"}),e.jsx(s.SidePanel.Content,{className:"u-no-padding",children:e.jsx(s.ScrollableContainer,{dependencies:[o.notification],belowIds:["panel-footer"],children:e.jsx(M,{formik:p,bucket:t})})}),e.jsxs(s.SidePanel.Footer,{className:"u-align--right",children:[e.jsx(s.Button,{appearance:"base",onClick:j,className:"u-no-margin--bottom",children:"Cancel"}),e.jsx(s.ActionButton,{appearance:"positive",loading:p.isSubmitting,onClick:()=>{p.submitForm()},className:"u-no-margin--bottom",disabled:!p.isValid||p.isSubmitting||n===0,children:n===0?"Save changes":`Save ${n} ${v("change",n)}`})]})]})})},Ze=()=>{const{pool:t,project:a,member:l,bucket:i}=G();if(!t)return e.jsx(e.Fragment,{children:"Missing storage pool"});if(!a)return e.jsx(e.Fragment,{children:"Missing project"});if(!i)return e.jsx(e.Fragment,{children:"Missing bucket"});const{data:o,error:d,isLoading:u}=oe(i,t,a,l),h=w();return u?e.jsx(s.Spinner,{className:"u-loader",text:"Loading...",isMainComponent:!0}):o?e.jsxs(e.Fragment,{children:[e.jsx(s.CustomLayout,{header:e.jsx(xe,{bucket:o,project:a}),contentClassName:"detail-page u-no-padding--bottom",children:e.jsx(s.Row,{children:e.jsx(ve,{bucket:o})})}),h.panel===L.editStorageBucket&&e.jsx(re,{bucket:o}),h.panel===L.createStorageBucketKey&&e.jsx(Ce,{bucket:o}),h.panel===L.editStorageBucketKey&&e.jsx(Be,{bucket:o})]}):e.jsx(W,{entityType:"bucket",entityName:i,errorMessage:d?.message})};export{Ze as default};

Youez - 2016 - github.com/yon3zu
LinuXploit