@topgroup/diginext
Version:
A BUILD SERVER & CLI to deploy apps to any Kubernetes clusters.
1 lines • 8.5 kB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3523],{72945:function(e,l,t){"use strict";var n=t(11163),i=t(67294),o=t(79661),a=t(85893);l.Z=function(e){var l=(0,n.useRouter)(),t=(0,o.vs)().isDarkMode,r=(0,i.useState)("".concat(l.basePath,"/assets/images/diginext_logo_white.svg")),s=r[0],u=r[1];return(0,i.useEffect)(function(){u(t?"".concat(l.basePath,"/assets/images/diginext_logo_white.svg"):"".concat(l.basePath,"/assets/images/diginext_logo.svg"))},[t]),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"mx-auto my-5 w-64 text-center ".concat(e.className||""),children:(0,a.jsx)("img",{src:s,alt:"DXUP Logo",className:"inline-block"})}),e.useTagline&&(0,a.jsx)("div",{className:"mb-6",children:"Build faster. Deploy easier. More flexible."})]})}},99681:function(e,l,t){"use strict";t.r(l),t.d(l,{default:function(){return deploy}});var n=t(41664),i=t.n(n),o=t(22598),a=t(54846),r=t(72945),s=t(27812),u=t(50029),c=t(16835),d=t(87794),p=t.n(d),v=t(79090),m=t(87603),h=t(89035),g=t(9361),f=t(8232),x=t(51423),y=t(71471),j=t(65217),b=t(78045),w=t(39249),S=t(73318),Z=t(96486),N=t(67294),P=t(34187),_=t(23907),C=t(47859),L=t(4400),D=t(74040),E=t(61771),R=t(95259),k=t(9449),F=t(56832),B=t(85893),deployments_DeployModal=function(e){var l,t,n,i=e.className;g.Z.useToken().token.colorBgContainer;var o=f.Z.useForm(),a=(0,c.Z)(o,1)[0],r=(0,F.o)(),d=(0,c.Z)(r,2),I=d[0];d[1].setQuery,I.project;var T=I.app,V=I.env,q=I.registry,H=I.cluster,O=(I.build,I.branch,I.port),M=(0,N.useState)(),z=M[0],G=M[1],U=(0,N.useState)(),X=U[0],A=U[1],Q=(0,N.useState)(),W=Q[0],Y=Q[1],J=(0,N.useState)(),K=J[0],$=J[1],ee=(0,N.useState)(),el=ee[0],et=ee[1],en=(0,E.BT)({populate:"owner",pagination:{page:1,size:100}}),ei=en.data,eo=(ei=void 0===ei?{}:ei).list,ea=void 0===eo?[]:eo;en.status;var er=(0,P.VD)().data;(er=void 0===er?{}:er).list;var es=(0,R.fy)().data,eu=(es=void 0===es?{}:es).list,ec=(0,C.x7)().data,ed=(ec=void 0===ec?{}:ec).list,ep=(0,_.BY)({filter:{appSlug:null==z?void 0:z.slug}}).data,ev=(ep=void 0===ep?{}:ep).list,em=(0,L._q)(),eh=(0,c.Z)(em,2),eg=eh[0],ef=eh[1],ex=(0,k.t1)((null==z?void 0:null===(t=z.git)||void 0===t?void 0:t.repoSSH)||""),ey=(0,D.Td)(ex.repoSlug||"",{enabled:void 0!==ex.repoSlug&&void 0!==(null==z?void 0:z.gitProvider),filter:{_id:null==z?void 0:z.gitProvider}}).data,ej=(ey=void 0===ey?{}:ey).list,eb=(0,Z.flatMap)(ea,"apps"),ew=(l=(0,u.Z)(p().mark(function _callee(e){return p().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:console.log("Submit:",e),eg({appSlug:e.app,gitBranch:e.gitBranch,deployParams:{env:e.env,cluster:e.cluster,registry:e.registry}}).then(function(e){var l,t;console.log("res.data?.logURL :>> ",null===(l=e.data)||void 0===l?void 0:l.logURL),et(null===(t=e.data)||void 0===t?void 0:t.logURL)});case 2:case"end":return l.stop()}},_callee)})),function(e){return l.apply(this,arguments)});return(0,B.jsxs)(x.Z,{bordered:!1,title:(0,B.jsx)(y.Z.Title,{level:4,className:"!mb-0 text-center",children:"success"===ef?"A deployment is being processed!":"loading"===ef?"Processing...":"Deploy your app"}),children:["loading"===ef&&(0,B.jsx)(v.Z,{}),"success"!==ef?(0,B.jsxs)(f.Z,{className:["h-full","overflow-x-hidden",void 0===i?"":i].join(" "),layout:"vertical",form:a,onFinish:ew,onFinishFailed:function(e){console.log("Failed:",e)},autoComplete:"off",children:[(0,B.jsx)(f.Z.Item,{name:"app",rules:[{required:!0,message:"Please select app."}],className:"mb-2",initialValue:T,children:(0,B.jsx)(j.Z,{placeholder:"Select app",onSelect:function(e){G(eb.find(function(l){return l.slug===e}))},showSearch:!0,filterOption:function(e,l){var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:null==ea?void 0:ea.map(function(e){var l;return{label:e.name,options:null===(l=e.apps)||void 0===l?void 0:l.map(function(e){return{label:e.name,value:e.slug}})}})})}),(0,B.jsx)(f.Z.Item,{name:"env",label:"Deploy environment",rules:[{required:!0,message:"Please select deploy environment."}],className:"mb-2",initialValue:V,children:(0,B.jsxs)(b.ZP.Group,{onChange:function(e){$(e.target.value),Y(((null==z?void 0:z.deployEnvironment)||{})[e.target.value])},children:[(0,B.jsx)(b.ZP,{value:"dev",children:"dev"}),(0,B.jsx)(b.ZP,{value:"prod",children:"prod"}),(0,B.jsx)(b.ZP,{value:"other",children:"other"===K?(0,B.jsx)(w.Z,{style:{width:100,marginLeft:10},onChange:function(e){Y(((null==z?void 0:z.deployEnvironment)||{})[e.target.value])}}):(0,B.jsx)(B.Fragment,{children:"+ other"})})]})}),(0,B.jsx)(f.Z.Item,{name:"registry",rules:[{required:!0,message:"Please select container registry."}],className:"mb-2",initialValue:(null==W?void 0:W.registry)||q||(null===(n=(eu||[])[0])||void 0===n?void 0:n.slug),children:(0,B.jsx)(j.Z,{placeholder:"Container registry",showSearch:!0,filterOption:function(e,l){var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:null==eu?void 0:eu.map(function(e){return{label:e.name,value:e.slug}}),onSelect:function(e){return console.log("Select container registry > value :>> ",e)}})}),(0,B.jsx)(f.Z.Item,{name:"cluster",rules:[{required:!0,message:"Please select cluster."}],className:"mb-2",initialValue:H,children:(0,B.jsx)(j.Z,{placeholder:"Cluster",showSearch:!0,filterOption:function(e,l){var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:null==ed?void 0:ed.map(function(e){return{label:e.name,value:e.shortName}})})}),(0,B.jsx)(f.Z.Item,{name:"build",className:"mb-2",children:(0,B.jsx)(j.Z,{placeholder:"Start new build",showSearch:!0,filterOption:function(e,l){var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{label:"Start new build",value:"new"}].concat((0,s.Z)((null==ev?void 0:ev.map(function(e){return{label:e.name,value:e.slug}}))||[])),onSelect:function(e){return A(null==ev?void 0:ev.find(function(l){return l.slug===e}))}})}),void 0===X?(0,B.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,B.jsx)(f.Z.Item,{name:"gitBranch",rules:[{required:!0,message:"Please git branch."}],initialValue:"main",children:(0,B.jsx)(j.Z,{placeholder:"Git branch",showSearch:!0,filterOption:function(e,l){var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:null==ej?void 0:ej.map(function(e){return{label:e.name,value:e.name}})})}),(0,B.jsx)(f.Z.Item,{name:"port",rules:[{required:!0,message:"Please enter exposed port."}],initialValue:(null==W?void 0:W.port)||O||"3000",children:(0,B.jsx)(w.Z,{placeholder:"Port",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off"})})]}):(0,B.jsx)(B.Fragment,{}),(0,B.jsx)(f.Z.Item,{style:{marginBottom:0},className:"text-center",children:(0,B.jsx)(S.ZP,{type:"primary",htmlType:"submit",icon:(0,B.jsx)(m.Z,{}),size:"large",shape:"round",children:"Deploy Now"})})]}):(0,B.jsx)("div",{className:"text-center",children:(0,B.jsx)(S.ZP,{href:el,icon:(0,B.jsx)(h.Z,{}),size:"large",shape:"round",children:"View build logs"})})]})},I=t(6761),T=t(1071),deploy=function(){return(0,B.jsx)(o.Wk,{children:(0,B.jsx)(I.o,{useSidebar:!1,meta:(0,B.jsx)(T.h,{title:"Deploy Now",description:"Deploy your application to target environment."}),children:(0,B.jsxs)(a.Z,{className:"max-w-md ",children:[(0,B.jsx)(i(),{href:"/",children:(0,B.jsx)(r.Z,{})}),(0,B.jsx)(deployments_DeployModal,{})]})})})}},9449:function(e,l,t){"use strict";function parseGitRepoDataFromRepoSSH(e){if(!e)return{};try{l=null===(o=e.split(":")[1])||void 0===o?void 0:o.split("/")[0]}catch(l){throw Error("Repository SSH (".concat(e,") is invalid"))}try{t=null===(a=e.split(":")[1])||void 0===a?void 0:null===(r=a.split("/")[1])||void 0===r?void 0:r.split(".")[0]}catch(l){throw Error("Repository SSH (".concat(e,") is invalid"))}try{n=null===(s=e.split(":")[0])||void 0===s?void 0:s.split("@")[1]}catch(l){throw Error("Repository SSH (".concat(e,") is invalid"))}try{i=null===(u=n)||void 0===u?void 0:u.split(".")[0]}catch(l){throw Error("Repository SSH (".concat(e,") is invalid"))}var l,t,n,i,o,a,r,s,u,c="".concat(l,"/").concat(t);return{namespace:l,repoSlug:t,fullSlug:c,gitDomain:n,gitProvider:i}}t.d(l,{t1:function(){return parseGitRepoDataFromRepoSSH}}),t(96486)},9210:function(e,l,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/deploy",function(){return t(99681)}])}},function(e){e.O(0,[3662,5877,3945,9774,2888,179],function(){return e(e.s=9210)}),_N_E=e.O()}]);