grafana/public/app/features/profile/SignupPage.tsx
Tobias Skarhed 0c4dae321c
Migrations: Signup page (#21514)
* Start Angular migration

* Add SignupCtrl

* Change name signup

* Add backend call

* Put form in separate file

* Add form model

* Start using react-hook-forms

* Add FormModel to state

* Reduxify

* Connect nav with Redux

* Fix routing and navModel

* Fetch state options on mount

* Add default values and add button margin

* Add errror messages

* Fix title

* Remove files and cleanup

* Add Signup tests

* Add boot config assingnAutoOrg and verifyEmailEnabled

* Remove onmount call

* Remove ctrl and move everything to SignupForm

* Make routeParams optional for testing

* Remove name if it is empty

* Set username

* Make function component

* Fix subpath issues and add link button

* Move redux to SignupPage
2020-02-17 11:13:13 +01:00

52 lines
1.3 KiB
TypeScript

import React, { FC } from 'react';
import { SignupForm } from './SignupForm';
import Page from 'app/core/components/Page/Page';
import { getConfig } from 'app/core/config';
import { connect } from 'react-redux';
import { hot } from 'react-hot-loader';
import { StoreState } from 'app/types';
const navModel = {
main: {
icon: 'gicon gicon-branding',
text: 'Sign Up',
subTitle: 'Register your Grafana account',
breadcrumbs: [{ title: 'Login', url: 'login' }],
},
node: {
text: '',
},
};
interface Props {
email?: string;
orgName?: string;
username?: string;
code?: string;
name?: string;
}
export const SignupPage: FC<Props> = props => {
return (
<Page navModel={navModel}>
<Page.Contents>
<h3 className="p-b-1">You're almost there.</h3>
<div className="p-b-1">
We just need a couple of more bits of
<br /> information to finish creating your account.
</div>
<SignupForm
{...props}
verifyEmailEnabled={getConfig().verifyEmailEnabled}
autoAssignOrg={getConfig().autoAssignOrg}
/>
</Page.Contents>
</Page>
);
};
const mapStateToProps = (state: StoreState) => ({
...state.location.routeParams,
});
export default hot(module)(connect(mapStateToProps)(SignupPage));