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

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[466],{96674:function(e,t,s){var n=s(85893),i=s(89256),r=s(62191),l=s(89262),a=s(59879),o=s(324),c=s(28721),u=s(73315),p=s(14440),d=s(55074),x=s(67294),m=s(77831),h=s(34635),g=s(91029);let v=e=>(0,n.jsx)(i.Z,{in:!0,children:(0,n.jsx)(r.Z,{...e})}),U=(0,l.ZP)("ul")({padding:0}),f=a.Z;t.Z=e=>{let{componentsProps:t,extendRenderInput:s,getGroupLabel:i,label:r,messageBoxProps:l,renderGroup:a,renderInput:S,sx:j,...I}=e,D=(0,x.useMemo)(()=>({paper:{sx:{backgroundColor:m.lD,["& .".concat(o.Z.groupLabel)]:{backgroundColor:m.lD}}},...t}),[t]),b=(0,x.useMemo)(()=>a||i&&(e=>(0,n.jsxs)("li",{children:[(0,n.jsx)(f,{component:"div",className:o.Z.groupLabel,children:i(e.group)}),(0,n.jsx)(U,{className:o.Z.groupUl,children:e.children})]},e.key)),[i,a]),y=(0,x.useMemo)(()=>null!=S?S:e=>{let{fullWidth:t,InputProps:i,InputLabelProps:l,inputProps:a}=e,o={formControlProps:{fullWidth:t,ref:i.ref},inputLabelProps:l,inputProps:{className:i.className,endAdornment:i.endAdornment,inputProps:a,startAdornment:i.startAdornment},label:r};return null==s||s.call(null,o,e),(0,n.jsx)(g.Z,{...o})},[s,r,S]),P=(0,x.useMemo)(()=>({["& .".concat(c.Z.root," .").concat(o.Z.endAdornment)]:{right:"7px",["& .".concat(u.Z.root)]:{color:m.s7}},...j}),[j]);return(0,n.jsxs)(p.Z,{sx:{display:"flex",flexDirection:"column"},children:[(0,n.jsx)(d.Z,{PaperComponent:v,...I,componentsProps:D,renderGroup:b,renderInput:y,sx:P}),(0,n.jsx)(h.Z,{...l})]})}},56466:function(e,t,s){let n,i;s.d(t,{Z:function(){return V}});var r=s(85893),l=s(67294),a=s(14440),o=s(99514),c=s(92309),u=s(12641),p=s(25934),d=s(77831),x=s(98484),m=s(96674),h=s(77583),g=s(99429),v=s(56903),U=s(62800),f=s(65895),S=s(99576),j=s(91029),I=s(20408),D=s(28721),b=s(34635),y=s(6189);let P={inputWithLabelProps:{},messageBoxProps:{},selectWithLabelProps:{}},Z=e=>{let{id:t,label:s,inputWithLabelProps:n=P.inputWithLabelProps,messageBoxProps:i=P.messageBoxProps,selectItems:l,selectWithLabelProps:o=P.selectWithLabelProps}=e;return(0,r.jsxs)(a.Z,{children:[(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"row","& > :first-child":{flexGrow:1},"& > :not(:last-child)":{marginRight:".5em"},["&:hover\n .".concat(I.Z.root,"\n .").concat(D.Z.root,"\n .").concat(D.Z.notchedOutline)]:{borderColor:d.s7}},children:[(0,r.jsx)(j.Z,{id:t,label:s,...n}),(0,r.jsx)(y.Z,{formControlProps:{fullWidth:!1,sx:{minWidth:"min-content"}},id:"".concat(t,"-nested-select"),selectItems:l,...o})]}),(0,r.jsx)(b.Z,{...i})]})};Z.defaultProps=P;var M=s(23930),C=s(25137),G=s(52675),A=s(59278);let k=BigInt(0),B=[{value:"B"},{value:"KiB"},{value:"MiB"},{value:"GiB"},{value:"TiB"}],z=BigInt(65536),w=BigInt(104857600),T={backgroundColor:d.Ej,color:d.lD,"&:hover":{backgroundColor:d.Ej}},N=(e,t)=>{let{onButtonClick:s}=t;return(0,r.jsx)(g.Z,{disabled:void 0===s,onClick:s,sx:{minWidth:"unset",whiteSpace:"nowrap"},children:"Max: ".concat(e)})},O=function(){let{endAdornment:e,mainLabel:t,subLabel:s}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,r.jsxs)(a.Z,{sx:{alignItems:"center",display:"flex",flexDirection:"row",width:"100%","& > :first-child":{flexGrow:1}},children:[(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column"},children:[t&&(0,r.jsx)(A.Ac,{inverted:!0,text:t}),s&&(0,r.jsx)(A.Ac,{inverted:!0,text:s})]}),e]})},F=e=>{let t={},s=e.reduce((e,s)=>{let{anvilUUID:n,anvilName:i,anvilTotalMemory:l,anvilTotalAllocatedMemory:o,anvilTotalAvailableMemory:c,hosts:u,servers:p,storageGroups:d,files:x}=s,{anvilStorageGroups:m,anvilStorageGroupUUIDs:h}=d.reduce((t,s)=>{let l={...s,anvilUUID:n,anvilName:i,storageGroupSize:BigInt(s.storageGroupSize),storageGroupFree:BigInt(s.storageGroupFree),humanizedStorageGroupFree:""};return(0,U.Bh)(s.storageGroupFree,{fromUnit:"B",onSuccess:{string:(e,t)=>{l.humanizedStorageGroupFree="".concat(e," ").concat(t)}},precision:0,toUnit:"ibyte"}),t.anvilStorageGroupUUIDs.push(s.storageGroupUUID),t.anvilStorageGroups.push(l),e.storageGroups.push(l),e.storageGroupSelectItems.push({displayValue:O({endAdornment:(0,r.jsx)(A.Ac,{inverted:!0,text:"~".concat(l.humanizedStorageGroupFree," free")}),mainLabel:s.storageGroupName,subLabel:i}),value:s.storageGroupUUID}),e.storageGroupUUIDMapToData[s.storageGroupUUID]=l,t},{anvilStorageGroups:[],anvilStorageGroupUUIDs:[]}),g=[];x.forEach(e=>{let{fileUUID:s}=e;g.push(s),t[s]=e});let v={...s,anvilTotalMemory:BigInt(l),anvilTotalAllocatedMemory:BigInt(o),anvilTotalAvailableMemory:BigInt(c),humanizedAnvilTotalAvailableMemory:"",hosts:u.map(e=>({...e,hostMemory:BigInt(e.hostMemory)})),servers:p.map(t=>{let{serverMemory:s,serverName:n,...i}=t,r={...i,serverMemory:BigInt(s),serverName:n};return e.serverNameMapToData[n]=r,r}),storageGroupUUIDs:h,storageGroups:m,fileUUIDs:g};return(0,U.Bh)(c,{fromUnit:"B",onSuccess:{string:(e,t)=>{v.humanizedAnvilTotalAvailableMemory="".concat(e," ").concat(t)}},precision:0,toUnit:"ibyte"}),e.anvils.push(v),e.anvilSelectItems.push({displayValue:O({endAdornment:(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column",width:"8rem"},children:[(0,r.jsx)(A.Ac,{inverted:!0,text:"CPU: ".concat(v.anvilTotalCPUCores," cores")}),(0,r.jsx)(A.Ac,{inverted:!0,text:"Memory: ~".concat(v.humanizedAnvilTotalAvailableMemory)})]}),mainLabel:v.anvilName,subLabel:v.anvilDescription}),value:n}),e.anvilUUIDMapToData[n]=v,e},{anvils:[],anvilSelectItems:[],anvilUUIDMapToData:{},files:[],fileSelectItems:[],fileUUIDMapToData:{},serverNameMapToData:{},storageGroups:[],storageGroupSelectItems:[],storageGroupUUIDMapToData:{}});return Object.values(t).forEach(e=>{s.files.push(e),s.fileSelectItems.push({displayValue:e.fileName,value:e.fileUUID}),s.fileUUIDMapToData[e.fileUUID]=e}),s},L=function(e,t,s,n,i,r,l){let{includeAnvilUUIDs:a=[],includeFileUUIDs:o=[],includeStorageGroupUUIDs:c=[]}=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},u=()=>!0,p=()=>!0,d=()=>!0;a.length>0&&(u=e=>a.includes(e)),o.length>0&&(p=e=>o.includes(e)),c.length>0&&(d=e=>c.includes(e));let x={},m=r.reduce((e,t,s)=>{var n;let r=null!==(n=i[s])&&void 0!==n?n:k;return e.all+=r,""===t||(void 0===e[t]&&(e[t]=k),e[t]+=r),e},{all:k}),h=e.reduce((e,a)=>{let{anvilUUID:o}=a;if(u(o)){let{anvilTotalCPUCores:c,anvilTotalAvailableMemory:u,files:h,fileUUIDs:g,storageGroups:v}=a,U=[],f=k,S=k;v.forEach(e=>{let{storageGroupUUID:t,storageGroupFree:s}=e;d(t)&&(U.push(t),S+=s,s>f&&(f=s))}),[()=>v.length>0,()=>s<=c,()=>n<=u,()=>r.every((e,s)=>{var n;let r=null!==(n=i[s])&&void 0!==n?n:k,l=!0,a=r<=f;return""!==e&&(l=U.includes(e),a=r<=t[e].storageGroupFree),l&&a}),()=>Object.entries(m).every(e=>{let[s,n]=e;return"all"===s?n<=S:n<=t[s].storageGroupFree}),()=>l.every(e=>""===e||g.includes(e))].every(e=>e())&&(e.anvils.push(a),e.anvilUUIDs.push(o),e.maxCPUCores=Math.max(c,e.maxCPUCores),u>e.maxMemory&&(e.maxMemory=u),h.forEach(e=>{let{fileUUID:t}=e;p(t)&&(x[t]=!0)}),e.storageGroupUUIDs.push(...U),e.maxVirtualDiskSizes.fill(f))}return e},{anvils:[],anvilUUIDs:[],fileUUIDs:[],maxCPUCores:0,maxMemory:k,maxVirtualDiskSizes:r.map(()=>k),storageGroupUUIDs:[]});return h.fileUUIDs=Object.keys(x),r.forEach((e,s)=>{""!==e&&(h.maxVirtualDiskSizes[s]=t[e].storageGroupFree)}),h},R=(e,t,s,n,i,l,o,c)=>{let u=function(s){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return e[s][n]},p=function(n,i){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t;e[n][r]=i,s({...e})},d=function(){let s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:k;p("sizes",s);let{formattedMaxVDSizes:n,maxVirtualDiskSizes:i}=l({virtualDisks:e});c({inputs:{["vd".concat(t,"Size")]:{displayMax:"".concat(n[t]),max:i[t],value:s}}})},x=e=>{let{value:t=u("inputSizes"),unit:s=u("inputUnits")}=e;t!==u("inputSizes")&&p("inputSizes",t),s!==u("inputUnits")&&p("inputUnits",s),(0,U.KY)(t,s,e=>d(e),()=>d())},m=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u("inputStorageGroupUUIDs");t!==u("inputStorageGroupUUIDs")&&p("inputStorageGroupUUIDs",t),l({virtualDisks:e})};return(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column","& > :not(:first-child)":{marginTop:"1em"}},children:[(0,r.jsx)(a.Z,{sx:{display:"flex",flexDirection:"column"},children:(0,r.jsx)(Z,{id:"ps-virtual-disk-size-".concat(t),label:"Disk size",messageBoxProps:u("inputSizeMessages"),inputWithLabelProps:{inputProps:{endAdornment:N("".concat(u("inputMaxes")," ").concat(u("inputUnits")),{onButtonClick:()=>{p("inputSizes",u("inputMaxes")),d(u("maxes"))}}),onChange:e=>{let{target:{value:t}}=e;x({value:t})},type:"number",value:u("inputSizes")},inputLabelProps:{isNotifyRequired:u("sizes")===k}},selectItems:B,selectWithLabelProps:{selectProps:{onChange:e=>{let{target:{value:t}}=e;x({unit:t})},value:u("inputUnits")}}})}),(0,r.jsx)(a.Z,{sx:{display:"flex",flexDirection:"column"},children:(0,r.jsx)(y.Z,{id:"ps-storage-group-".concat(t),label:"Storage group",disableItem:e=>!(i.includes(e)&&u("sizes")<=o[e].storageGroupFree),inputLabelProps:{isNotifyRequired:0===u("inputStorageGroupUUIDs").length},messageBoxProps:u("inputStorageGroupUUIDMessages"),selectItems:n,selectProps:{onChange:e=>{let{target:{value:t}}=e;m(t)},onClearIndicatorClick:()=>m(""),renderValue:e=>{var t;let{anvilName:s="?",storageGroupName:n="Unknown (".concat(e,")")}=null!==(t=o[e])&&void 0!==t?t:{};return"".concat(n," (").concat(s,")")},value:u("inputStorageGroupUUIDs")}})})]},"ps-virtual-disk-".concat(u("stateIds")))},q=function(){let{existingVirtualDisks:e={stateIds:[],inputMaxes:[],inputSizeMessages:[],inputSizes:[],inputStorageGroupUUIDMessages:[],inputStorageGroupUUIDs:[],inputUnits:[],maxes:[],sizes:[]},stateId:t=(0,p.Z)(),inputMax:s="0",inputSize:n="",inputSizeMessage:i,inputStorageGroupUUID:r="",inputStorageGroupUUIDMessage:l,inputUnit:a="GiB",max:o=k,setVirtualDisks:c,size:u=k}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{stateIds:d,inputMaxes:x,inputSizeMessages:m,inputSizes:h,inputStorageGroupUUIDMessages:g,inputStorageGroupUUIDs:v,inputUnits:U,maxes:f,sizes:S}=e;return d.push(t),x.push(s),m.push(i),h.push(n),g.push(l),v.push(r),U.push(a),f.push(o),S.push(u),null==c||c.call(null,{...e}),e},Q=e=>e.filter(e=>""!==e),E=e=>({fromUnit:"B",onSuccess:{string:e},precision:0,toUnit:"ibyte"});(0,U.Bh)(z,E((e,t)=>{n="".concat(e," ").concat(t)})),(0,U.Bh)(w,E((e,t)=>{i="".concat(e," ").concat(t)}));var V=e=>{let{dialogProps:{open:t},onClose:s}=e,[p,I]=(0,l.useState)([]),[D,b]=(0,l.useState)({}),[P,O]=(0,l.useState)({}),[E,V]=(0,l.useState)({}),[W,_]=(0,l.useState)({}),[H,Y]=(0,l.useState)([]),[J,K]=(0,l.useState)([]),[X,$]=(0,l.useState)([]),[ee,et]=(0,l.useState)([]),[es,en]=(0,l.useState)(""),[ei,er]=(0,l.useState)(),[el,ea]=(0,l.useState)(1),[eo,ec]=(0,l.useState)(0),[eu,ep]=(0,l.useState)(),[ed,ex]=(0,l.useState)(k),[em,eh]=(0,l.useState)(k),[eg,ev]=(0,l.useState)(),[eU,ef]=(0,l.useState)("0"),[eS,ej]=(0,l.useState)(""),[eI,eD]=(0,l.useState)("GiB"),[eb,ey]=(0,l.useState)(q()),[eP,eZ]=(0,l.useState)(""),[eM,eC]=(0,l.useState)(),[eG,eA]=(0,l.useState)(""),[ek]=(0,l.useState)(),[eB,ez]=(0,l.useState)(""),[ew,eT]=(0,l.useState)(),[eN,eO]=(0,l.useState)(null),[eF,eL]=(0,l.useState)(),[eR,eq]=(0,l.useState)([]),[eQ,eE]=(0,l.useState)([]),[eV,eW]=(0,l.useState)([]),[e_,eH]=(0,l.useState)(!1),[eY,eJ]=(0,l.useState)(!1),[eK,eX]=(0,l.useState)(!1),[e$,e0]=(0,l.useState)(0),e1=(0,l.useMemo)(()=>{let e=[];for(let t=1;t<=eo;t+=1)e.push(t);return e},[eo]),e9={serverName:{defaults:{onSuccess:()=>{er(void 0)},value:es},isRequired:!0,tests:[{onFailure:()=>{er({text:"The server name length must be 1 to 16 characters.",type:"warning"})},test:e=>{let{value:t}=e,{length:s}=t;return s>=1&&s<=16}},{onFailure:()=>{er({text:"The server name is expected to only contain alphanumeric, hyphen, or underscore characters.",type:"warning"})},test:e=>{let{value:t}=e;return/^[a-zA-Z0-9_-]+$/.test(t)}},{onFailure:()=>{er({text:"This server name already exists, please choose another name.",type:"warning"})},test:e=>{let{value:t}=e;return void 0===E[t]}}]},cpuCores:{defaults:{max:eo,min:1,onSuccess:()=>{ep(void 0)},value:el},isRequired:!0,tests:[{onFailure:()=>{ep({text:"Non available.",type:"warning"})},test:G.X7},{onFailure:e=>{let{displayMax:t,displayMin:s}=e;ep({text:"The number of CPU cores is expected to be between ".concat(s," and ").concat(t,"."),type:"warning"})},test:G.SQ}]},memory:{defaults:{displayMax:"".concat(eU," ").concat(eI),displayMin:n,max:em,min:z,onSuccess:()=>{ev(void 0)},value:ed},isRequired:!0,tests:[{onFailure:()=>{ev({text:"Non available.",type:"warning"})},test:G.X7},{onFailure:e=>{let{displayMax:t,displayMin:s}=e;ev({text:"Memory is expected to be between ".concat(s," and ").concat(t,"."),type:"warning"})},test:G.SQ}]},installISO:{defaults:{onSuccess:()=>{eC(void 0)},value:eP},isRequired:!0,tests:[{test:G.HJ}]},anvil:{defaults:{onSuccess:()=>{eT(void 0)},value:eB},isRequired:!0,tests:[{test:G.HJ}]},optimizeForOS:{defaults:{onSuccess:()=>{eL(void 0)},value:null==eN?void 0:eN.key},isRequired:!0,tests:[{test:G.HJ}]}};eb.inputSizeMessages.forEach((e,t)=>{e9["vd".concat(t,"Size")]={defaults:{displayMax:"".concat(eb.inputMaxes[t]," ").concat(eb.inputUnits[t]),displayMin:i,max:eb.maxes[t],min:w,onSuccess:()=>{eb.inputSizeMessages[t]=void 0},value:eb.sizes[t]},isRequired:!0,onFinishBatch:()=>{ey({...eb})},tests:[{onFailure:()=>{eb.inputSizeMessages[t]={text:"Non available.",type:"warning"}},test:G.X7},{onFailure:e=>{let{displayMax:s,displayMin:n}=e;eb.inputSizeMessages[t]={text:"Virtual disk ".concat(t," size is expected to be between ").concat(n," and ").concat(s,"."),type:"warning"}},test:G.SQ}]},e9["vd".concat(t,"StorageGroup")]={defaults:{onSuccess:()=>{eb.inputStorageGroupUUIDMessages[t]=void 0},value:eb.inputStorageGroupUUIDs[t]},isRequired:!0,onFinishBatch:()=>{ey({...eb})},tests:[{test:G.HJ}]}});let e2=function(){let{allAnvils:e=p,cpuCores:t=el,fileUUIDs:s=[eP,eG],includeAnvilUUIDs:n=Q([eB]),includeFileUUIDs:i,includeStorageGroupUUIDs:r,inputMemoryUnit:l=eI,memory:a=ed,storageGroupUUIDMapToData:o=W,virtualDisks:c=eb}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{anvilUUIDs:u,fileUUIDs:d,maxCPUCores:x,maxMemory:m,maxVirtualDiskSizes:h,storageGroupUUIDs:g}=L(e,o,t,a,c.sizes,c.inputStorageGroupUUIDs,s,{includeAnvilUUIDs:n,includeFileUUIDs:i,includeStorageGroupUUIDs:r});ec(x),eh(m);let v=[];c.maxes=h,c.maxes.forEach((e,t)=>{(0,U.Bh)(e,{fromUnit:"B",onSuccess:{string:(e,s)=>{c.inputMaxes[t]=e,v[t]="".concat(e," ").concat(s)}},toUnit:c.inputUnits[t]})}),ey({...c}),eq(u),eE(d),eW(g);let f="";return(0,U.Bh)(m,{fromUnit:"B",onSuccess:{string:(e,t)=>{ef(e),f="".concat(e," ").concat(t)}},toUnit:l}),{formattedMaxMemory:f,formattedMaxVDSizes:v,maxCPUCores:x,maxMemory:m,maxVirtualDiskSizes:h}},e6=(0,l.useCallback)(e2,[]),e5=function(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];let[n,...i]=t;return(0,G.BD)({tests:e9,...n},...i)},e7=function(){let{cmValue:e=k,cmUnit:t=eI}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ex(e);let{formattedMaxMemory:s,maxMemory:n}=e2({inputMemoryUnit:t,memory:e});e5({inputs:{memory:{displayMax:s,max:n,value:e}}})},e4=function(){let{value:e=eS,unit:t=eI}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e!==eS&&ej(e),t!==eI&&eD(t),(0,U.KY)(e,t,e=>e7({cmValue:e,cmUnit:t}),()=>e7({cmUnit:t}))},e8=e=>{eZ(e),e2({fileUUIDs:[e,eG]})},e3=e=>{eA(e),e2({fileUUIDs:[eP,e]})},te=e=>{let t=Q([e]);ez(e),e2({includeAnvilUUIDs:t})},tt=(0,l.useMemo)(()=>({"anvil node":!!Object.keys(D).length,file:!!Object.keys(P).length,"storage group":!!Object.keys(W).length}),[D,P,W]);return(0,l.useEffect)(()=>{x.Z.get("/anvil",{params:{anvilUUIDs:"all",isForProvisionServer:!0}}).then(e=>{let{data:t}=e,{anvils:s,anvilSelectItems:n,anvilUUIDMapToData:i,fileSelectItems:r,fileUUIDMapToData:l,serverNameMapToData:a,storageGroupSelectItems:o,storageGroupUUIDMapToData:c}=F(t.anvils);I(s),b(i),O(l),V(a),_(c),Y(n),K(r),et(o);let u={allAnvils:s,storageGroupUUIDMapToData:c};if(1===n.length){let{0:{value:e}}=n;ez(e),u.includeAnvilUUIDs=[e]}if(1===r.length){let{0:{value:e}}=r;eZ(e),u.fileUUIDs=[e,""]}if(1===o.length){let{0:{value:e}}=o;ey(t=>{let s={...t};return s.inputStorageGroupUUIDs[0]=e,u.virtualDisks=s,s})}e6(u),$(Object.entries(t.oses).map(e=>{let[t,s]=e;return{key:t,label:s}})),eH(!0)}).catch(()=>{})},[e6]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(c.Z,{fullWidth:!0,maxWidth:"sm",open:t,PaperComponent:M.s_,PaperProps:{sx:{overflow:"visible"}},children:[(0,r.jsxs)(M.V9,{children:[(0,r.jsx)(A.z,{text:"Provision a Server"}),(0,r.jsx)(f.Z,{onClick:s,sx:{backgroundColor:d.hM,color:d.lD,"&:hover":{backgroundColor:d.hM}},children:(0,r.jsx)(u.Z,{})})]}),(0,r.jsx)(v.Z,{spacing:".6em",children:Object.entries(tt).map(e=>{let[t,s]=e;return!s&&(0,r.jsxs)(S.Z,{type:"warning",children:["No ",t," available yet. Try refreshing after the resource gets created."]})})}),e_?(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column",maxHeight:"50vh",overflowY:"scroll",paddingTop:".6em","& > :not(:first-child)":{marginTop:"1em"}},children:[(0,r.jsx)(a.Z,{sx:{display:"flex",flexDirection:"column"},children:(0,r.jsx)(j.Z,{id:"ps-server-name",label:"Server name",inputProps:{onChange:e=>{let{target:{value:t}}=e;en(t),e5({inputs:{serverName:{value:t}}})},value:es},inputLabelProps:{isNotifyRequired:0===es.length},messageBoxProps:ei})}),(0,r.jsx)(m.Z,{id:"ps-cpu-cores",disableClearable:!0,extendRenderInput:e=>{let{inputLabelProps:t={}}=e;t.isNotifyRequired=el<=0},getOptionLabel:e=>String(e),label:"CPU cores",messageBoxProps:eu,noOptionsText:"No available number of cores.",onChange:(e,t)=>{if(!t||t===el)return;ea(t);let{maxCPUCores:s}=e2({cpuCores:t});e5({inputs:{cpuCores:{max:s,value:t}}})},openOnFocus:!0,options:e1,renderOption:(e,t)=>(0,l.createElement)("li",{...e,key:"ps-cpu-cores-".concat(t)},t),value:el}),(0,r.jsx)(Z,{id:"ps-memory",label:"Memory",messageBoxProps:eg,inputWithLabelProps:{inputProps:{endAdornment:N("".concat(eU," ").concat(eI),{onButtonClick:()=>{ej(eU),e7({cmValue:em})}}),onChange:e=>{let{target:{value:t}}=e;e4({value:t})},type:"number",value:eS},inputLabelProps:{isNotifyRequired:ed===k}},selectItems:B,selectWithLabelProps:{selectProps:{onChange:e=>{let{target:{value:t}}=e;e4({unit:t})},value:eI}}}),eb.stateIds.map((e,t)=>R(eb,t,ey,ee,eV,e2,W,e5)),(0,r.jsx)(y.Z,{disableItem:e=>e===eG,hideItem:e=>!eQ.includes(e),id:"ps-install-image",inputLabelProps:{isNotifyRequired:0===eP.length},label:"Install ISO",messageBoxProps:eM,selectItems:J,selectProps:{onChange:e=>{let{target:{value:t}}=e;e8(t)},onClearIndicatorClick:()=>e8(""),value:eP}}),(0,r.jsx)(y.Z,{disableItem:e=>e===eP,hideItem:e=>!eQ.includes(e),id:"ps-driver-image",label:"Driver ISO",messageBoxProps:ek,selectItems:J,selectProps:{onChange:e=>{let{target:{value:t}}=e;e3(t)},onClearIndicatorClick:()=>e3(""),value:eG}}),(0,r.jsx)(y.Z,{disableItem:e=>!eR.includes(e),id:"ps-anvil",inputLabelProps:{isNotifyRequired:0===eB.length},label:"Anvil node",messageBoxProps:ew,selectItems:H,selectProps:{onChange:e=>{let{target:{value:t}}=e;te(t)},onClearIndicatorClick:()=>te(""),renderValue:e=>{var t;let{anvilName:s="Unknown ".concat(e)}=null!==(t=D[e])&&void 0!==t?t:{};return s},value:eB}}),(0,r.jsx)(m.Z,{id:"ps-optimize-for-os",extendRenderInput:e=>{let{inputLabelProps:t={}}=e;t.isNotifyRequired=null===eN},isOptionEqualToValue:(e,t)=>e.key===t.key,label:"Optimize for OS",messageBoxProps:eF,noOptionsText:"No matching OS",onChange:(e,t)=>{eO(t)},openOnFocus:!0,options:X,renderOption:(e,t)=>(0,l.createElement)("li",{...e,key:"ps-optimize-for-os-".concat(t.key),children:[t.label," (",t.key,")"]}),value:eN})]}):(0,r.jsx)(C.Z,{}),(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column",marginTop:"1em","& > :not(:first-child)":{marginTop:"1em"}},children:[e$>0&&(0,r.jsx)(S.Z,{isAllowClose:!0,text:"Provision server job registered. You can provision another server, or exit; it won't affect the registered job."}),eK?(0,r.jsx)(C.Z,{mt:0}):(0,r.jsx)(a.Z,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",width:"100%"},children:(0,r.jsx)(g.Z,{disabled:!e5({isIgnoreOnCallbacks:!0}),onClick:()=>{eJ(!0)},sx:T,children:"Provision"})})]})]}),eY&&(0,r.jsx)(h.Z,{actionProceedText:"Provision",content:(0,r.jsxs)(o.ZP,{container:!0,columns:10,direction:"column",children:[(0,r.jsx)(o.ZP,{item:!0,xs:10,children:(0,r.jsxs)(A.Ac,{children:["Server ",(0,r.jsx)(A.Q0,{text:es})," will be created on anvil node"," ",(0,r.jsx)(A.Q0,{text:D[eB].anvilName})," ","with the following properties:"]})}),(0,r.jsxs)(o.ZP,{container:!0,direction:"row",item:!0,xs:10,children:[(0,r.jsx)(o.ZP,{item:!0,xs:2,children:(0,r.jsx)(A.Ac,{text:"CPU"})}),(0,r.jsx)(o.ZP,{item:!0,xs:5,children:(0,r.jsxs)(A.Ac,{children:[(0,r.jsx)(A.Q0,{edge:"start",children:el})," ","core(s)"]})}),(0,r.jsx)(o.ZP,{item:!0,xs:3,children:(0,r.jsxs)(A.Ac,{children:[(0,r.jsx)(A.Q0,{edge:"start",children:eo})," ","core(s) available"]})})]}),(0,r.jsxs)(o.ZP,{container:!0,direction:"row",item:!0,xs:10,children:[(0,r.jsx)(o.ZP,{item:!0,xs:2,children:(0,r.jsx)(A.Ac,{text:"Memory"})}),(0,r.jsx)(o.ZP,{item:!0,xs:5,children:(0,r.jsx)(A.Ac,{children:(0,r.jsxs)(A.Q0,{edge:"start",children:[eS," ",eI]})})}),(0,r.jsx)(o.ZP,{item:!0,xs:3,children:(0,r.jsxs)(A.Ac,{children:[(0,r.jsxs)(A.Q0,{edge:"start",children:[eU," ",eI]})," ","available"]})})]}),eb.stateIds.map((e,t)=>{let s=eb.inputMaxes[t],n=eb.inputSizes[t],i=eb.inputUnits[t],l=W[eb.inputStorageGroupUUIDs[t]].storageGroupName;return(0,r.jsxs)(o.ZP,{container:!0,direction:"row",item:!0,xs:10,children:[(0,r.jsx)(o.ZP,{item:!0,xs:2,children:(0,r.jsxs)(A.Ac,{children:["Disk ",(0,r.jsx)(A.Q0,{text:t})]})}),(0,r.jsx)(o.ZP,{item:!0,xs:5,children:(0,r.jsxs)(A.Ac,{children:[(0,r.jsxs)(A.Q0,{edge:"start",children:[n," ",i]})," ","on ",(0,r.jsx)(A.Q0,{children:l})]})}),(0,r.jsx)(o.ZP,{item:!0,xs:3,children:(0,r.jsxs)(A.Ac,{children:[(0,r.jsxs)(A.Q0,{edge:"start",children:[s," ",i]})," ","available"]})})]},"ps-virtual-disk-".concat(e,"-summary"))}),(0,r.jsxs)(o.ZP,{container:!0,direction:"row",item:!0,xs:10,children:[(0,r.jsx)(o.ZP,{item:!0,xs:2,children:(0,r.jsx)(A.Ac,{text:"Install ISO"})}),(0,r.jsx)(o.ZP,{item:!0,xs:8,children:(0,r.jsx)(A.Ac,{children:(0,r.jsx)(A.Q0,{edge:"start",children:P[eP].fileName})})})]}),(0,r.jsxs)(o.ZP,{container:!0,direction:"row",item:!0,xs:10,children:[(0,r.jsx)(o.ZP,{item:!0,xs:2,children:(0,r.jsx)(A.Ac,{text:"Driver ISO"})}),(0,r.jsx)(o.ZP,{item:!0,xs:8,children:(0,r.jsx)(A.Ac,{children:P[eG]?(0,r.jsx)(A.Q0,{edge:"start",children:P[eG].fileName}):"none"})})]}),(0,r.jsxs)(o.ZP,{container:!0,direction:"row",item:!0,xs:10,children:[(0,r.jsx)(o.ZP,{item:!0,xs:2,children:(0,r.jsx)(A.Ac,{text:"Optimize for OS"})}),(0,r.jsx)(o.ZP,{item:!0,xs:8,children:(0,r.jsx)(A.Ac,{children:(0,r.jsx)(A.Q0,{edge:"start",children:"".concat(null==eN?void 0:eN.label)})})})]})]}),dialogProps:{open:eY},onCancelAppend:()=>{eJ(!1)},onProceedAppend:()=>{let e={serverName:es,cpuCores:el,memory:ed.toString(),virtualDisks:eb.stateIds.map((e,t)=>({storageSize:eb.sizes[t].toString(),storageGroupUUID:eb.inputStorageGroupUUIDs[t]})),installISOFileUUID:eP,driverISOFileUUID:eG,anvilUUID:eB,optimizeForOS:null==eN?void 0:eN.key};eX(!0),x.Z.post("/server",e).then(()=>{eX(!1),e0(e$+1)}),eJ(!1)},proceedButtonProps:{sx:T},titleText:"Provision ".concat(es,"?")})]})}},62800:function(e,t,s){s.d(t,{Bh:function(){return i},KY:function(){return r},MU:function(){return l}});var n=s(54490),i=function(e){let{fromUnit:t,onFailure:s,onSuccess:i,precision:r,toUnit:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=(0,n.gO)(e,{fromUnit:t,precision:r,toUnit:l});if(a){let{value:e,unit:t}=a;try{var o,c,u;null==i||null===(o=i.bigint)||void 0===o||o.call(null,BigInt(e),t),null==i||null===(c=i.number)||void 0===c||c.call(null,parseFloat(e),t),null==i||null===(u=i.string)||void 0===u||u.call(null,e,t)}catch(n){null==s||s.call(null,n,e,t)}}else null==s||s.call(null)},r=(e,t,s,n)=>{i(e,{fromUnit:t,onFailure:n,onSuccess:{bigint:s},precision:0,toUnit:"B"})},l=e=>(0,n._d)(e,{toUnit:"ibyte"})}}]);