Move shutdown and restart to settings tab, hard set server version to prealpha

This commit is contained in:
jaknapper 2025-05-22 15:11:25 +01:00
parent 57840ab979
commit 27ed10e27f
2 changed files with 47 additions and 40 deletions

View file

@ -25,7 +25,7 @@
<div>
<b>Server Version:</b> <br />
TODO
V3 (pre-alpha)
</div>
<hr />
@ -48,28 +48,6 @@
</div>
<hr />
<div class="uk-grid-small uk-child-width-1-2" uk-grid>
<div>
<button
v-show="'shutdown' in things.system_control.actions"
class="uk-button uk-button-danger uk-float-right uk-margin uk-margin-remove-top uk-width-1-1"
@click="systemRequest('shutdown')"
>
Shutdown
</button>
</div>
<div>
<button
v-show="'reboot' in things.system_control.actions"
class="uk-button uk-button-danger uk-float-right uk-margin uk-margin-remove-top uk-width-1-1"
@click="systemRequest('reboot')"
>
Restart
</button>
</div>
</div>
</div>
<div v-else-if="$store.state.waiting">
Loading...
@ -82,7 +60,6 @@
</template>
<script>
import axios from "axios";
import ActionButton from "../../labThingsComponents/actionButton.vue";
export default {
@ -94,22 +71,6 @@ export default {
return this.$store.getters["wot/thingDescriptions"];
}
},
methods: {
systemRequest: function(action) {
this.modalConfirm("Restart microscope?").then(
() => {
this.$store.commit("resetState");
this.$store.commit("wot/deleteAllThingDescriptions");
// Post and silence errors
axios
.post(this.thingActionUrl("system_control", action))
.catch(() => {});
},
() => {}
);
}
}
};
</script>

View file

@ -63,6 +63,25 @@
action="save_all_thing_settings"
submit-label="Save All Settings"
/>
<div>
<button
v-show="'shutdown' in things.system_control.actions"
class="uk-button uk-button-primary uk-margin uk-margin-remove-top uk-width-1-1"
@click="systemRequest('shutdown')"
>
Shutdown
</button>
</div>
<div>
<button
v-show="'reboot' in things.system_control.actions"
class="uk-button uk-button-primary uk-margin uk-margin-remove-top uk-width-1-1"
@click="systemRequest('reboot')"
>
Restart
</button>
</div>
</div>
<div class="view-component uk-width-expand uk-padding-small">
<tabContent
@ -110,6 +129,7 @@
</template>
<script>
import axios from "axios";
import streamSettings from "./settingsComponents/streamSettings.vue";
import cameraSettings from "./settingsComponents/cameraSettings.vue";
import appSettings from "./settingsComponents/appSettings.vue";
@ -135,6 +155,12 @@ export default {
ActionButton
},
computed: {
things: function() {
return this.$store.getters["wot/thingDescriptions"];
}
},
data: function() {
return {
selected: "display",
@ -147,6 +173,26 @@ export default {
if (!(this.currentTab == tab)) {
this.currentTab = tab;
}
},
systemRequest: function(action) {
let message = "";
if (action == "reboot") {
message = "Restart microscope?"
}
else {
message = "Shutdown microscope?"
}
this.modalConfirm(message).then(
() => {
this.$store.commit("resetState");
this.$store.commit("wot/deleteAllThingDescriptions");
// Post and silence errors
axios
.post(this.thingActionUrl("system_control", action))
.catch(() => {});
},
() => {}
);
}
}
};