"use strict";(self.webpackChunkinfluxdb_ui=self.webpackChunkinfluxdb_ui||[]).push([[221],{36096:(e,t,n)=>{n.r(t),n.d(t,{default:()=>S});var s=n(70655),a=n(67294),r=n(47886),l=n(46458),o=n(80500),i=n(62165),c=n(55735),m=n(96486),u=n(98555),d=n(12197);let p=class extends a.PureComponent{constructor(){super(...arguments),this.state={username:"",password:""},this.handleUsername=e=>{const t=e.target.value;this.setState({username:t})},this.handlePassword=e=>{const t=e.target.value;this.setState({password:t})},this.handleSignIn=async()=>{const{notify:e}=this.props,{username:t,password:n}=this.state;try{const e=await(0,o.Yo0)({auth:{username:t,password:n}});if(204!==e.status)throw new Error(e.data.message);this.handleRedirect()}catch(t){const n=(0,m.get)(t,"response.data.msg","");if(401===(0,m.get)(t,"response.status",""))return void e(Object.assign(Object.assign({},d.Xm),{message:"Login failed: username or password is invalid"}));if(!n)return void e(d.Xm);e(Object.assign(Object.assign({},d.Xm),{message:n}))}}}render(){const{username:e,password:t}=this.state;return a.createElement(u.Form,{onSubmit:this.handleSignIn},a.createElement(u.Grid,null,a.createElement(u.Grid.Row,null,a.createElement(u.Grid.Column,{widthXS:u.Columns.Twelve},a.createElement(u.Form.Element,{label:"Username"},a.createElement(u.Input,{name:"username",value:e,onChange:this.handleUsername,size:u.ComponentSize.Medium,autoFocus:!0,testID:"username",id:"login"}))),a.createElement(u.Grid.Column,{widthXS:u.Columns.Twelve},a.createElement(u.Form.Element,{label:"Password"},a.createElement(u.Input,{name:"password",value:t,onChange:this.handlePassword,size:u.ComponentSize.Medium,type:u.InputType.Password,testID:"password",id:"password"}))),a.createElement(u.Grid.Column,{widthXS:u.Columns.Twelve},a.createElement(u.Form.Footer,null,a.createElement(u.Button,{color:u.ComponentColor.Primary,text:"Sign In",size:u.ComponentSize.Medium,type:u.ButtonType.Submit,id:"submit-login"}))))))}handleRedirect(){const{history:e,location:t}=this.props,n=new URLSearchParams(t.search).get("returnTo");n?e.replace(n):e.push("/")}};p=(0,s.gn)([c.X],p);const h={notify:i.h4},g=(0,l.$j)(null,h)((0,r.EN)(p));var E=n(46730),w=n(97950),f=n(96541),v=n(45055);let b=class extends a.PureComponent{constructor(e){super(e),this.state={status:E.zZ.Loading}}async componentDidMount(){const e=await(0,o.lTd)({});if(200!==e.status)throw new Error("There was an error onboarding");const{allowed:t}=e.data;if(t)this.props.history.push("/onboarding/0");else if(v.H_)return void(window.location.pathname=v.xw);this.setState({status:E.zZ.Done})}componentWillUnmount(){this.props.dismissAllNotifications()}render(){return a.createElement(u.SpinnerContainer,{loading:this.state.status,spinnerComponent:a.createElement(u.TechnoSpinner,null)},a.createElement(f.Z,null),a.createElement(u.AppWrapper,null,a.createElement(u.FunnelPage,{className:"signin-page",testID:"signin-page"},a.createElement(u.Panel,{className:"signin-page--panel"},a.createElement(u.Panel.Body,{alignItems:u.AlignItems.Center},a.createElement("div",{className:"signin-page--cubo"}),a.createElement(u.InfluxDBCloudLogo,{cloud:!1,className:"signin-page--logo"}),a.createElement(g,null)),a.createElement(u.Panel.Footer,null,a.createElement(w.Z,null))))))}};b=(0,s.gn)([c.X,(0,s.w6)("design:paramtypes",[Object])],b);const C={dismissAllNotifications:i.rB},S=(0,l.$j)(null,C)((0,r.EN)(b))},97950:(e,t,n)=>{n.d(t,{Z:()=>d});var s=n(67294),a=n(46458),r=n(45055),l=n(55387),o=n(56200);var i=n(70821);const c=()=>{const e=(0,a.I0)(),t=(0,a.v9)(i.gn);return(0,s.useEffect)((()=>{e((async e=>{try{const t=`${(0,l.OU)()}/health`,n=await fetch(t),s=await n.json();return e((0,o.Ed)({version:s.version,commit:s.commit})),s}catch(t){console.error(t),e((0,o.Ed)({version:"n/a",commit:"n/a"}))}}))}),[e]),s.createElement(s.Fragment,null,"InfluxDB ",t.version,s.createElement("br",null),"Server:"," ",s.createElement("code",null,s.createElement("a",{href:`https://github.com/influxdata/influxdb/tree/${t.commit}`},t.commit&&t.commit.slice(0,7))),s.createElement("br",null),"Frontend:"," ",s.createElement("code",null,s.createElement("a",{href:`https://github.com/influxdata/ui/tree/${r.ui.slice(0,7)}`},r.ui.slice(0,7))))};var m=n(3837),u=n(23915);const d=()=>{const e=(0,a.v9)(u.bw)?"IOx":"TSM",t=(0,a.v9)(u.bw)?"https://docs.influxdata.com/influxdb/cloud-iox/":"https://docs.influxdata.com/influxdb/latest/reference/internals/storage-engine/#time-structured-merge-tree-tsm";return s.createElement("div",{className:"version-info","data-testid":"version-info"},r.H_?s.createElement("div",null,s.createElement(m.Q,{href:t},"InfluxDB Cloud powered by ",e),s.createElement("br",null),"Version ",r.q4," ",r.ui&&s.createElement("code",null,"(",r.ui.slice(0,7),")")):s.createElement(c,null))}}}]);
//# sourceMappingURL=1fb690d5a2.js.map