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

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[94],{5094:function(e,n,t){t.d(n,{S:function(){return Z},M:function(){return $}});var r=t(5893),i=t(791),o=t(5537),a=t(1496),s=t(7357),c=t(8333),l=t(5861),u=t(5152),f=t(7294),d=t(1706),v="0xffe3",h="0xffe9",x=[{keys:"Ctrl + Alt + Delete",scans:[]},{keys:"Ctrl + Alt + F1",scans:[v,h,"0xffbe"]},{keys:"Ctrl + Alt + F2",scans:[v,h,"0xffbf"]},{keys:"Ctrl + Alt + F3",scans:[v,h,"0xffc0"]},{keys:"Ctrl + Alt + F4",scans:[v,h,"0xffc1"]},{keys:"Ctrl + Alt + F5",scans:[v,h,"0xffc2"]},{keys:"Ctrl + Alt + F6",scans:[v,h,"0xffc3"]},{keys:"Ctrl + Alt + F7",scans:[v,h,"0xffc4"]},{keys:"Ctrl + Alt + F8",scans:[v,h,"0xffc5"]},{keys:"Ctrl + Alt + F9",scans:[v,h,"0xffc6"]}],m=t(4427),y=t(3679),p=t(2152),b=t(7750),j=t(1081);function g(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function w(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function C(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(!e)return;if("string"===typeof e)return g(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return g(e,n)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var S="FullSize",A={displayBox:"".concat(S,"-displayBox"),spinnerBox:"".concat(S,"-spinnerBox")},k=(0,a.ZP)("div")((function(){var e;return w(e={},"& .".concat(A.displayBox),{width:"75vw",height:"75vh"}),w(e,"& .".concat(A.spinnerBox),{flexDirection:"column",width:"75vw",height:"75vh",alignItems:"center",justifyContent:"center"}),e})),P=(0,u.default)((function(){return Promise.all([t.e(460),t.e(665)]).then(t.bind(t,4665))}),{loadableGenerated:{webpack:function(){return[4665]}},ssr:!1}),Z=function(e){var n=e.onClickCloseButton,t=e.serverUUID,a=e.serverName,u=e.vncReconnectTimerStart,v=void 0===u?5:u,h=(0,j.Z)(),g=(0,f.useState)(null),w=g[0],S=g[1],Z=(0,f.useState)(void 0),I=Z[0],F=Z[1],E=(0,f.useState)(!1),O=E[0],U=E[1],B=(0,f.useState)(!1),M=B[0],T=B[1],_=(0,f.useState)(v),z=_[0],D=_[1],N=(0,f.useRef)(null),R=(0,f.useRef)(null),L=function(e){S(e.currentTarget)},$=(0,f.useCallback)((function(){var e,n;U(!0),T(!1),F({url:(e=window.location.host,n=t,"ws://".concat(e,"/ws/server/vnc/").concat(n))})}),[t]),G=(0,f.useCallback)((function(){F(void 0)}),[]),J=(0,f.useCallback)((function(){(null===N||void 0===N?void 0:N.current)&&(N.current.disconnect(),N.current=null,$())}),[$]),K=(0,f.useCallback)((function(){var e=setInterval((function(){D((function(n){var t=n-1;return t<1&&clearInterval(e),t}))}),1e3)}),[]),V=(0,f.useCallback)((function(){U(!1)}),[]),H=(0,f.useCallback)((function(e){e.detail.clean||(U(!1),T(!0),K())}),[K]),q=(0,f.useMemo)((function(){return!O&&!M}),[O,M]),Q=(0,f.useMemo)((function(){return(0,r.jsxs)(s.Z,{children:[(0,r.jsx)(d.Z,{onClick:L,children:(0,r.jsx)(i.Z,{})}),(0,r.jsx)(c.Z,{anchorEl:w,keepMounted:!0,open:Boolean(w),onClose:function(){return S(null)},children:x.map((function(e){var n=e.keys,t=e.scans;return(0,r.jsx)(m.Z,{onClick:function(){return function(e){if(N.current){if(e.length){for(var n=0;n<=e.length-1;n+=1)N.current.sendKey(e[n],1);for(var t=e.length-1;t>=0;t-=1)N.current.sendKey(e[t],0)}else N.current.sendCtrlAltDel();S(null)}}(t)},children:(0,r.jsx)(l.Z,{variant:"subtitle1",children:n})},n)}))})]})}),[w]),W=(0,f.useMemo)((function(){return(0,r.jsx)(d.Z,{onClick:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i;G(),null===n||void 0===n||(i=n).call.apply(i,[null].concat(C(t)))},variant:"redcontained",children:(0,r.jsx)(o.Z,{})})}),[G,n]),X=(0,f.useMemo)((function(){return q&&(0,r.jsxs)(r.Fragment,{children:[Q,W]})}),[Q,q,W]);return(0,f.useEffect)((function(){0===z&&(D(v),J())}),[J,z,v]),(0,f.useEffect)((function(){h&&$()}),[$,h]),(0,r.jsxs)(y.s_,{children:[(0,r.jsxs)(y.V9,{children:[(0,r.jsx)(b.z,{text:"Server: ".concat(a)}),X]}),(0,r.jsxs)(k,{children:[(0,r.jsx)(s.Z,{display:q?"flex":"none",className:A.displayBox,children:(0,r.jsx)(P,{onConnect:V,onDisconnect:H,rfb:N,rfbConnectArgs:I,rfbScreen:R})}),!q&&(0,r.jsxs)(s.Z,{display:"flex",className:A.spinnerBox,children:[O&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(b.z,{textAlign:"center",children:["Connecting to ",a,"."]}),(0,r.jsx)(p.Z,{})]}),M&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(b.z,{textAlign:"center",children:"There was a problem connecting to the server."}),(0,r.jsxs)(b.z,{textAlign:"center",mt:"1em",children:["Retrying in ",z,"."]})]})]})]})]})},I=t(4051),F=t.n(I),E=t(5668),O=t(2787),U=t(4799),B=t(7169),M=t(4390),T=t(4690),_=t(9370);function z(e,n,t,r,i,o,a){try{var s=e[o](a),c=s.value}catch(l){return void t(l)}s.done?n(c):Promise.resolve(c).then(r,i)}var D={externalPreview:"",externalTimestamp:0,headerEndAdornment:null,isExternalLoading:!1,isExternalPreviewStale:!1,isFetchPreview:!0,isShowControls:!0,isUseInnerPanel:!1,onClickConnectButton:void 0,onClickPreview:void 0,serverName:"",serverState:""},N=function(e){var n=e.children;return e.isUseInnerPanel?(0,r.jsx)(y.Lg,{children:n}):(0,r.jsx)(y.s_,{children:n})},R=function(e){var n=e.children,t=e.isUseInnerPanel,i=e.text;return t?(0,r.jsxs)(y.CH,{children:[i?(0,r.jsx)(b.Ac,{text:i}):(0,r.jsx)(r.Fragment,{}),n]}):(0,r.jsxs)(y.V9,{children:[i?(0,r.jsx)(b.z,{text:i}):(0,r.jsx)(r.Fragment,{}),n]})},L=function(e){var n=e.externalPreview,t=void 0===n?D.externalPreview:n,i=e.externalTimestamp,o=void 0===i?D.externalTimestamp:i,a=e.headerEndAdornment,c=e.isExternalLoading,l=void 0===c?D.isExternalLoading:c,u=e.isExternalPreviewStale,v=void 0===u?D.isExternalPreviewStale:u,h=e.isFetchPreview,x=void 0===h?D.isFetchPreview:h,m=e.isShowControls,y=void 0===m?D.isShowControls:m,j=e.isUseInnerPanel,g=void 0===j?D.isUseInnerPanel:j,w=e.onClickPreview,C=e.serverName,S=e.serverState,A=void 0===S?D.serverState:S,k=e.serverUUID,P=e.onClickConnectButton,Z=void 0===P?w:P,I=(0,f.useState)(!0),L=I[0],$=I[1],G=(0,f.useState)(!1),J=G[0],K=G[1],V=(0,f.useState)(""),H=V[0],q=V[1],Q=(0,f.useState)(0),W=Q[0],X=Q[1],Y=(0,_.zO)(),ee=(0,f.useMemo)((function(){return"running"===A?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.Z,{alt:"",component:"img",src:"data:image;base64,".concat(H),sx:{height:"100%",opacity:J?"0.4":"1",padding:g?".2em":0,width:"100%"}}),J&&function(e){var n=(0,_._J)(Y-e),t=n.unit,i=n.value;return(0,r.jsxs)(b.Ac,{position:"absolute",children:["Updated ~",i," ",t," ago"]})}(W)]}):(0,r.jsx)(E.Z,{sx:{color:B.UZ,height:"80%",width:"80%"}})}),[J,g,Y,H,W,A]);return(0,f.useEffect)((function(){var e;x?(e=F().mark((function e(){var n,t,r;return F().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M.Z.get("/server/".concat(k,"?ss=1"));case 3:n=e.sent.data,t=n.screenshot,r=n.timestamp,q(t),X(r),K(!(0,_.Z$)(r,300)),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),K(!0);case 13:return e.prev=13,$(!1),e.finish(13);case 16:case"end":return e.stop()}}),e,null,[[0,10,13,16]])})),function(){var n=this,t=arguments;return new Promise((function(r,i){var o=e.apply(n,t);function a(e){z(o,r,i,a,s,"next",e)}function s(e){z(o,r,i,a,s,"throw",e)}a(void 0)}))})():l||(q(t),X(o),K(v),$(!1))}),[t,o,l,v,x,k]),(0,r.jsxs)(N,{isUseInnerPanel:g,children:[(0,r.jsx)(R,{isUseInnerPanel:g,text:C,children:a}),(0,r.jsxs)(T.Z,{row:!0,sx:{"& > :first-child":{flexGrow:1}},children:[(0,r.jsx)(s.Z,{textAlign:"center",children:L?(0,r.jsx)(p.Z,{mt:"1em",mb:"1em"}):(0,r.jsx)(U.Z,{component:"span",disabled:!H,onClick:w,sx:{borderRadius:B.n_,color:B.s7,padding:0},children:ee})}),y&&H&&(0,r.jsx)(T.Z,{children:(0,r.jsx)(d.Z,{onClick:Z,children:(0,r.jsx)(O.Z,{})})})]})]})};L.defaultProps=D;var $=L},9370:function(e,n,t){function r(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,i,o=[],a=!0,s=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(o.push(r.value),!n||o.length!==n);a=!0);}catch(c){s=!0,i=c}finally{try{a||null==t.return||t.return()}finally{if(s)throw i}}return o}}(e,n)||s(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||s(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,n){if(e){if("string"===typeof e)return r(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?r(e,n):void 0}}t.d(n,{_J:function(){return u},Z$:function(){return l},zO:function(){return c}});var c=function(e){var n=Date.now();return e||(n=Math.floor(n/1e3)),n},l=function(e,n){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).ms,r=c(t)-e;return r<=n},u=function(e){var n,t=e,r=o(a([60,60].reduce((function(e,n){var r=t%n;return e.push(r),t=(t-r)/n,e}),[])).concat([t]),3),s=r[0],c=r[1],l=r[2],u=null!==(n=[{unit:"h",value:l},{unit:"m",value:c}].find((function(e){return e.value})))&&void 0!==n?n:{unit:"s",value:s};return function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){i(e,n,t[n])}))}return e}({h:l,m:c,s:s},u)}}}]);