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

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{6538:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return Qe}});var r=t(5893),i=t(6265),o=t(6049),s=t(1120),a=t(8788),d=(0,s.Z)((function(){return{innerHeader:{position:"relative",padding:"0 .7em"},header:{top:"-.3em",left:"-.3em",padding:"1.4em 0",position:"absolute",content:'""',borderColor:a.d,borderWidth:"1px",borderRadius:a.n_,borderStyle:"solid",width:"100%"}}})),c=function(e){var n=e.children,t=d();return(0,r.jsxs)(o.Z,{className:t.innerHeader,whiteSpace:"pre-wrap",children:[(0,r.jsx)("div",{className:t.header}),n]})},l=(0,s.Z)((function(){return{innerBody:{borderWidth:"1px",borderRadius:a.n_,borderStyle:"solid",borderColor:a.d,marginTop:"1.4em",marginBottom:"1.4em",paddingBottom:".7em",position:"relative"}}})),u=function(e){var n=e.children,t=l();return(0,r.jsx)(o.Z,{className:t.innerBody,children:n})},h=(0,s.Z)((function(){return{paper:{padding:"2.1em",backgroundColor:a.v9,opacity:.8,zIndex:999},container:{margin:"1em",position:"relative"},square:{content:'""',position:"absolute",width:"2.1em",height:"2.1em",border:"1px",borderColor:a.lD,borderWidth:"1px",borderRadius:a.n_,borderStyle:"solid",padding:0,margin:0},topSquare:{top:"-.3em",left:"-.3em"},bottomSquare:{bottom:"-.3em",right:"-.3em"}}})),x=function(e){var n=e.children,t=h();return(0,r.jsxs)("div",{className:t.container,children:[(0,r.jsx)("div",{className:"".concat(t.square," ").concat(t.topSquare)}),(0,r.jsx)("div",{className:"".concat(t.square," ").concat(t.bottomSquare)}),(0,r.jsx)("div",{className:t.paper,children:n})]})},p=t(5723),g=function(){return fetch.apply(void 0,arguments).then((function(e){return e.json()}))},f=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,t=(0,p.ZP)(e,g,{refreshInterval:n}),r=t.data,i=t.error;return{data:r,isLoading:!i&&!r,isError:i}},m=t(7294),j=t(9570),v=t(2318),b=t(4670),_=(0,b.Z)({root:{color:a.lD}})(v.Z),Z=function(e){var n=e.text;return(0,r.jsx)(_,{variant:"h4",children:n})},w=(0,s.Z)((function(){return{selected:{color:a.lD},unselected:{color:a.UZ}}})),y=function(e){var n=e.text,t=e.selected,i=w();return(0,r.jsx)(v.Z,{variant:"subtitle1",className:t?i.selected:i.unselected,children:n})};y.defaultProps={selected:!0};var k=y,N=new Map([["optimal","Optimal"],["not_ready","Not Ready"],["degraded","Degraded"]]),O={uuid:"",setAnvilUuid:function(){return null}},C=(0,m.createContext)(O),P=function(e){var n=e.children,t=(0,m.useState)(""),i=t[0],o=t[1];return(0,r.jsx)(C.Provider,{value:{uuid:i,setAnvilUuid:function(e){o(e)}},children:n})},T=(0,s.Z)((function(){return{decorator:{width:"1.4em",height:"100%",borderRadius:a.n_},ok:{backgroundColor:a.Ej},warning:{backgroundColor:a.Wd},error:{backgroundColor:a.hM},off:{backgroundColor:a.s7}}})),D=function(e){var n=e.colour,t=T();return(0,r.jsx)("div",{className:"".concat(t.decorator," ").concat(t[n])})},E=function(e,n){fetch("".concat("/cgi-bin").concat(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})},S=(0,s.Z)((function(){return{root:{width:"100%","&:hover $child":{backgroundColor:a.Gf}},anvilName:{paddingLeft:0}}})),B=function(e){switch(e){case"optimal":return"ok";case"not_ready":return"warning";case"degraded":default:return"error"}},L=function(e){return!(-1===e.hosts.findIndex((function(e){return"offline"!==e.state})))},R=function(e){var n=e.list,t=(0,m.useContext)(C).uuid,i=S(),s=n.findIndex((function(e){return e.anvil_uuid===t}));return(0,r.jsx)(o.Z,{display:"flex",flexDirection:"row",width:"100%",children:""!==t&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,{p:1,children:(0,r.jsx)(D,{colour:B(n[s].anvil_state)})}),(0,r.jsxs)(o.Z,{p:1,flexGrow:1,className:i.anvilName,children:[(0,r.jsx)(Z,{text:n[s].anvil_name}),(0,r.jsx)(Z,{text:N.get(n[s].anvil_state)||"State unavailable"})]}),(0,r.jsx)(o.Z,{p:1,children:(0,r.jsx)(j.Z,{checked:L(n[s]),onChange:function(){return E("/set_power",{anvil_uuid:n[s].anvil_uuid,is_on:!L(n[s])})}})})]})})},F=t(2822),G=t(5517),I=t(998),A=function(e){var n=e.anvil;return(0,r.jsxs)(r.Fragment,{children:[(0