Fix config becoming unblocked while still in progress
This commit is contained in:
12
ui.html
12
ui.html
@@ -112,7 +112,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Settings extends Component {
|
class Settings extends Component {
|
||||||
state = { inProgress: true, config: 'Connecting...' };
|
state = { inProgress: false, config: 'Connecting...' };
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@@ -124,10 +124,6 @@
|
|||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
setStatePromise(state) {
|
|
||||||
return new Promise(resolve => this.setState(state, resolve));
|
|
||||||
}
|
|
||||||
|
|
||||||
handleInput = async e => {
|
handleInput = async e => {
|
||||||
let name = e.target.id;
|
let name = e.target.id;
|
||||||
if (!name.startsWith('config-')) {
|
if (!name.startsWith('config-')) {
|
||||||
@@ -147,7 +143,7 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.setStatePromise({ inProgress: true });
|
this.setState({ inProgress: true });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await scheduleOp(() => context.setConfigValue(name, value));
|
await scheduleOp(() => context.setConfigValue(name, value));
|
||||||
@@ -156,6 +152,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
await this.refreshConfig();
|
await this.refreshConfig();
|
||||||
|
this.setState({ inProgress: false });
|
||||||
};
|
};
|
||||||
|
|
||||||
async refreshConfig() {
|
async refreshConfig() {
|
||||||
@@ -165,8 +162,7 @@
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
config = String(e);
|
config = String(e);
|
||||||
}
|
}
|
||||||
await this.setStatePromise({
|
this.setState({
|
||||||
inProgress: false,
|
|
||||||
config
|
config
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user