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 line
4.3 KiB

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{5301:function(e,r,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return n(5075)}])},5075:function(e,r,n){"use strict";n.r(r);var t=n(5893),c=n(9008),o=n(1163),i=n(7294),s=n(7357),a=n(7720),u=n(2428),l=n(2029),f=n(7169),v=n(7906),d=n(1200),h=n(5716),p=n(1706),m=n(5741),x=n(9),y=n(3679),_=n(1905),b=n(6350),j=n(2152);function g(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function w(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function S(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},t=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),t.forEach((function(r){w(e,r,n[r])}))}return e}function Z(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,r){if(!e)return;if("string"===typeof e)return g(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return g(e,r)}(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 O=function(e,r){return(0,t.jsx)(s.Z,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap","& > *":{width:{xs:"20em",md:"24em"}},"& > :not(:last-child)":{marginRight:"2em"}},children:e.map((function(e){var n=e.anvilName,c=e.anvilUUID,o=e.isScreenshotStale,i=e.screenshot,s=e.serverName,a=e.serverUUID;return(0,t.jsx)(v.M,{externalPreview:i,headerEndAdornment:[(0,t.jsx)(m.Z,{href:"/server?uuid=".concat(a,"&server_name=").concat(s),children:s},"server_list_to_server_".concat(a)),(0,t.jsx)(m.Z,{href:"/anvil?anvil_uuid=".concat(c),sx:{opacity:.7},children:n},"server_list_server_".concat(a,"_to_anvil_").concat(c))],isExternalPreviewStale:o,isFetchPreview:!1,isShowControls:!1,isUseInnerPanel:!0,onClickPreview:function(){r.push("/server?uuid=".concat(a,"&server_name=").concat(s,"&vnc=1"))},serverUUID:a},"server-preview-".concat(a))}))})},P=function(e,r){return""===r?{exclude:e,include:[]}:e.reduce((function(e,n){return n.serverName.includes(r)?e.include.push(n):e.exclude.push(n),e}),{exclude:[],include:[]})};r.default=function(){var e=(0,i.useRef)(!0),r=(0,o.useRouter)(),n=(0,i.useState)([]),v=n[0],m=n[1],g=(0,i.useState)([]),w=g[0],U=g[1],E=(0,i.useState)([]),I=E[0],A=E[1],C=(0,i.useState)(""),k=C[0],D=C[1],N=(0,i.useState)(!1),R=N[0],T=N[1],F=function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];var c=P.apply(void 0,Z(n)),o=c.exclude,i=c.include;e.current&&(U(o),A(i))},M=(0,_.Z)("".concat(l.Z,"/server"),{onSuccess:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=r.map((function(r){var t,c=r.serverUUID,o=S({},r,{screenshot:(null===(t=v.find((function(e){return e.serverUUID===c})))||void 0===t?void 0:t.screenshot)||""});return(0,d.Z)("".concat(l.Z,"/server/").concat(c,"?ss")).then((function(r){var t=r.screenshot;o.screenshot=t,o.isScreenshotStale=!1;var c=Z(n);e.current&&m(c)})).catch((function(){o.isScreenshotStale=!0})),o}));m(n),F(n,k)},refreshInterval:6e4}).isLoading;return(0,i.useEffect)((function(){return function(){e.current=!1}}),[]),(0,t.jsxs)(s.Z,{children:[(0,t.jsx)(c.default,{children:(0,t.jsx)("title",{children:"Dashboard"})}),(0,t.jsx)(h.Z,{}),(0,t.jsx)(y.s_,{children:M?(0,t.jsx)(j.Z,{}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(y.V9,{children:[(0,t.jsx)(x.Z,{placeholder:"Search by server name",onChange:function(e){var r=e.target.value;D(r),F(v,r)},sx:{marginRight:".6em"},value:k}),(0,t.jsx)(p.Z,{onClick:function(){return T(!0)},children:(0,t.jsx)(u.Z,{})})]}),O(I,r),I.len