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

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[753],{8954:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/server",function(){return t(8266)}])},8336:function(e,n){"use strict";n.Z=function(e,n){return fetch(e,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}},8266:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return W}});var r=t(5893),o=t(7294),c=t(1163),s=t(9008),a=t(7357),i=t(1496),l=t(4051),u=t.n(l),d=t(5152),f=t(3946),p=t(7850),x=t(40),h=t(5861),v=t(3321),m=t(594),g=t(1846),w=t(9203),y=t(7169),b="0xffe3",j="0xffe9",k=[{keys:"Ctrl + Alt + Delete",scans:[]},{keys:"Ctrl + Alt + F1",scans:[b,j,"0xffbe"]},{keys:"Ctrl + Alt + F2",scans:[b,j,"0xffbf"]},{keys:"Ctrl + Alt + F3",scans:[b,j,"0xffc0"]},{keys:"Ctrl + Alt + F4",scans:[b,j,"0xffc1"]},{keys:"Ctrl + Alt + F5",scans:[b,j,"0xffc2"]},{keys:"Ctrl + Alt + F6",scans:[b,j,"0xffc3"]},{keys:"Ctrl + Alt + F7",scans:[b,j,"0xffc4"]},{keys:"Ctrl + Alt + F8",scans:[b,j,"0xffc5"]},{keys:"Ctrl + Alt + F9",scans:[b,j,"0xffc6"]}],B=t(8336);function C(e,n,t,r,o,c,s){try{var a=e[c](s),i=a.value}catch(l){return void t(l)}a.done?n(i):Promise.resolve(i).then(r,o)}var Z=function(){var e,n=(e=u().mark((function e(n,t,r){var o,c,s;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=new AbortController,c=setTimeout((function(){return o.abort()}),r),e.next=4,fetch(n,{method:"PUT",headers:{"Content-Type":"application/json","Keep-Alive":"timeout=120"},signal:o.signal,body:JSON.stringify(t)});case 4:return s=e.sent,clearTimeout(c),e.abrupt("return",s);case 7:case"end":return e.stop()}}),e)})),function(){var n=this,t=arguments;return new Promise((function(r,o){var c=e.apply(n,t);function s(e){C(c,r,o,s,a,"next",e)}function a(e){C(c,r,o,s,a,"throw",e)}s(void 0)}))});return function(e,t,r){return n.apply(this,arguments)}}(),N=Z,_=t(3430),T=t(2152);function S(e,n,t,r,o,c,s){try{var a=e[c](s),i=a.value}catch(l){return void t(l)}a.done?n(i):Promise.resolve(i).then(r,o)}function P(e){return function(){var n=this,t=arguments;return new Promise((function(r,o){var c=e.apply(n,t);function s(e){S(c,r,o,s,a,"next",e)}function a(e){S(c,r,o,s,a,"throw",e)}s(void 0)}))}}function E(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var A="FullSize",D={displayBox:"".concat(A,"-displayBox"),spinnerBox:"".concat(A,"-spinnerBox"),closeButton:"".concat(A,"-closeButton"),keyboardButton:"".concat(A,"-keyboardButton"),closeBox:"".concat(A,"-closeBox"),buttonsBox:"".concat(A,"-buttonsBox"),keysItem:"".concat(A,"-keysItem"),buttonText:"".concat(A,"-buttonText")},I=(0,i.ZP)("div")((function(){var e;return E(e={},"& .".concat(D.displayBox),{width:"75vw",height:"75vh",paddingTop:"1em",paddingBottom:0,paddingLeft:0,paddingRight:0}),E(e,"& .".concat(D.spinnerBox),{flexDirection:"column",width:"75vw",height:"75vh",alignItems:"center",justifyContent:"center"}),E(e,"& .".concat(D.closeButton),{borderRadius:8,backgroundColor:y.hM,"&:hover":{backgroundColor:y.hM}}),E(e,"& .".concat(D.keyboardButton),{borderRadius:8,backgroundColor:y.lD,"&:hover":{backgroundColor:y.lD}}),E(e,"& .".concat(D.closeBox),{paddingBottom:"1em",paddingLeft:".7em",paddingRight:0}),E(e,"& .".concat(D.buttonsBox),{paddingTop:0}),E(e,"& .".concat(D.keysItem),{backgroundColor:y.lD,paddingRight:"3em","&:hover":{backgroundColor:y.lD}}),E(e,"& .".concat(D.buttonText),{color:y.E5}),e})),O=(0,d.default)((function(){return Promise.all([t.e(460),t.e(665)]).then(t.bind(t,4665))}),{loadableGenerated:{webpack:function(){return[4665]}},ssr:!1}),F=function(e){var n=e.setMode,t=e.uuid,c=e.serverName,s=(0,o.useState)(null),i=s[0],l=s[1],d=(0,o.useRef)(),b=(0,o.useRef)(void 0),j=(0,o.useState)(void 0),C=j[0],Z=j[1],S=(0,o.useState)(!1),E=S[0],A=S[1];(0,o.useEffect)((function(){b.current=window.location.hostname,C||P(u().mark((function e(){var n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,N("".concat("/cgi-bin","/manage_vnc_pipes"),{server_uuid:t,is_open:!0},12e4);case 3:return n=e.sent,e.t0=Z,e.next=7,n.json();case 7:e.t1=e.sent,(0,e.t0)(e.t1),e.next=14;break;case 11:e.prev=11,e.t2=e.catch(0),A(!0);case 14:case"end":return e.stop()}}),e,null,[[0,11]])})))()}),[t,C,E]);var F=function(){var e=P(u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,B.Z)("".concat("/cgi-bin","/manage_vnc_pipes"),{server_uuid:t,is_open:!1});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,r.jsx)(w.s_,{children:(0,r.jsxs)(I,{children:[(0,r.jsx)(a.Z,{flexGrow:1,children:(0,r.jsx)(_.z,{text:"Server: ".concat(c)})}),C?(0,r.jsxs)(a.Z,{display:"flex",className:D.displayBox,children:[(0,r.jsx)(O,{rfb:d,url:"".concat(C.protocol,"://").concat(b.current,":").concat(C.forward_port),viewOnly:!1,focusOnClick:!1,clipViewport:!1,dragViewport:!1,scaleViewport:!0,resizeSession:!0,showDotCursor:!1,background:"",qualityLevel:6,compressionLevel:2}),(0,r.jsxs)(a.Z,{children:[(0,r.jsx)(a.Z,{className:D.closeBox,children:(0,r.jsx)(f.Z,{className:D.closeButton,style:{color:y.lD},component:"span",onClick:function(){F(),n(!0)},children:(0,r.jsx)(m.Z,{})})}),(0,r.jsxs)(a.Z,{className:D.closeBox,children:[(0,r.jsx)(f.Z,{className:D.keyboardButton,style:{color:y.E5},component:"span",onClick:function(e){l(e.currentTarget)},children:(0,r.jsx)(g.Z,{})}),(0,r.jsx)(p.Z,{anchorEl:i,keepMounted:!0,open:Boolean(i),onClose:function(){return l(null)},children:k.map((function(e){var n=e.keys,t=e.scans;return(0,r.jsx)(x.Z,{onClick:function(){return function(e){if(d.current){if(e.length){for(var n=0;n<=e.length-1;n+=1)d.current.sendKey(e[n],1);for(var t=e.length-1;t>=0;t-=1)d.current.sendKey(e[t],0)}else d.current.sendCtrlAltDel();l(null)}}(t)},className:D.keysItem,children:(0,r.jsx)(h.Z,{variant:"subtitle1",children:n})},n)}))})]})]})]}):(0,r.jsx)(a.Z,{display:"flex",className:D.spinnerBox,children:E?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.Z,{style:{paddingBottom:"2em"},children:(0,r.jsx)(_.z,{text:"There was a problem connecting to the server, please try again"})}),(0,r.jsx)(v.Z,{variant:"contained",onClick:function(){A(!1)},style:{textTransform:"none"},children:(0,r.jsx)(h.Z,{className:D.buttonText,variant:"subtitle1",children:"Reconnect"})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(_.z,{text:"Establishing connection with ".concat(c)}),(0,r.jsx)(_.z,{text:"This may take a few minutes"}),(0,r.jsx)(T.Z,{})]})})]})})},R=t(9628),z=t(2787);function M(e,n,t,r,o,c,s){try{var a=e[c](s),i=a.value}catch(l){return void t(l)}a.done?n(i):Promise.resolve(i).then(r,o)}function V(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var L="Preview",G={displayBox:"".concat(L,"-displayBox"),fullScreenButton:"".concat(L,"-fullScreenButton"),fullScreenBox:"".concat(L,"-fullScreenBox"),imageButton:"".concat(L,"-imageButton"),powerOffIcon:"".concat(L,"-powerOffIcon"),previewImage:"".concat(L,"-previewImage")},K=(0,i.ZP)("div")((function(){var e;return V(e={},"& .".concat(G.displayBox),{padding:0,paddingTop:".7em",width:"100%"}),V(e,"& .".concat(G.fullScreenButton),{borderRadius:8,backgroundColor:y.lD,"&:hover":{backgroundColor:y.lD}}),V(e,"& .".concat(G.fullScreenBox),{paddingLeft:"1em",padding:0}),V(e,"& .".concat(G.imageButton),{padding:0,color:y.lD}),V(e,"& .".concat(G.powerOffIcon),{borderRadius:8,padding:0,color:y.s7,width:"100%",height:"100%"}),V(e,"& .".concat(G.previewImage),{width:"100%",height:"100%"}),e})),q=function(e){var n=e.setMode,t=e.uuid,c=e.serverName,s=(0,o.useState)(),i=s[0],l=s[1];return(0,o.useEffect)((function(){var e;(e=u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch("".concat("/cgi-bin","/get_server_screenshot?server_uuid=").concat(t),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=e.sent,e.next=6,n.json();case 6:r=e.sent.screenshot,l(r),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),l("");case 13:case"end":return e.stop()}}),e,null,[[0,10]])})),function(){var n=this,t=arguments;return new Promise((function(r,o){var c=e.apply(n,t);function s(e){M(c,r,o,s,a,"next",e)}function a(e){M(c,r,o,s,a,"throw",e)}s(void 0)}))})()}),[t]),(0,r.jsx)(w.s_,{children:(0,r.jsxs)(K,{children:[(0,r.jsx)(a.Z,{flexGrow:1,children:(0,r.jsx)(_.z,{text:"Server: ".concat(c)})}),(0,r.jsxs)(a.Z,{display:"flex",className:G.displayBox,children:[(0,r.jsx)(a.Z,{children:(0,r.jsx)(f.Z,{className:G.imageButton,style:{color:y.E5},component:"span",onClick:function(){return n(!1)},children:i?(0,r.jsx)("img",{alt:"",src:"data:image/png;base64,".concat(i),className:G.previewImage},"preview"):(0,r.jsx)(R.Z,{className:G.powerOffIcon})})}),(0,r.jsx)(a.Z,{className:G.fullScreenBox,children:(0,r.jsx)(f.Z,{className:G.fullScreenButton,style:{color:y.E5},component:"span",onClick:function(){return n(!1)},children:(0,r.jsx)(z.Z,{})})})]})]})})},J=t(8750);function U(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var X="Server",H={preview:"".concat(X,"-preview"),fullView:"".concat(X,"-fullView")},Q=(0,i.ZP)("div")((function(e){var n,t=e.theme;return U(n={},"& .".concat(H.preview),U({width:"25%",height:"100%"},t.breakpoints.down("md"),{width:"100%"})),U(n,"& .".concat(H.fullView),{display:"flex",flexDirection:"row",width:"100%",justifyContent:"center"}),n})),W=function(){var e=(0,o.useState)(!0),n=e[0],t=e[1],i=(0,c.useRouter)().query,l=i.uuid,u=i.server_name;return(0,r.jsxs)(Q,{children:[(0,r.jsx)(s.default,{children:(0,r.jsx)("title",{children:u})}),(0,r.jsx)(J.Z,{}),"string"===typeof l&&(n?(0,r.jsx)(a.Z,{className:H.preview,children:(0,r.jsx)(q,{setMode:t,uuid:l,serverName:u})}):(0,r.jsx)(a.Z,{className:H.fullView,children:(0,r.jsx)(F,{setMode:t,uuid:l,serverName:u})}))]})}}},function(e){e.O(0,[806,341,478,774,888,179],(function(){return n=8954,e(e.s=n);var n}));var n=e.O();_N_E=n}]);