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
8.4 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(1142)}])},5521:function(e,n,t){"use strict";t.d(n,{Z:function(){return F}});var r=t(5893),o=t(1113),i=t(1496),c=t(2293),a=t(7357),l=t(2992),s=t(4799),u=t(7294),f=t(7169),d=t(4433),p=t(9029),h=t(7533),g=t(8462),v=t(7212),m=t(8619),b=[{text:"Anvil",image:"/pngs/anvil_icon_on.png",uri:"/manage-element"},{text:"Files",image:"/pngs/files_on.png",uri:"/file-manager"},{text:"Configure",image:"/pngs/configure_icon_on.png",uri:"/config"},{text:"Help",image:"/pngs/help_icon_on.png",uri:"https://alteeve.com/w/Support"}],x={width:"40em",height:"40em"},j=t(4390),w=t(582),y=t(4690),Z=t(1770),k=t(7750),O=t(1081);function C(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 S(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,o,i=[],c=!0,a=!1;try{for(t=t.call(e);!(c=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);c=!0);}catch(l){a=!0,o=l}finally{try{c||null==t.return||t.return()}finally{if(a)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return C(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 C(e,n)}(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.")}()}var _=function(){var e=(0,O.Z)(),n=(0,u.useState)({}),t=n[0],r=n[1],o=(0,u.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"suiapi.";return t["".concat(n).concat(e)]}),[t]),i=(0,u.useCallback)((function(){return o("user")}),[o]);return(0,u.useEffect)((function(){if(e){var n=document.cookie.split(/\s*;\s*/);r(n.reduce((function(e,n){var t,r=S(n.split("=",2),2),o=r[0],i=r[1],c=decodeURIComponent(i);if(c.startsWith("j:"))try{t=JSON.parse(c.substring(2))}catch(a){t=i}else t=i;return e[o]=t,e}),{}))}}),[e]),{cookieJar:t,getCookie:o,getSessionUser:i}};function P(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function A(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){P(e,n,t[n])}))}return e}var N="AnvilDrawer",E={actionIcon:"".concat(N,"-actionIcon"),list:"".concat(N,"-list")},B=(0,i.ZP)(h.ZP)((function(){var e;return P(e={},"& .".concat(E.list),{width:"200px"}),P(e,"& .".concat(E.actionIcon),{fontSize:"2.3em",color:f.of}),e})),I=function(e){var n=e.open,t=e.setOpen,o=(0,_().getSessionUser)();return(0,r.jsx)(B,{BackdropProps:{invisible:!0},anchor:"left",open:n,onClose:function(){return t(!n)},children:(0,r.jsx)("div",{role:"presentation",children:(0,r.jsxs)(g.Z,{className:E.list,children:[(0,r.jsx)(v.ZP,{children:(0,r.jsx)(k.Ac,{children:o?(0,r.jsxs)(r.Fragment,{children:["Welcome, ",o.name]}):"Unregistered"})}),(0,r.jsx)(w.Z,{}),(0,r.jsx)(m.Z,{component:"a",href:"/index.html",children:(0,r.jsxs)(y.Z,{fullWidth:!0,row:!0,spacing:"2em",children:[(0,r.jsx)(d.Z,{className:E.actionIcon}),(0,r.jsx)(k.Ac,{children:"Dashboard"})]})}),b.map((function(e){return(0,r.jsx)(m.Z,{component:"a",href:e.uri,children:(0,r.jsxs)(y.Z,{fullWidth:!0,row:!0,spacing:"2em",children:[(0,r.jsx)("img",A({alt:e.text,src:e.image},x)),(0,r.jsx)(k.Ac,{children:e.text})]})},"anvil-drawer-".concat(e.image))})),(0,r.jsx)(m.Z,{onClick:function(){j.Z.put("/auth/logout").then((function(){window.location.replace("/login")})).catch((function(e){(0,Z.Z)(e)}))},children:(0,r.jsxs)(y.Z,{fullWidth:!0,row:!0,spacing:"2em",children:[(0,r.jsx)(p.Z,{className:E.actionIcon}),(0,r.jsx)(k.Ac,{children:"Logout"})]})})]})})})},D=t(3377),R=t(2444);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 V="Header",W={input:"".concat(V,"-input"),barElement:"".concat(V,"-barElement"),iconBox:"".concat(V,"-iconBox"),searchBar:"".concat(V,"-searchBar"),icons:"".concat(V,"-icons")},T=(0,i.ZP)(c.Z)((function(e){var n,t=e.theme;return U(n={paddingTop:t.spacing(.5),paddingBottom:t.spacing(.5),paddingLeft:t.spacing(3),paddingRight:t.spacing(3),borderBottom:"solid 1px",borderBottomColor:f.hM,position:"static"},"& .".concat(W.input),{height:"2.8em",width:"30vw",backgroundColor:t.palette.secondary.main,borderRadius:f.n_}),U(n,"& .".concat(W.barElement),{padding:0}),U(n,"& .".concat(W.iconBox),U({},t.breakpoints.down("sm"),{display:"none"})),U(n,"& .".concat(W.searchBar),U({},t.breakpoints.down("sm"),{flexGrow:1,paddingLeft:"15vw"})),U(n,"& .".concat(W.icons),{paddingLeft:".1em",paddingRight:".1em"}),n})),F=function(){var e=(0,u.useRef)({}),n=(0,u.useRef)({}),t=(0,u.useState)(!1),i=t[0],c=t[1];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(T,{children:(0,r.jsxs)(a.Z,{display:"flex",justifyContent:"space-between",flexDirection:"row",children:[(0,r.jsx)(y.Z,{row:!0,children:(0,r.jsx)(l.Z,{onClick:function(){return c(!i)},children:(0,r.jsx)("img",{alt:"",src:"/pngs/logo.png",width:"160",height:"40"})})}),(0,r.jsx)(y.Z,{className:W.iconBox,row:!0,spacing:0,children:(0,r.jsx)(a.Z,{children:(0,r.jsx)(s.Z,{onClick:function(e){var t,r,o=e.currentTarget;null===(t=n.current.setAnchor)||void 0===t||t.call(null,o),null===(r=n.current.setOpen)||void 0===r||r.call(null,!0)},sx:{color:f.of,padding:"0 .1rem"},children:(0,r.jsx)(D.Z,{icon:o.Z,ref:e})})})})]})}),(0,r.jsx)(I,{open:i,setOpen:c}),(0,r.jsx)(R.Z,{onFetchSuccessAppend:function(n){var t;null===(t=e.current.indicate)||void 0===t||t.call(null,Object.keys(n).length>0)},ref:n})]})}},4427:function(e,n,t){"use strict";var r=t(5893),o=t(2429),i=t(9309),c=t(7169);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(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){a(e,n,t[n])}))}return e}n.Z=function(e){var n,t,s=e.children,u=e.sx,f=l((a(t={backgroundColor:c.lD,paddingRight:"3em"},"&.".concat(o.Z.selected),(a(n={backgroundColor:c.s7,fontWeight:400},"&.".concat(o.Z.focusVisible),{backgroundColor:c.s7}),a(n,"&:hover",{backgroundColor:c.s7}),n)),a(t,"&.".concat(o.Z.focusVisible),{backgroundColor:c.s7}),a(t,"&:hover",{backgroundColor:c.s7}),t),u);return(0,r.jsx)(i.Z,l({},e,{sx:f,children:s}))}},1081:function(e,n,t){"use strict";var r=t(7294);n.Z=function(){var e=(0,r.useRef)(!0);return e.current?(e.current=!1,!0):e.current}},1142:function(e,n,t){"use strict";t.r(n);var r=t(5893),o=t(1496),i=t(7357),c=t(9008),a=t(1163),l=t(7294),s=t(5094),u=t(5521);function f(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var d="Server",p={preview:"".concat(d,"-preview"),fullView:"".concat(d,"-fullView")},h=(0,o.ZP)("div")((function(e){var n,t=e.theme;return f(n={},"& .".concat(p.preview),f({width:"25%",height:"100%"},t.breakpoints.down("md"),{width:"100%"})),f(n,"& .".concat(p.fullView),{display:"flex",flexDirection:"row",width:"100%",justifyContent:"center"}),n}));n.default=function(){var e=(0,l.useState)(!0),n=e[0],t=e[1],o=(0,a.useRouter)().query,f=o.server_name,d=o.server_state,g=o.uuid,v=o.vnc,m=((null===v||void 0===v?void 0:v.toString())||"").length>0,b=(null===f||void 0===f?void 0:f.toString())||"",x=(null===d||void 0===d?void 0:d.toString())||"",j=(null===g||void 0===g?void 0:g.toString())||"";return(0,l.useEffect)((function(){m&&t(!1)}),[m]),(0,r.jsxs)(h,{children:[(0,r.jsx)(c.default,{children:(0,r.jsx)("title",{children:b})}),(0,r.jsx)(u.Z,{}),n?(0,r.jsx)(i.Z,{className:p.preview,children:(0,r.jsx)(s.M,{onClickPreview:function(){t(!1)},serverName:b,serverState:x,serverUUID:j})}):(0,r.jsx)(i.Z,{className:p.fullView,children:(0,r.jsx)(s.S,{onClickCloseButton:function(){t(!0)},serverUUID:j,serverName:b})})]})}}},function(e){e.O(0,[412,894,528,62,94,774,888,179],(function(){return n=8954,e(e.s=n);var n}));var n=e.O();_N_E=n}]);