(this["webpackJsonp@factor/webapp"]=this["webpackJsonp@factor/webapp"]||[]).push([[22],{1111:function(e,t,a){"use strict";a.r(t);var r=a(33),n=a(9),i=a(23),o=a.n(i),c=a(0),l=a.n(c),d=a(542),u=a(529),m=a(685),s=a(686),b=a(189),h=a(784),f=a(1174),p=a(1182),g=a(1176),O=a(178),j=a(160),w=a(137),v=a(155),E=a(51),C=a(158),N=a(157),k=a(156),I=a(388),x=a(534),S=a(687),y=a(688),B=a(689),R=a(535);function M(e){var t=c.useState(!0),a=Object(n.a)(t,2),r=a[0],i=a[1],o=function(){i(!1)};return c.createElement(x.a,{open:r,onClose:o,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description"},c.createElement(R.a,{id:"alert-dialog-title"},"Error"),c.createElement(y.a,null,c.createElement(B.a,{id:"alert-dialog-description"},e.children)),c.createElement(S.a,null,c.createElement(u.a,{onClick:o},"Close")))}var W=a(159),D=Object(h.a)((function(e){return{root:{minHeight:"100%",backgroundColor:Object(j.highlightedBgColor)(e),paddingTop:e.spacing(3),paddingBottom:e.spacing(3)},datagrid:{color:e.palette.text.primary,borderColor:Object(j.highlightedBgColor)(e,3),"& .MuiDataGrid-columnsContainer":{color:e.palette.text.primary,borderColor:Object(j.highlightedBgColor)(e,3)},"& .MuiDataGrid-cell":{color:e.palette.text.primary,borderColor:Object(j.highlightedBgColor)(e,3)},"& .MuiDataGrid-columnSeparator":{color:Object(j.highlightedBgColor)(e,3)}}}})),G=function(e){var t=e.row;if(!t.runId)return"";var a=Object(E.f)(C.a.WatchRecording.path,{runId:t.runId,stepId:"0"});return l.a.createElement(N.a,{to:a},t.runId)},T=function(e){var t=e.runner,a=Object(c.useState)(!1),i=Object(n.a)(a,2),s=i[0],b=i[1],h=Object(c.useState)(""),f=Object(n.a)(h,2),p=f[0],g=f[1],O=Object(W.b)().enqueueSnackbar,j=Object(c.useCallback)(Object(r.a)(o.a.mark((function e(){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,g(""),b(!0),e.next=5,Object(k.a)(I.killRunnerFn,{id:t.id});case 5:O("Stop command sent to runner ".concat(t.vmId)),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),g(Object(k.b)(e.t0));case 11:return e.prev=11,b(!1),e.finish(11);case 14:case"end":return e.stop()}}),e,null,[[0,8,11,14]])}))),[e.runner.id,e.runner.vmId]);return t.iam&&t.vmId&&!t.deregisteredAt&&t.hostname?l.a.createElement(l.a.Fragment,null,p&&l.a.createElement(M,null,p),l.a.createElement(d.a,{title:"Send a stop command to the runner. May take up to one minute to propagate"},l.a.createElement(u.a,{variant:"outlined",color:"secondary",onClick:j,disabled:s},!s&&"Stop",s&&l.a.createElement(m.a,{size:20})))):""},A=function(e){var t=e.colDef.component,a=e.row;return l.a.createElement(t,{runner:a})},_=function(e){var t=e.runners,a=D(),r=function(){var e=Object(w.b)(v.UserTableConfig);return e.items?e.items.reduce((function(e,t){return e[t.id]=t,e}),{}):{}}(),n=Object(c.useMemo)((function(){return[{field:Object(g.a)("status"),headerName:"status",width:250},{field:Object(g.a)("statusReason"),headerName:"statusReason",minWidth:250,flex:1},{field:Object(g.a)("command"),headerName:"command",width:100},{field:Object(g.a)("hostname"),headerName:"hostname",minWidth:200,flex:1},{field:Object(g.a)("vmId"),headerName:"vmId",minWidth:200,flex:1},{field:Object(g.a)("heartbeatTime"),headerName:"heartbeat",width:200},{field:Object(g.a)("runId"),headerName:"runId",renderCell:G,width:200},{field:Object(g.a)("iam"),headerName:"cloud",width:80},{field:"__action",headerName:"action",renderCell:A,component:T,width:80},{field:Object(g.a)("region"),headerName:"region",width:120},{field:Object(g.a)("owner"),width:225,headerName:"owner",valueGetter:function(e){return console.log({params:e}),e.row.owner&&r[e.row.owner]?r[e.row.owner].preferred_name:e.row.owner}},{field:Object(g.a)("deregisteredAt"),headerName:"deregisteredAt",width:200}]}),[r]),i=t;return l.a.createElement(p.a,{className:a.datagrid,columnBuffer:2,disableSelectionOnClick:!0,autoHeight:!0,rows:i,columns:n})};t.default=function(){var e=D(),t=Object(w.b)(Object(c.useMemo)((function(){return{table:v.RunnerTableConfig}}),[])),a=t.loaded,r=t.items;return a?l.a.createElement(f.a,{className:e.root,title:"Runners"},l.a.createElement(s.a,{maxWidth:!1},l.a.createElement(b.a,{pt:2},l.a.createElement(_,{runners:r})))):l.a.createElement(O.a,null)}},1174:function(e,t,a){"use strict";var r=a(28),n=a(0),i=a.n(n),o=a(574),c=["children","title"],l=Object(n.forwardRef)((function(e,t){var a=e.children,n=e.title,l=void 0===n?"":n,d=Object(r.a)(e,c);return i.a.createElement("div",Object.assign({ref:t},d),i.a.createElement(o.a,null,i.a.createElement("title",null,l)),a)}));l.displayName="Page",t.a=l},1176:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var r=function(e){return e}}}]);