Skip to content

Commit

Permalink
Turn FirmwareModal.save() into an async method
Browse files Browse the repository at this point in the history
This makes it easier to extend in the next commit.
  • Loading branch information
martinpitt committed Feb 19, 2024
1 parent e70fc41 commit 56ff41d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/components/vm/overview/firmware.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,19 @@ class FirmwareModal extends React.Component {
this.setState({ dialogError: text, dialogErrorDetail: detail });
}

save() {
async save() {
const Dialogs = this.context;
const vm = this.props.vm;
domainSetOSFirmware({ connectionName: vm.connectionName, objPath: vm.id, loaderType: stateToXml(this.state.firmware) })
.then(Dialogs.close, exc => this.dialogErrorSet(_("Failed to change firmware"), exc.message));
try {
await domainSetOSFirmware({
connectionName: vm.connectionName,
objPath: vm.id,
loaderType: stateToXml(this.state.firmware)
});
Dialogs.close();
} catch (exc) {
this.dialogErrorSet(_("Failed to change firmware"), exc.message);
}
}

render() {
Expand Down

0 comments on commit 56ff41d

Please sign in to comment.