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> <div>
<b>Server Version:</b> <br /> <b>Server Version:</b> <br />
TODO V3 (pre-alpha)
</div> </div>
<hr /> <hr />
@ -48,28 +48,6 @@
</div> </div>
<hr /> <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>
<div v-else-if="$store.state.waiting"> <div v-else-if="$store.state.waiting">
Loading... Loading...
@ -82,7 +60,6 @@
</template> </template>
<script> <script>
import axios from "axios";
import ActionButton from "../../labThingsComponents/actionButton.vue"; import ActionButton from "../../labThingsComponents/actionButton.vue";
export default { export default {
@ -94,22 +71,6 @@ export default {
return this.$store.getters["wot/thingDescriptions"]; 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> </script>

View file

@ -63,6 +63,25 @@
action="save_all_thing_settings" action="save_all_thing_settings"
submit-label="Save All 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>
<div class="view-component uk-width-expand uk-padding-small"> <div class="view-component uk-width-expand uk-padding-small">
<tabContent <tabContent
@ -110,6 +129,7 @@
</template> </template>
<script> <script>
import axios from "axios";
import streamSettings from "./settingsComponents/streamSettings.vue"; import streamSettings from "./settingsComponents/streamSettings.vue";
import cameraSettings from "./settingsComponents/cameraSettings.vue"; import cameraSettings from "./settingsComponents/cameraSettings.vue";
import appSettings from "./settingsComponents/appSettings.vue"; import appSettings from "./settingsComponents/appSettings.vue";
@ -135,6 +155,12 @@ export default {
ActionButton ActionButton
}, },
computed: {
things: function() {
return this.$store.getters["wot/thingDescriptions"];
}
},
data: function() { data: function() {
return { return {
selected: "display", selected: "display",
@ -147,6 +173,26 @@ export default {
if (!(this.currentTab == tab)) { if (!(this.currentTab == tab)) {
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(() => {});
},
() => {}
);
} }
} }
}; };