Browse Source

Merge pull request #1787 from valpinkman/feat/skip-bootloader-screen

LL-832 skip 'restart in bootloader' if device is already in bootloader
gre-patch-1
Gaëtan Renaudeau 6 years ago
committed by GitHub
parent
commit
aaeb3da3c0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      src/components/SettingsPage/RepairDeviceButton.js

12
src/components/SettingsPage/RepairDeviceButton.js

@ -33,28 +33,38 @@ class RepairDeviceButton extends PureComponent<Props, State> {
progress: 0,
}
componentWillUnmount() {
if (this.timeout) {
clearTimeout(this.timeout)
}
}
open = () => this.setState({ opened: true, error: null })
sub: *
timeout: *
close = () => {
if (this.sub) this.sub.unsubscribe()
if (this.timeout) clearTimeout(this.timeout)
this.setState({ opened: false, isLoading: false, error: null, progress: 0 })
}
repair = (version = null) => {
if (this.state.isLoading) return
const { push } = this.props
this.setState({ isLoading: true })
this.timeout = setTimeout(() => this.setState({ isLoading: true }), 500)
this.sub = firmwareRepair.send({ version }).subscribe({
next: patch => {
this.setState(patch)
},
error: error => {
logger.critical(error)
if (this.timeout) clearTimeout(this.timeout)
this.setState({ error, isLoading: false, progress: 0 })
},
complete: () => {
if (this.timeout) clearTimeout(this.timeout)
this.setState({ opened: false, isLoading: false, progress: 0 }, () => {
push('/manager')
})

Loading…
Cancel
Save