Linter fixes

This commit is contained in:
Richard Bowman 2023-11-30 23:21:45 +00:00
parent f1f6ed5f80
commit 54df1faeeb
4 changed files with 37 additions and 18 deletions

View file

@ -239,7 +239,7 @@ export default {
}, },
positionStatusUri: function() { positionStatusUri: function() {
return `${this.baseUri}/stage/position`; return `${this.baseUri}/stage/position`;
}, }
}, },
watch: { watch: {

View file

@ -136,19 +136,17 @@ export default {
{ text: "Normal (30fps)", value: 30 }, { text: "Normal (30fps)", value: 30 },
{ text: "Low (15fps)", value: 15 }, { text: "Low (15fps)", value: 15 },
{ text: "Very low (10fps)", value: 10 } { text: "Very low (10fps)", value: 10 }
], ]
thingDescription: undefined
}; };
}, },
computed: { computed: {
cameraUri: function() { cameraUri: function() {
return `${this.$store.getters.baseUri}/camera/`; return `${this.$store.getters.baseUri}/camera/`;
}
}, },
thingDescription: function() {
mounted: async function() { return this.$store.getters["wot/thingDescription"]("camera");
this.thingDescription = await this.getThingDescription("camera"); }
} }
}; };
</script> </script>

View file

@ -1,6 +1,7 @@
import Vue from "vue"; import Vue from "vue";
import App from "./App.vue"; import App from "./App.vue";
import store from "./store"; import store from "./store";
import axios from "axios";
import UIkit from "uikit"; import UIkit from "uikit";
import VueTour from "vue-tour"; import VueTour from "vue-tour";
import VueFriendlyIframe from "vue-friendly-iframe"; import VueFriendlyIframe from "vue-friendly-iframe";
@ -41,7 +42,11 @@ Vue.mixin({
return this.$store.getters["wot/thingAvailable"](thing); return this.$store.getters["wot/thingAvailable"](thing);
}, },
async readThingProperty(thing, property) { async readThingProperty(thing, property) {
let url = this.$store.getters["wot/thingPropertyUrl"](thing, property, "readproperty"); let url = this.$store.getters["wot/thingPropertyUrl"](
thing,
property,
"readproperty"
);
try { try {
let response = await axios.get(url); let response = await axios.get(url);
return response.data; return response.data;
@ -50,9 +55,13 @@ Vue.mixin({
} }
}, },
async writeThingProperty(thing, property, value) { async writeThingProperty(thing, property, value) {
let url = this.$store.getters["wot/thingPropertyUrl"](thing, property, "writeproperty"); let url = this.$store.getters["wot/thingPropertyUrl"](
thing,
property,
"writeproperty"
);
try { try {
let response = await axios.put(url, value); await axios.put(url, value);
} catch (error) { } catch (error) {
this.modalError(error); this.modalError(error);
} }

View file

@ -28,8 +28,16 @@ export const wotStoreModule = {
// Deduplication should be done elsewhere. // Deduplication should be done elsewhere.
let response = await axios.get(uri); let response = await axios.get(uri);
let td = response.data; let td = response.data;
let thing_name = name | uri.replace(/\/$/, "").split("/").pop(); let thing_name =
commit("addThingDescription", { thingName: thing_name, thingDescription: td }); name |
uri
.replace(/\/$/, "")
.split("/")
.pop();
commit("addThingDescription", {
thingName: thing_name,
thingDescription: td
});
}, },
async fetchThingDescriptions({ commit }, uri) { async fetchThingDescriptions({ commit }, uri) {
// Fetch thing descriptions from the given URI // Fetch thing descriptions from the given URI
@ -37,15 +45,19 @@ export const wotStoreModule = {
if (response.status != 200) throw "Could not retrieve thing descriptions"; if (response.status != 200) throw "Could not retrieve thing descriptions";
for (const k in response.data) { for (const k in response.data) {
let thing_name = k.replace(/\/$/, "").replace(/^\//, ""); let thing_name = k.replace(/\/$/, "").replace(/^\//, "");
commit("addThingDescription", {thing_name: thing_name, thing_description: response.data[k]}); commit("addThingDescription", {
thingName: thing_name,
thingDescription: response.data[k]
});
}
} }
},
}, },
getters: { getters: {
thingDescription: state => thingName => { thingDescription: state => thingName => {
return state.thingDescriptions[thingName]; return state.thingDescriptions[thingName];
}, },
thingAvailable: state => thingName => { thingAvailable: state => thingName => {
console.log("thingAvailable", thingName, state.thingDescriptions)
return thingName in state.thingDescriptions; return thingName in state.thingDescriptions;
}, },
thingFormUrl: state => (thing, affordanceType, affordance, op) => { thingFormUrl: state => (thing, affordanceType, affordance, op) => {
@ -62,7 +74,7 @@ export const wotStoreModule = {
thingActionUrl: (_state, getters) => (thing, action, op) => { thingActionUrl: (_state, getters) => (thing, action, op) => {
// Find the URL for a particular action // Find the URL for a particular action
return getters.thingFormUrl(thing, "actions", action, op); return getters.thingFormUrl(thing, "actions", action, op);
}, }
} }
}; };