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/CreateInstance-IQP3Fpxu.js
import{r as b,H as Ne,w as Ve,b as Pe,j as e,d as o,U as Re,E as Be,x as Ge,v as De,V as le,B as $e,W as J,J as ie,s as ce,c as ue,h as de,e as me,X as pe,q as Ee,R as Y,Y as Te,t as X,Z as we,o as Le,Q as he,S as ke,_ as ze,$ as qe,f as Ke,a0 as fe,a1 as Ye}from"./index-H4PaR1Ay.js";import{u as Qe}from"./userKeys--m55T-U-.js";import{u as We,c as Oe}from"./useInstances-CTyW6bRj.js";import{l as He,b as Xe,L as ee,i as te,a as ae,c as be}from"./images-BuQHcoRx.js";import{M as ve,Y as Z,I as Je,D as xe,N as Ze,G as et,P as tt,O as at,R as st,S as nt,a as ot,b as rt,B as lt,C as it,c as ct,d as ut,y as dt,o as mt}from"./YamlSwitch-B3aH5O73.js";import{P as pt}from"./ProfileSelector-3bWxNt0J.js";import{g as gt}from"./architectures-BcTUUUGa.js";import{u as ht,a as ft,c as bt,m as vt,i as xt}from"./useImages-BYHePzIj.js";import{b as Ct}from"./useClusterGroups-DdmxAuRp.js";import{u as yt}from"./PlacementGroupExplanationTooltip-DitUqaPL.js";import{u as Ue}from"./useClusterMembers-7DaTUHV4.js";import{P as jt,C as St,S as Ft,U as It,h as Nt,a as Pt,b as Ce,D as Rt,N as Et,G as Tt,c as wt,O as Lt,R as Ot,d as Ut,I as At,M as _t,B as Mt,e as Vt,f as Bt}from"./NetworkDevicePanel-DOIT31lz.js";import{P as Gt}from"./PlacementGroupForm-ZIvZ1Dcv.js";import{C as ye}from"./ClusterMemberExplanationTooltip-B--IjkYZ.js";import{C as Dt}from"./ClusterGroupExplanationTooltip-DYcO1yEQ.js";import{A as $t}from"./AutoExpandingTextArea-BxIWUale.js";import{S as kt}from"./ScrollableForm-BtdYbmZT.js";import{P as zt}from"./ProgressBar-BRC5vpcB.js";import{S as Ae}from"./StoragePoolSelector-CJRwrd1Y.js";import{R as se}from"./ResourceLabel-BMIFVwPY.js";import{I as ge}from"./InstanceRichChip-CmtepUSG.js";import{C as qt}from"./ClusterMemberSelector-DIlP54jh.js";import{I as Kt}from"./InstanceExplanationTooltip-DKqw8pXu.js";import{r as Yt,u as Qt,s as Wt,c as Ht,b as Xt,m as Jt,a as Zt,d as ea,e as ta,f as aa,i as sa}from"./instanceAndProfilePayloads-DnzPlN57.js";import{B as na}from"./BaseLayout-ap1D3dAl.js";import{F as oa}from"./FormFooterLayout-BAdc854l.js";import{Y as ra}from"./NetworkDefaultACLSelector-B5SPtM37.js";import{u as la,I as ia}from"./devices-BmVPmxwo.js";import{u as ca,p as je}from"./useEscCallback-zQN3vs8-.js";import"./promises-DrIa_NWl.js";import"./index-BCn5QfZZ.js";import"./FormMenuItem-wWC_cxfa.js";import"./ProfileExplanationTooltip-CjC-F4wD.js";import"./ExplanationTooltip-BtzkKEJm.js";import"./imageRegistry-BR44AA00.js";import"./image-registries-CM9txDWK.js";import"./cluster-members-LZARpnVy.js";import"./scroll-BSkJfxH1.js";import"./ProfileRichChip-BLxwj1Me.js";import"./ResourceLink-uXW9L0Ar.js";import"./ProfileResourceLimits-CLeCMI9t.js";import"./ItemName-COo4SMvJ.js";import"./RichTooltipTable-BK1fclsa.js";import"./usedBy-CACK-irk.js";import"./resourceDetails-DtLpXei1.js";import"./storageVolume-B1nkHAqF.js";import"./storageBucket-B7LHuAXl.js";import"./TruncatedList-BHP7CqkY.js";import"./options-DGWNjuoa.js";import"./ConfigurationTable-DEm36PYo.js";import"./ConfigFieldDescription-BuOtqnNZ.js";import"./useStoragePools-R3ZOO4pU.js";import"./useConfigOptions-qesCQJVe.js";import"./ScrollableConfigurationTable-gvGDy_Ul.js";import"./StorageVolumeForm-D9fkrXvn.js";import"./DiskSizeSelector-97sBb-TL.js";import"./StoragePoolSize-lekZ0CbT.js";import"./Meter-Bmiz6lct.js";import"./ProjectRichChip-CFmGZ5fm.js";import"./StoragePoolExplanationTooltip-75F5PHZT.js";import"./snapshots-oc8RhmUf.js";import"./useResources-CPhpL_ul.js";import"./formChangeCount-obF4N3HN.js";import"./StoragePoolRichChip-B2CCdBci.js";import"./projects-CsVQvwvI.js";import"./useVolumes-Xg79hRkT.js";import"./storage-volumes-fC4CfBPB.js";import"./BackLink-Cuy7YFjT.js";import"./CustomIsoExplanationTooltip-vPTmYoBF.js";import"./useNetworks-CX5r56DC.js";import"./ExpandableList-CQ-CShP2.js";import"./NetworkRichChip-_Wd7Km7z.js";import"./NetworkSelector-Di2e2NuZ.js";import"./useNetworkAcls-XKZxGxZP.js";import"./network-acls-XrnCKCa1.js";import"./InstanceStatus-DrJFk_Gl.js";import"./ConfirmationCheckbox-BIDRuxD0.js";const H="any",Se="container",Fe="virtual-machine",ua=({onSelect:t,onClose:c})=>{const[r,p]=b.useState(""),[l,i]=b.useState(""),[f,C]=b.useState(""),[h,x]=b.useState("amd64"),[j,P]=b.useState(void 0),[w,L]=b.useState(H),[S,O]=b.useState(!1),[A,D]=b.useState(""),[V,B]=b.useState(!1),[g,U]=b.useState(!1),{project:G}=Ne(),E=Ve(1090),{data:n,isLoading:T}=Pe(),{data:u,isLoading:F}=ht(),{data:m=[],isLoading:Q}=ft(G??"default");u?.error&&u?.error!==A&&(D(u?.error??""),B(!1));const y=!S&&F||Q||T,v=gt(n?.environment?.architectures??[]),s=y?[]:m.map(He).sort(Xe).concat(u?.images??[]).filter(a=>v.includes(a.arch)),d=[...new Set(s.map(a=>a.arch))].filter(a=>a!=="").sort(),R=[...new Set(s.map(a=>a.variant))].sort();!y&&!d.includes(h)&&d.length>0&&x(d[0]);const I=(a,q=()=>!0)=>{const K=[...new Set(s.filter(q).map(a))].sort().map(M=>({label:M,value:M}));return K.unshift({label:"Any",value:""}),K},k=s.filter(a=>{const q=a.server===ee;return j===Fe&&te(a)||j===Se&&ae(a)||h!==a.arch&&!q||w!==H&&w!==a.variant||l&&a.os!==l||f&&a.release!==f?!1:r?a.aliases.toLowerCase().includes(r)||a.arch.toLowerCase().includes(r)||a.os.toLowerCase().includes(r)||a.release.toLowerCase().includes(r):!0}).filter(a=>S?a.server===be||a.cached:!0).map(a=>{const K=a.type?a.type:ae(a)?Fe:te(a)?Se:"all",M=z=>{z.stopPropagation(),t(a,a.type??j)},ne=a.os==="Ubuntu"&&a.release_title&&!a.release.includes(a.release_title)?a.release_title:a.release,oe=a.os==="Ubuntu"&&a.release_title&&!a.variant&&!a.release.includes(a.release_title)?a.release:a.variant,Me=()=>{let z="Custom";!a.cached&&a.created_at&&(z="Local"),a.registryName&&(z=a.registryBuiltIn?a.registryName.split("-").map(Be).join(" "):a.registryName);const re=["images","ubuntu","ubuntu-minimal",""].includes(a.registryName??"");return a.server===bt&&re&&(z="Ubuntu"),a.server===vt&&re&&(z="Ubuntu Minimal"),a.server===xt&&re&&(z="LXD Images"),z};return{key:K+a.os+ne+oe+a.server+a.fingerprint+a.registryName,className:"u-row",columns:[{content:a.os,role:"rowheader","aria-label":"Distribution",onClick:M},{content:ne,role:"cell","aria-label":"Release",onClick:M},{content:oe,role:"cell","aria-label":"Variant",onClick:M},{content:K,role:"cell","aria-label":"Type",onClick:M},{content:a.aliases.split(",").pop(),title:a.aliases.split(",").pop(),role:"cell","aria-label":"Alias",onClick:M},{content:Me(),role:"cell","aria-label":"Source",onClick:M},{content:a.cached?"Cached":"Remote",role:"cell","aria-label":"Cached",onClick:M},{content:e.jsx(o.Button,{onClick:M,type:"button",dense:!E,className:"u-no-margin--bottom",appearance:a.cached||a.server===be?"positive":"default",children:"Select"}),role:"cell","aria-label":"Action",onClick:M}],sortData:{os:a.os.toLowerCase(),release:ne.toLowerCase(),variant:oe?.toLowerCase(),type:K,alias:a.aliases}}}),_=[{content:"Distribution",sortKey:"os"},{content:"Release",sortKey:"release"},{content:"Variant",sortKey:"variant"},{content:"Type",sortKey:"type"},{content:"Alias",sortKey:"alias"},{content:"Source"},{content:"Cached"},{content:"","aria-label":"Actions"}],$=e.jsxs("div",{className:"image-select-filters",children:[e.jsx(o.Select,{label:"Distribution",name:"distribution",onChange:a=>{i(a.target.value),C("")},options:I(a=>a.os),value:l}),e.jsx(o.Select,{label:"Release",name:"release",onChange:a=>{C(a.target.value)},options:I(a=>a.release,a=>a.os===l),value:f,disabled:l===""}),e.jsx(o.Select,{label:"Variant",name:"variant",onChange:a=>{L(a.target.value)},options:[{label:"Any",value:H}].concat(R.filter(a=>!!a).map(a=>({label:a??"",value:a??""}))),value:w}),e.jsx(o.Select,{label:"Architecture",name:"architecture",onChange:a=>{x(a.target.value)},options:d.map(a=>({label:a,value:a})),value:h}),e.jsx(o.Select,{label:"Type",name:"type",onChange:a=>{P(a.target.value===H?void 0:a.target.value)},options:[{label:"Any",value:H},...Re],value:j??""}),e.jsx(o.CheckboxInput,{checked:S,label:"Show only cached images",onChange:()=>{O(a=>!a)}})]});return e.jsx(o.Modal,{close:c,title:"Select base image",className:"image-select-modal",children:e.jsxs(o.Row,{className:"u-no-padding--left u-no-padding--right",children:[e.jsx(o.Col,{size:3,className:"u-hide--small u-hide--medium",children:$}),e.jsxs(o.Col,{size:9,small:12,medium:12,children:[e.jsxs("div",{className:"image-select-header",children:[A&&!V?e.jsx(o.Notification,{severity:"negative",title:"Failed loading images",onDismiss:()=>{B(!0)},children:A}):e.jsx("div",{children:e.jsx(o.SearchBox,{autoFocus:!0,className:"search-image",name:"search-image",type:"text",onChange:a=>{p(a.toLowerCase()),i(""),C("")},placeholder:"Search an image"})}),e.jsx(o.Button,{type:"button",hasIcon:!0,className:"image-filter-toggle u-no-margin--bottom u-hide--large","aria-expanded":g,"aria-label":g?"Hide filters":"Show filters",onClick:()=>{U(a=>!a)},children:e.jsx(o.Icon,{name:"filter"})})]}),E&&g&&$,e.jsx("div",{className:"image-list",children:e.jsx(o.ScrollableTable,{dependencies:[s],tableId:"image-selector-table",children:e.jsx(o.MainTable,{id:"image-selector-table",className:"table-image-select",emptyStateMsg:y?e.jsx(o.Spinner,{className:"u-loader",text:"Loading images..."}):"No matching images found",headers:_,rows:k,paginate:null,responsive:!0,sortable:!0})})})]})]})})},da=({onSelect:t})=>{const{openPortal:c,closePortal:r,isOpen:p,Portal:l}=o.usePortal(),i=(f,C)=>{r(),t(f,C)};return e.jsxs(e.Fragment,{children:[e.jsx(o.Button,{appearance:"positive",onClick:c,type:"button",id:"select-image",children:e.jsx("span",{children:"Browse images"})}),p&&e.jsx(l,{children:e.jsx(ua,{onClose:r,onSelect:i})})]})},N={AUTO:"auto",CLUSTER_GROUP:"clusterGroup",CLUSTER_MEMBER:"clusterMember",PLACEMENT_GROUP:"placementGroup"},ma=t=>t.target?.startsWith(J)?N.CLUSTER_GROUP:t.placementGroup?N.PLACEMENT_GROUP:t.target?N.CLUSTER_MEMBER:N.AUTO,pa=t=>t?.startsWith(J)?t.split(J)[1]:"",Ie=t=>!t||t.startsWith(J)?"":t,ga=({formik:t})=>{if(!Ge())return e.jsx(e.Fragment,{});const{canOverrideClusterTargetRestriction:r}=De(),{project:p}=le(),l=ma(t.values),i=b.useRef(null),f=b.useRef(null),C=b.useRef(null),{data:h=[],isLoading:x}=Ct(),j=p?.config.restricted==="true",P=p?.config["restricted.cluster.groups"],w=h.filter(u=>u.members.length<1?!1:j&&P?P.includes(u.name):!0).map(u=>({label:e.jsxs("div",{className:"label",children:[e.jsx("span",{className:"name",children:u.name}),e.jsx("span",{className:"members",children:u.members.length})]}),text:`${u.name} (${u.members.length} ${$e("member",u.members.length)})`,value:u.name})),{data:L=[]}=Ue(),S=L.map(u=>({label:u.server_name,value:u.server_name})),{data:O=[]}=yt(p?.name??"default"),A=()=>{t.setFieldValue("target",void 0),t.setFieldValue("placementGroup",void 0)},D=u=>{t.setFieldValue("target",`${J}${u}`),t.values.placementGroup&&t.setFieldValue("placementGroup",void 0)},V=u=>{t.setFieldValue("target",u),t.values.placementGroup&&t.setFieldValue("placementGroup",void 0)},B=u=>{t.setFieldValue("placementGroup",u),t.values.target&&t.setFieldValue("target",void 0)},g=O.find(u=>u.name===t.values.placementGroup),U=g&&g.used_by.length===0&&g.config.policy===Gt,G=p?.config["restricted.cluster.target"],E=j&&!r()&&(G==="block"||G===void 0),n=t.values.targetSelectedByVolume;if(x)return e.jsx(o.Spinner,{className:"u-loader",text:"Loading..."});if(n)return e.jsx(o.Input,{id:"clusterMember",label:e.jsx(ye,{children:"Cluster member"}),value:t.values.target,disabled:!0,help:"Member is determined by the selected ISO volume and can't be changed.",type:"text"});const T=t.values.image?void 0:"Please select an image before adding a placement group";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"instance-target-selector",children:[e.jsx(o.Select,{id:"target",label:"Target",wrapperClassName:"select-input",value:l,options:[{label:"Auto",value:N.AUTO},{label:"Cluster group",value:N.CLUSTER_GROUP,disabled:w.length===0},{label:"Cluster member",value:N.CLUSTER_MEMBER,disabled:S.length===0||E},{label:"Placement group",value:N.PLACEMENT_GROUP}],onChange:u=>{const F=u.target.value;F===N.AUTO&&A(),F===N.CLUSTER_GROUP&&(D(w[0].value),setTimeout(()=>f.current?.open(),100)),F===N.CLUSTER_MEMBER&&(V(S[0].value),setTimeout(()=>i.current?.open(),100)),F===N.PLACEMENT_GROUP&&(B(O[0]?.name??"-"),O.length>0&&setTimeout(()=>C.current?.open(),100))},disabled:!t.values.image,error:l===N.PLACEMENT_GROUP&&O.length===0?"No placement groups found for this project.":"",title:T}),l===N.CLUSTER_GROUP&&e.jsx(o.CustomSelect,{id:"clusterGroup",label:e.jsx(Dt,{children:"Cluster group"}),wrapperClassName:"select-input",dropdownClassName:"instance-target-dropdown",selectRef:f,onChange:D,value:pa(t.values.target),options:w,header:e.jsxs("div",{className:"header",children:[e.jsx("span",{className:"name",children:"Name"}),e.jsx("span",{className:"members",children:"Members"})]}),disabled:!t.values.image}),l===N.CLUSTER_MEMBER&&e.jsx(o.CustomSelect,{id:"clusterMember",label:e.jsx(ye,{children:"Cluster member"}),wrapperClassName:"select-input",dropdownClassName:"instance-target-dropdown",selectRef:i,onChange:V,value:Ie(t.values.target),options:S,disabled:!t.values.image}),l===N.PLACEMENT_GROUP&&e.jsx(jt,{value:t.values.placementGroup,setValue:B,project:p?.name??"default",ref:C,disabled:!t.values.image,profileNames:t.values.profiles,isCreateInstance:!0}),U&&e.jsx(o.CustomSelect,{id:"clusterMember",label:"Anchor",wrapperClassName:"select-input",dropdownClassName:"instance-target-dropdown",selectRef:i,onChange:u=>{const F=u??void 0;t.setFieldValue("target",F)},value:Ie(t.values.target),options:[{label:"Auto",value:""}].concat(...S),disabled:!t.values.image,help:"Cluster member to anchor the placement group"})]}),l===N.AUTO&&e.jsx("p",{className:"p-form-help-text",children:"LXD automatically selects a cluster member for the instance, unless a target is specified."})]})},ha=({onSelect:t})=>{const{openPortal:c,closePortal:r,isOpen:p,Portal:l}=o.usePortal(),i=(f,C)=>{r(),t(f,C)};return e.jsxs(e.Fragment,{children:[e.jsx(o.Button,{onClick:c,type:"button",id:"select-custom-iso",children:e.jsx("span",{children:"Use custom ISO"})}),p&&e.jsx(l,{children:e.jsx(St,{onClose:r,onSelect:i})})]})},_e=({value:t,onChange:c})=>e.jsxs(e.Fragment,{children:[e.jsx("label",{htmlFor:"file-type",children:"Select upload file type"}),e.jsxs("div",{id:"file-type",children:[e.jsx("div",{className:"u-sv1",children:e.jsx(o.RadioInput,{label:"LXD backup archive (.tar.gz)",checked:t==="instance-backup",onChange:()=>{c("instance-backup")}})}),e.jsx("div",{className:"u-sv3",children:e.jsx(o.RadioInput,{label:e.jsxs("span",{children:["External format (.qcow2, .vmdk,"," ",e.jsx("abbr",{title:".qcow, .vdi, .vhdx",children:"etc..."}),")"]}),checked:t==="external-format",onChange:()=>{c("external-format")}})})]})]}),fa=({close:t,uploadState:c,setUploadState:r,fileType:p,setFileType:l,defaultInstanceName:i})=>{const{project:f,isLoading:C}=le(),h=ie(),x=o.useToastNotification(),j=o.useNotify(),P=ce(),w=ue(),[L,S]=b.useState(null),O=b.useState(null),A=n=>{const T=`${Y}/ui/project/${encodeURIComponent(f?.name??"")}/instance/${encodeURIComponent(n)}`,u=e.jsxs(e.Fragment,{children:["Created instance"," ",e.jsx(ge,{instanceName:n,projectName:f?.name??""}),"."]}),F=[{label:"Configure",onClick:async()=>w(`${T}/configuration`)}];x.success(u,F)},D=n=>{x.failure("Instance creation failed.",new Error(n))},V=()=>{P.invalidateQueries({predicate:n=>n.queryKey[0]===X.instances})},B=n=>{const T=new AbortController;S(T),We(n.instanceFile,n.name,f?.name,n.pool,r,T).then(u=>{x.info(e.jsxs(e.Fragment,{children:["Upload completed. Now creating instance"," ",e.jsx(se,{bold:!0,type:"instance",value:n.name}),"."]})),h.set(u.metadata.id,()=>{A(n.name)},D,V),U(),w(`${Y}/ui/project/${encodeURIComponent(f?.name??"")}/instances`)}).catch(u=>{const F=new Error(u.response?.data.error);j.failure("Instance upload failed",F),g.setSubmitting(!1),r(null)})},g=de({initialValues:{name:i||"",pool:"",instanceFile:null},validateOnMount:!0,validationSchema:me().shape({name:pe(f?.name||"",O).optional()}),onSubmit:B}),U=b.useCallback(()=>{L?.abort(),r(null),S(null),g.resetForm(),t(),j.clear()},[L,g.resetForm,t,j]),G=async n=>{const{onChange:T}=g.getFieldProps("instanceFile");if(T(n),n.currentTarget.files){const u=n.currentTarget.files[0];if(await g.setFieldValue("instanceFile",u),!i){const F=Te(u.name,"-import");await g.setFieldValue("name",F),await g.validateField("name"),g.setFieldTouched("name",!0,!0),g.errors.name||g.setFieldError("name",void 0)}}},E=g.values.instanceFile?"":"Please select a file before adding custom configuration.";return e.jsxs(e.Fragment,{children:[e.jsxs(o.Form,{onSubmit:g.handleSubmit,className:Ee({"u-hide":c}),children:[e.jsx(_e,{value:p,onChange:l}),e.jsx(o.Input,{id:"instance-file",name:"instanceFile",type:"file",accept:".tar, application/gzip, application/x-bzip, application/x-xz, application/x-lzma, application/x-squashfs, application/x-qcow2, application/zstd",label:"Local file",labelClassName:"u-hide",onChange:n=>{G(n)}}),e.jsx(o.Input,{...g.getFieldProps("name"),id:"upload-instance-name",type:"text",label:"New instance name",placeholder:"Enter name",error:g.touched.name?g.errors.name:null,disabled:!!E,title:E}),e.jsx(Ae,{value:g.values.pool,setValue:n=>{g.setFieldValue("pool",n)},selectProps:{id:"pool",label:"Root storage pool",disabled:C||!!E,title:E}})]}),e.jsxs("footer",{className:"p-modal__footer",id:"modal-footer",children:[e.jsx(o.Button,{appearance:"base",className:"u-no-margin--bottom",type:"button",onClick:U,children:"Cancel"}),e.jsx(o.ActionButton,{appearance:"positive",className:"u-no-margin--bottom",loading:g.isSubmitting||!!c,disabled:!g.isValid||g.isSubmitting||C||!g.values.instanceFile,onClick:()=>{g.submitForm()},children:"Upload and create"})]})]})},ba=t=>[{value:"x86_64",label:"x86_64"},{value:"aarch64",label:"aarch64"},{value:"ppc64le",label:"ppc64le"},{value:"s390x",label:"s390x"}].filter(r=>t.includes(r.value)),va=t=>{const c=t.file?.size||0,r=[];t.formatConversion&&r.push("format"),t.virtioConversion&&r.push("virtio");const p={source:{type:"conversion",mode:"push",conversion_options:r,source_disk_size:c},devices:{root:{path:"/",type:"disk",pool:t.pool}},type:"virtual-machine",name:t.name,architecture:t.architecture};return JSON.stringify(p)},xa=(t,c,r,p)=>{const i=new WebSocket(t);return i.onopen=()=>{const f=new FileReader;let C=0;const h=()=>{if(!c)return;const x=c.slice(C,C+1048576);if(!x.size){i.close(1e3,"File upload complete");return}f.readAsArrayBuffer(x)};f.onload=x=>{if(!c||i.readyState===WebSocket.CLOSING||i.readyState===WebSocket.CLOSED)return;const j=x.target?.result;let P;j&&typeof j=="string"?P=new TextEncoder().encode(j).buffer:P=j,i.send(P),C+=P.byteLength,r&&r(C,c.size),setTimeout(h,0)},f.onerror=x=>{p&&p(x.target?.error?x.target.error:new Error("Failed to read read file"))},h()},i},Ca=async t=>new Promise(c=>{const r=new FileReader;r.onload=p=>{const l=p.target?.result,i=new Uint8Array(l);i[510]===85&&i[511]===170?c(!0):c(!1)},r.onerror=()=>{c(!1)},r.readAsArrayBuffer(t.slice(0,512))}),ya=({close:t,uploadState:c,setUploadState:r,fileType:p,setFileType:l,defaultInstanceName:i})=>{const{project:f,isLoading:C}=le(),h=b.useState(null),[x,j]=b.useState(),[P,w]=b.useState(""),L=o.useToastNotification(),S=o.useNotify(),O=ue(),A=ie(),D=ce(),{data:V}=Pe(),{data:B=[]}=Ue(),g=(v,s,d)=>{r({percentage:Math.floor(s/d*100),loaded:s,total:d}),s===d&&(t(),L.info(e.jsxs(e.Fragment,{children:["Upload completed. Now creating instance"," ",e.jsx(se,{bold:!0,type:"instance",value:v}),"."]})),O(`${Y}/ui/project/${encodeURIComponent(f?.name??"")}/instances`))},U=v=>{S.failure("File upload failed.",v),r(null)},G=()=>{x&&x.readyState===WebSocket.OPEN&&x.close(1e3,"cancel upload"),A.remove(P)},E=v=>{const s=`${Y}/ui/project/${encodeURIComponent(f?.name??"")}/instance/${encodeURIComponent(v)}`,d=e.jsxs(e.Fragment,{children:["Created instance"," ",e.jsx(ge,{instanceName:v,projectName:f?.name??""}),"."]}),R=[{label:"Configure",onClick:async()=>O(`${s}/configuration`)}];L.success(d,R)},n=v=>{L.failure("Instance creation failed.",new Error(v))},T=()=>{D.invalidateQueries({predicate:v=>v.queryKey[0]===X.instances})},u=v=>{Oe(va(v),f?.name||"",v.member).then(s=>{const d=s.metadata.id,R=s.metadata.metadata?.fs??"",I=we(s.metadata),_=`${location.protocol==="https:"?"wss":"ws"}://${location.host}${Y}/1.0/operations/${encodeURIComponent(d)}/websocket?secret=${encodeURIComponent(R)}`,$=xa(_,m.values.file,g.bind(null,I),U);j($),w(d),A.set(d,()=>{E(I)},n,T)}).catch(s=>{S.failure("Instance creation failed.",s),m.setSubmitting(!1),r(null)})},F=ba(V?.environment?.architectures||[]),m=de({initialValues:{name:i||"",pool:"",member:B?.[0]?.server_name,file:null,formatConversion:!0,virtioConversion:!1,architecture:F[0]?.value},enableReinitialize:!0,validateOnMount:!0,validationSchema:me().shape({name:pe(f?.name||"",h).optional()}),onSubmit:u}),Q=async v=>{const{onChange:s}=m.getFieldProps("file");if(s(v),v.currentTarget.files){const d=v.currentTarget.files[0];if(await m.setFieldValue("file",d),!i){const I=Te(d.name,"-import");await m.setFieldValue("name",I),await m.validateField("name"),m.setFieldTouched("name",!0,!0),m.errors.name||m.setFieldError("name",void 0)}const R=await Ca(d);await m.setFieldValue("formatConversion",!R)}},W=b.useCallback(()=>{m.resetForm(),t(),S.clear(),G()},[m.resetForm,t,S,x]),y=m.values.file?"":"Please select a file before adding custom configuration.";return e.jsxs(e.Fragment,{children:[e.jsxs(o.Form,{onSubmit:m.handleSubmit,className:Ee({"u-hide":c}),children:[e.jsx(_e,{value:p,onChange:l}),e.jsx(o.Input,{id:"image-file",name:"file",type:"file",label:"Local file",accept:".img, .qcow, .qcow2, .vdi, .vhdx, .vmdk",labelClassName:"u-hide",onChange:v=>{Q(v)}}),e.jsx(o.Input,{...m.getFieldProps("name"),id:"upload-instance-name",type:"text",label:"New instance name",placeholder:"Enter name",error:m.touched.name?m.errors.name:null,disabled:!!y,title:y}),e.jsx(qt,{...m.getFieldProps("member"),id:"member",label:"Target cluster member"}),e.jsx(Ae,{value:m.values.pool,setValue:v=>{m.setFieldValue("pool",v)},selectProps:{id:"pool",label:"Root storage pool",disabled:!f||!!y,title:y}}),e.jsx(o.Select,{...m.getFieldProps("architecture"),id:"architecture",label:"Image architecture",options:F,disabled:!!y,title:y}),e.jsx("label",{htmlFor:"",children:"Conversion options"}),e.jsx(o.CheckboxInput,{...m.getFieldProps("formatConversion"),label:e.jsxs("span",{title:y,children:["Convert to raw format"," ",e.jsx(o.Icon,{name:"information",title:y||"Can be skipped if the image is already in raw format to speed up the import."})]}),disabled:!!y,checked:m.values.formatConversion}),e.jsx(o.CheckboxInput,{...m.getFieldProps("virtioConversion"),label:e.jsxs("span",{title:y,children:["Add Virtio drivers"," ",e.jsx(o.Icon,{name:"information",title:y||"Mandatory, if the image does not have Virtio drivers installed."})]}),disabled:!!y,checked:m.values.virtioConversion})]}),e.jsxs("footer",{className:"p-modal__footer",id:"modal-footer",children:[e.jsx(o.Button,{appearance:"base",className:"u-no-margin--bottom",type:"button",onClick:W,children:"Cancel"}),e.jsx(o.ActionButton,{appearance:"positive",className:"u-no-margin--bottom",loading:m.isSubmitting||!!c,disabled:!m.isValid||m.isSubmitting||C||!m.values.file,onClick:()=>{m.submitForm()},children:"Upload and create"})]})]})},ja=({close:t,name:c})=>{const[r,p]=b.useState("instance-backup"),[l,i]=b.useState(null);return e.jsxs(o.Modal,{close:t,className:"upload-instance-modal",title:"Upload instance file",closeOnOutsideClick:!1,children:[e.jsx(Le,{className:"u-no-padding u-no-margin"}),l&&e.jsxs(e.Fragment,{children:[e.jsx(zt,{percentage:Math.floor(l.percentage)}),e.jsxs("p",{children:[he(l.loaded)," loaded of"," ",he(l.total??0)]})]}),r==="instance-backup"&&e.jsx(fa,{close:t,uploadState:l,setUploadState:i,fileType:r,setFileType:p,defaultInstanceName:c}),r==="external-format"&&e.jsx(ya,{close:t,uploadState:l,setUploadState:i,fileType:r,setFileType:p,defaultInstanceName:c})]})},Sa=({name:t})=>{const{openPortal:c,closePortal:r,isOpen:p,Portal:l}=o.usePortal();return e.jsxs(e.Fragment,{children:[e.jsx(o.Button,{onClick:c,type:"button",children:e.jsx("span",{children:"Upload instance file"})}),p&&e.jsx(l,{children:e.jsx(ja,{close:r,name:t})})]})},Fa=({formik:t,onSelectImage:c,project:r})=>{const p=()=>{const l=t.values.image;return l?l.variant?.toLocaleLowerCase().includes("desktop")?`${l.os} ${l.release} ${l.aliases.split(",")[0]}`:l.variant==="iso"?`${l.os} - ${l.aliases.split(",")[0]}`:`${l.os} ${l.release} ${l.release_title}`:""};return e.jsxs(kt,{children:[e.jsx(o.Row,{children:e.jsxs(o.Col,{size:12,children:[e.jsx(o.Input,{id:"name",name:"name",type:"text",label:"Instance name",placeholder:"Enter name",onBlur:t.handleBlur,onChange:t.handleChange,value:t.values.name,error:t.touched.name?t.errors.name:null}),e.jsx($t,{id:"description",name:"description",label:"Description",placeholder:"Enter description",onBlur:t.handleBlur,onChange:t.handleChange,value:t.values.description})]})}),e.jsx(o.Row,{children:e.jsxs(o.Col,{size:12,children:[e.jsx(o.Label,{forId:"select-image",required:!0,children:"Base Image"}),e.jsx("div",{className:"p-form__control u-clearfix base-image",children:t.values.image?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"u-text--muted u-truncate u-sv3 image-name",children:p()}),e.jsx(o.Button,{appearance:"base",type:"button",onClick:async()=>t.setFieldValue("image",void 0),title:"Clear",hasIcon:!0,children:e.jsx(o.Icon,{name:"close"})})]}):e.jsxs(e.Fragment,{children:[e.jsx(da,{onSelect:c}),e.jsx(ha,{onSelect:c}),e.jsx(Sa,{name:t.values.name})]})}),e.jsx(o.Select,{id:"instanceType",label:"Instance type",name:"instanceType",onBlur:t.handleBlur,onChange:t.handleChange,options:Re,value:t.values.instanceType,disabled:!t.values.image||te(t.values.image)||ae(t.values.image),title:t.values.image?"":"Please select an image before adding a type"}),e.jsx(ga,{formik:t})]})}),e.jsx(pt,{project:r,selected:t.values.profiles,setSelected:l=>{t.setFieldValue("profiles",l)},readOnly:!t.values.image,title:t.values.image?"":"Please select an image before adding profiles"}),e.jsx(Ft,{formik:t,disabledReason:t.values.image?"":"Please select an image before adding SSH Keys"}),e.jsx(It,{formik:t,disabledReason:t.values.image?"":"Please select an image before adding user keys"})]})},Qs=()=>{const t=ie(),c=ke(),r=ue(),p=o.useToastNotification(),l=o.useNotify(),{project:i}=Ne(),f=ce(),C=b.useState(null),[h,x]=b.useState(ve),{hasImageRegistries:j}=ze(),P=ca();if(!i)return e.jsx(e.Fragment,{children:"Missing project"});const w=me().shape({name:pe(i,C).optional(),instanceType:Ke().required("Instance type is required"),limits_memory:qe().test("non-zero","Limit must be greater than 0",s=>s?.value!==0),user_keys:Qe}),L=()=>{Ye("form-contents","p-bottom-controls")};b.useEffect(L,[h]),o.useListener(window,L,"resize",!0);const S=()=>{f.invalidateQueries({queryKey:[X.instances]}),f.invalidateQueries({queryKey:[X.operations,i]}),f.invalidateQueries({queryKey:[X.projects,i]})},O=(s,d)=>{p.info(e.jsxs(e.Fragment,{children:["Creation for instance"," ",e.jsx(se,{bold:!0,type:d,value:s})," started."]}))},A=s=>{p.success(e.jsxs(e.Fragment,{children:["Created and started instance ",s,"."]})),S()},D=(s,d)=>{p.success(e.jsxs(e.Fragment,{children:["Created instance ",s,".",d]})),S()},V=(s,d,R,I,k)=>{(I==="toast"?p:l).failure("Instance creation failed",s,null,[{label:"Check configuration",onClick:()=>{r(d,{state:{retryFormValues:R,retryFormSection:k}})}}]),S()},B=(s,d)=>{p.info(e.jsxs(e.Fragment,{children:["Instance ",e.jsx(se,{bold:!0,type:d,value:s})," ","creation has begun. The instance will automatically start upon completion."]}))},g=(s,d,R)=>{const I=e.jsx(ge,{instanceName:s,projectName:i}),k=`${Y}/ui/project/${encodeURIComponent(i)}/instance/${encodeURIComponent(s)}/console`,_=R&&e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"Continue the installation process from its console."}),e.jsxs(o.Button,{onClick:async()=>r(k),hasIcon:!0,children:[e.jsx(o.Icon,{name:"canvas"}),e.jsx("span",{children:"Open console"})]})]});d?A(I):D(I,_)},{data:U=[],isLoading:G}=la(i),E=(s,d=!0)=>{const R=s.yaml?dt(s.yaml):F(s);if(Ce(s,U)){x(xe);return}const I=c.pathname+c.search;r(fe(i));const k={...R,start:d};Oe(JSON.stringify(k),i,s.target).then(_=>{const $=we(_.metadata);if(!$)return;d?B($,s.instanceType):O($,s.instanceType);const a=s.image?.server===ee;t.set(_.metadata.id,()=>{g($,d,a)},q=>{V(new Error(q),I,s,"toast",h)})}).catch(_=>{_.message!=="Cancelled"&&V(_,I,s,void 0,h)})},n=de({initialValues:c.state?.retryFormValues??{instanceType:"container",profiles:["default"],devices:[],cloud_init_ssh_keys:[],user_keys:[],readOnly:!1,entityType:"instance",isCreating:!0},validationSchema:w,onSubmit:s=>{E(s)}});b.useEffect(()=>{G||U.find(d=>d.name==="default")||n.setFieldValue("profiles",[])},[G,U]);const T=n.values.image?.server===ee,u=(s,d)=>{n.setFieldValue("image",s);const R=n.values.devices.filter(I=>I.type!==ia);if(s.server===ee){const I=Yt(s);R.push(I)}n.setFieldValue("devices",R),d?n.setFieldValue("instanceType",d):ae(s)?n.setFieldValue("instanceType","virtual-machine"):te(s)&&n.setFieldValue("instanceType","container"),s.volume?.location&&s.volume.location!=="none"?(n.setFieldValue("target",s.volume?.location),n.setFieldValue("targetSelectedByVolume",!0)):n.setFieldValue("targetSelectedByVolume",void 0)};b.useEffect(()=>{const s=c.state?.selectedImage;s&&u(s,s.type)},[c.state?.selectedImage]),b.useEffect(()=>{c.state?.retryFormSection&&x(c.state.retryFormSection)},[c.state?.retryFormSection]);const F=s=>({...sa(s,j),devices:aa(s.devices),config:{...ta(s),...ea(s),...Zt(s),...Jt(s),...Xt(s),...Ht(s),...Wt(s),...Qt(s),...s.placementGroup&&{"placement.group":s.placementGroup}}}),m=s=>{n.values.yaml&&s!==Z&&n.setFieldValue("yaml",void 0),x(s)},Q=()=>{if(c.state?.retryFormSection===Z&&n.values.yaml)return n.values.yaml;const s=F(n.values);return mt(s)},W=Nt(n),y=Pt(n),v=!n.isValid||!n.values.image||W||y;return e.jsxs(na,{title:e.jsx(Kt,{isConfigVariant:!0,children:"Create an instance"}),contentClassName:"create-instance",children:[e.jsxs(o.Form,{onSubmit:n.handleSubmit,className:"form",children:[h!==Z&&e.jsx(Je,{active:h,setActive:m,isDisabled:!n.values.image,hasDiskError:W||Ce(n.values,U),hasNetworkError:y,formik:n}),e.jsx(o.Row,{className:"form-contents",children:e.jsxs(o.Col,{size:12,children:[e.jsx(Le,{}),h===ve&&e.jsx(Fa,{formik:n,project:i,onSelectImage:u}),h===xe&&e.jsx(Rt,{formik:n,project:i}),h===Ze&&e.jsx(Et,{formik:n,project:i}),h===et&&e.jsx(Tt,{formik:n,project:i}),h===tt&&e.jsx(wt,{formik:n,project:i}),h===at&&e.jsx(Lt,{formik:n,project:i}),h===st&&e.jsx(Ot,{formik:n}),h===nt&&e.jsx(Ut,{formik:n,setSection:m}),h===ot&&e.jsx(At,{formik:n}),h===rt&&e.jsx(_t,{formik:n}),h===lt&&e.jsx(Mt,{formik:n}),h===it&&e.jsx(Vt,{formik:n,project:i}),h===Z&&e.jsx(ct,{yaml:Q(),setYaml:s=>{n.setFieldValue("yaml",s)},children:e.jsx(ra,{entity:"instance",docPath:"/instances"})})]})},h)]}),e.jsxs(oa,{children:[e.jsx("div",{className:"yaml-switch",children:e.jsx(ut,{formik:n,section:h,setSection:m,disableReason:n.values.image?void 0:"Please select an image before adding custom configuration"})}),e.jsx(o.Button,{appearance:"base",onClick:async()=>r(c.state?.cancelLocation??fe(i)),children:"Cancel"}),e.jsx(o.ActionButton,{loading:n.isSubmitting,disabled:v||n.isSubmitting,appearance:T?"positive":"default",onClick:()=>{E(n.values,!1)},children:"Create"}),!T&&e.jsx(o.ActionButton,{appearance:"positive",loading:n.isSubmitting,disabled:v||n.isSubmitting,onClick:()=>{E(n.values)},children:"Create and start"})]}),(P.panel===je.editNetworkDevice||P.panel===je.createNetworkDevice)&&e.jsx(Bt,{project:i,formik:n})]})};export{Qs as default};

Youez - 2016 - github.com/yon3zu
LinuXploit