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/StorageBucketDetail-B8KHzvTq.js
import{j as e,L as U,R as V,r as S,d as n,D as K,ct as Y,w as O,W as w,s as F,K as D,t as k,B as v,F as _,o as R,H as z,e as J,f as W,h as q,J as G,aQ as X}from"./index-C5moRkRM.js";import{f as Z,u as T,g as ee,h as te,b as ae,i as se,S as A,j as ne,k as oe,l as re,E as ie}from"./EditStorageBucketPanel-DR0Hqpwh.js";import{R as le}from"./RenameHeader-B0XWLDzt.js";import{I as ce}from"./ItemName-Dt16GXN3.js";import{S as de}from"./SelectableMainTable-wRMsxkIr.js";import{S as ue}from"./SelectedTableNotification-DR6-T9f2.js";import{u as me}from"./useSortTableData-DOqSqaiW.js";import{u as pe}from"./projects-BYXh-TO0.js";import{u as P,a as M,p as E}from"./useEscCallback-CiLQokzn.js";import{R as C}from"./ResourceLabel-5vQU6ndJ.js";import{B as ye}from"./BulkDeleteButton--AqObKRB.js";import{g as ge}from"./promises-DrIa_NWl.js";import{R as N}from"./ResourceLink-CSSa-WON.js";import{g as I,a as he}from"./storageBucket-Dt08U0oy.js";import{u as je}from"./useBulkDetails-lYUt51kB.js";import{A as xe}from"./AutoExpandingTextArea-BtMcH1Et.js";import"./StoragePoolSelector-B2DFQOGf.js";import"./useStoragePools-Crzn42fh.js";import"./useClusterMembers-DYP3yC8I.js";import"./cluster-members-B9SkLa7e.js";import"./StoragePoolSize-BVlyAxMa.js";import"./Meter-BW_a3lG4.js";import"./DiskSizeSelector-T95OK-_Q.js";import"./StoragePoolExplanationTooltip-CY366rOX.js";import"./ExplanationTooltip-AfbgOckm.js";import"./Breadcrumb-CpbG2SRs.js";const ke=({bucket:t,project:a})=>e.jsx(le,{name:t.name,parentItems:[e.jsx(U,{to:`${V}/ui/project/${encodeURIComponent(a)}/storage/buckets`,children:"Storage buckets"},1)],controls:t?e.jsx(Z,{bucket:t,isDetailPage:!0}):null,isLoaded:!0,renameDisabledReason:"Storage buckets cannot be renamed"}),fe=({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(n.List,{inline:!0,className:"u-no-margin--bottom password-output-toggle-actions-list",items:[e.jsx(n.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(K,{icon:a?"hide":"show"})},"reveal"),e.jsx(Y,{value:t,tooltipMessage:"Copy password"},"copy")]})]}):null},$=({className:t})=>{const a=O(),{canCreateStorageBuckets:l}=pe(),{project:i}=w(),o=P();return e.jsxs(n.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(K,{icon:"plus"}),e.jsx("span",{children:"Create key"})]})},be=({bucket:t,bucketKey:a})=>{const l=n.useNotify(),[i,o]=S.useState(!1),d=F(),{canEditBucket:u}=T(),{project:h}=w(),j=h?.name||"",m=n.useToastNotification(),c=D(),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),ee(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(n.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(K,{icon:"delete"})})},Se=({bucket:t,bucketKey:a})=>{const l=P(),{canEditBucket:i}=T();return e.jsx(n.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(K,{icon:"edit"})})},Ne=({bucketKey:t,bucket:a})=>{const l=[e.jsx(Se,{bucketKey:t,bucket:a},"edit"),e.jsx(be,{bucketKey:t,bucket:a},"delete")];return e.jsx(n.List,{inline:!0,className:"u-no-margin--bottom actions-list",items:l})},ve=({keys:t,bucket:a,onStart:l,onFinish:i})=>{const o=n.useToastNotification(),d=F(),[u,h]=S.useState(!1),j=je(),{project:m}=w(),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:I(a.name,a.pool,m?.name??"")}),"."]});te(a,t,c).then(r=>{const{fulfilledCount:p,rejectedCount:s}=ge(r);p===g?o.success(x,j(r)):s===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:s})," ",v("key",s)," 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(ye,{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})},Ce=({bucket:t})=>{const[a,l]=S.useState(""),i=n.useNotify(),[o,d]=S.useState([]),[u,h]=S.useState([]),{project:j}=w(),{data:m=[]}=ae(t,j?.name??"");S.useEffect(()=>{const s=new Set(m?.map(B=>B.name)),y=o.filter(B=>s.has(B));y.length!==o.length&&d(y)},[m]);const c=m?.filter(s=>{if(a){const y=a.toLowerCase();return s.name.toLowerCase().includes(y)||s.role.toLowerCase().includes(y)||s.description.toLowerCase().includes(y)||s["access-key"].toLowerCase().includes(y)||s["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(s=>({key:s.name,className:"u-row",name:s.name,columns:[{content:e.jsx("div",{className:"u-truncate",title:`Key ${s.name}`,children:e.jsx(ce,{item:s})}),role:"rowheader","aria-label":"Name",className:"name"},{content:_(s.role),role:"cell","aria-label":"Role",className:"role"},{content:s.description||"-",title:s.description,role:"cell","aria-label":"Description",className:"description u-truncate"},{content:s["access-key"],role:"cell","aria-label":"Access key",className:"access-key"},{content:e.jsx(fe,{password:s["secret-key"]}),role:"cell","aria-label":"Secret key",className:"secret-key"},{content:e.jsx(Ne,{bucketKey:s,bucket:t}),role:"cell","aria-label":"Actions",className:"u-align--right actions"}],sortData:{name:s.name.toLowerCase(),role:s.role,description:s.description.toLowerCase(),"access-key":s["access-key"],"secret-key":s["secret-key"]}})),x=m.filter(s=>o.includes(s.name)),{rows:r,updateSort:p}=me({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(n.SearchBox,{name:"search-snapshot",className:"search-box margin-right--large",type:"text",onChange:s=>{l(s)},placeholder:"Search for keys",value:a,"aria-label":"Search for keys"})}),e.jsx($,{})]}):e.jsx("div",{className:"p-panel__controls",children:e.jsx(ve,{keys:x,bucket:t,onStart:()=>{h(o)},onFinish:()=>{h([])}})})}),e.jsx(R,{}),g?e.jsx(e.Fragment,{children:e.jsx(n.ScrollableTable,{dependencies:[c,i.notification],tableId:"buckets-key-table",belowIds:["status-bar"],children:e.jsx(n.TablePagination,{data:r,id:"pagination",itemName:"key",className:"u-no-margin--top","aria-label":"Table pagination control",description:o.length>0&&e.jsx(ue,{totalCount:m?.length??0,itemName:"key",parentName:"bucket",selectedNames:o,setSelectedNames:d,filteredNames:c.map(s=>s.name)}),children:e.jsx(de,{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(s=>s.name),onUpdateSort:p,defaultSort:"name",defaultSortDirection:"ascending",responsive:!0})})})}):e.jsxs(n.EmptyState,{className:"empty-state",image:e.jsx(K,{icon:"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(z,{docPath:"/howto/storage_buckets/#manage-storage-bucket-keys",hasExternalIcon:!0,children:"Learn how to manage storage bucket keys"})}),e.jsx($,{})]})]})},H=({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(n.Form,{onSubmit:t.handleSubmit,className:"bucket-create-form",children:[e.jsx(n.Input,{type:"submit",hidden:!0,value:"Hidden input"}),e.jsx(n.Input,{...i("name"),type:"text",label:"Name",required:!0,autoFocus:!0,disabled:!!d||o,title:d}),e.jsx(n.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(xe,{...i("description"),label:"Description",disabled:!!d,title:d}),e.jsx(n.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(n.PasswordToggle,{...i("secret-key"),label:"Secret Key",disabled:!!d,title:d,help:o?void 0:"Leave empty to generate a secret key automatically."})]})},Be=({bucket:t})=>{const a=P(),{project:l}=w(),i=n.useNotify(),o=n.useToastNotification(),d=F(),u=S.useState(null),h=D(),j=()=>{a.clear(),i.clear()};M(j);const m=I(t.name,t.pool,l?.name??""),c=J().shape({name:W().test(...he(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=q({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"]};se(JSON.stringify(p),a.project,t.pool,t.name).then(s=>{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(s.metadata.id,()=>{b(r.name)},y=>{f(r.name,new Error(y))})}).catch(s=>{f(r.name,s)})}});return e.jsx(e.Fragment,{children:e.jsxs(n.SidePanel,{children:[e.jsx(n.SidePanel.Header,{children:e.jsx(n.SidePanel.HeaderTitle,{children:e.jsx(A,{children:"Create key"})})}),e.jsx(R,{className:"u-no-padding"}),e.jsx(n.SidePanel.Content,{className:"u-no-padding",children:e.jsx(n.ScrollableContainer,{dependencies:[i.notification],belowIds:["panel-footer"],children:e.jsx(H,{formik:x})})}),e.jsxs(n.SidePanel.Footer,{className:"u-align--right",children:[e.jsx(n.Button,{appearance:"base",onClick:j,className:"u-no-margin--bottom",children:"Cancel"}),e.jsx(n.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"})]})]})})},Ke=({bucket:t})=>{const a=P(),{project:l,key:i}=a,o=n.useNotify(),d=n.useToastNotification(),u=F(),h=D(),j=()=>{a.clear(),o.clear()};M(j);const m=I(t.name,t.pool,l),{data:c,error:g,isLoading:b}=ne(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=q({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"]};oe(t.name,B,t.pool,l||"").then(L=>{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(L.metadata.id,()=>{x(t)},Q=>{r(new Error(Q))})}).catch(L=>{r(L)})}});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(n.Spinner,{className:"u-loader",text:"Loading...",isMainComponent:!0});if(!c)return e.jsx(e.Fragment,{children:"Loading key failed"});const s=(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(n.SidePanel,{children:[e.jsx(n.SidePanel.Header,{children:e.jsx(n.SidePanel.HeaderTitle,{children:e.jsxs(A,{children:["Edit key ",c.name]})})}),e.jsx(R,{className:"u-no-padding"}),e.jsx(n.SidePanel.Content,{className:"u-no-padding",children:e.jsx(n.ScrollableContainer,{dependencies:[o.notification],belowIds:["panel-footer"],children:e.jsx(H,{formik:p,bucket:t})})}),e.jsxs(n.SidePanel.Footer,{className:"u-align--right",children:[e.jsx(n.Button,{appearance:"base",onClick:j,className:"u-no-margin--bottom",children:"Cancel"}),e.jsx(n.ActionButton,{appearance:"positive",loading:p.isSubmitting,onClick:()=>{p.submitForm()},className:"u-no-margin--bottom",disabled:!p.isValid||p.isSubmitting||s===0,children:s===0?"Save changes":`Save ${s} ${v("change",s)}`})]})]})})},et=()=>{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}=re(i,t,a,l),h=P();return u?e.jsx(n.Spinner,{className:"u-loader",text:"Loading...",isMainComponent:!0}):o?e.jsxs(e.Fragment,{children:[e.jsx(n.CustomLayout,{header:e.jsx(ke,{bucket:o,project:a}),contentClassName:"detail-page u-no-padding--bottom",children:e.jsx(n.Row,{children:e.jsx(Ce,{bucket:o})})}),h.panel===E.editStorageBucket&&e.jsx(ie,{bucket:o}),h.panel===E.createStorageBucketKey&&e.jsx(Be,{bucket:o}),h.panel===E.editStorageBucketKey&&e.jsx(Ke,{bucket:o})]}):e.jsx(X,{entityType:"bucket",entityName:i,errorMessage:d?.message})};export{et as default};

Youez - 2016 - github.com/yon3zu
LinuXploit