Show busy indicator, focus first field (#4997)

This commit is contained in:
Jaco Greeff 2017-03-22 16:39:49 +01:00 committed by Gav Wood
parent 1879dbca8a
commit 5df3f5d136

View File

@ -60,8 +60,11 @@ class PasswordManager extends Component {
store = new Store(this.context.api, this.props.account); store = new Store(this.context.api, this.props.account);
render () { render () {
const { busy } = this.store;
return ( return (
<Portal <Portal
busy={ busy }
buttons={ this.renderDialogActions() } buttons={ this.renderDialogActions() }
onClose={ this.onClose } onClose={ this.onClose }
open open
@ -133,8 +136,6 @@ class PasswordManager extends Component {
} }
renderPage () { renderPage () {
const { busy, isRepeatValid, newPassword, passwordHint } = this.store;
return ( return (
<Tabs <Tabs
inkBarStyle={ TABS_INKBAR_STYLE } inkBarStyle={ TABS_INKBAR_STYLE }
@ -149,9 +150,35 @@ class PasswordManager extends Component {
} }
onActive={ this.onActivateTestTab } onActive={ this.onActivateTestTab }
> >
{ this.renderTabTest() }
</Tab>
<Tab
label={
<FormattedMessage
id='passwordChange.tabChange.label'
defaultMessage='Change Password'
/>
}
onActive={ this.onActivateChangeTab }
>
{ this.renderTabChange() }
</Tab>
</Tabs>
);
}
renderTabTest () {
const { actionTab, busy } = this.store;
if (actionTab !== TEST_ACTION) {
return null;
}
return (
<Form className={ styles.form }> <Form className={ styles.form }>
<div> <div>
<Input <Input
autoFocus
disabled={ busy } disabled={ busy }
hint={ hint={
<FormattedMessage <FormattedMessage
@ -172,19 +199,21 @@ class PasswordManager extends Component {
/> />
</div> </div>
</Form> </Form>
</Tab> );
<Tab
label={
<FormattedMessage
id='passwordChange.tabChange.label'
defaultMessage='Change Password'
/>
} }
onActive={ this.onActivateChangeTab }
> renderTabChange () {
const { actionTab, busy, isRepeatValid, newPassword, passwordHint } = this.store;
if (actionTab !== CHANGE_ACTION) {
return null;
}
return (
<Form className={ styles.form }> <Form className={ styles.form }>
<div> <div>
<Input <Input
autoFocus
disabled={ busy } disabled={ busy }
hint={ hint={
<FormattedMessage <FormattedMessage
@ -274,8 +303,6 @@ class PasswordManager extends Component {
<PasswordStrength input={ newPassword } /> <PasswordStrength input={ newPassword } />
</div> </div>
</Form> </Form>
</Tab>
</Tabs>
); );
} }