@@ -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(() => {});
},
() => {}
);