UNPKG

@topgroup/diginext

Version:

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

1 lines 6.04 kB
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3459],{72945:function(e,s,r){"use strict";var a=r(11163),t=r(67294),n=r(79661),i=r(85893);s.Z=function(e){var s=(0,a.useRouter)(),r=(0,n.vs)().isDarkMode,o=(0,t.useState)("".concat(s.basePath,"/assets/images/diginext_logo_white.svg")),l=o[0],c=o[1];return(0,t.useEffect)(function(){c(r?"".concat(s.basePath,"/assets/images/diginext_logo_white.svg"):"".concat(s.basePath,"/assets/images/diginext_logo.svg"))},[r]),(0,i.jsxs)("div",{className:"text-center",children:[(0,i.jsx)("div",{className:"mx-auto my-5 w-64 text-center ".concat(e.className||""),children:(0,i.jsx)("img",{src:l,alt:"DXUP Logo",className:"inline-block"})}),e.useTagline&&(0,i.jsx)("div",{className:"mb-6",children:"Build faster. Deploy easier. More flexible."})]})}},85564:function(e,s,r){"use strict";r.r(s),r.d(s,{default:function(){return login}});var a=r(16835),t=r(24126),n=r(96074),i=r(73318),o=r(22598),l=r(92783),c=r(67294),u=r(50029),d=r(87794),m=r.n(d),p=r(8232),h=r(39249),x=r(47041),f=r(41664),g=r.n(f),v=r(11163),w=r(11778),j=r(85893),login_form=function(){var e,s=(0,c.useState)(""),r=s[0],t=s[1],n=(0,w.FF)(["basic-auth","login"],"/api/v1/login",void 0),o=(0,a.Z)(n,1)[0],l=(0,v.useRouter)(),d=(e=(0,u.Z)(m().mark(function _callee(e){var s;return m().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return console.log("Success:",e),r.prev=1,r.next=4,o(e);case 4:null!=(s=r.sent)&&s.status?((0,x.setCookie)("x-auth-cookie",s.data.access_token),(0,x.setCookie)("refresh_token",s.data.refresh_token),l.push("/workspace/select")):t((null==s?void 0:s.messages.join("."))||"Unexpected error."),r.next=12;break;case 8:r.prev=8,r.t0=r.catch(1),console.error(r.t0),t("Network error, please try again later.");case 12:case"end":return r.stop()}},_callee,null,[[1,8]])})),function(s){return e.apply(this,arguments)});return(0,j.jsxs)(p.Z,{className:"text-left",name:"basic",labelCol:{span:8},wrapperCol:{span:16},style:{maxWidth:600},initialValues:{remember:!0},onFinish:d,onFinishFailed:function(e){console.log("Failed:",e)},autoComplete:"off",children:[(0,j.jsx)(p.Z.Item,{label:"Email",name:"email",rules:[{required:!0,type:"email",message:"Please input a valid email"}],children:(0,j.jsx)(h.Z,{})}),(0,j.jsx)(p.Z.Item,{label:"Password",name:"password",rules:[{required:!0,message:"Please input your password"}],children:(0,j.jsx)(h.Z.Password,{})}),(0,j.jsxs)(p.Z.Item,{wrapperCol:{offset:8,span:16},className:"mb-0 text-left",children:[(0,j.jsx)(i.ZP,{type:"primary",htmlType:"submit",children:"Submit"}),(0,j.jsx)(g(),{href:"#",className:"ml-3 underline",children:"Forgot password?"})]}),(0,j.jsx)(p.Z.ErrorList,{errors:[r]})]})},register_form=function(){var e,s=(0,c.useState)(""),r=s[0],t=s[1],n=(0,w.FF)(["basic-auth","register"],"/api/v1/register",void 0),o=(0,a.Z)(n,1)[0],l=(0,v.useRouter)(),d=(e=(0,u.Z)(m().mark(function _callee(e){var s;return m().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return console.log("Success:",e),r.prev=1,r.next=4,o(e);case 4:null!=(s=r.sent)&&s.status?((0,x.setCookie)("x-auth-cookie",s.data.access_token),(0,x.setCookie)("refresh_token",s.data.refresh_token),l.push("/workspace/select")):t((null==s?void 0:s.messages.join("."))||"Unexpected error."),r.next=12;break;case 8:r.prev=8,r.t0=r.catch(1),console.error(r.t0),t("Network error, please try again later.");case 12:case"end":return r.stop()}},_callee,null,[[1,8]])})),function(s){return e.apply(this,arguments)});return(0,j.jsx)("div",{children:(0,j.jsxs)(p.Z,{name:"basic",className:"text-left",labelCol:{span:8},wrapperCol:{span:16},style:{maxWidth:600},initialValues:{remember:!0},onFinish:d,onFinishFailed:function(e){console.log("Failed:",e)},autoComplete:"off",scrollToFirstError:!0,children:[(0,j.jsx)(p.Z.Item,{label:"Email",name:"email",rules:[{required:!0,type:"email",message:"Please input a valid email"}],children:(0,j.jsx)(h.Z,{})}),(0,j.jsx)(p.Z.Item,{label:"Password",name:"password",rules:[{required:!0,message:"Please input your password"},{type:"string",min:8,message:"Password must has at least 8 digits."}],hasFeedback:!0,children:(0,j.jsx)(h.Z.Password,{})}),(0,j.jsx)(p.Z.Item,{label:"Confirm Password",name:"confirm",dependencies:["password"],hasFeedback:!0,rules:[{required:!0,message:"Please confirm your password"},function(e){var s=e.getFieldValue;return{validator:function(e,r){return r&&s("password")!==r?Promise.reject(Error("The new password that you entered do not match!")):Promise.resolve()}}}],children:(0,j.jsx)(h.Z.Password,{})}),(0,j.jsxs)(p.Z.Item,{wrapperCol:{offset:8,span:16},className:"mb-0 text-left",children:[(0,j.jsx)(i.ZP,{type:"primary",htmlType:"submit",children:"Create Account"}),(0,j.jsx)(p.Z.ErrorList,{errors:[r]})]})]})})},basic_auth=function(){var e=(0,c.useState)("Sign in"),s=e[0],r=e[1];return(0,j.jsxs)("div",{children:[(0,j.jsx)(l.Z,{options:["Sign in","Register"],onChange:function(e){return r(e.toString())}}),(0,j.jsxs)("div",{className:"p-3",children:["Sign in"===s&&(0,j.jsx)(login_form,{}),"Register"===s&&(0,j.jsx)(register_form,{})]})]})},_=r(54846),b=r(72945),k=r(56832),Z=r(6761),P=r(1071),y=r(55611),login=function(){var e,s,l,c,u=(0,k.o)(),d=(0,a.Z)(u,1)[0].redirect_url,m=null!==(e=null!=d?d:null===(s=r.g)||void 0===s?void 0:null===(l=s.window)||void 0===l?void 0:null===(c=l.location)||void 0===c?void 0:c.origin)&&void 0!==e?e:y.De.NEXT_PUBLIC_BASE_URL;return(0,j.jsx)(Z.o,{useSidebar:!1,meta:(0,j.jsx)(P.h,{title:"Dashboard",description:"Your workspace overview."}),children:(0,j.jsxs)(_.Z,{className:"text-center",children:[(0,j.jsx)(b.Z,{useTagline:!0}),(0,j.jsx)(basic_auth,{}),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(n.Z,{children:"OR"}),(0,j.jsxs)(i.ZP,{type:"primary",size:"large",onClick:function(){return(0,o.x4)({redirectURL:m})},children:[(0,j.jsx)(t.Z,{}),"Sign in with Google"]})]})]})})}},83236:function(e,s,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/login",function(){return r(85564)}])}},function(e){e.O(0,[3662,5877,8569,3945,9774,2888,179],function(){return e(e.s=83236)}),_N_E=e.O()}]);