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

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{5301:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return t(9048)}])},7504:function(e,n,t){"use strict";var r=t(5893),i=t(7294),o=t(8263),c=t(7357);function a(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,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){s(e,n,t[n])}))}return e}function u(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}function d(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=[],c=!0,a=!1;try{for(t=t.call(e);!(c=(r=t.next()).done)&&(o.push(r.value),!n||o.length!==n);c=!0);}catch(s){a=!0,i=s}finally{try{c||null==t.return||t.return()}finally{if(a)throw i}}return o}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return a(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 a(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.")}()}n.Z=function(e){var n=e.calculateItemBreakpoints,t=void 0===n?function(){return{xs:1}}:n,a=e.layout,s=e.wrapperBoxProps,f=u(e,["calculateItemBreakpoints","layout","wrapperBoxProps"]),h=(0,i.useMemo)((function(){return Object.entries(a).map((function(e,n){var r=d(e,2),c=r[0],a=r[1],s=c;return a?(0,i.createElement)(o.ZP,l({},t(n,s),{key:s,item:!0},a)):void 0}))}),[t,a]);return(0,r.jsx)(c.Z,l({},s,{children:(0,r.jsx)(o.ZP,l({container:!0},f,{children:h}))}))}},5741:function(e,n,t){"use strict";var r=t(5893),i=t(1714),o=t(122),c=t(7169),a=t(4690);function s(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){s(e,n,t[n])}))}return e}function u(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}n.Z=function(e){var n=e.children,t=e.sx,s=u(e,["children","sx"]);return(0,r.jsx)(o.Z,l({underline:"hover",variant:"subtitle1"},s,{sx:l({color:c.lD,textDecorationColor:c.s7},t),children:(0,r.jsxs)(a.Z,{row:!0,children:[n,(0,r.jsx)(i.Z,{sx:{marginLeft:".3em"}})]})}))}},7791:function(e,n,t){"use strict";var r=t(8100),i=t(2029),o=t(1200);function c(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}n.Z=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.fetcher,a=void 0===t?o.Z:t,s=n.baseUrl,l=void 0===s?i.Z:s,u=c(n,["fetcher","baseUrl"]),d=(0,r.ZP)("".concat(l).concat(e),a,u),f=d.data,h=d.error,m=!h&&!f;return{data:f,error:h,loading:m}}},8669:function(e,n,t){"use strict";t.d(n,{Z:function(){return i}});var r=function(e){return e.reduce((function(e,n){var t=n.hostName,r=n.hostType,i=n.hostUUID;return e[i]={name:t,type:r,uuid:i},e}),{})},i=function(e){return e.reduce((function(e,n){var t=n.anvilDescription,i=n.anvilName,o=n.anvilUUID,c=n.hosts;return e[o]={description:t,hosts:r(c),name:i,uuid:o},e}),{})}},9048:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return V}});var r=t(5893),i=t(2428),o=t(8263),c=t(7357),a=t(7720),s=t(9008),l=t(7294),u=t(2029),d=t(7169),f=t(8673),h=t(4490),m=function(e){var n=e.anvil_name,t=e.anvil_state,r=e.anvil_uuid;return{hosts:e.hosts.reduce((function(e,n){var t=n.host_name,r=n.host_uuid,i=n.maintenance_mode,o=n.server_count,c=n.state,a=n.state_percent;return e[r]={name:t,maintenance:i,serverCount:o,state:c,stateProgress:a,uuid:r},e}),{}),name:n,state:t,uuid:r}},v=function(e){var n=e.allocated,t=e.reserved,r=e.total;return{allocated:BigInt(n),reserved:BigInt(t),total:BigInt(r)}},x=function(e){var n=e.storage_groups,t=e.total_free,r=e.total_size,i=BigInt(t),o=BigInt(r);return n.reduce((function(e,n){var t=n.storage_group_free,r=n.storage_group_name,i=n.storage_group_total,o=n.storage_group_uuid,c=BigInt(t),a=BigInt(i);return e.storageGroups[o]={free:c,name:r,size:a,uuid:o},e}),{storageGroups:{},totalFree:i,totalSize:o})},j=t(582),p=t(4690),g=t(2152),b=t(5813),y=t(7750),Z=t(7791);function O(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var P=BigInt(100),w={degraded:d.hM,not_ready:d.Wd,optimal:d.Ej},_={offline:d.Wd,online:d.Ej},S=function(e){var n=e.anvilUuid,t=(0,Z.Z)("/anvil/".concat(n)),i=t.data,c=t.loading,a=(0,l.useMemo)((function(){return i&&m(i)}),[i]),s=(0,Z.Z)("/anvil/".concat(n,"/cpu")),u=s.data,S=s.loading,I=(0,l.useMemo)((function(){return u&&Object.values(u.hosts)}),[u]),A=(0,Z.Z)("/anvil/".concat(n,"/memory")),U=A.data,C=A.loading,E=(0,l.useMemo)((function(){return U&&v(U)}),[U]),M=(0,Z.Z)("/anvil/".concat(n,"/store")),B=M.data,k=M.loading,N=(0,l.useMemo)((function(){return B&&x(B)}),[B]),D=(0,l.useMemo)((function(){return[c,S,C,k].some((function(e){return e}))}),[c,S,C,k]),T=(0,l.useMemo)((function(){return a&&(0,r.jsx)(y.$_,{inheritColour:!0,color:w[a.state],children:a.state})}),[a]),z=(0,l.useMemo)((function(){return a&&(0,r.jsx)(o.ZP,{alignItems:"center",columns:20,columnSpacing:"0.5em",container:!0,sx:O({},"& > .".concat(f.Z.item,":nth-child(-n + 4)"),{marginBottom:"-.6em"}),children:Object.values(a.hosts).map((function(e){var n,t,i=e.name,c=e.serverCount,a=e.state,s=e.stateProgress,l=e.uuid,u=null!==(n=_[a])&&void 0!==n?n:d.s7,f=a;return["offline","online"].includes(a)?t=(0,r.jsx)(y.$_,{variant:"caption",children:c}):f="".concat(s,"%"),[(0,r.jsx)(o.ZP,{item:!0,xs:7,children:(0,r.jsx)(y.Ac,{variant:"caption",whiteSpace:"nowrap",children:i})},"".concat(l,"-state-label")),(0,r.jsx)(o.ZP,{item:!0,xs:5,children:(0,r.jsx)(y.$_,{inheritColour:!0,color:u,children:f})},"".concat(l,"-state")),(0,r.jsx)(o.ZP,{item:!0,xs:!0,children:(0,r.jsx)(j.Z,{sx:{marginBottom:"-.4em"}})},"".concat(l,"-divider")),(0,r.jsx)(o.ZP,{item:!0,width:"2.2em",children:t&&(0,r.jsx)(y.Ac,{variant:"caption",children:"Servers"})},"".concat(l,"-server-label")),(0,r.jsx)(o.ZP,{display:"flex",item:!0,justifyContent:"flex-end",width:"2em",children:t},"".concat(l,"-server-count"))]}))})}),[a]),$=(0,l.useMemo)((function(){return u&&I&&(0,r.jsxs)(p.Z,{row:!0,spacing:".5em",children:[(0,r.jsx)(p.Z,{spacing:0,children:(0,r.jsxs)(y.Ac,{variant:"caption",whiteSpace:"nowrap",children:["Vendor"," ",(0,r.jsx)(y.Q0,{sx:{paddingRight:0},children:I[0].vendor})]})}),(0,r.jsx)(j.Z,{sx:{flexGrow:1}}),(0,r.jsxs)(o.ZP,{alignItems:"center",columns:2,container:!0,sx:O({width:"3.7em"},"& > .".concat(f.Z.item,":nth-child(-n + 2)"),{marginBottom:"-.6em"}),children:[(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(y.Ac,{variant:"caption",children:"Cores"})}),(0,r.jsx)(o.ZP,{display:"flex",item:!0,justifyContent:"flex-end",xs:1,children:(0,r.jsx)(y.$_,{variant:"caption",children:u.cores})}),(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(y.Ac,{variant:"caption",children:"Threads"})}),(0,r.jsx)(o.ZP,{display:"flex",item:!0,justifyContent:"flex-end",xs:1,children:(0,r.jsx)(y.$_,{variant:"caption",children:u.threads})})]})]})}),[u,I]),W=(0,l.useMemo)((function(){return E&&(0,r.jsxs)(p.Z,{spacing:0,children:[(0,r.jsx)(p.Z,{row:!0,justifyContent:"flex-end",children:(0,r.jsxs)(y.Ac,{mb:"-.3em",variant:"caption",children:["Free",(0,r.jsx)(y.Q0,{children:(0,h._d)(E.total-(E.reserved+E.allocated),{toUnit:"ibyte"})}),"/",(0,r.jsx)(y.Q0,{sx:{paddingRight:0},children:(0,h._d)(E.total,{toUnit:"ibyte"})})]})}),(0,r.jsx)(b.Z,{thin:!0,value:{reserved:{value:Number(E.reserved*P/E.total)},allocated:{value:Number((E.reserved+E.allocated)*P/E.total),colour:{0:d.Ej,70:d.Wd,90:d.hM}}}})]})}),[E]),F=(0,l.useMemo)((function(){return N&&(0,r.jsxs)(p.Z,{spacing:0,children:[(0,r.jsx)(p.Z,{row:!0,justifyContent:"flex-end",children:(0,r.jsxs)(y.Ac,{mb:"-.3em",variant:"caption",children:["Total free",(0,r.jsx)(y.Q0,{children:(0,h._d)(N.totalFree,{toUnit:"ibyte"})}),"/",(0,r.jsx)(y.Q0,{sx:{paddingRight:0},children:(0,h._d)(N.totalSize,{toUnit:"ibyte"})})]})}),(0,r.jsx)(b.Z,{thin:!0,value:{allocated:{value:Number((N.totalSize-N.totalFree)*P/N.totalSize),colour:{0:d.Ej,70:d.Wd,90:d.hM}}}})]})}),[N]);return D?(0,r.jsx)(g.Z,{mt:0}):(0,r.jsxs)(o.ZP,{alignItems:"center",columns:4,container:!0,sx:O({},"& > .".concat(f.Z.item,":nth-child(odd)"),{alignItems:"center",display:"flex",height:"2.2em"}),children:[(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(y.Ac,{children:"Node"})}),(0,r.jsx)(o.ZP,{item:!0,xs:3,children:T}),(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(y.Ac,{children:"Subnodes"})}),(0,r.jsx)(o.ZP,{item:!0,xs:3,children:z}),(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(y.Ac,{children:"CPU"})}),(0,r.jsx)(o.ZP,{item:!0,xs:3,children:$}),(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(y.Ac,{children:"Memory"})}),(0,r.jsx)(o.ZP,{item:!0,xs:3,children:W}),(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(y.Ac,{children:"Storage"})}),(0,r.jsx)(o.ZP,{item:!0,xs:3,children:F})]})},I=t(8669),A=t(7504),U=t(3679);var C=function(){var e=(0,Z.Z)("/anvil",{refreshInterval:5e3}),n=e.data,t=e.loading,i=(0,l.useMemo)((function(){return n&&(0,I.Z)(n)}),[n]),o=(0,l.useMemo)((function(){return i&&(0,r.jsx)(A.Z,{columns:{xs:1,sm:2,md:3,xl:4},layout:Object.values(i).reduce((function(e,n){var t=n.description,i=n.name,o=n.uuid;return e["anvil-".concat(o)]={children:(0,r.jsxs)(U.Lg,{height:"100%",mv:0,children:[(0,r.jsx)(U.CH,{children:(0,r.jsxs)(y.Ac,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:[i,": ",t]})}),(0,r.jsx)(U.bc,{children:(0,r.jsx)(S,{anvilUuid:o})})]})},e}),{}),spacing:"1em",sx:(e={alignContent:"stretch"},n="& > .".concat(f.Z.item),t={minWidth:"20em"},n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e)});var e,n,t}),[i]);return(0,r.jsxs)(U.s_,{children:[(0,r.jsx)(U.V9,{children:(0,r.jsx)(y.z,{children:"Nodes"})}),t?(0,r.jsx)(g.Z,{}):o]})},E=t(5094),M=t(1200),B=t(8750),k=t(1706),N=t(5741),D=t(9),T=t(1905),z=t(7698),$=t(9370);function W(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 F(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Q(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){F(e,n,t[n])}))}return e}function L(e){return function(e){if(Array.isArray(e))return W(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 W(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 W(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 R=function(e){return(0,r.jsx)(o.ZP,{alignContent:"stretch",columns:{xs:1,sm:2,md:3,xl:4},container:!0,spacing:"1em",children:e.map((function(e){var n=e.anvilName,t=e.anvilUUID,i=e.isScreenshotStale,c=e.loading,a=e.screenshot,s=e.serverName,l=e.serverState,u=e.serverUUID,d=e.timestamp;return(0,r.jsx)(o.ZP,{item:!0,sx:{minWidth:"20em","& > div":{height:"100%",marginBottom:0,marginTop:0}},xs:1,children:(0,r.jsx)(E.M,{externalPreview:a,externalTimestamp:d,headerEndAdornment:[(0,r.jsx)(N.Z,{href:"/server?uuid=".concat(u,"&server_name=").concat(s,"&server_state=").concat(l),children:s},"server_list_to_server_".concat(u)),(0,r.jsx)(N.Z,{href:"/anvil?anvil_uuid=".concat(t),sx:{opacity:.7},children:n},"server_list_server_".concat(u,"_to_anvil_").concat(t))],hrefPreview:"/server?uuid=".concat(u,"&server_name=").concat(s,"&server_state=").concat(l,"&vnc=1"),isExternalLoading:c,isExternalPreviewStale:i,isFetchPreview:!1,isShowControls:!1,isUseInnerPanel:!0,serverState:l,serverUUID:u})},"".concat(u,"-preview"))}))})},G=function(e,n){return""===n?{exclude:e,include:[]}:e.reduce((function(e,t){return t.serverName.includes(n)?e.include.push(t):e.exclude.push(t),e}),{exclude:[],include:[]})},V=function(){var e=(0,l.useRef)(!0),n=(0,l.useState)([]),t=n[0],o=n[1],f=(0,l.useState)([]),h=f[0],m=f[1],v=(0,l.useState)([]),x=v[0],j=v[1],p=(0,l.useState)(""),b=p[0],Z=p[1],O=(0,l.useState)(!1),P=O[0],w=O[1],_=function(){for(var n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];var i=G.apply(void 0,L(t)),o=i.exclude,c=i.include;e.current&&(m(o),j(c))},S=(0,T.Z)("".concat(u.Z,"/server"),{onSuccess:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=n.map((function(n){var i,c=n.serverUUID,a=Q({},n,{loading:!0,screenshot:(null===(i=t.find((function(e){return e.serverUUID===c})))||void 0===i?void 0:i.screenshot)||"",timestamp:0});return(0,M.Z)("".concat(u.Z,"/server/").concat(c,"?ss=1")).then((function(n){var t=n.screenshot,i=n.timestamp;if(0!==t.length){a.isScreenshotStale=!(0,$.Z$)(i,300),a.loading=!1,a.screenshot=t,a.timestamp=i;var c=L(r);e.current&&o(c)}})).catch((function(){a.isScreenshotStale=!0})).finally((function(){a.loading=!1})),a}));o(r),_(r,b)},refreshInterval:6e4}).isLoading;return(0,l.useEffect)((function(){return function(){e.current=!1}}),[]),(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(s.default,{children:(0,r.jsx)("title",{children:"Dashboard"})}),(0,r.jsx)(B.Z,{}),(0,r.jsx)(U.s_,{children:S?(0,r.jsx)(g.Z,{}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(U.V9,{sx:{marginBottom:"2em"},children:[(0,r.jsx)(y.z,{children:"Servers"}),(0,r.jsx)(k.Z,{onClick:function(){return w(!0)},children:(0,r.jsx)(i.Z,{})}),(0,r.jsx)(D.Z,{placeholder:"Search by server name",onChange:function(e){var n=e.target.value;Z(n),_(t,n)},sx:{minWidth:"16em"},value:b})]}),R(x),x.length>0&&(0,r.jsx)(a.Z,{sx:{backgroundColor:d.d}}),R(h)]})}),(0,r.jsx)(C,{}),(0,r.jsx)(z.Z,{dialogProps:{open:P},onClose:function(){w(!1)}})]})}}},function(e){e.O(0,[412,438,894,182,209,82,62,195,27,157,707,94,774,888,179],(function(){return n=5301,e(e.s=n);var n}));var n=e.O();_N_E=n}]);