From ca6988ca99e89017bbc49b365f6a76066911a193 Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Fri, 1 Dec 2023 00:55:56 +0000 Subject: [PATCH] Update statusPane with new-style thing access --- .../aboutComponents/statusPane.vue | 73 ++++--------------- 1 file changed, 13 insertions(+), 60 deletions(-) diff --git a/webapp/src/components/tabContentComponents/aboutComponents/statusPane.vue b/webapp/src/components/tabContentComponents/aboutComponents/statusPane.vue index e23999b6..c098eee1 100644 --- a/webapp/src/components/tabContentComponents/aboutComponents/statusPane.vue +++ b/webapp/src/components/tabContentComponents/aboutComponents/statusPane.vue @@ -21,7 +21,7 @@
Camera:
-
+
{{ things.camera.title }}
No camera configured
@@ -29,7 +29,7 @@
Stage:
-
+
{{ things.stage.title }}
No stage configured
@@ -40,9 +40,9 @@
@@ -50,9 +50,9 @@
@@ -75,69 +75,22 @@ import axios from "axios"; export default { name: "StatusPane", - components: {}, - - data: function() { - return { - things: {}, - systemControlActions: {} - }; - }, - computed: { - baseUri: function() { - return `${this.$store.getters.baseUri}/`; + things: function() { + return this.$store.state["wot/thingDescriptions"]; } }, - mounted: function() { - // Watch for host 'ready', then update configuration - this.updateConfiguration(); - this.updateActions(); - }, - methods: { - updateConfiguration: async function() { - console.log("Showing the configuration is not yet fully implemented"); - // Retrieve TDs for camera and stage - let things = {}; - for (let thing of ["camera", "stage"]) { - try { - let response = await axios.get(this.baseUri + thing); // Get Thing Description - things[thing] = response.data; - } catch (error) { - console.log(thing + " was missing", error); - } - } - this.things = things; // We must set this.things in order to trigger the UI update - }, - updateActions: async function() { - try { - let response = await axios.get(this.baseUri + "system_control"); // Get Thing Description - this.systemControlActions = response.data.actions; - } catch (error) { - console.log( - "system control was missing - shutdown/restart buttons will not appear", - error - ); - } - }, - shutdownRequest: function() { - this.modalConfirm("Shut down microscope?").then( - () => { - this.$store.commit("resetState"); - // Post and silence errors - axios.post(this.baseUri + "system_control/shutdown").catch(() => {}); - }, - () => {} - ); - }, - rebootRequest: function() { + systemRequest: function(action) { this.modalConfirm("Restart microscope?").then( () => { this.$store.commit("resetState"); + this.$store.commit("wot/deleteAllThingDescriptions"); // Post and silence errors - axios.post(this.baseUri + "system_control/restart").catch(() => {}); + axios + .post(this.thingActionUrl("system_control", action)) + .catch(() => {}); }, () => {} );