Skip to content

Commit

Permalink
web: restart on config apply
Browse files Browse the repository at this point in the history
  • Loading branch information
SpComb committed Jan 6, 2025
1 parent 5efb026 commit 498c909
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 5 additions & 1 deletion web/src/components/ConfigView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
<div class="controls">
<h2>Apply</h2>
<fieldset class="actions">
<progress class="form" v-show="applying">Applying...</progress>
<button type="submit" form="config">Apply</button>
<progress class="input" v-show="applying">Applying...</progress>
</fieldset>

<h2>Backup</h2>
Expand Down Expand Up @@ -154,6 +154,8 @@ export default {
try {
await this.$store.dispatch('postConfig', formdata);
await this.$store.dispatch('restartSystem');
await this.$store.dispatch('loadConfig');
} catch (error) {
// XXX: UI?
alert(error.name + ": " + error.message);
Expand All @@ -170,6 +172,8 @@ export default {
try {
await this.$store.dispatch('uploadConfig', file);
await this.$store.dispatch('restartSystem');
await this.$store.dispatch('loadConfig');
} catch (error) {
input.setCustomValidity(error.name + ": " + error.message);
} finally {
Expand Down
1 change: 1 addition & 0 deletions web/src/components/SystemView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ export default {
try {
await this.$store.dispatch('restartSystem');
await this.$store.dispatch('loadSystem');
} catch (error) {
} finally {
Expand Down
5 changes: 0 additions & 5 deletions web/src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,9 @@ export default new Vuex.Store({
},
async postConfig({ state, dispatch }, formdata) {
await configService.post(state.config, formdata);

await dispatch('loadConfig');
},
async uploadConfig({ dispatch }, file) {
await configService.upload(file);
await dispatch('loadConfig');
},

/* system */
Expand All @@ -107,8 +104,6 @@ export default new Vuex.Store({
},
async restartSystem({ dispatch }) {
await systemService.restart();

await dispatch('loadSystem');
},

/* wifi */
Expand Down

0 comments on commit 498c909

Please sign in to comment.