Add keys for steps (future-proof)

This commit is contained in:
Jaco Greeff 2016-12-15 15:56:50 +01:00
parent 5e59e0b9d3
commit 9dd1268b69
3 changed files with 25 additions and 19 deletions

View File

@ -25,7 +25,7 @@ const A_DAY = 24 * 60 * A_MINUTE;
const STEP_INFO = 0; const STEP_INFO = 0;
const STEP_UPDATING = 1; const STEP_UPDATING = 1;
const STEP_COMPLETED = 2; const STEP_COMPLETED = 2;
const STEP_ERROR = 3; const STEP_ERROR = 2;
const CHECK_INTERVAL = 1 * A_MINUTE; const CHECK_INTERVAL = 1 * A_MINUTE;

View File

@ -49,16 +49,20 @@ export default class UpgradeParity extends Component {
steps={ [ steps={ [
<FormattedMessage <FormattedMessage
id='upgradeParity.step.info' id='upgradeParity.step.info'
key='info'
defaultMessage='upgrade available' />, defaultMessage='upgrade available' />,
<FormattedMessage <FormattedMessage
key='updating'
id='upgradeParity.step.updating' id='upgradeParity.step.updating'
defaultMessage='upgrading parity' />, defaultMessage='upgrading parity' />,
store.step === STEP_ERROR store.step === STEP_ERROR
? <FormattedMessage ? <FormattedMessage
id='upgradeParity.step.error' id='upgradeParity.step.error'
key='error'
defaultMessage='error' /> defaultMessage='error' />
: <FormattedMessage : <FormattedMessage
id='upgradeParity.step.completed' id='upgradeParity.step.completed'
key='completed'
defaultMessage='upgrade completed' /> defaultMessage='upgrade completed' />
] } ] }
visible> visible>
@ -158,6 +162,25 @@ export default class UpgradeParity extends Component {
); );
case STEP_COMPLETED: case STEP_COMPLETED:
case STEP_ERROR:
if (store.error) {
return (
<Completed>
<div>
<FormattedMessage
id='upgradeParity.failed'
defaultMessage='Your upgrade to Parity {newversion} has failed with an error.'
values={ {
newversion: <div className={ styles.version }>{ newversion }</div>
} } />
</div>
<div className={ styles.error }>
{ store.error.message }
</div>
</Completed>
);
}
return ( return (
<Completed> <Completed>
<FormattedMessage <FormattedMessage
@ -168,23 +191,6 @@ export default class UpgradeParity extends Component {
} } /> } } />
</Completed> </Completed>
); );
case STEP_ERROR:
return (
<Completed>
<div>
<FormattedMessage
id='upgradeParity.failed'
defaultMessage='Your upgrade to Parity {newversion} has failed with an error.'
values={ {
newversion: <div className={ styles.version }>{ newversion }</div>
} } />
</div>
<div className={ styles.error }>
{ store.error.message }
</div>
</Completed>
);
} }
} }

View File

@ -72,7 +72,7 @@ export default class Title extends Component {
return steps.map((label, index) => { return steps.map((label, index) => {
return ( return (
<Step <Step
key={ index }> key={ label.key || index }>
<StepLabel> <StepLabel>
{ label } { label }
</StepLabel> </StepLabel>