Local modifications to ClusterLabs/Anvil by Alteeve
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1 lines
12 KiB

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[16],{93016:function(e,n,t){t.d(n,{S:function(){return O},M:function(){return X}});var r=t(85893),l=t(53183),s=t(24378),i=t(12641),o=t(55278),c=t(89262),a=t(14440),u=t(65086),d=t(94246),h=t(5152),x=t.n(h),f=t(67294),v=t(65895);let j="0xffe3",m="0xffe9";var p=[{keys:"Ctrl + Alt + Delete",scans:[]},{keys:"Ctrl + Alt + F1",scans:[j,m,"0xffbe"]},{keys:"Ctrl + Alt + F2",scans:[j,m,"0xffbf"]},{keys:"Ctrl + Alt + F3",scans:[j,m,"0xffc0"]},{keys:"Ctrl + Alt + F4",scans:[j,m,"0xffc1"]},{keys:"Ctrl + Alt + F5",scans:[j,m,"0xffc2"]},{keys:"Ctrl + Alt + F6",scans:[j,m,"0xffc3"]},{keys:"Ctrl + Alt + F7",scans:[j,m,"0xffc4"]},{keys:"Ctrl + Alt + F8",scans:[j,m,"0xffc5"]},{keys:"Ctrl + Alt + F9",scans:[j,m,"0xffc6"]}],C=t(23833),g=t(23930),Z=t(5552),w=t(98484),k=t(14789),b=t(99429),y=t(60207),S=e=>{let{getItemDisabled:n,items:t={},muiMenuProps:l,onItemClick:s,open:i,renderItem:o}=e,c=(0,f.useMemo)(()=>Object.entries(t),[t]),a=(0,f.useMemo)(()=>c.map(e=>{let[t,l]=e;return(0,r.jsx)(C.Z,{disabled:null==n?void 0:n.call(null,t,l),onClick:function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==s?void 0:s.call(null,t,l,...n)},children:null==o?void 0:o.call(null,t,l)},t)}),[n,s,c,o]);return(0,r.jsx)(u.Z,{open:i,...l,children:a})},A=e=>{let{children:n,containedButtonProps:t,iconButtonProps:l,muiMenuProps:s,onButtonClick:i,onItemClick:o,variant:c="icon",...u}=e,[d,h]=(0,f.useState)(null),x=(0,f.useMemo)(()=>!!d,[d]),v=(0,f.useMemo)(()=>n||("icon"===c?(0,r.jsx)(k.Z,{fontSize:null==l?void 0:l.size}):"Options"),[n,null==l?void 0:l.size,c]),j=(0,f.useCallback)(function(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];let{0:{currentTarget:r}}=n;return h(r),null==i?void 0:i.call(null,...n)},[i]),m=(0,f.useMemo)(()=>"contained"===c?(0,r.jsx)(b.Z,{onClick:j,...t,children:v}):(0,r.jsx)(y.Z,{onClick:j,...l,children:v}),[j,v,t,l,c]),p=(0,f.useCallback)(function(e,n){for(var t=arguments.length,r=Array(t>2?t-2:0),l=2;l<t;l++)r[l-2]=arguments[l];return h(null),null==o?void 0:o.call(null,e,n,...r)},[o]);return(0,r.jsxs)(a.Z,{children:[m,(0,r.jsx)(S,{muiMenuProps:{anchorEl:d,keepMounted:!0,onClose:()=>h(null),...s},onItemClick:p,open:x,...u})]})},F=t(97607),P=t(59278),M=t(2188),z=e=>{var n;let{getItemDisabled:t,items:l,onItemClick:s,renderItem:i,serverName:o,serverState:c,serverUuid:u,...d}=e,{confirmDialog:h,setConfirmDialogOpen:x,setConfirmDialogProps:v,finishConfirm:j}=(0,M.Z)(),m=(0,f.useMemo)(()=>({"force-off":{colour:"red",description:(0,r.jsx)(r.Fragment,{children:"This is equal to pulling the power cord, which may cause data loss or system corruption."}),label:"Force off",path:"/command/stop-server/".concat(u,"?force=1")},"power-off":{description:(0,r.jsx)(r.Fragment,{children:"This is equal to pushing the power button. If the server doesn't respond to the corresponding signals, you may have to manually shut it down."}),label:"Power off",path:"/command/stop-server/".concat(u)},"power-on":{description:(0,r.jsx)(r.Fragment,{children:"This is equal to pushing the power button."}),label:"Power on",path:"/command/start-server/".concat(u)}}),[u]);return(0,r.jsxs)(a.Z,{children:[(0,r.jsx)(A,{getItemDisabled:e=>"running"===c===e.includes("on"),items:m,onItemClick:(e,n)=>{let{colour:t,description:l,label:s,path:i}=n,c=s.toLocaleLowerCase();v({actionProceedText:s,content:(0,r.jsx)(P.Ac,{children:l}),onProceedAppend:()=>{v(e=>({...e,loading:!0})),w.Z.put(i).then(()=>{j("Success",{children:(0,r.jsxs)(r.Fragment,{children:["Successfully registered ",c," job on ",o,"."]})})}).catch(e=>{let n=(0,F.Z)(e);n.children=(0,r.jsxs)(r.Fragment,{children:["Failed to register ",c," job on ",o,"; CAUSE:"," ",n.children,"."]}),j("Error",n)})},proceedColour:t,titleText:"".concat(s," server ").concat(o,"?")}),x(!0)},renderItem:(e,n)=>{let t;let{colour:l,label:s}=n;return l&&(t=b.D[l]),(0,r.jsx)(P.Ac,{inheritColour:!0,color:t,children:s})},...d,children:(0,r.jsx)(Z.Z,{fontSize:null==d?void 0:null===(n=d.iconButtonProps)||void 0===n?void 0:n.size})}),h]})},E=t(25137),B=t(6946),I=t(6631);let T="FullSize",U={displayBox:"".concat(T,"-displayBox"),spinnerBox:"".concat(T,"-spinnerBox")},_=(0,c.ZP)("div")(()=>({["& .".concat(U.displayBox)]:{width:"75vw",height:"75vh"},["& .".concat(U.spinnerBox)]:{flexDirection:"column",width:"75vw",height:"75vh",alignItems:"center",justifyContent:"center"}})),D=x()(()=>Promise.all([t.e(460),t.e(724)]).then(t.bind(t,38724)),{loadableGenerated:{webpack:()=>[38724]},ssr:!1}),N={1e3:"in-use by another process?",1006:"destination is down?"},L=(e,n)=>"ws://".concat(e,"/ws/server/vnc/").concat(n);var O=e=>{let{onClickCloseButton:n,serverUUID:t,serverName:c,vncReconnectTimerStart:h=10}=e,{buildCookieJar:x}=(0,B.Z)(),j=(0,I.Z)(),[m,Z]=(0,f.useState)(null),[w,k]=(0,f.useState)(void 0),[b,y]=(0,f.useState)(!1),[S,A]=(0,f.useState)(!1),[F,M]=(0,f.useState)(),[T,O]=(0,f.useState)(),[R,q]=(0,f.useState)(h),G=(0,f.useRef)(null),H=(0,f.useRef)(null),J=e=>{Z(e.currentTarget)},K=e=>{if(G.current){if(e.length){for(let n=0;n<=e.length-1;n+=1)G.current.sendKey(e[n],1);for(let n=e.length-1;n>=0;n-=1)G.current.sendKey(e[n],0)}else G.current.sendCtrlAltDel();Z(null)}},V=(0,f.useCallback)(()=>{y(!0),A(!1),k({url:L(window.location.host,t)})},[t]),$=(0,f.useCallback)(()=>{(null==G?void 0:G.current)&&(G.current.disconnect(),G.current=null),k(void 0)},[]),W=(0,f.useCallback)(()=>{$(),V()},[V,$]),Q=(0,f.useCallback)(()=>{let e=setInterval(()=>{q(n=>{let t=n-1;return t<1&&clearInterval(e),t})},1e3)},[]),X=(0,f.useCallback)(()=>{y(!1)},[]),Y=(0,f.useCallback)(e=>{let{detail:n}=e,{clean:t}=n;t||(y(!1),A(!0),Q())},[Q]),ee=(0,f.useCallback)(e=>{if(!e){M(void 0);return}let{code:n,reason:r}=e,l="ws: ".concat(n),s=N[n];s&&(l+=" (".concat(s,")")),r&&(l+=", ".concat(r)),M(l);let i=x()["suiapi.vncerror.".concat(t)];if(!i){O(void 0);return}let{code:o,message:c}=i;O("api: ".concat(o,", ").concat(c))},[x,t]),en=(0,f.useMemo)(()=>!b&&!S,[b,S]),et=(0,f.useMemo)(()=>(0,r.jsx)(a.Z,{children:(0,r.jsx)(v.Z,{onClick:()=>{var e;null===(e=H.current)||void 0===e||e.requestFullscreen()},children:(0,r.jsx)(l.Z,{})})}),[]),er=(0,f.useMemo)(()=>(0,r.jsxs)(a.Z,{children:[(0,r.jsx)(v.Z,{onClick:J,children:(0,r.jsx)(s.Z,{})}),(0,r.jsx)(u.Z,{anchorEl:m,keepMounted:!0,open:!!m,onClose:()=>Z(null),children:p.map(e=>{let{keys:n,scans:t}=e;return(0,r.jsx)(C.Z,{onClick:()=>K(t),children:(0,r.jsx)(d.Z,{variant:"subtitle1",children:n})},n)})})]}),[m]),el=(0,f.useMemo)(()=>(0,r.jsx)(a.Z,{children:(0,r.jsx)(v.Z,{onClick:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];$(),null==n||n.call(null,...t)},children:(0,r.jsx)(i.Z,{})})}),[$,n]),es=(0,f.useMemo)(()=>(0,r.jsx)(a.Z,{children:(0,r.jsx)(v.Z,{onClick:()=>{window&&($(),window.location.assign("/"))},children:(0,r.jsx)(o.Z,{})})}),[$]),ei=(0,f.useMemo)(()=>en&&(0,r.jsxs)(r.Fragment,{children:[et,er,(0,r.jsx)(z,{serverName:c,serverState:"running",serverUuid:t}),es,el]}),[et,er,es,c,t,en,el]);return(0,f.useEffect)(()=>{0===R&&(q(h),W())},[W,R,h]),(0,f.useEffect)(()=>{j&&V()},[V,j]),(0,r.jsxs)(g.s_,{children:[(0,r.jsxs)(g.V9,{children:[(0,r.jsx)(P.z,{text:"Server: ".concat(c)}),ei]}),(0,r.jsxs)(_,{children:[(0,r.jsx)(a.Z,{display:en?"flex":"none",className:U.displayBox,children:(0,r.jsx)(D,{onConnect:X,onDisconnect:Y,onWsClose:ee,rfb:G,rfbConnectArgs:w,rfbScreen:H})}),!en&&(0,r.jsxs)(a.Z,{display:"flex",className:U.spinnerBox,textAlign:"center",children:[b&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(P.z,{children:["Connecting to ",c,"."]}),(0,r.jsx)(E.Z,{})]}),S&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(P.z,{children:"Can't connect to the server."}),(0,r.jsx)(P.Ac,{children:T}),(0,r.jsx)(P.Ac,{children:F}),(0,r.jsxs)(P.z,{mt:".5em",children:["Retrying in ",R,"."]})]})]})]})]})},R=t(59826),q=t(27095),G=t(80594),H=t(77831),J=t(56903),K=t(41021);let V={externalPreview:"",externalTimestamp:0,headerEndAdornment:null,hrefPreview:void 0,isExternalLoading:!1,isExternalPreviewStale:!1,isFetchPreview:!0,isShowControls:!0,isUseInnerPanel:!1,onClickConnectButton:void 0,onClickPreview:void 0,serverName:"",serverState:""},$=e=>{let{children:n,isUseInnerPanel:t}=e;return t?(0,r.jsx)(g.Lg,{children:n}):(0,r.jsx)(g.s_,{children:n})},W=e=>{let{children:n,isUseInnerPanel:t,text:l}=e;return t?(0,r.jsxs)(g.CH,{children:[l?(0,r.jsx)(P.Ac,{text:l}):(0,r.jsx)(r.Fragment,{}),n]}):(0,r.jsxs)(g.V9,{children:[l?(0,r.jsx)(P.z,{text:l}):(0,r.jsx)(r.Fragment,{}),n]})},Q=e=>{let{externalPreview:n=V.externalPreview,externalTimestamp:t=V.externalTimestamp,headerEndAdornment:l,hrefPreview:s,isExternalLoading:i=V.isExternalLoading,isExternalPreviewStale:o=V.isExternalPreviewStale,isFetchPreview:c=V.isFetchPreview,isShowControls:u=V.isShowControls,isUseInnerPanel:d=V.isUseInnerPanel,onClickPreview:h,serverName:x=V.serverName,serverState:j=V.serverState,serverUUID:m,onClickConnectButton:p=h}=e,[C,g]=(0,f.useState)(!0),[Z,k]=(0,f.useState)(!1),[b,y]=(0,f.useState)(""),[S,A]=(0,f.useState)(0),F=(0,K.zO)(),M=(0,f.useMemo)(()=>"running"===j?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.Z,{alt:"Preview is temporarily unavailable, but the server is ".concat(j,"."),component:"img",src:"data:image;base64,".concat(b),sx:{height:"100%",minHeight:"10em",opacity:Z?"0.4":"1",padding:d?".2em":0,width:"100%"}}),Z&&(e=>{let{unit:n,value:t}=(0,K._J)(F-e);return(0,r.jsxs)(P.Ac,{position:"absolute",children:["Updated ~",t," ",n," ago"]})})(S)]}):(0,r.jsx)(R.Z,{sx:{color:H.UZ,height:"80%",width:"80%"}}),[Z,d,F,b,S,j]),B=(0,f.useMemo)(()=>{if(C)return(0,r.jsx)(E.Z,{mb:"1em",mt:"1em"});let e=!b,n={borderRadius:H.n_,color:H.s7,padding:0};return s?(0,r.jsx)(G.Z,{disabled:e,href:s,sx:n,children:M}):(0,r.jsx)(G.Z,{component:"span",disabled:e,onClick:h,sx:n,children:M})},[s,C,b,M,h]);return(0,f.useEffect)(()=>{c?(async()=>{try{let{data:e}=await w.Z.get("/server/".concat(m,"?ss=1")),{screenshot:n,timestamp:t}=e;y(n),A(t),k(!(0,K.Z$)(t,300))}catch(e){k(!0)}finally{g(!1)}})():i||(y(n),A(t),k(o),g(!1))},[n,t,i,o,c,m]),(0,r.jsxs)($,{isUseInnerPanel:d,children:[(0,r.jsxs)(W,{isUseInnerPanel:d,text:x,children:[l,(0,r.jsx)(z,{iconButtonProps:{size:d?"small":void 0},serverName:x,serverState:j,serverUuid:m})]}),(0,r.jsxs)(J.Z,{row:!0,sx:{"& > :first-child":{flexGrow:1}},children:[(0,r.jsx)(a.Z,{textAlign:"center",children:B}),u&&b&&(0,r.jsx)(J.Z,{spacing:".3em",children:(0,r.jsx)(v.Z,{onClick:p,children:(0,r.jsx)(q.Z,{})})})]})]})};Q.defaultProps=V;var X=Q},2188:function(e,n,t){var r=t(85893),l=t(67294),s=t(77583),i=t(99576);n.Z=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{initial:{actionProceedText:n="",content:t="",titleText:o="",...c}={}}=e,a=(0,l.useRef)(null),[u,d]=(0,l.useState)({actionProceedText:n,content:t,titleText:o}),h=(0,l.useCallback)(e=>d(n=>{let{loading:t,...r}=n;return{...r,loading:e}}),[]),x=(0,l.useCallback)(e=>{var n,t;return null==a?void 0:null===(t=a.current)||void 0===t?void 0:null===(n=t.setOpen)||void 0===n?void 0:n.call(null,e)},[]),f=(0,l.useCallback)((e,n)=>d({actionProceedText:"",content:(0,r.jsx)(i.Z,{...n}),showActionArea:!1,showClose:!0,titleText:e}),[]);return{confirmDialog:(0,l.useMemo)(()=>(0,r.jsx)(s.Z,{...c,...u,ref:a}),[u,c]),confirmDialogRef:a,setConfirmDialogLoading:h,setConfirmDialogOpen:x,setConfirmDialogProps:d,finishConfirm:f}}},41021:function(e,n,t){t.d(n,{Z$:function(){return l},_J:function(){return s},zO:function(){return r}});let r=e=>{let n=Date.now();return e||(n=Math.floor(n/1e3)),n},l=function(e,n){let{ms:t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r(t)-e<=n},s=e=>{var n;let t=e,[r,l,s]=[...[60,60].reduce((e,n)=>{let r=t%n;return e.push(r),t=(t-r)/n,e},[]),t],i=null!==(n=[{unit:"h",value:s},{unit:"m",value:l}].find(e=>{let{value:n}=e;return n}))&&void 0!==n?n:{unit:"s",value:r};return{h:s,m:l,s:r,...i}}}}]);