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

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[16],{93016:function(e,n,t){t.d(n,{S:function(){return O},M:function(){return X}});var r=t(85893),l=t(53183),s=t(24378),i=t(12641),o=t(55278),c=t(89262),a=t(14440),u=t(65086),d=t(94246),h=t(5152),x=t.n(h),f=t(67294),v=t(65895);let j="0xffe3",m="0xffe9";var p=[{keys:"Ctrl + Alt + Delete",scans:[]},{keys:"Ctrl + Alt + F1",scans:[j,m,"0xffbe"]},{keys:"Ctrl + Alt + F2",scans:[j,m,"0xffbf"]},{keys:"Ctrl + Alt + F3",scans:[j,m,"0xffc0"]},{keys:"Ctrl + Alt + F4",scans:[j,m,"0xffc1"]},{keys:"Ctrl + Alt + F5",scans:[j,m,"0xffc2"]},{keys:"Ctrl + Alt + F6",scans:[j,m,"0xffc3"]},{keys:"Ctrl + Alt + F7",scans:[j,m,"0xffc4"]},{keys:"Ctrl + Alt + F8",scans:[j,m,"0xffc5"]},{keys:"Ctrl + Alt + F9",scans:[j,m,"0xffc6"]}],C=t(23833),g=t(23930),Z=t(5552),w=t(98484),k=t(14789),b=t(99429),y=t(60207),S=e=>{let{getItemDisabled:n,items:t={},muiMenuProps:l,onItemClick:s,open:i,renderItem:o}=e,c=(0,f.useMemo)(()=>Object.entries(t),[t]),a=(0,f.useMemo)(()=>c.map(e=>{let[t,l]=e;return(0,r.jsx)(C.Z,{disabled:null==n?void 0:n.call(null,t,l),onClick:function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==s?void 0:s.call(null,t,l,...n)},children:null==o?void 0:o.call(null,t,l)},t)}),[n,s,c,o]);return(0,r.jsx)(u.Z,{open:i,...l,children:a})},A=e=>{let{children:n,containedButtonProps:t,iconButtonProps:l,muiMenuProps:s,onButtonClick:i,onItemClick:o,variant:c="icon",...u}=e,[d,h]=(0,f.useState)(null),x=(0,f.useMemo)(()=>!!d,[d]),v=(0,f.useMemo)(()=>n||("icon"===c?(0,r.jsx)(k.Z,{fontSize:null==l?void 0:l.size}):"Options"),[n,null==l?void 0:l.size,c]),j=(0,f.useCallback)(function(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];let{0:{currentTarget:r}}=n;return h(r),null==i?void 0:i.call(null,...n)},[i]),m=(0,f.useMemo)(()=>"contained"===c?(0,r.jsx)(b.Z,{onClick:j,...t,children:v}):(0,r.jsx)(y.Z,{onClick:j,...l,children:v}),[j,v,t,l,c]),p=(0,f.useCallback)(function(e,n){for(var t=arguments.length,r=Array(t>2?t-2:0),l=2;l<t;l++)r[l-2]=arguments[l];return h(null),null==o?void 0:o.call(null,e,n,...r)},[o]);return(0,r.jsxs)(a.Z,{children:[m,(0,r.jsx)(S,{muiMenuProps:{anchorEl:d,keepMounted:!0,onClose:()=>h(null),...s},onItemClick:p,open:x,...u})]})},F=t(97607),P=t(59278),M=t(2188),z=e=>{var n;let{getItemDisabled:t,items:l,onItemClick:s,renderItem:i,serverName:o,serverState:c,serverUuid:u,...d}=e,{confirmDialog:h,setConfirmDialogOpen:x,setConfirmDialogProps:v,finishConfirm:j}=(0,M.Z)(),m=(0,f.useMemo)(()=>({"force-off":{colour:"red",description:(0,r.jsx)(r.Fragment,{children:"This is equal to pulling the power cord, which may cause data loss or system corruption."}),label:"Force off",path:"/command/stop-server/".concat(u,"?force=1")},"power-off":{description:(0,r.jsx)(r.Fragment,{children:"This is equal to pushing the power button. If the server doesn't respond to the corresponding signals, you may have to manually shut it down."}),label:"Power off",path:"/command/stop-server/".concat(u)},"power-on":{description:(0,r.jsx)(r.Fragment,{children:"This is equal to pushing the power button."}),label:"Power on",path:"/command/start-server/".concat(u)}}),[u]);return(0,r.jsxs)(a.Z,{children:[(0,r.jsx)(A,{getItemDisabled:e=>"running"===c===e.includes("on"),items:m,onItemClick:(e,n)=>{let{colour:t,description:l,label:s,path:i}=n,c=s.toLocaleLowerCase();v({actionProceedText:s,content:(0,r.jsx)(P.Ac,{children:l}),onProceedAppend:()=>{v(e=>({...e,loading:!0})),w.Z.put(i).then(()=>{j("Success",{children:(0,r.jsxs)(r.Fragment,{children:["Successfully registered ",c," job on ",o,"."]})})}).catch(e=>{let n=(0,F.Z)(e);n.children=(0,r.jsxs)(r.Fragment,{children:["Failed to register ",c," job on ",o,"; CAUSE:"," ",n.children,"."]}),j("Error",n)})},proceedColour:t,titleText:"".concat(s," server ").concat(o,"?")}),x(!0)},renderItem:(e,n)=>{let t;let{colour:l,label:s}=n;return l&&(t=b.D[l]),(0,r.jsx)(P.Ac,{inheritColour:!0,color:t,children:s})},...d,children:(0,r.jsx)(Z.Z,{fontSize:null==d?void 0:null===(n=d.iconButtonProps)||void 0===n?void 0:n.size})}),h]})},E=