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/41228/share/lxd-ui/assets/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /snap/lxd/41228/share/lxd-ui/assets/EditReplicatorPanel-Bm8QIS1m.js
import{d as o,j as e,L as T,R as p,ay as w,bA as Q,u as D,O as V,t as C,ar as ne,c8 as H,z as K,w as ae,s as M,c as oe,r as E,D as U,q as k,ap as z,B as q,K as re,c9 as ie,af as ce,ac as le,e as ue,f as de,h as pe,o as me}from"./index-C5moRkRM.js";import{R as G}from"./ResourceLabel-5vQU6ndJ.js";import{u as J,a as he}from"./useEscCallback-CiLQokzn.js";import{C as je}from"./ConfirmationCheckbox-DamTlu4y.js";import{R as I}from"./ResourceLink-CSSa-WON.js";import{u as ge,b as fe,a as xe}from"./useClusterLinks-BDw2JUo9.js";import{u as Re}from"./useIdentities-C0Vj9TWR.js";import{a as ye}from"./useInstances-B6o12EBG.js";import{a as Y,g as be,c as ve,C as O}from"./ClusterLinkRichChip-DuawR_xB.js";import{P as $}from"./ProjectRichChip-CJO1yxV_.js";import{P as Ce}from"./ProjectSelector-BglOCzqU.js";import{R as Se,S as Ne}from"./RichTooltipTable-D64CU4ks.js";import{I as Pe}from"./ItemName-Dt16GXN3.js";import{E as $e}from"./ExplanationTooltip-AfbgOckm.js";const Fe=({onChange:t,name:a="cluster",label:s="Cluster",value:n="",error:r,required:m=!1,help:l,emptyOptionLabel:u="Select a cluster",...i})=>{const{data:h=[],error:S,isLoading:j}=ge(),g=o.useNotify(),y=h.map(f=>f.name),x=h.length===0&&!j,R=!!n&&!j&&!y.includes(n),N=R?"Clear value":"No cluster links available";S&&g.failure("Loading cluster links failed",S);const b=h.map(f=>({value:f.name,text:f.name,label:e.jsxs("div",{className:"cluster-link-label",children:[e.jsx("span",{className:"cluster-link-name u-truncate",title:f.name,children:f.name}),e.jsx("span",{className:"u-text--muted",children:e.jsx(Y,{link:f})})]})})),c=R?[{value:n,label:`${n} (no longer available)`}]:[],F=R?`Selected cluster link "${n}" no longer exists. Select another cluster link or clear the value.`:r,L=x?[...c,{value:"",label:N}]:[{value:"",label:u},...c,...b],P=e.jsxs(e.Fragment,{children:[l,x?e.jsxs(e.Fragment,{children:["Create your first"," ",e.jsx(T,{to:`${p}/ui/cluster/links`,children:"cluster link"}),"."]}):e.jsxs(e.Fragment,{children:["Manage your"," ",e.jsx(T,{to:`${p}/ui/cluster/links`,children:"cluster links"}),"."]})]});return e.jsx(o.CustomSelect,{...i,name:a,label:s,options:L,value:n,help:P,required:m,error:F,onChange:t})},we=({children:t})=>e.jsx($e,{className:"explanation-tooltip-wrapper--inline",explanation:"Replicators copy instances between clusters across cluster links.",docPath:"/explanation/replicators/",docLabel:"Learn more about replicators",children:t}),W=["can_edit","can_delete"],Le=async(t,a)=>{const s=new URLSearchParams;return t?s.set("project",t):s.set("all-projects","true"),s.set("recursion","1"),Q(s,a,W),fetch(`${p}/1.0/replicators?${s.toString()}`).then(w).then(n=>n.metadata)},Ie=async(t,a,s)=>{const n=new URLSearchParams;return n.set("recursion","1"),n.set("project",a),Q(n,s,W),fetch(`${p}/1.0/replicators/${encodeURIComponent(t)}?${n.toString()}`).then(w).then(r=>r.metadata)},at=async(t,a)=>{await fetch(`${p}/1.0/replicators/${encodeURIComponent(t)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a})}).then(w)},Te=async(t,a)=>{await fetch(`${p}/1.0/replicators/${encodeURIComponent(t)}?project=${encodeURIComponent(a)}`,{method:"DELETE"}).then(w)},ot=async(t,a)=>{const s=new URLSearchParams;s.set("project",a),await fetch(`${p}/1.0/replicators?${s.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:t}).then(w)},Ee=async(t,a,s)=>{const n=new URLSearchParams;n.set("project",a),await fetch(`${p}/1.0/replicators/${encodeURIComponent(t)}?${n.toString()}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:s}).then(w)},Ue=async(t,a,s)=>fetch(`${p}/1.0/replicators/${encodeURIComponent(t)}/state?project=${encodeURIComponent(a)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:s})}).then(w).then(n=>n),rt=(t=null,a=!0)=>{const{isFineGrained:s}=D();return V({queryKey:[C.projects,t,C.replicators],queryFn:async()=>Le(t,s),enabled:a&&s!==null})},X=(t,a,s=!0)=>{const{isFineGrained:n}=D();return V({queryKey:[C.projects,a,C.replicators,t],queryFn:async()=>Ie(t,a,n),enabled:s&&n!==null})},ke=({replicator:t})=>ne(t.last_run_at)||"Never",_e={Completed:"status-succeeded-small",Failed:"status-failed-small",Running:"status-waiting-small",Pending:"status-queued-small"},Be=({replicator:t})=>{const s=H().getStatus(t),n=_e[s]??"";return e.jsxs(e.Fragment,{children:[e.jsx(o.Icon,{name:n,className:"status-icon"}),s]})},A=()=>{const{isFineGrained:t}=D();return{canDeleteReplicator:n=>K(t,"can_delete",n?.access_entitlements),canEditReplicator:n=>K(t,"can_edit",n?.access_entitlements)}},Oe=({replicatorName:t,project:a})=>{const{data:s,isLoading:n}=X(t,a),r=!!s&&!!s.config?.cluster,{data:m}=fe(s?.config.cluster||"",r);if(!s&&!n)return e.jsxs(e.Fragment,{children:["Replicator ",e.jsx(G,{type:"replicator",value:t})," ","not found"]});const l=[{title:"Replicator",value:!s||n?e.jsx(o.Spinner,{}):e.jsx(T,{to:`${p}/ui/project/${encodeURIComponent(a)}/replicator/${encodeURIComponent(t)}`,onClick:u=>{u.stopPropagation()},children:e.jsx(Pe,{item:{name:t}})}),valueTitle:t},{title:"Description",value:s?.description||"-",valueTitle:s?.description||""},{title:"Source project",value:s?e.jsx(I,{type:"project",value:s.project,to:`${p}/ui/project/${encodeURIComponent(s.project)}/configuration/replication`}):"-",valueTitle:s?.project||""},{title:"Cluster",value:s?e.jsx(I,{type:"cluster-link",value:s.config.cluster,to:`${p}/ui/cluster/links`}):"-",valueTitle:s?.config?.cluster||""},{title:"Cluster status",value:m?e.jsx(Y,{link:m}):"-",className:"status-row"},{title:"Schedule",value:s?.config?.schedule||"-",valueTitle:s?.config?.schedule||""},{title:"Last run at",value:s?e.jsx(ke,{replicator:s}):"-"},{title:"Status",value:s?e.jsx(Be,{replicator:s}):"-",className:"status-row"}];return e.jsx(Se,{rows:l,className:"replicator-rich-tooltip-table"})},Z=({replicator:t,project:a,className:s,disabled:n})=>{const r=!ae(Ne,"height"),m=`${p}/ui/project/${encodeURIComponent(a)}/replicator/${encodeURIComponent(t)}`,l=e.jsx(I,{type:"replicator",value:t,to:m,hasTitle:!r,className:s,disabled:n});return r?e.jsx(o.Tooltip,{zIndex:1e3,position:"right",message:e.jsx(Oe,{replicatorName:t,project:a}),children:l}):e.jsx(e.Fragment,{children:l})},it=({replicator:t,className:a,onClose:s,hasLabel:n=!1})=>{const r=M(),m=oe(),l=o.useNotify(),u=o.useToastNotification(),[i,h]=E.useState(!1),{canDeleteReplicator:S}=A(),j=t.last_run_status==="Running",g=()=>{if(!S(t))return"You do not have permission to delete this replicator"},y=c=>{u.success(e.jsxs(e.Fragment,{children:["Replicator"," ",e.jsx(G,{bold:!0,type:"replicator",value:c})," deleted."]}))},x=()=>{r.invalidateQueries({predicate:c=>c.queryKey[2]===C.replicators})},R=()=>{x();const c=`${p}/ui/project/${encodeURIComponent(t.project)}/replicator/${encodeURIComponent(t.name)}`;location.pathname.startsWith(c)&&m(`${p}/ui/cluster/replicators`),y(t.name)},N=c=>{x(),h(!1),l.failure(`Deleting replicator ${t.name} failed`,c)},b=()=>{h(!0),Te(t.name,t.project).then(R).catch(N)};return e.jsxs(o.ConfirmationButton,{type:"button",onHoverText:g(),appearance:n?"default":"base",className:k("u-no-margin--bottom has-icon",a,{"is-dense":!n}),loading:i,confirmationModalProps:{title:"Confirm delete",children:e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["This will permanently delete replicator"," ",e.jsx(Z,{replicator:t.name,project:t.project}),"."]}),e.jsx("p",{children:"Scheduled refreshes to the standby cluster will stop."}),e.jsx("p",{children:"Instances on the standby cluster remain available, but they will no longer receive updates."}),j&&e.jsx(o.Notification,{severity:"caution",title:"Replicator is currently running.",children:"This replicator is actively transferring data. Deleting it now will not cancel ongoing instance refresh operations."})]}),onConfirm:b,confirmButtonLabel:"Delete",confirmButtonProps:{type:"button"},cancelButtonProps:{type:"button"},close:s},disabled:!!g()||i,shiftClickEnabled:!0,showShiftClickHint:!0,children:[e.jsx(U,{icon:"delete"}),n&&e.jsx("span",{children:"Delete"})]})},ct=({replicator:t,className:a,onClose:s,hasLabel:n=!1})=>{const{canEditReplicator:r}=A(),{openEditReplicator:m}=J(),l=()=>{if(!r(t))return"You do not have permission to edit this replicator"};return e.jsxs(o.Button,{type:"button",appearance:n?"default":"base","aria-label":"Edit replicator",className:k("u-no-margin--bottom has-icon",a,{"is-dense":!n}),onClick:()=>{m(t.project,t.name),s?.()},title:l()??"Edit",disabled:!!l(),children:[e.jsx(U,{icon:"edit"}),n&&e.jsx("span",{children:"Edit"})]})},qe=({check:t})=>{const a=()=>t.status==="loading"?e.jsx(o.Spinner,{className:"u-no-padding--top"}):t.status==="pass"?e.jsx(U,{icon:"success-fill"}):t.status==="fail"?e.jsx(U,{icon:"error-fill"}):null;return e.jsxs("div",{className:"preflight-check-row",children:[e.jsxs("div",{className:"u-flex u-gap--small",children:[a(),e.jsx("p",{className:k("u-no-padding--top","u-no-margin--bottom",{"u-text--muted":t.status==="loading"}),children:t.label})]}),t.message&&t.status==="fail"&&e.jsx("p",{className:"preflight-check-row-error-message u-text--muted u-no-padding--top u-no-margin--bottom",children:t.message})]})},De=({replicator:t,onValidationChange:a,isRestore:s=!1})=>{const{data:n,isLoading:r}=z(t.project),{data:m,isLoading:l}=ye(t.project),{data:u=[]}=Re(),{data:i,isLoading:h}=xe(t.config?.cluster||""),S=be(u,t.config?.cluster),j=[],g=n?.replica_mode,y=g==="leader"||g==="standby",x=`/ui/project/${encodeURIComponent(t.project)}/configuration/replication`,R=window.location.pathname.includes(x);j.push({id:"project-mode",label:g?e.jsxs(e.Fragment,{children:["Project"," ",e.jsx($,{projectName:t.project,urlSuffix:"/configuration/replication"})," ","is in ",e.jsx("strong",{children:g})," mode"]}):e.jsxs(e.Fragment,{children:["Project"," ",e.jsx($,{projectName:t.project,urlSuffix:"/configuration/replication"})," ",e.jsx("strong",{children:"replica mode"})," is unset"]}),status:r?"loading":y?"pass":"fail",message:!r&&!y?e.jsxs(e.Fragment,{children:[g?e.jsxs(e.Fragment,{children:["The project replica mode ",e.jsx("strong",{children:g})," is invalid."]}):null," ","It must be either ",e.jsx("strong",{children:"leader"})," or ",e.jsx("strong",{children:"standby"})," ","to run replicator.",!R&&e.jsxs(e.Fragment,{children:[" ",e.jsx(T,{to:x,children:"See project configuration"})]})]}):void 0});const N=n?.config?.["replica.cluster"],b=t.config?.cluster;if(!r&&g==="standby"&&!!N){const d=N===b;j.push({id:"replica-cluster-match",label:e.jsxs(e.Fragment,{children:["Project"," ",e.jsx($,{projectName:n?.name||"default",urlSuffix:"/configuration/replication"})," ",e.jsx("strong",{children:"replica cluster"})," configuration matches replicator cluster"]}),status:d?"pass":"fail",message:d?void 0:e.jsxs(e.Fragment,{children:["Project replica cluster ",e.jsx("strong",{children:N||"none"})," ","does not equal replicator cluster"," ",e.jsx("strong",{children:b||"none"}),".",!R&&e.jsxs(e.Fragment,{children:[" ",e.jsx(T,{to:x,children:"See project configuration"})]})]})})}const F=ve(S,i),L=F==="Reachable";if(j.push({id:"cluster-link-reachable",label:e.jsxs(e.Fragment,{children:["Cluster link"," ",e.jsx(O,{clusterLink:t.config?.cluster})," is reachable"]}),status:h?"loading":L?"pass":"fail",message:!h&&!L?`Cluster link status is '${F}' but must be 'Reachable' to run replicator. Ensure both clusters are online, can reach each other over the network, and the link is configured bi-directionally.`:void 0}),s){const d=m?.filter(B=>B.project===t.project&&B.status==="Running")||[],_=d.length===0;j.push({id:"instances-stopped",label:e.jsxs(e.Fragment,{children:["All instances in the project"," ",e.jsx($,{projectName:t.project})," are stopped"]}),status:l?"loading":_?"pass":"fail",message:!l&&!_?`${d.length} running ${q("instance",d.length)} in the project. Stop ${d.length>1?"them":"it"} to allow restore.`:void 0})}const P=j.every(d=>d.status==="pass"),f=j.some(d=>d.status==="loading");return E.useEffect(()=>{a(P&&!f)},[P,f,a]),e.jsx(o.List,{items:j.map(d=>e.jsx(qe,{check:d},d.id)),className:"u-no-margin--bottom"})},lt=({replicator:t,className:a,hasLabel:s=!1,onClose:n})=>{const r=M(),m=re(),l=o.useToastNotification(),u=H(),[i,h]=E.useState(!1),[S,j]=E.useState(!1),{canEditReplicator:g}=A(),{data:y,isLoading:x}=z(t.project),[R,N]=E.useState(!1),b=t.config.cluster,c=ie(y),F=c?"Restore":"Run",L=g(t),P=y?ce(y).length:0,f=()=>{if(!L)return"You do not have permission to run this replicator";if(i)return"Replicator is starting...";if(u.getStatus(t)==="Running")return"This replicator is currently running"},d=()=>{r.invalidateQueries({predicate:v=>v.queryKey[2]===C.replicators})},_=()=>{h(!1),u.clearLastRunError(t),u.setRunning(t),d(),l.info(e.jsxs(e.Fragment,{children:["Replicator"," ",e.jsx(I,{type:"replicator",value:t.name,to:`${p}/ui/project/${encodeURIComponent(t.project)}/replicator/${encodeURIComponent(t.name)}`})," ","started."]}))},B=v=>{h(!1),u.setFinish(t),d(),l.failure(`Running replicator ${t.name} failed`,v)},ee=()=>{u.setFinish(t),u.clearLastRunError(t),l.success(e.jsxs(e.Fragment,{children:["Replicator"," ",e.jsx(I,{type:"replicator",value:t.name,to:`${p}/ui/project/${encodeURIComponent(t.project)}/replicator/${encodeURIComponent(t.name)}`})," ","completed successfully."]})),d()},te=v=>{u.setFinish(t),u.setLastRunError(t,v),d(),l.failure(`Replicator ${t.name} failed while running`,new Error(v))},se=()=>{h(!0),Ue(t.name,t.project,c?"restore":"start").then(v=>{_(),m.set(v.metadata.id,ee,te,d)}).catch(B)};return e.jsxs(o.ConfirmationButton,{type:"button",onHoverText:f(),appearance:s?"default":"base",className:k("u-no-margin has-icon",a,{"is-dense":!s}),loading:i||x,confirmationModalProps:{className:"run-replicator-modal",title:e.jsxs(e.Fragment,{children:[c?"Restore":"Run"," replicator"," ",e.jsx(I,{type:"replicator",value:t.name,to:`${p}/ui/project/${encodeURIComponent(t.project)}/replicator/${encodeURIComponent(t.name)}`})]}),children:e.jsxs(e.Fragment,{children:[e.jsx(De,{replicator:t,onValidationChange:v=>{j(v)},isRestore:c}),e.jsxs("div",{className:k("replicator-data-flow u-hide--small",{"replicator-data-flow--restore":c}),children:[e.jsxs("div",{className:"replicator-data-flow__node replicator-data-flow__source",children:[e.jsxs("span",{className:"node-heading u-text--muted",children:[c?"standby":"leader"," project (local)"]}),e.jsx($,{projectName:t.project,urlSuffix:"/configuration/replication"})]}),e.jsx("div",{className:"replicator-data-flow__arrow-shaft",children:e.jsx(O,{clusterLink:b})}),e.jsxs("div",{className:"replicator-data-flow__node replicator-data-flow__target",children:[e.jsxs("span",{className:"node-heading u-text--muted",children:[c?"leader":"standby"," project (remote)"]}),e.jsx("strong",{className:"mono-font",children:t.project})]})]}),c?e.jsxs("p",{children:["This will sync all instances from the"," ",e.jsx(O,{clusterLink:b})," cluster back to the"," ",e.jsx($,{projectName:t.project,urlSuffix:"/configuration/replication"})," ","project."]}):e.jsxs("p",{children:["This will sync ",P," ",q("instance",P)," from the source project ",e.jsx($,{projectName:t.project})," to the standby cluster"," ",e.jsx(O,{clusterLink:b}),"."]}),c&&e.jsx(o.Notification,{severity:"caution",messageElement:"div",title:"All local data will be overwritten by the remote version",children:e.jsxs("p",{children:[P," ",q("instance",P)," ","in local project"," ",e.jsx($,{projectName:t.project})," will be permanently replaced by the version fetched from the remote cluster. This cannot be undone."]})})]}),onConfirm:se,confirmButtonLabel:F,confirmButtonProps:{type:"button"},cancelButtonProps:{type:"button"},confirmButtonDisabled:!S||i||c&&!R,close:n,confirmExtra:c?e.jsx(je,{label:"Overwrite local data",confirmed:[R,N],disabled:!S||i}):void 0},disabled:!!f(),children:[e.jsx(U,{icon:"play"}),s&&e.jsx("span",{children:F})]})},Me=({formik:t})=>e.jsx(o.Input,{...t.getFieldProps("schedule"),id:"schedule",name:"schedule",label:"Schedule",placeholder:"Enter cron expression",help:"Cron expression specifying replicator schedule: <minute> <hour> <dom> <month> <dow> or a comma-separated list of schedule aliases (@hourly, @daily, @midnight, @weekly, @monthly, @annually, @yearly).",type:"text"}),Ae=({formik:t,isEdit:a=!1})=>{const{data:s=[]}=le(),n=r=>t.touched[r]?t.errors[r]:void 0;return e.jsxs(o.Form,{onSubmit:t.handleSubmit,children:[e.jsx(o.Input,{type:"submit",hidden:!0,value:"Hidden input"}),e.jsx(Fe,{value:t.values.cluster,required:!0,error:t.touched.cluster?t.errors.cluster:void 0,onChange:r=>{t.setFieldError("cluster",void 0),t.setFieldTouched("cluster",!0,!1),t.setFieldValue("cluster",r,!1).then(()=>{t.validateField("cluster")})},help:"Cluster to replicate to. ",takeFocus:!0}),a?e.jsx(o.OutputField,{id:"Name",label:"Name",value:t.values.name,help:e.jsxs(e.Fragment,{children:["Click the name in the header of the"," ",e.jsx(T,{to:`${p}/ui/project/${encodeURIComponent(t.values.project)}/replicator/${encodeURIComponent(t.values.name)}`,children:"detail page"})," ","to rename the replicator."]})}):e.jsx(o.Input,{...t.getFieldProps("name"),type:"text",label:"Name",required:!0,error:n("name"),placeholder:"Enter name"}),e.jsx(o.Input,{...t.getFieldProps("description"),type:"text",autoFocus:a,label:"Description",placeholder:"Enter description",error:n("description")}),a?e.jsx(o.OutputField,{id:"Project",label:"Project",value:t.values.project,help:"Project cannot be changed."}):e.jsx(Ce,{id:"project",name:"project",label:"Project",value:t.values.project||"",setValue:r=>{t.setFieldValue("project",r)},disabled:a,projects:s,help:"Source project.",required:!0,error:n("project")}),e.jsx(Me,{formik:t})]})},Ke=t=>({name:t.values.name,description:t.values.description,config:{cluster:t.values.cluster,schedule:t.values.schedule}}),ut=()=>{const t=J(),a=o.useNotify(),s=o.useToastNotification(),n=M(),r=t.replicator??"",{data:m}=X(r,t.project,!!r),l=ue().shape({cluster:de().required("Cluster is required.")}),u=()=>{t.clear(),a.clear()};he(u);const i=pe({initialValues:{isCreating:!1,name:r||"",description:m?.description||"",project:t.project,cluster:m?.config?.cluster||"",schedule:m?.config?.schedule||""},enableReinitialize:!0,validationSchema:l,validateOnChange:!0,onSubmit:()=>{Ee(i.values.name,t.project,JSON.stringify(Ke(i))).then(()=>{s.success(e.jsxs(e.Fragment,{children:["Replicator"," ",e.jsx(Z,{replicator:i.values.name,project:i.values.project})," ","updated."]})),n.invalidateQueries({queryKey:[C.projects,i.values.project,C.replicators]}),n.invalidateQueries({queryKey:[C.projects,null,C.replicators]}),u()}).catch(h=>{a.failure("Replicator update failed",h),i.setSubmitting(!1)})}});return e.jsx(e.Fragment,{children:e.jsxs(o.SidePanel,{children:[e.jsx(o.SidePanel.Header,{children:e.jsx(o.SidePanel.HeaderTitle,{children:e.jsx(we,{children:"Edit replicator"})})}),e.jsx(me,{className:"u-no-padding"}),e.jsx(o.SidePanel.Content,{className:"u-no-padding",children:e.jsx(o.ScrollableContainer,{dependencies:[a.notification],belowIds:["panel-footer"],children:e.jsx(Ae,{formik:i,isEdit:!0})})}),e.jsxs(o.SidePanel.Footer,{className:"u-align--right",children:[e.jsx(o.Button,{appearance:"base",onClick:u,className:"u-no-margin--bottom",children:"Cancel"}),e.jsx(o.ActionButton,{appearance:"positive",onClick:()=>{i.submitForm()},className:"u-no-margin--bottom",disabled:!i.isValid||i.isSubmitting||!i.values.name,loading:i.isSubmitting,children:"Update"})]})]})})};export{Fe as C,it as D,ct as E,we as R,Z as a,Ae as b,ot as c,Be as d,ke as e,lt as f,Ke as g,ut as h,A as i,X as j,at as r,rt as u};

Youez - 2016 - github.com/yon3zu
LinuXploit