UNPKG

@topgroup/diginext

Version:

A BUILD SERVER & CLI to deploy apps to any Kubernetes clusters.

1 lines 6.86 kB
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1688],{4408:function(e,t,s){"use strict";s.d(t,{Hg:function(){return useWorkspaceInviteApi},av:function(){return useWorkspaceCreateApi},d1:function(){return useTestWorkspaceUploadApi},hv:function(){return useWorkspaceUpdateApi}});var a=s(11778),useWorkspaceCreateApi=function(e){return(0,a.FF)(["workspaces"],"/api/v1/workspace",e)},useWorkspaceUpdateApi=function(e){return(0,a.yt)(["workspaces"],"/api/v1/workspace",e)},useWorkspaceInviteApi=function(e){return(0,a.FF)(["workspaces","invite"],"/api/v1/workspace/invite",e)},useTestWorkspaceUploadApi=function(){return(0,a.FF)(["workspaces","test-upload"],"/api/v1/workspace/test-cloud-storage")}},72945:function(e,t,s){"use strict";var a=s(11163),r=s(67294),n=s(79661),c=s(85893);t.Z=function(e){var t=(0,a.useRouter)(),s=(0,n.vs)().isDarkMode,i=(0,r.useState)("".concat(t.basePath,"/assets/images/diginext_logo_white.svg")),o=i[0],l=i[1];return(0,r.useEffect)(function(){l(s?"".concat(t.basePath,"/assets/images/diginext_logo_white.svg"):"".concat(t.basePath,"/assets/images/diginext_logo.svg"))},[s]),(0,c.jsxs)("div",{className:"text-center",children:[(0,c.jsx)("div",{className:"mx-auto my-5 w-64 text-center ".concat(e.className||""),children:(0,c.jsx)("img",{src:o,alt:"DXUP Logo",className:"inline-block"})}),e.useTagline&&(0,c.jsx)("div",{className:"mb-6",children:"Build faster. Deploy easier. More flexible."})]})}},39989:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return workspace_select}});var a=s(50029),r=s(16835),n=s(87794),c=s.n(n),i=s(79090),o=s(1413),l=s(67294),u={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M868 732h-70.3c-4.8 0-9.3 2.1-12.3 5.8-7 8.5-14.5 16.7-22.4 24.5a353.84 353.84 0 01-112.7 75.9A352.8 352.8 0 01512.4 866c-47.9 0-94.3-9.4-137.9-27.8a353.84 353.84 0 01-112.7-75.9 353.28 353.28 0 01-76-112.5C167.3 606.2 158 559.9 158 512s9.4-94.2 27.8-137.8c17.8-42.1 43.4-80 76-112.5s70.5-58.1 112.7-75.9c43.6-18.4 90-27.8 137.9-27.8 47.9 0 94.3 9.3 137.9 27.8 42.2 17.8 80.1 43.4 112.7 75.9 7.9 7.9 15.3 16.1 22.4 24.5 3 3.7 7.6 5.8 12.3 5.8H868c6.3 0 10.2-7 6.7-12.3C798 160.5 663.8 81.6 511.3 82 271.7 82.6 79.6 277.1 82 516.4 84.4 751.9 276.2 942 512.4 942c152.1 0 285.7-78.8 362.3-197.7 3.4-5.3-.4-12.3-6.7-12.3zm88.9-226.3L815 393.7c-5.3-4.2-13-.4-13 6.3v76H488c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h314v76c0 6.7 7.8 10.5 13 6.3l141.9-112a8 8 0 000-12.6z"}}]},name:"logout",theme:"outlined"},d=s(91146),p=l.forwardRef(function(e,t){return l.createElement(d.Z,(0,o.Z)((0,o.Z)({},e),{},{ref:t,icon:u}))}),h=s(85945),x=s(71471),f=s(26855),m=s(8232),v=s(65217),w=s(84567),g=s(39249),k=s(73318),j=s(11163),Z=s(22598),b=s(15832),_=s(4408),N=s(54846),y=s(72945),C=s(6761),P=s(1071),F=s(85893),W=x.Z.Title,workspace_select=function(){var e,t,s,n,o=(0,j.useRouter)(),u=(0,h.NL)(),d=(0,l.useState)(""),x=d[0],S=d[1],U=(0,l.useState)(""),A=U[0],E=U[1],I=(0,l.useState)(!1),T=I[0],L=I[1],R=(0,Z.aC)(),q=(0,r.Z)(R,2),z=q[0],H=q[1],D=H.refetch,M=H.status,O=(0,_.av)(),X=(0,r.Z)(O,2),B=X[0],K=X[1],Q=(0,b.Hc)(),G=(0,r.Z)(Q,1)[0],J=(z||{}).workspaces,V=void 0===J?[]:J,Y=(e=(0,a.Z)(c().mark(function _callee(e){var t,s;return c().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(z._id){a.next=3;break}return f.ZP.error({message:"Unauthenticated."}),a.abrupt("return");case 3:return L(!0),a.next=6,G({userId:z._id,workspace:e});case 6:if(!(null!=(t=a.sent)&&t.status)){a.next=16;break}return a.next=10,u.invalidateQueries({queryKey:["auth"]});case 10:return a.next=12,D();case 12:console.log("redirectUrl :>> ",s=new URL(window.location.href).searchParams.get("redirect_url")||window.location.origin),o.push(s);case 16:L(!1);case 17:case"end":return a.stop()}},_callee)})),function(t){return e.apply(this,arguments)}),$=(t=(0,a.Z)(c().mark(function _callee2(e){var t,s,a,r,n;return c().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return(t={}).name=e.name,t.public=void 0!==e.public&&e.public,c.next=5,B(t);case 5:if(!(null!=(s=c.sent)&&s.status)){c.next=21;break}if((a=null==s?void 0:s.data).name){c.next=11;break}return E("Unable to create new workspace."),c.abrupt("return");case 11:return S(a.name),c.next=14,u.invalidateQueries({queryKey:["auth"]});case 14:return c.next=16,D();case 16:r=new URL(window.location.href).searchParams.get("redirect_url")||window.location.origin,o.push(r),c.next=22;break;case 21:E((null==s?void 0:null===(n=s.messages)||void 0===n?void 0:n.join("."))||"Internal Server Error");case 22:case"end":return c.stop()}},_callee2)})),function(e){return t.apply(this,arguments)});return(0,F.jsx)(F.Fragment,{children:(0,F.jsxs)(C.o,{useSidebar:!1,meta:(0,F.jsx)(P.h,{title:"Select/Create a Workspace",description:"Select or create your workspace."}),children:["loading"===M&&(0,F.jsxs)(N.Z,{className:"text-center",children:[(0,F.jsx)(y.Z,{}),(0,F.jsx)(i.Z,{})]}),"success"===M&&z&&(0,F.jsxs)(N.Z,{className:"text-center",children:[(0,F.jsx)(y.Z,{}),V.length>0&&"loading"!==K&&"success"!==K&&(0,F.jsxs)("div",{children:[(0,F.jsx)(W,{level:3,children:"Select a workspace:"}),(0,F.jsx)("p",{children:"Choose a workspace which you want to interact with:"}),(0,F.jsx)(m.Z,{name:"select",children:(0,F.jsx)(m.Z.Item,{name:"workspace",children:(0,F.jsx)(v.Z,{size:"large",value:"".concat(null===(s=V[0])||void 0===s?void 0:s.name," (").concat(null===(n=V[0])||void 0===n?void 0:n.slug,")"),onChange:function(e){console.log("workspace > id :>> ",e),Y(e)},options:null==V?void 0:V.map(function(e){return{label:"".concat(e.name," (").concat(e.slug,")"),value:e._id}}),loading:T,disabled:T})})})]}),"loading"===K&&(0,F.jsx)(i.Z,{}),("idle"===K||"error"===K)&&(0,F.jsxs)("div",{children:[(0,F.jsx)(W,{level:3,children:"Create a new workspace:"}),(0,F.jsxs)(m.Z,{name:"create",onFinish:$,onFinishFailed:function(e){console.log("Failed:",e)},autoComplete:"off",disabled:T,children:[(0,F.jsxs)("div",{className:"flex gap-2",children:[(0,F.jsx)(m.Z.Item,{name:"public",valuePropName:"checked",children:(0,F.jsx)(w.Z,{children:"Public"})}),(0,F.jsx)(m.Z.Item,{name:"name",style:{flex:"auto"},rules:[{required:!0,message:"Workspace name is required."}],children:(0,F.jsx)(g.Z,{className:"text-center text-lg",placeholder:"Workspace name",onChange:function(e){return S(e.currentTarget.value)}})}),(0,F.jsx)(m.Z.Item,{children:(0,F.jsx)(k.ZP,{type:"primary",htmlType:"submit",disabled:""===x,className:"h-[38px]",children:"GO!"})})]}),(0,F.jsx)(m.Z.ErrorList,{className:"text-red-400",errors:[A]})]}),(0,F.jsx)(k.ZP,{href:"/logout",shape:"round",size:"large",type:"primary",icon:(0,F.jsx)(p,{}),children:"Sign out"})]})]})]})})}},21599:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/workspace/select",function(){return s(39989)}])}},function(e){e.O(0,[3662,5877,3945,9774,2888,179],function(){return e(e.s=21599)}),_N_E=e.O()}]);