@topgroup/diginext
Version:
A BUILD SERVER & CLI to deploy apps to any Kubernetes clusters.
1 lines • 7.82 kB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5120],{70395:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return deploy_environment}});var r,o=t(22598);t(50029);var l=t(59499),i=t(16835);t(87794),t(76971);var a=t(57546),u=t(51042),d=t(85945),c=t(84213),s=t(66309),p=t(73318);t(26855),t(71471);var v=t(44973),f=t(27484),m=t.n(f),y=t(41664),g=t.n(y),x=t(11163),h=t(67294),j=t(34187),b=t(23907),w=t(47859),S=t(4400),Z=t(11778),k=t(61771),O=t(61123),_=t(90447),N=t(21084),P=t(20100),I=t(91710),E=t(56832),C=t(3669),D=t(55240),A=t(55611);t(59322);var z=t(73455);t(53072);var F=t(85893);function ownKeys(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,r)}return t}function _objectSpread(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ownKeys(Object(t),!0).forEach(function(n){(0,l.Z)(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}var L=t(56176),M=t(84110);m().extend(M),m().extend(L);var K=null!==(r=A.XL.tableConfig.defaultPageSize)&&void 0!==r?r:20,DeployEnvironmentList=function(){var e,n=(0,x.useRouter)(),t=(0,E.o)(),r=(0,i.Z)(t,2),o=r[0],l=r[1].setQuery,f=(0,C.Jl)().responsive,y=(0,D.f9)().modal,A=(0,h.useState)(o.page?parseInt(o.page,10):1),L=A[0],M=A[1];(0,d.NL)();var R=(e={pagination:{page:L,size:K},filter:{status:!0,cluster:o.cluster}},(0,Z.wz)(["deploy-environments","list"],"/api/v1/deploy-environment",e)),T=R.data,U=R.status;R.refetch;var W=T||{},X=W.list,Y=W.pagination||{},q=(Y.total_pages,Y.total_items),B=null==X?void 0:X.map(function(e,n){return _objectSpread(_objectSpread({},e),{},{key:"".concat(e.projectSlug,"-").concat(e.appSlug,"-").concat(e.env,"-").concat(n)})});console.log({displayedDeployEnvironments:B});var V=(0,w.x7)(),G=V.data;V.status;var H=(G||{}).list,J=[{title:"Deployment",width:30,dataIndex:"deploymentName",key:"deploymentName",fixed:null!=f&&f.md?"left":void 0,filterSearch:!0,render:function(e,n){return(0,F.jsx)(g(),{href:"?lv1=deploy_environment&project=".concat(n.projectSlug,"&app=").concat(n.appSlug,"&env=").concat(n.env),children:e})}},{title:"ENV",width:15,dataIndex:"env",key:"env",render:function(e){return(0,F.jsx)(s.Z,{color:"prod"===e?"success":"default",children:e})},filters:(0,P.Y)((null==B?void 0:B.map(function(e){var n,t;return{text:null!==(n=e.env)&&void 0!==n?n:"",value:null!==(t=e.env)&&void 0!==t?t:""}}))||[]).filter(function(e,n,t){return n===t.findIndex(function(n){return n.value===e.value})}),onFilter:function(e,n){return n.env===e}},{title:"Project",width:30,dataIndex:"projectSlug",key:"projectSlug",render:function(e){return(0,F.jsx)(F.Fragment,{children:(0,F.jsx)(s.Z,{children:e})})},filters:(0,P.Y)(((null==B?void 0:B.map(function(e){var n,t;return{text:null!==(n=e.projectName)&&void 0!==n?n:"",value:null!==(t=e.projectSlug)&&void 0!==t?t:""}}))||[]).filter(function(e){return""!==e.text&&""!==e.value})).filter(function(e,n,t){return n===t.findIndex(function(n){return n.value===e.value})}),onFilter:function(e,n){return n.projectSlug===e}},{title:"App",width:30,dataIndex:"appSlug",key:"appSlug",render:function(e){return(0,F.jsx)(F.Fragment,{children:(0,F.jsx)(s.Z,{children:e})})}},{title:"Cluster",width:30,dataIndex:"cluster",key:"cluster",render:function(e){return(0,F.jsx)(p.ZP,{type:"link",style:{padding:0},children:e})},filters:(0,P.Y)((null==H?void 0:H.map(function(e){return{text:e.name,value:e.slug}}))||[]).filter(function(e){return""!==e.text&&""!==e.value}),filterMultiple:!1,onFilter:function(e,n){return n.cluster===e}},{title:"CPU",dataIndex:"cpu",width:15,key:"cpu",render:function(e,n){var t,r,o,l,i,a,u,d;return(0,F.jsxs)(s.Z,{color:null!==(t=n.resources)&&void 0!==t&&null!==(r=t.limits)&&void 0!==r&&r.cpu?"success":"default",children:[(null===(o=n.resources)||void 0===o?void 0:null===(l=o.usage)||void 0===l?void 0:l.cpu)||e||"-"," / ",null!==(i=n.resources)&&void 0!==i&&null!==(a=i.limits)&&void 0!==a&&a.cpu?"".concat(null===(u=n.resources)||void 0===u?void 0:null===(d=u.limits)||void 0===d?void 0:d.cpu):"-"]})},sorter:function(e,n){return I.Su.indexOf(e.cpu||"")-I.Su.indexOf(n.cpu||"")}},{title:"Memory",dataIndex:"memory",key:"memory",width:15,render:function(e,n){var t,r,o,l,i,a,u,d;return(0,F.jsxs)(s.Z,{color:null!==(t=n.resources)&&void 0!==t&&null!==(r=t.limits)&&void 0!==r&&r.memory?"success":"default",children:[(null===(o=n.resources)||void 0===o?void 0:null===(l=o.usage)||void 0===l?void 0:l.memory)||e||"-"," / ",null!==(i=n.resources)&&void 0!==i&&null!==(a=i.limits)&&void 0!==a&&a.memory?"".concat(null===(u=n.resources)||void 0===u?void 0:null===(d=u.limits)||void 0===d?void 0:d.memory):"-"]})},sorter:function(e,n){return I.gM.indexOf(e.memory||"")-I.gM.indexOf(n.memory||"")}},{title:"Replicas",dataIndex:"replicas",key:"replicas",width:15},{title:"Last updated by",dataIndex:"lastUpdatedBy",key:"lastUpdatedBy",width:25,filterSearch:!0},{title:"Last updated",dataIndex:"updatedAt",key:"updatedAt",width:20,render:function(e){return(0,F.jsx)(O.q,{date:e})},sorter:function(e,n){return m()(e.updatedAt).diff(m()(n.updatedAt))}}],Q=(0,k.E_)(),$=(0,i.Z)(Q,2);$[0],$[1];var ee=(0,j._M)(),en=(0,i.Z)(ee,2);en[0],en[1];var et=(0,j.rg)(),er=(0,i.Z)(et,2);er[0],er[1];var eo=(0,j.WK)(),el=(0,i.Z)(eo,2);el[0],el[1];var ei=(0,j.md)(),ea=(0,i.Z)(ei,2);ea[0],ea[1];var eu=(0,b.rA)(),ed=(0,i.Z)(eu,2);ed[0],ed[1];var ec=(0,b.fg)(),es=(0,i.Z)(ec,2);es[0],es[1];var ep=(0,S.GD)(),ev=(0,i.Z)(ep,2);ev[0],ev[1];var ef=(0,j.yq)(),em=(0,i.Z)(ef,2);em[0],em[1];var ey=(0,j.wt)(),eg=(0,i.Z)(ey,2);eg[0],eg[1];var ex=(0,j.kK)(),eh=(0,i.Z)(ex,2);eh[0],eh[1];var openNewApp=function(){var e=null==y?void 0:y.info({className:"!p-0",style:{padding:0},bodyStyle:{padding:0},icon:null,content:(0,F.jsx)(z.Z,{onClose:function(){return null==e?void 0:e.destroy()}}),footer:null,closable:!0,maskClosable:!0,onOk:function(){}})};(0,h.useEffect)(function(){n.isReady&&M(o.page?parseInt(o.page.toString(),10):1)},[o.page]);var ej=(0,h.useRef)(null),eb=(0,c.Z)(ej);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(N.Z,{commands:null==B?void 0:B.map(function(e){var n,t;return{label:"".concat(null===(n=e.app)||void 0===n?void 0:n.name," (").concat(null===(t=e.app)||void 0===t?void 0:t.slug,")"),value:e.deploymentName}})}),(0,F.jsx)(_.V,{title:"Deploy environments",breadcrumbs:[{name:"Workspace"}],actions:[(0,F.jsx)(p.ZP,{icon:(0,F.jsx)(a.Z,{className:"align-middle"}),href:"/import",children:"Import"},"import-btn"),(0,F.jsx)(p.ZP,{icon:(0,F.jsx)(u.Z,{className:"align-middle"}),onClick:function(){return openNewApp()},children:"Create app"},"create-app-btn")]}),(0,F.jsx)("div",{className:"h-full flex-auto overflow-hidden",ref:ej,children:(0,F.jsx)(v.Z,{size:"small",loading:"loading"===U,columns:J,dataSource:B,scroll:{x:null!=f&&f.md?1600:1200,y:void 0!==(null==eb?void 0:eb.height)?eb.height-120:void 0},sticky:{offsetHeader:0},pagination:{showSizeChanger:!0,current:L,defaultPageSize:K,total:q,position:["bottomCenter"]},onChange:function(e,n){console.log("Table changed: ",e,n);var t=e.current;l(_objectSpread({page:null!=t?t:1},n))}})})]})},R=t(6761),T=t(1071),deploy_environment=function(){return(0,F.jsx)(o.Wk,{children:(0,F.jsx)(R.o,{meta:(0,F.jsx)(T.h,{title:"Deploy Environment",description:"Manage deploy environments across clusters"}),children:(0,F.jsx)(DeployEnvironmentList,{})})})}},49740:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/deploy-environment",function(){return t(70395)}])}},function(e){e.O(0,[3662,5877,6043,3945,7786,9774,2888,179],function(){return e(e.s=49740)}),_N_E=e.O()}]);