"use strict";(self.webpackChunkwebadmin=self.webpackChunkwebadmin||[]).push([["libs_dialogs_restart-server_restart-server_component_ts"],{9049:(C,_,e)=>{e.d(_,{A:()=>l});const l=function i(c){return function(s){return c?.[s]}}},11966:(C,_,e)=>{e.d(_,{l:()=>p});var i=e(58750),l=e(21413),c=e(39974),s=e(54360);function p(d){return(0,c.N)((O,P)=>{let v,f,r=!1;const m=()=>{v=O.subscribe((0,s._)(P,void 0,void 0,T=>{f||(f=new l.B,(0,i.Tg)(d(f)).subscribe((0,s._)(P,()=>v?m():r=!0))),f&&f.next(T)})),r&&(v.unsubscribe(),v=null,r=!1,m())};m()})}},60704:(C,_,e)=>{e.r(_),e.d(_,{RestartServerModalContent:()=>X});var i=e(82529),l=e(60177),c=e(89417),s=e(60802),p=e(1807),d=e(96354),O=e(31397),P=e(11966),v=e(88141),r=e(2901),f=e(19689),m=e(58415),T=e(45047),U=e(40221),B=e(48233),W=e(36121),b=e(10391),t=e(4020),S=e(39060),K=e(92388),g=e(84009),y=e(34875),N=e(98718),x=e(60272),G=e(84165),F=e(77894);const j=u=>({title:u});function H(u,J){if(1&u){const A=t.RV6();t.j41(0,"button",6),t.bIt("click",function(){t.eBV(A);const a=t.XpG();return t.Njj(a.close())}),t.nrm(1,"div",7),t.k0s()}}let X=(()=>{class u extends U.f{constructor(A,M,a,Y,$,V,{system:n,server:h}){super(V),this.processService=A,this.dialogs=M,this.ribbonService=a,this.toastService=Y,this.applyService=$,this.LANG=B,this.maxNumberServerChecked=6,this.serverName=h.name,this.restartServer=this.processService.createProcess(()=>{this.unlock();const o=n.serverManager.servers.some(({status:E,id:R})=>"Online"===E&&R!==h.id);return o||this.ribbonService.show(this.LANG.ribbon.systemOffline,[],"alert",void 0,!0),this.applyService.isOnline$.next(o),n.isAvailable=!1,n.serverManager.restartServer(h.id)},{ignoreError:!0},()=>{n.currentBusyServerIds.add(h.id),this.close(b.b0.status.restarting);let o=!1,E=!1,R=0;const z=n.serverManager.getForceServers(!1).pipe((0,d.T)(D=>{if(!D)throw E=!0,Error("no response yet");{const I=Object.fromEntries(D.map(L=>[L.id,L.status]));if(!I[h.id])throw Error("server not found");if("Offline"===I[h.id])throw E=!0,Error("still restarting");if(!E||R<this.maxNumberServerChecked)throw R++,Error("still in the process of restarting")}}),(0,O.Z)(()=>n.getInfo(!0,!1).then(()=>{if(!n.isOnline)throw this.ribbonService.show(this.LANG.ribbon.systemOffline,[],"alert",void 0,!0),Error("system is offline still")}).catch(D=>{throw Error(D)})),(0,P.l)(D=>D.pipe((0,v.M)(I=>{!o&&[502,503].includes(I.status)&&(o=!0,E=!0,this.ribbonService.show(this.LANG.ribbon.systemOffline,[],"alert",void 0,!0))}),(0,r.o)(()=>(0,p.O)(4e3))))).subscribe(()=>{n.isAvailable=!0,this.ribbonService.hide(),n.systemInfo=n,z.unsubscribe()})},o=>{this.unlock(),n.currentBusyServerIds.delete(h.id),n.isAvailable=!0;let E=this.LANG.servers.restartFailed;if(!o||"TimeoutError"!==o.name&&503!==o.status)if(o.errorId===b.b0.errors.oldSessionErrorId)this.toastService.notify(this.LANG.servers.restartFailed,T.C.Warning);else{if(403===o.status||o.errorId===b.b0.errors.unauthorized)return this.dialogs.expiredSession().then(()=>window.location.reload());this.toastService.notify(E,T.C.Warning)}else E=this.LANG.servers.serverOffline,this.close(b.b0.status.offline),this.toastService.notify(E,T.C.Warning)})}static{this.\u0275fac=function(M){return new(M||u)(t.rXU(S.z),t.rXU(K.L),t.rXU(g.W),t.rXU(y.z),t.rXU(N.i),t.rXU(i.ce),t.rXU(i.Qs))}}static{this.\u0275cmp=t.VBU({type:u,selectors:[["nx-modal-restart-server-content"]],features:[t.Vt3],decls:11,vars:20,consts:[[1,"modal-header"],[1,"modal-title",3,"innerHTML"],["type","button","class","close","data-dismiss","modal","aria-label","Close",3,"click",4,"ngIf"],[1,"modal-footer"],[3,"process","actionType","buttonText"],[3,"process","cancelFn","discardFn"],["type","button","data-dismiss","modal","aria-label","Close",1,"close",3,"click"],[1,"close-content"]],template:function(M,a){1&M&&(t.j41(0,"div")(1,"div",0),t.nrm(2,"h1",1),t.nI1(3,"escapeHTML"),t.nI1(4,"translate"),t.nI1(5,"safe"),t.DNE(6,H,2,0,"button",2),t.k0s(),t.j41(7,"div",3),t.nrm(8,"nx-process-button",4),t.nI1(9,"translate"),t.nrm(10,"nx-cancel-button",5),t.k0s()()),2&M&&(t.R7$(2),t.Y8G("innerHTML",t.i5U(5,13,t.i5U(4,10,a.LANG.dialogs.titles.serversRestart,t.eq3(18,j,t.bMT(3,8,a.serverName))),"html"),t.npT),t.R7$(4),t.Y8G("ngIf",a.closable),t.R7$(2),t.FS9("buttonText",t.bMT(9,16,"Restart")),t.Y8G("process",a.restartServer)("actionType","primary"),t.R7$(2),t.Y8G("process",a.restartServer)("cancelFn",a.unlock)("discardFn",a.close))},dependencies:[l.MD,l.bT,c.YN,s.h,x.D,W.Y,G.l,F.i,f.f,m.N],encapsulation:2})}}return u})()},84165:(C,_,e)=>{e.d(_,{l:()=>c});var i=e(92408),l=e(4020);let c=(()=>{class s{transform(d){return(0,i.A)(d)}static{this.\u0275fac=function(O){return new(O||s)}}static{this.\u0275pipe=l.EJ8({name:"escapeHTML",type:s,pure:!0})}}return s})()},92408:(C,_,e)=>{e.d(_,{A:()=>v});const s=(0,e(9049).A)({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});var p=e(70591),d=/[&<>"']/g,O=RegExp(d.source);const v=function P(r){return(r=(0,p.A)(r))&&O.test(r)?r.replace(d,s):r}}}]);