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
11 KiB

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