1 line
10 KiB
JavaScript
1 line
10 KiB
JavaScript
|
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{48312:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return n(71585)}])},86549:function(e,t,n){"use strict";var r=n(85893),s=n(11632),i=n(77574),c=n(77831),a=n(56903);t.Z=e=>{let{children:t,sx:n,...l}=e;return(0,r.jsx)(i.Z,{underline:"hover",variant:"subtitle1",...l,sx:{color:c.lD,textDecorationColor:c.s7,...n},children:(0,r.jsxs)(a.Z,{row:!0,children:[t,(0,r.jsx)(s.Z,{sx:{marginLeft:".3em"}})]})})}},77510:function(e,t,n){"use strict";var r=n(67294),s=n(8100),i=n(92230),c=n(54120);t.Z=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{baseUrl:n=i.Z,fetcher:a=c.Z,mod:l,...o}=t,{data:d,error:h,mutate:x}=(0,s.ZP)("".concat(n).concat(e),a,o),u=(0,r.useMemo)(()=>l&&d&&l(d),[d,l]),m=!h&&!d;return{altData:u,data:d,error:h,mutate:x,loading:m}}},59752:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=e=>e.reduce((e,t)=>{let{hostName:n,hostType:r,hostUUID:s}=t;return e[s]={name:n,type:r,uuid:s},e},{}),s=e=>e.reduce((e,t)=>{let{anvilDescription:n,anvilName:s,anvilUUID:i,hosts:c}=t;return e[i]={description:n,hosts:r(c),name:s,uuid:i},e},{})},71585:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return Q}});var r=n(85893),s=n(31530),i=n(99514),c=n(14440),a=n(59505),l=n(9008),o=n.n(l),d=n(67294),h=n(92230),x=n(77831),u=n(84501),m=n(54490),j=e=>{let{anvil_name:t,anvil_state:n,anvil_uuid:r,hosts:s}=e;return{hosts:s.reduce((e,t)=>{let{host_name:n,host_uuid:r,maintenance_mode:s,server_count:i,state:c,state_percent:a}=t;return e[r]={name:n,maintenance:s,serverCount:i,state:c,stateProgress:a,uuid:r},e},{}),name:t,state:n,uuid:r}},v=e=>{let{allocated:t,reserved:n,total:r}=e;return{allocated:BigInt(t),reserved:BigInt(n),total:BigInt(r)}},Z=e=>{let{storage_groups:t,total_free:n,total_size:r}=e,s=BigInt(n),i=BigInt(r);return t.reduce((e,t)=>{let{storage_group_free:n,storage_group_name:r,storage_group_total:s,storage_group_uuid:i}=t,c=BigInt(n),a=BigInt(s);return e.storageGroups[i]={free:c,name:r,size:a,uuid:i},e},{storageGroups:{},totalFree:s,totalSize:i})},g=n(29535),p=n(56903),_=n(25137),f=n(38196),P=n(59278),w=n(77510);let S=BigInt(100),b={degraded:x.hM,not_ready:x.Wd,optimal:x.Ej},y={offline:x.Wd,online:x.Ej};var C=e=>{let{anvilUuid:t,refreshInterval:n=5e3}=e,{data:s,loading:c}=(0,w.Z)("/anvil/".concat(t),{refreshInterval:n}),a=(0,d.useMemo)(()=>s&&j(s),[s]),{data:l,loading:o}=(0,w.Z)("/anvil/".concat(t,"/cpu"),{refreshInterval:n}),h=(0,d.useMemo)(()=>l&&Object.values(l.hosts),[l]),{data:C,loading:I}=(0,w.Z)("/anvil/".concat(t,"/memory"),{refreshInterval:n}),M=(0,d.useMemo)(()=>C&&v(C),[C]),{data:A,loading:U}=(0,w.Z)("/anvil/".concat(t,"/store"),{refreshInterval:n}),B=(0,d.useMemo)(()=>A&&Z(A),[A]),E=(0,d.useMemo)(()=>[c,o,I,U].some(e=>e),[c,o,I,U]),N=(0,d.useMemo)(()=>a&&(0,r.jsx)(P.$_,{inheritColour:!0,color:b[a.state],children:a.state}),[a]),D=(0,d.useMemo)(()=>a&&(0,r.jsx)(i.ZP,{alignItems:"center",columns:20,columnSpacing:"0.5em",container:!0,sx:{["& > .".concat(u.Z.item,":nth-child(-n + 4)")]:{marginBottom:"-.6em"}},children:Object.values(a.hosts).map(e=>{var t;let n;let{name:s,serverCount:c,state:a,stateProgress:l,uuid:o}=e,d=null!==(t=y[a])&&void 0!==t?t:x.s7,h=a;return["offline","online"].includes(a)?n=(0,r.jsx)(P.$_,{variant:"caption",children:c}):h="".concat(l,"%"),[(0,r.jsx)(i.ZP,{item:!0,xs:7,children:(0,r.jsx)(P.Ac,{variant:"caption",whiteSpace:"nowrap",children:s})},"".concat(o,"-state-label")),(0,r.jsx)(i.ZP,{item:!0,xs:5,children:(0,r.jsx)(P.$_,{inheritColour:!0,color:d,children:h})},"".concat(o,"-state")),(0,r.jsx)(i.ZP,{item:!0,xs:!0,children:(0,r.jsx)(g.Z,{sx:{marginBottom:"-.4em"}})},"".concat(o,"-divider")),(0,r.jsx)(i.ZP,{item:!0,width:"2.2em",children:n&&(0,r.jsx)(P.Ac,{variant:"caption",children:"Servers"})},"".concat(o,"-server-label")),(0,r.jsx)(i.ZP,{display:"flex",item:!0,justifyContent:"flex-end",width:"2em",children:n},"".concat(o,"-server-count"))]})}),[a]),T=(0,d.useMemo)(()=>l&&h&&(0,r.jsxs)(p.Z,{row:!0,spacing:".5em",children:[(0,r.jsx)(p.Z,{spacing:0,children
|