ui_migration refactor(store) use pinia stores in components
This commit is contained in:
parent
694a5a690f
commit
3a5a7488dd
25 changed files with 284 additions and 273 deletions
|
|
@ -2,8 +2,8 @@
|
||||||
<div id="app" class="uk-height-1-1 uk-margin-remove uk-padding-remove" :class="handleTheme">
|
<div id="app" class="uk-height-1-1 uk-margin-remove uk-padding-remove" :class="handleTheme">
|
||||||
<!-- this stops the app loading until setConnected is committed in the store, this means
|
<!-- this stops the app loading until setConnected is committed in the store, this means
|
||||||
other components will not load until we have Thing Descriptions. -->
|
other components will not load until we have Thing Descriptions. -->
|
||||||
<loadingContent v-if="!$store.getters.ready" />
|
<loadingContent v-if="!ready" />
|
||||||
<appContent v-if="$store.getters.ready" />
|
<appContent v-else />
|
||||||
<!-- Runtime modals -->
|
<!-- Runtime modals -->
|
||||||
<div id="modal-center" ref="keyboardManualModal" class="uk-flex-top" uk-modal>
|
<div id="modal-center" ref="keyboardManualModal" class="uk-flex-top" uk-modal>
|
||||||
<div class="uk-modal-dialog uk-modal-body uk-margin-auto-vertical">
|
<div class="uk-modal-dialog uk-modal-body uk-margin-auto-vertical">
|
||||||
|
|
@ -28,6 +28,9 @@ import appContent from "./components/appContent.vue";
|
||||||
import loadingContent from "./components/loadingContent.vue";
|
import loadingContent from "./components/loadingContent.vue";
|
||||||
import Mousetrap from "mousetrap";
|
import Mousetrap from "mousetrap";
|
||||||
import { eventBus } from "./eventBus.js";
|
import { eventBus } from "./eventBus.js";
|
||||||
|
import { mapWritableState, mapState, mapActions } from "pinia";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
import { useWotStore } from "@/stores/wot.js";
|
||||||
|
|
||||||
const move_keys = ["up", "down", "left", "right", "pageup", "pagedown"];
|
const move_keys = ["up", "down", "left", "right", "pageup", "pagedown"];
|
||||||
|
|
||||||
|
|
@ -75,6 +78,16 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapWritableState(useSettingsStore, [
|
||||||
|
"appTheme",
|
||||||
|
"navigationStepSize",
|
||||||
|
"navigationInvert",
|
||||||
|
"microscopeHostname",
|
||||||
|
"error",
|
||||||
|
"waiting",
|
||||||
|
]),
|
||||||
|
...mapState(useSettingsStore, ["ready", "baseUri"]),
|
||||||
|
|
||||||
isSystemDark: function () {
|
isSystemDark: function () {
|
||||||
if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -84,9 +97,9 @@ export default {
|
||||||
},
|
},
|
||||||
handleTheme: function () {
|
handleTheme: function () {
|
||||||
var isDark = false;
|
var isDark = false;
|
||||||
if (this.$store.state.appTheme == "dark") {
|
if (this.appTheme == "dark") {
|
||||||
isDark = true;
|
isDark = true;
|
||||||
} else if (this.$store.state.appTheme == "system") {
|
} else if (this.appTheme == "system") {
|
||||||
if (this.systemDark) {
|
if (this.systemDark) {
|
||||||
isDark = true;
|
isDark = true;
|
||||||
}
|
}
|
||||||
|
|
@ -98,126 +111,130 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// watch origin function refactored
|
||||||
|
watch: {
|
||||||
|
baseUri() {
|
||||||
|
this.checkConnection();
|
||||||
|
},
|
||||||
|
// The "Whole App" Wrapper Logic
|
||||||
|
ready(isReady) {
|
||||||
|
if (isReady) {
|
||||||
|
this.bindHardwareInputs(); // Turn keys ON when connected
|
||||||
|
} else {
|
||||||
|
this.unbindHardwareInputs(); // Turn keys OFF if disconnected
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
// Query CSS dark theme preference
|
// Query CSS dark theme preference
|
||||||
var mql = window.matchMedia("(prefers-color-scheme: dark)");
|
this.mql = window.matchMedia("(prefers-color-scheme: dark)");
|
||||||
|
this.systemDark = this.mql.matches;
|
||||||
// Check for system dark theme when mounted
|
// Check for system dark theme when mounted
|
||||||
if (mql.matches) {
|
if (this.mql.matches) {
|
||||||
this.systemDark = true;
|
this.systemDark = true;
|
||||||
}
|
}
|
||||||
// Create a theme observer to watch for changes
|
// Create a theme observer to watch for changes
|
||||||
this.themeObserver = mql.addListener((e) => {
|
this.themeWatchdog = (e) => {
|
||||||
if (e.matches) {
|
this.systemDark = e.matches;
|
||||||
this.systemDark = true;
|
};
|
||||||
} else {
|
this.mql.addEventListener("change", this.themeWatchdog);
|
||||||
this.systemDark = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// Check connection to API
|
// Check connection to API
|
||||||
this.checkConnection();
|
this.checkConnection();
|
||||||
},
|
},
|
||||||
|
|
||||||
created: function () {
|
created: function () {
|
||||||
window.addEventListener("beforeunload", this.handleExit);
|
window.addEventListener("beforeunload", this.handleExit);
|
||||||
// Scrollwheel listener
|
|
||||||
window.addEventListener("wheel", this.wheelMonitor);
|
|
||||||
// Watch for origin changes
|
|
||||||
this.unwatchOriginFunction = this.$store.watch(
|
|
||||||
(state, getters) => {
|
|
||||||
return getters.baseUri;
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
this.checkConnection();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// Keyboard shortcuts
|
|
||||||
Mousetrap.bind("?", () => {
|
|
||||||
this.toggleModalElement(this.$refs["keyboardManualModal"]); // Calls the mixin
|
|
||||||
});
|
|
||||||
|
|
||||||
Mousetrap.bind(
|
|
||||||
move_keys,
|
|
||||||
(event, key) => {
|
|
||||||
event.preventDefault();
|
|
||||||
this.keysDown.add(key);
|
|
||||||
this.updateJogFromKeys();
|
|
||||||
},
|
|
||||||
"keydown",
|
|
||||||
);
|
|
||||||
|
|
||||||
Mousetrap.bind(
|
|
||||||
move_keys,
|
|
||||||
(event, key) => {
|
|
||||||
event.preventDefault();
|
|
||||||
this.keysDown.delete(key);
|
|
||||||
this.updateJogFromKeys();
|
|
||||||
},
|
|
||||||
"keyup",
|
|
||||||
);
|
|
||||||
|
|
||||||
this.keyboardManual.push({
|
|
||||||
shortcut: "←↑→↓",
|
|
||||||
description: "Move the microscope stage",
|
|
||||||
});
|
|
||||||
|
|
||||||
this.keyboardManual.push({
|
|
||||||
shortcut: "pgup / pgdn",
|
|
||||||
description: "Move the microscope focus",
|
|
||||||
});
|
|
||||||
|
|
||||||
// Capture
|
|
||||||
Mousetrap.bind("c", () => {
|
|
||||||
eventBus.emit("globalCaptureEvent", {});
|
|
||||||
});
|
|
||||||
this.keyboardManual.push({
|
|
||||||
shortcut: "c",
|
|
||||||
description: "Take a capture",
|
|
||||||
});
|
|
||||||
|
|
||||||
// Autofocus
|
|
||||||
Mousetrap.bind("a", () => {
|
|
||||||
eventBus.emit("globalFastAutofocusEvent", {});
|
|
||||||
});
|
|
||||||
this.keyboardManual.push({
|
|
||||||
shortcut: "a",
|
|
||||||
description: "Fast autofocus",
|
|
||||||
});
|
|
||||||
|
|
||||||
// Increment/decrement tab
|
|
||||||
Mousetrap.bind("shift+down", () => {
|
|
||||||
eventBus.emit("globalIncrementTab", {});
|
|
||||||
});
|
|
||||||
Mousetrap.bind("shift+up", () => {
|
|
||||||
eventBus.emit("globalDecrementTab", {});
|
|
||||||
});
|
|
||||||
this.keyboardManual.push({
|
|
||||||
shortcut: "shift+↑ / shift+↓",
|
|
||||||
description: "Switch tab",
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeUnmount: function () {
|
beforeUnmount: function () {
|
||||||
// Disconnect the theme observer
|
// Disconnect the theme observer
|
||||||
if (this.themeObserver) {
|
this.mql.removeEventListener("change", this.themeWatchdog);
|
||||||
this.themeObserver.disconnect();
|
|
||||||
}
|
|
||||||
// Remove scrollwheel listener
|
// Remove scrollwheel listener
|
||||||
window.removeEventListener("wheel", this.wheelMonitor);
|
window.removeEventListener("wheel", this.wheelMonitor);
|
||||||
// Remove origin watcher
|
|
||||||
this.unwatchOriginFunction();
|
|
||||||
// Remove key listeners
|
// Remove key listeners
|
||||||
Mousetrap.reset();
|
Mousetrap.reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions(useSettingsStore, ["setConnected"]),
|
||||||
|
|
||||||
|
bindHardwareInputs() {
|
||||||
|
window.addEventListener("wheel", this.wheelMonitor);
|
||||||
|
|
||||||
|
Mousetrap.bind("?", () => {
|
||||||
|
this.toggleModalElement(this.$refs["keyboardManualModal"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
Mousetrap.bind(
|
||||||
|
move_keys,
|
||||||
|
(event, key) => {
|
||||||
|
event.preventDefault();
|
||||||
|
this.keysDown.add(key);
|
||||||
|
this.updateJogFromKeys();
|
||||||
|
},
|
||||||
|
"keydown",
|
||||||
|
);
|
||||||
|
|
||||||
|
Mousetrap.bind(
|
||||||
|
move_keys,
|
||||||
|
(event, key) => {
|
||||||
|
event.preventDefault();
|
||||||
|
this.keysDown.delete(key);
|
||||||
|
this.updateJogFromKeys();
|
||||||
|
},
|
||||||
|
"keyup",
|
||||||
|
);
|
||||||
|
|
||||||
|
this.keyboardManual.push({
|
||||||
|
shortcut: "←↑→↓",
|
||||||
|
description: "Move the microscope stage",
|
||||||
|
});
|
||||||
|
|
||||||
|
this.keyboardManual.push({
|
||||||
|
shortcut: "pgup / pgdn",
|
||||||
|
description: "Move the microscope focus",
|
||||||
|
});
|
||||||
|
|
||||||
|
Mousetrap.bind("c", () => {
|
||||||
|
eventBus.emit("globalCaptureEvent", {});
|
||||||
|
});
|
||||||
|
this.keyboardManual.push({
|
||||||
|
shortcut: "c",
|
||||||
|
description: "Take a capture",
|
||||||
|
});
|
||||||
|
|
||||||
|
Mousetrap.bind("a", () => {
|
||||||
|
eventBus.emit("globalFastAutofocusEvent", {});
|
||||||
|
});
|
||||||
|
this.keyboardManual.push({
|
||||||
|
shortcut: "a",
|
||||||
|
description: "Fast autofocus",
|
||||||
|
});
|
||||||
|
|
||||||
|
Mousetrap.bind("shift+down", () => {
|
||||||
|
eventBus.emit("globalIncrementTab", {});
|
||||||
|
});
|
||||||
|
Mousetrap.bind("shift+up", () => {
|
||||||
|
eventBus.emit("globalDecrementTab", {});
|
||||||
|
});
|
||||||
|
this.keyboardManual.push({
|
||||||
|
shortcut: "shift+↑ / shift+↓",
|
||||||
|
description: "Switch tab",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
unbindHardwareInputs() {
|
||||||
|
window.removeEventListener("wheel", this.wheelMonitor);
|
||||||
|
Mousetrap.reset();
|
||||||
|
this.keyboardManual = [];
|
||||||
|
},
|
||||||
|
|
||||||
async checkConnection() {
|
async checkConnection() {
|
||||||
var baseUri = this.$store.getters.baseUri;
|
this.waiting = true;
|
||||||
this.$store.commit("changeWaiting", true);
|
const wotStore = useWotStore();
|
||||||
// TODO: more robust check - e.g. use a microscope Thing
|
|
||||||
// TODO: should we purge existing consumedThings?
|
|
||||||
try {
|
try {
|
||||||
await this.$store.dispatch("wot/fetchThingDescriptions", `${baseUri}/thing_descriptions/`);
|
await wotStore.fetchThingDescriptions(`${this.baseUri}/thing_descriptions/`);
|
||||||
for (let requiredThing of ["camera", "system"]) {
|
for (let requiredThing of ["camera", "system"]) {
|
||||||
if (!this.thingAvailable(requiredThing)) {
|
if (!this.thingAvailable(requiredThing)) {
|
||||||
throw new Error(`No ${requiredThing} found, the GUI won't work without one.`);
|
throw new Error(`No ${requiredThing} found, the GUI won't work without one.`);
|
||||||
|
|
@ -225,74 +242,48 @@ export default {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
let hostname = await this.readThingProperty("system", "hostname");
|
let hostname = await this.readThingProperty("system", "hostname");
|
||||||
this.$store.commit("changeMicroscopeHostname", hostname);
|
this.microscopeHostname = hostname;
|
||||||
document.title = `OpenFlexure Microscope: ${hostname}`;
|
document.title = `OpenFlexure Microscope: ${hostname}`;
|
||||||
} catch {
|
} catch {
|
||||||
this.$store.commit("changeMicroscopeHostname", null);
|
this.microscopeHostname = null;
|
||||||
}
|
}
|
||||||
// start rendering components
|
this.setConnected();
|
||||||
this.$store.commit("setConnected");
|
this.error = null;
|
||||||
this.$store.commit("setErrorMessage", null);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$store.commit("setErrorMessage", error);
|
this.error = error;
|
||||||
} finally {
|
} finally {
|
||||||
this.$store.commit("changeWaiting", false);
|
this.waiting = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleExit: function () {},
|
|
||||||
|
|
||||||
/**
|
handleExit() {},
|
||||||
* Handle global mouse wheel events to be associated with navigation
|
|
||||||
*/
|
wheelMonitor(event) {
|
||||||
wheelMonitor: function (event) {
|
|
||||||
// Only capture scroll if the event target's parent contains the "scrollTarget" class
|
|
||||||
if (
|
if (
|
||||||
event.target.parentNode.classList.contains("scrollTarget") ||
|
event.target.parentNode.classList.contains("scrollTarget") ||
|
||||||
event.target.classList.contains("scrollTarget")
|
event.target.classList.contains("scrollTarget")
|
||||||
) {
|
) {
|
||||||
const z_rel = event.deltaY / 100;
|
const z_rel = event.deltaY / 100;
|
||||||
// Emit a signal to move, acted on by panelControl.vue
|
const z = z_rel * this.navigationStepSize.z;
|
||||||
const navigationStepSize = this.$store.state.navigationStepSize;
|
|
||||||
const z = z_rel * navigationStepSize.z;
|
|
||||||
// Don't use `jog() due to variable size of jogs here and the rate limiting in
|
|
||||||
// `jog()`. No need to invert on z, as navigationInvert.z isn't exposed.
|
|
||||||
this.invokeAction("stage", "jog", { x: 0, y: 0, z: z });
|
this.invokeAction("stage", "jog", { x: 0, y: 0, z: z });
|
||||||
eventBus.emit("globalUpdatePositionEvent");
|
eventBus.emit("globalUpdatePositionEvent");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Jog for key-presses.
|
|
||||||
*
|
|
||||||
* This is a similar to the function in stageControlButtons.vue however it uses
|
|
||||||
* uses the key repeat to fire in case a key up is missed. It debounces any
|
|
||||||
* request to jog that is too recent after the last jog.
|
|
||||||
*/
|
|
||||||
jog(x, y, z) {
|
jog(x, y, z) {
|
||||||
// Manually debounce extra requests from keyboard repeat rate.
|
|
||||||
// This is used rather than an interval in case of missing a repeat.
|
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const navigationInvert = this.$store.state.navigationInvert;
|
|
||||||
if (now - this.lastJogTime < this.jogTime) {
|
if (now - this.lastJogTime < this.jogTime) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.lastJogTime = now;
|
this.lastJogTime = now;
|
||||||
|
|
||||||
this.invokeAction("stage", "jog", {
|
this.invokeAction("stage", "jog", {
|
||||||
x: x * this.jogDistance * (navigationInvert.x ? -1 : 1),
|
x: x * this.jogDistance * (this.navigationInvert.x ? -1 : 1),
|
||||||
y: y * this.jogDistance * (navigationInvert.y ? -1 : 1),
|
y: y * this.jogDistance * (this.navigationInvert.y ? -1 : 1),
|
||||||
z: z * this.jogDistance,
|
z: z * this.jogDistance,
|
||||||
});
|
});
|
||||||
eventBus.emit("globalUpdatePositionEvent");
|
eventBus.emit("globalUpdatePositionEvent");
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop jogging on key-up
|
|
||||||
*
|
|
||||||
* This is also similar to the function in stageControlButtons.vue. It handles
|
|
||||||
* stopping jogging and resetting the `lastJogTime` so there is no delay when
|
|
||||||
* starting a new jog after an old jog finished.
|
|
||||||
*/
|
|
||||||
jogStop() {
|
jogStop() {
|
||||||
this.invokeAction("stage", "jog", { stop: true });
|
this.invokeAction("stage", "jog", { stop: true });
|
||||||
this.lastJogTime = 0;
|
this.lastJogTime = 0;
|
||||||
|
|
@ -301,9 +292,6 @@ export default {
|
||||||
}, 100);
|
}, 100);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Track which keys are still down on keypress (or key repeat).
|
|
||||||
*/
|
|
||||||
updateJogFromKeys() {
|
updateJogFromKeys() {
|
||||||
let x = 0,
|
let x = 0,
|
||||||
y = 0,
|
y = 0,
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ import slideScanContent from "./tabContentComponents/slideScanContent.vue";
|
||||||
import viewContent from "./tabContentComponents/viewContent.vue";
|
import viewContent from "./tabContentComponents/viewContent.vue";
|
||||||
import { markRaw } from "vue";
|
import { markRaw } from "vue";
|
||||||
import { eventBus } from "../eventBus.js";
|
import { eventBus } from "../eventBus.js";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
|
||||||
// Import modal components for device initialisation
|
// Import modal components for device initialisation
|
||||||
import calibrationWizard from "./modalComponents/calibrationWizard.vue";
|
import calibrationWizard from "./modalComponents/calibrationWizard.vue";
|
||||||
|
|
@ -196,6 +197,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
const store = useSettingsStore();
|
||||||
// A global signal listener to switch tab
|
// A global signal listener to switch tab
|
||||||
eventBus.on("globalSwitchTab", (tabID) => {
|
eventBus.on("globalSwitchTab", (tabID) => {
|
||||||
this.currentTab = tabID;
|
this.currentTab = tabID;
|
||||||
|
|
@ -208,7 +210,7 @@ export default {
|
||||||
eventBus.on("globalDecrementTab", () => {
|
eventBus.on("globalDecrementTab", () => {
|
||||||
this.incrementTabBy(-1);
|
this.incrementTabBy(-1);
|
||||||
});
|
});
|
||||||
if (this.$store.getters.ready) {
|
if (store.ready) {
|
||||||
this.startModals();
|
this.startModals();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { useIntersectionObserver } from "@vueuse/core";
|
import { useIntersectionObserver } from "@vueuse/core";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
import { mapState } from "pinia";
|
||||||
|
|
||||||
// Export main app
|
// Export main app
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -28,8 +30,9 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
streamImgUri: function () {
|
...mapState(useSettingsStore, ["baseUri"]),
|
||||||
return `${this.$store.getters.baseUri}/camera/mjpeg_stream`;
|
streamImgUri() {
|
||||||
|
return `${this.baseUri}/camera/mjpeg_stream`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapState } from "pinia";
|
||||||
|
import { useSettingsStore } from "@/stores/settings";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ProgressBar",
|
name: "ProgressBar",
|
||||||
|
|
||||||
|
|
@ -13,6 +16,7 @@ export default {
|
||||||
emits: ["set-tab"],
|
emits: ["set-tab"],
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState(useSettingsStore, ["ready"]),
|
||||||
tooltipOptions: function () {
|
tooltipOptions: function () {
|
||||||
var title = this.id.charAt(0).toUpperCase() + this.id.slice(1);
|
var title = this.id.charAt(0).toUpperCase() + this.id.slice(1);
|
||||||
return `pos: right; title: ${title}; delay: 500`;
|
return `pos: right; title: ${title}; delay: 500`;
|
||||||
|
|
@ -21,7 +25,7 @@ export default {
|
||||||
classObject: function () {
|
classObject: function () {
|
||||||
return {
|
return {
|
||||||
"tabicon-active": this.currentTab == this.id,
|
"tabicon-active": this.currentTab == this.id,
|
||||||
"uk-disabled": this.requireConnection && !this.$store.getters.ready,
|
"uk-disabled": this.requireConnection && !this.ready,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
v-if="!(requireConnection && !$store.getters.ready)"
|
v-if="!(requireConnection && !ready) && currentTab === tabID"
|
||||||
:hidden="currentTab != tabID"
|
|
||||||
class="uk-width-expand uk-height-1-1"
|
class="uk-width-expand uk-height-1-1"
|
||||||
>
|
>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
|
|
@ -9,6 +8,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapState } from "pinia";
|
||||||
|
import { useSettingsStore } from "@/stores/settings";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TabContent",
|
name: "TabContent",
|
||||||
|
|
||||||
|
|
@ -23,7 +25,9 @@ export default {
|
||||||
},
|
},
|
||||||
requireConnection: Boolean,
|
requireConnection: Boolean,
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {
|
||||||
|
...mapState(useSettingsStore, ["ready"]),
|
||||||
|
},
|
||||||
|
|
||||||
methods: {},
|
methods: {},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapState } from "pinia";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TabIcon",
|
name: "TabIcon",
|
||||||
|
|
||||||
|
|
@ -52,6 +55,7 @@ export default {
|
||||||
emits: ["set-tab"],
|
emits: ["set-tab"],
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState(useSettingsStore, ["ready"]),
|
||||||
computedTitle: function () {
|
computedTitle: function () {
|
||||||
if (this.title !== undefined) {
|
if (this.title !== undefined) {
|
||||||
return this.title;
|
return this.title;
|
||||||
|
|
@ -74,7 +78,7 @@ export default {
|
||||||
classObject: function () {
|
classObject: function () {
|
||||||
return {
|
return {
|
||||||
"tabicon-active": this.currentTab == this.tabID,
|
"tabicon-active": this.currentTab == this.tabID,
|
||||||
"uk-disabled": this.requireConnection && !this.$store.getters.ready,
|
"uk-disabled": this.requireConnection && !this.ready,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,7 @@ export default {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
async checkExistingTasks() {
|
async checkExistingTasks() {
|
||||||
const ongoingTask = await this.getOngingAction(this.thing, this.action);
|
const ongoingTask = await this.getOngoingAction(this.thing, this.action);
|
||||||
if (ongoingTask) {
|
if (ongoingTask) {
|
||||||
// There is a started task
|
// There is a started task
|
||||||
this.taskStarted = true;
|
this.taskStarted = true;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
barWidthFromProgress: function () {
|
barWidthFromProgress: function () {
|
||||||
var progress = this.progress <= 100 ? this.progress : 100;
|
var progress = this.progress <= 100 ? this.progress : 100;
|
||||||
var styleString = `width: ${progress}%`;
|
var styleString = progress != null ? `width: ${progress}%` : `width: 0%`;
|
||||||
return styleString;
|
return styleString;
|
||||||
},
|
},
|
||||||
indeterminateProgressBar: function () {
|
indeterminateProgressBar: function () {
|
||||||
|
|
|
||||||
|
|
@ -67,11 +67,9 @@ export default {
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
propertyDescription: function () {
|
propertyDescription: function () {
|
||||||
try {
|
const td = this.wotStore.thingDescriptions[this.thingName];
|
||||||
return this.thingDescription(this.thingName).properties[this.propertyName];
|
if (!td || !td.properties) return undefined;
|
||||||
} catch {
|
return td.properties[this.propertyName];
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="uk-flex uk-flex-column uk-flex-center uk-height-1-1">
|
<div class="uk-flex uk-flex-column uk-flex-center uk-height-1-1">
|
||||||
<div v-if="$store.state.waiting" class="uk-align-center" uk-spinner="ratio: 3"></div>
|
<div v-if="waiting" class="uk-align-center uk-text-center">
|
||||||
<div v-if="$store.state.waiting" class="uk-align-center">Loading...</div>
|
<div uk-spinner="ratio: 3"></div>
|
||||||
|
<p>Loading...</p>
|
||||||
|
</div>
|
||||||
<span class="material-symbols-outlined uk-align-center error-icon">error_outline</span>
|
<span class="material-symbols-outlined uk-align-center error-icon">error_outline</span>
|
||||||
<div v-if="$store.state.error" class="uk-align-center">
|
<div v-if="error" class="uk-align-center">
|
||||||
{{ $store.state.error }}
|
{{ error }}
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-align-center">
|
<div class="uk-align-center">
|
||||||
<devTools class="uk-width-medium"></devTools>
|
<devTools class="uk-width-medium"></devTools>
|
||||||
|
|
@ -14,6 +16,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import devTools from "./tabContentComponents/aboutComponents/devTools.vue";
|
import devTools from "./tabContentComponents/aboutComponents/devTools.vue";
|
||||||
|
import { mapWritableState } from "pinia";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
|
||||||
// Export main app
|
// Export main app
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -23,8 +27,8 @@ export default {
|
||||||
devTools,
|
devTools,
|
||||||
},
|
},
|
||||||
|
|
||||||
data: function () {
|
computed: {
|
||||||
return {};
|
...mapWritableState(useSettingsStore, ["error", "waiting"]),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@
|
||||||
<script>
|
<script>
|
||||||
import stepTemplateWithStream from "../stepTemplateWithStream.vue";
|
import stepTemplateWithStream from "../stepTemplateWithStream.vue";
|
||||||
import cameraCalibrationSettings from "../../../tabContentComponents/settingsComponents/cameraSettingsComponents/cameraCalibrationSettings.vue";
|
import cameraCalibrationSettings from "../../../tabContentComponents/settingsComponents/cameraSettingsComponents/cameraCalibrationSettings.vue";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
import { mapState } from "pinia";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "CameraMainCalibrationStep",
|
name: "CameraMainCalibrationStep",
|
||||||
|
|
@ -34,8 +36,9 @@ export default {
|
||||||
emits: ["awaiting-user"],
|
emits: ["awaiting-user"],
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState(useSettingsStore, ["baseUri"]),
|
||||||
cameraUri: function () {
|
cameraUri: function () {
|
||||||
return `${this.$store.getters.baseUri}/camera/`;
|
return `${this.baseUri}/camera/`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<div>
|
<div>
|
||||||
<form class="uk-form-stacked" action="" method="GET" @submit="overrideAPIHost">
|
<form class="uk-form-stacked" action="" method="GET" @submit="overrideAPIHost">
|
||||||
<label class="uk-form-label">Override API origin</label>
|
<label class="uk-form-label">Override API origin</label>
|
||||||
<input v-model="newOrigin" name="overrideOrigin" class="uk-input" type="text" />
|
<input v-model="overrideOrigin" name="overrideOrigin" class="uk-input" type="text" />
|
||||||
<label class="uk-form-label">
|
<label class="uk-form-label">
|
||||||
<input v-model="reloadWhenOverridingOrigin" class="uk-checkbox" type="checkbox" />
|
<input v-model="reloadWhenOverridingOrigin" class="uk-checkbox" type="checkbox" />
|
||||||
Reload web app with new origin
|
Reload web app with new origin
|
||||||
|
|
@ -13,31 +13,30 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Export main app
|
import { mapWritableState } from "pinia";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "DevTools",
|
name: "DevTools",
|
||||||
|
|
||||||
components: {},
|
data() {
|
||||||
|
|
||||||
data: function () {
|
|
||||||
return {
|
return {
|
||||||
newOrigin: this.$store.state.overrideOrigin,
|
|
||||||
reloadWhenOverridingOrigin: true,
|
reloadWhenOverridingOrigin: true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
computed: {
|
||||||
overrideAPIHost: function (event) {
|
...mapWritableState(useSettingsStore, ["overrideOrigin", "origin"]),
|
||||||
// Save the origin override, so that if we reload the web app, you can easily
|
},
|
||||||
this.$store.commit("changeOverrideOrigin", this.newOrigin);
|
|
||||||
|
|
||||||
// If we have elected not to reload the interface, just update the origin
|
methods: {
|
||||||
// in the store. Otherwise, the form's default action will do the job for us.
|
overrideAPIHost(event) {
|
||||||
// TODO: preserve other query parameters when reloading
|
|
||||||
if (!this.reloadWhenOverridingOrigin) {
|
if (!this.reloadWhenOverridingOrigin) {
|
||||||
this.$store.commit("changeOrigin", this.newOrigin);
|
this.origin = this.overrideOrigin;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
// if reloadWhenOverridingOrigin is true, form submits normally
|
||||||
|
// passing overrideOrigin as a query param in the URL
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ export default {
|
||||||
},
|
},
|
||||||
async checkIfStartedExternally() {
|
async checkIfStartedExternally() {
|
||||||
if (!this.taskStarted | !this.taskRunning) {
|
if (!this.taskStarted | !this.taskRunning) {
|
||||||
const ongoingTask = await this.getOngingAction(this.thing, this.action);
|
const ongoingTask = await this.getOngoingAction(this.thing, this.action);
|
||||||
if (ongoingTask) {
|
if (ongoingTask) {
|
||||||
this.resetData();
|
this.resetData();
|
||||||
const taskUrl = ongoingTask.links.find((t) => t.rel == "self").href;
|
const taskUrl = ongoingTask.links.find((t) => t.rel == "self").href;
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { eventBus } from "@/eventBus.js";
|
import { eventBus } from "@/eventBus.js";
|
||||||
|
import { mapWritableState } from "pinia";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "StageControlButtons",
|
name: "StageControlButtons",
|
||||||
|
|
@ -97,6 +99,13 @@ export default {
|
||||||
jogDistance: 600,
|
jogDistance: 600,
|
||||||
jogTime: 300,
|
jogTime: 300,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
...mapWritableState(useSettingsStore, ["navigationInvert"]),
|
||||||
|
},
|
||||||
|
|
||||||
|
// TODO: jogInterval may need to be cleared on "beforeUnmount()"
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* Jog d-pad and focus buttons.
|
* Jog d-pad and focus buttons.
|
||||||
|
|
@ -116,11 +125,10 @@ export default {
|
||||||
// pointer is.
|
// pointer is.
|
||||||
pointerEvent.target.setPointerCapture(pointerEvent.pointerId);
|
pointerEvent.target.setPointerCapture(pointerEvent.pointerId);
|
||||||
|
|
||||||
const navigationInvert = this.$store.state.navigationInvert;
|
|
||||||
let invokeJog = () =>
|
let invokeJog = () =>
|
||||||
this.invokeAction("stage", "jog", {
|
this.invokeAction("stage", "jog", {
|
||||||
x: x * this.jogDistance * (navigationInvert.x ? -1 : 1),
|
x: x * this.jogDistance * (this.navigationInvert.x ? -1 : 1),
|
||||||
y: y * this.jogDistance * (navigationInvert.y ? -1 : 1),
|
y: y * this.jogDistance * (this.navigationInvert.y ? -1 : 1),
|
||||||
z: z * this.jogDistance,
|
z: z * this.jogDistance,
|
||||||
});
|
});
|
||||||
invokeJog();
|
invokeJog();
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,8 @@ import axios from "axios";
|
||||||
import PaginateLinks from "@/components/genericComponents/paginateLinks.vue";
|
import PaginateLinks from "@/components/genericComponents/paginateLinks.vue";
|
||||||
import EndpointButton from "../labThingsComponents/endpointButton.vue";
|
import EndpointButton from "../labThingsComponents/endpointButton.vue";
|
||||||
import { useIntersectionObserver } from "@vueuse/core";
|
import { useIntersectionObserver } from "@vueuse/core";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
import { mapState } from "pinia";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "LoggingContent",
|
name: "LoggingContent",
|
||||||
|
|
@ -114,6 +116,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState(useSettingsStore, ["baseUri"]),
|
||||||
filteredLevels: function () {
|
filteredLevels: function () {
|
||||||
let cutoffIndex = this.allLevels.indexOf(this.filterLevel);
|
let cutoffIndex = this.allLevels.indexOf(this.filterLevel);
|
||||||
return this.allLevels.slice(cutoffIndex, -1);
|
return this.allLevels.slice(cutoffIndex, -1);
|
||||||
|
|
@ -130,10 +133,10 @@ export default {
|
||||||
return items;
|
return items;
|
||||||
},
|
},
|
||||||
logURI: function () {
|
logURI: function () {
|
||||||
return `${this.$store.getters.baseUri}/log/`;
|
return `${this.baseUri}/log/`;
|
||||||
},
|
},
|
||||||
logFileURI: function () {
|
logFileURI: function () {
|
||||||
return `${this.$store.getters.baseUri}/logfile/`;
|
return `${this.baseUri}/logfile/`;
|
||||||
},
|
},
|
||||||
pagedItems: function () {
|
pagedItems: function () {
|
||||||
let startIndex = (this.currentPage - 1) * this.maxitems;
|
let startIndex = (this.currentPage - 1) * this.maxitems;
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,9 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import { useWotStore } from "@/stores/wot.js";
|
||||||
|
import { mapActions } from "pinia";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "PowerContent",
|
name: "PowerContent",
|
||||||
|
|
@ -52,6 +55,8 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions(useSettingsStore, ["resetState"]),
|
||||||
|
...mapActions(useWotStore, ["deleteAllThingDescriptions"]),
|
||||||
systemRequest: function (action) {
|
systemRequest: function (action) {
|
||||||
let message = "";
|
let message = "";
|
||||||
if (action == "reboot") {
|
if (action == "reboot") {
|
||||||
|
|
@ -61,8 +66,8 @@ export default {
|
||||||
}
|
}
|
||||||
this.modalConfirm(message).then(
|
this.modalConfirm(message).then(
|
||||||
() => {
|
() => {
|
||||||
this.$store.commit("resetState");
|
this.resetState();
|
||||||
this.$store.commit("wot/deleteAllThingDescriptions");
|
this.deleteAllThingDescriptions();
|
||||||
// Post and silence errors
|
// Post and silence errors
|
||||||
axios.post(this.thingActionUrl("system", action)).catch(() => {});
|
axios.post(this.thingActionUrl("system", action)).catch(() => {});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,8 @@
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import actionButton from "../../labThingsComponents/actionButton.vue";
|
import actionButton from "../../labThingsComponents/actionButton.vue";
|
||||||
import EndpointButton from "../../labThingsComponents/endpointButton.vue";
|
import EndpointButton from "../../labThingsComponents/endpointButton.vue";
|
||||||
|
import { mapState } from "pinia";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
|
||||||
// Export main app
|
// Export main app
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -109,11 +111,12 @@ export default {
|
||||||
emits: ["viewer-requested", "update-requested"],
|
emits: ["viewer-requested", "update-requested"],
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState(useSettingsStore, ["baseUri"]),
|
||||||
downloadStitchFile() {
|
downloadStitchFile() {
|
||||||
return `${this.$store.getters.baseUri}/smart_scan/get_stitch/${this.scanData.name}`;
|
return `${this.baseUri}/smart_scan/get_stitch/${this.scanData.name}`;
|
||||||
},
|
},
|
||||||
thumbnailPath() {
|
thumbnailPath() {
|
||||||
return `${this.$store.getters.baseUri}/smart_scan/scans/stitched_thumbnail.jpg?scan_name=${this.scanData.name}&modified=${this.scanData.modified}`;
|
return `${this.baseUri}/smart_scan/scans/stitched_thumbnail.jpg?scan_name=${this.scanData.name}&modified=${this.scanData.modified}`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,18 +41,10 @@
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<ScanViewerModal
|
<ScanViewerModal ref="scanViewer" :selected-scan="selectedScan" :base-uri="baseUri" />
|
||||||
ref="scanViewer"
|
|
||||||
:selected-scan="selectedScan"
|
|
||||||
:base-uri="$store.getters.baseUri"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- Gallery -->
|
<!-- Gallery -->
|
||||||
<div
|
<div v-if="ready" class="uk-padding-remove-top" uk-lightbox="toggle: .lightbox-link">
|
||||||
v-if="$store.getters.ready"
|
|
||||||
class="uk-padding-remove-top"
|
|
||||||
uk-lightbox="toggle: .lightbox-link"
|
|
||||||
>
|
|
||||||
<!-- Gallery capture cards -->
|
<!-- Gallery capture cards -->
|
||||||
<div class="gallery-grid uk-grid-match" uk-grid>
|
<div class="gallery-grid uk-grid-match" uk-grid>
|
||||||
<div v-if="scansEmpty">
|
<div v-if="scansEmpty">
|
||||||
|
|
@ -86,6 +78,9 @@ import scanCard from "./scanListComponents/scanCard.vue";
|
||||||
import ScanViewerModal from "./scanListComponents/scanViewer.vue";
|
import ScanViewerModal from "./scanListComponents/scanViewer.vue";
|
||||||
import { eventBus } from "../../eventBus.js";
|
import { eventBus } from "../../eventBus.js";
|
||||||
import { useIntersectionObserver } from "@vueuse/core";
|
import { useIntersectionObserver } from "@vueuse/core";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
import { mapState, storeToRefs } from "pinia";
|
||||||
|
import { watch } from "vue";
|
||||||
|
|
||||||
// Export main app
|
// Export main app
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -111,6 +106,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState(useSettingsStore, ["baseUri", "ready"]),
|
||||||
scansUri() {
|
scansUri() {
|
||||||
return this.thingPropertyUrl("smart_scan", "scans");
|
return this.thingPropertyUrl("smart_scan", "scans");
|
||||||
},
|
},
|
||||||
|
|
@ -119,7 +115,7 @@ export default {
|
||||||
},
|
},
|
||||||
selectedScanDZI() {
|
selectedScanDZI() {
|
||||||
if (this.selectedScan && this.selectedScan.dzi != "") {
|
if (this.selectedScan && this.selectedScan.dzi != "") {
|
||||||
return `${this.$store.getters.baseUri}/data/smart_scan/${this.selectedScan.name}/images/${this.selectedScan.dzi}`;
|
return `${this.baseUri}/data/smart_scan/${this.selectedScan.name}/images/${this.selectedScan.dzi}`;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -134,6 +130,15 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
|
const store = useSettingsStore();
|
||||||
|
const { ready } = storeToRefs(store);
|
||||||
|
watch(ready, (isReady) => {
|
||||||
|
if (isReady) {
|
||||||
|
this.updateScans();
|
||||||
|
} else {
|
||||||
|
this.scans = [];
|
||||||
|
}
|
||||||
|
});
|
||||||
useIntersectionObserver(
|
useIntersectionObserver(
|
||||||
this.$refs.galleryDisplay,
|
this.$refs.galleryDisplay,
|
||||||
([{ isIntersecting }]) => {
|
([{ isIntersecting }]) => {
|
||||||
|
|
@ -155,24 +160,6 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
created: function () {
|
|
||||||
// Watch for host 'ready', then update status
|
|
||||||
this.unwatchStoreFunction = this.$store.watch(
|
|
||||||
(state, getters) => {
|
|
||||||
return getters.ready;
|
|
||||||
},
|
|
||||||
(ready) => {
|
|
||||||
if (ready) {
|
|
||||||
// If the connection is now ready, update capture list
|
|
||||||
this.updateScans();
|
|
||||||
} else {
|
|
||||||
// If the connection is now disconnected, empty capture list
|
|
||||||
this.captures = {};
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
// Remove global signal listener to perform a gallery refresh
|
// Remove global signal listener to perform a gallery refresh
|
||||||
eventBus.off("globalUpdateScans", this.updateScans);
|
eventBus.off("globalUpdateScans", this.updateScans);
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
import cameraCalibrationSettings from "./cameraSettingsComponents/cameraCalibrationSettings.vue";
|
import cameraCalibrationSettings from "./cameraSettingsComponents/cameraCalibrationSettings.vue";
|
||||||
import miniStreamDisplay from "../../genericComponents/miniStreamDisplay.vue";
|
import miniStreamDisplay from "../../genericComponents/miniStreamDisplay.vue";
|
||||||
import ServerSpecifiedPropertyControl from "../../labThingsComponents/serverSpecifiedPropertyControl.vue";
|
import ServerSpecifiedPropertyControl from "../../labThingsComponents/serverSpecifiedPropertyControl.vue";
|
||||||
|
import { mapState } from "pinia";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
|
||||||
// Export main app
|
// Export main app
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -43,8 +45,9 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
cameraUri: function () {
|
...mapState(useSettingsStore, ["baseUri"]),
|
||||||
return `${this.$store.getters.baseUri}/camera/`;
|
cameraUri() {
|
||||||
|
return `${this.baseUri}/camera/`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,9 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
import { mapWritableState } from "pinia";
|
||||||
|
|
||||||
// Export main app
|
// Export main app
|
||||||
export default {
|
export default {
|
||||||
name: "AppSettings",
|
name: "AppSettings",
|
||||||
|
|
@ -28,14 +31,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
appTheme: {
|
...mapWritableState(useSettingsStore, ["appTheme"]),
|
||||||
get() {
|
|
||||||
return this.$store.state.appTheme;
|
|
||||||
},
|
|
||||||
set(value) {
|
|
||||||
this.$store.commit("changeAppTheme", value);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapState } from "pinia";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
|
||||||
// Export main app
|
// Export main app
|
||||||
export default {
|
export default {
|
||||||
name: "StreamSettings",
|
name: "StreamSettings",
|
||||||
|
|
@ -21,12 +24,13 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState(useSettingsStore, ["disableStream"]),
|
||||||
disableStream: {
|
disableStream: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.state.disableStream;
|
return this.disableStream;
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
this.$store.commit("changeDisableStream", value);
|
this.disableStream = value;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -10,29 +10,27 @@
|
||||||
<div>
|
<div>
|
||||||
<label class="uk-form-label" for="form-stacked-text">x</label>
|
<label class="uk-form-label" for="form-stacked-text">x</label>
|
||||||
<div class="uk-form-controls">
|
<div class="uk-form-controls">
|
||||||
<input v-model="stepSize.x" class="uk-input uk-form-small" type="number" />
|
<input v-model="navigationStepSize.x" class="uk-input uk-form-small" type="number" />
|
||||||
</div>
|
</div>
|
||||||
<label class="uk-margin-small-right">
|
<label class="uk-margin-small-right">
|
||||||
<input v-model="invert.x" class="uk-checkbox" type="checkbox" />
|
<input v-model="navigationInvert.x" class="uk-checkbox" type="checkbox" />
|
||||||
Invert x
|
Invert x
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="uk-form-label" for="form-stacked-text">y</label>
|
<label class="uk-form-label" for="form-stacked-text">y</label>
|
||||||
<div class="uk-form-controls">
|
<div class="uk-form-controls">
|
||||||
<input v-model="stepSize.y" class="uk-input uk-form-small" type="number" />
|
<input v-model="navigationStepSize.y" class="uk-input uk-form-small" type="number" />
|
||||||
</div>
|
</div>
|
||||||
<label class="uk-margin-small-right">
|
<label class="uk-margin-small-right">
|
||||||
<input v-model="invert.y" class="uk-checkbox" type="checkbox" />
|
<input v-model="navigationInvert.y" class="uk-checkbox" type="checkbox" />
|
||||||
Invert y
|
Invert y
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="uk-form-label" for="form-stacked-text">z</label>
|
<label class="uk-form-label" for="form-stacked-text">z</label>
|
||||||
<div class="uk-form-controls">
|
<div class="uk-form-controls">
|
||||||
<input v-model="stepSize.z" class="uk-input uk-form-small" type="number" />
|
<input v-model="navigationStepSize.z" class="uk-input uk-form-small" type="number" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -40,35 +38,16 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { storeToRefs } from "pinia";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "StageControlSettings",
|
name: "StageControlSettings",
|
||||||
|
|
||||||
computed: {
|
setup() {
|
||||||
// Note that as stepSize and invert are mutated (i.e. we change stepSize.x not stepSize)
|
const store = useSettingsStore();
|
||||||
// rather than directly set we cannot use get() and set() computed to interact with the
|
const { navigationStepSize, navigationInvert } = storeToRefs(store);
|
||||||
// store as changed won't be detected by set(). Instead use a deep watcher to
|
return { navigationStepSize, navigationInvert };
|
||||||
// update the store (see ``watch:`` below)
|
|
||||||
stepSize() {
|
|
||||||
return this.$store.state.navigationStepSize;
|
|
||||||
},
|
|
||||||
invert() {
|
|
||||||
return this.$store.state.navigationInvert;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
watch: {
|
|
||||||
stepSize: {
|
|
||||||
deep: true,
|
|
||||||
handler(newVal) {
|
|
||||||
this.$store.commit("changeNavigationStepSize", newVal);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
invert: {
|
|
||||||
deep: true,
|
|
||||||
handler(newVal) {
|
|
||||||
this.$store.commit("changeNavigationInvert", newVal);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-margin">
|
<div class="uk-margin">
|
||||||
<propertyControl
|
<propertyControl
|
||||||
|
v-if="thingAvailable('smart_scan')"
|
||||||
thing-name="smart_scan"
|
thing-name="smart_scan"
|
||||||
property-name="stitch_tiff"
|
property-name="stitch_tiff"
|
||||||
label="When Stitching, Produce a Pyramidal TIFF"
|
label="When Stitching, Produce a Pyramidal TIFF"
|
||||||
|
|
@ -41,6 +42,8 @@
|
||||||
import propertyControl from "@/components/labThingsComponents/propertyControl.vue";
|
import propertyControl from "@/components/labThingsComponents/propertyControl.vue";
|
||||||
import ServerSpecifiedInterface from "@/components/labThingsComponents/serverSpecifiedInterface.vue";
|
import ServerSpecifiedInterface from "@/components/labThingsComponents/serverSpecifiedInterface.vue";
|
||||||
import { useIntersectionObserver } from "@vueuse/core";
|
import { useIntersectionObserver } from "@vueuse/core";
|
||||||
|
import { mapWritableState } from "pinia";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "SlideScanControls",
|
name: "SlideScanControls",
|
||||||
|
|
@ -81,6 +84,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapWritableState(useSettingsStore, ["ready"]),
|
||||||
visibilityChanged(isVisible) {
|
visibilityChanged(isVisible) {
|
||||||
if (isVisible) {
|
if (isVisible) {
|
||||||
this.readSettings();
|
this.readSettings();
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,8 @@ import actionTab from "./actionTab.vue";
|
||||||
import slideScanControls from "./slideScanComponents/slideScanControls.vue";
|
import slideScanControls from "./slideScanComponents/slideScanControls.vue";
|
||||||
import streamDisplay from "./streamContent.vue";
|
import streamDisplay from "./streamContent.vue";
|
||||||
import ActionButton from "../labThingsComponents/actionButton.vue";
|
import ActionButton from "../labThingsComponents/actionButton.vue";
|
||||||
|
import { mapState } from "pinia";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
export default {
|
export default {
|
||||||
name: "SlideScanContent",
|
name: "SlideScanContent",
|
||||||
|
|
||||||
|
|
@ -84,6 +85,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState(useSettingsStore, ["baseUri"]),
|
||||||
scanning() {
|
scanning() {
|
||||||
return this.taskId && this.taskUrl;
|
return this.taskId && this.taskUrl;
|
||||||
},
|
},
|
||||||
|
|
@ -138,7 +140,7 @@ export default {
|
||||||
// while the scan is running
|
// while the scan is running
|
||||||
let mtime = await this.readThingProperty("smart_scan", "latest_preview_stitch_time", true);
|
let mtime = await this.readThingProperty("smart_scan", "latest_preview_stitch_time", true);
|
||||||
if (mtime !== null) {
|
if (mtime !== null) {
|
||||||
this.lastStitchedImage = `${this.$store.getters.baseUri}/smart_scan/latest_preview_stitch.jpg?t=${mtime}`;
|
this.lastStitchedImage = `${this.baseUri}/smart_scan/latest_preview_stitch.jpg?t=${mtime}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lastScanName = await this.readThingProperty("smart_scan", "latest_scan_name", true);
|
this.lastScanName = await this.readThingProperty("smart_scan", "latest_scan_name", true);
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,11 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div v-if="!streamEnabled" class="uk-height-1-1">
|
<div v-if="!streamEnabled" class="uk-height-1-1">
|
||||||
<div v-if="$store.state.waiting" class="uk-position-center">
|
<div v-if="waiting" class="uk-position-center">
|
||||||
<div uk-spinner="ratio: 4.5"></div>
|
<div uk-spinner="ratio: 4.5"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div v-else-if="disableStream" class="uk-position-center position-relative text-center">
|
||||||
v-else-if="$store.state.disableStream"
|
|
||||||
class="uk-position-center position-relative text-center"
|
|
||||||
>
|
|
||||||
Stream preview disabled
|
Stream preview disabled
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -36,11 +33,20 @@
|
||||||
<script>
|
<script>
|
||||||
import { eventBus } from "../../eventBus.js";
|
import { eventBus } from "../../eventBus.js";
|
||||||
import { useIntersectionObserver } from "@vueuse/core";
|
import { useIntersectionObserver } from "@vueuse/core";
|
||||||
|
import { useSettingsStore } from "@/stores/settings.js";
|
||||||
|
import { mapState, mapWritableState } from "pinia";
|
||||||
|
|
||||||
// Export main app
|
// Export main app
|
||||||
export default {
|
export default {
|
||||||
name: "StreamDisplay",
|
name: "StreamDisplay",
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
const store = useSettingsStore();
|
||||||
|
return {
|
||||||
|
store,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
isVisible: false,
|
isVisible: false,
|
||||||
|
|
@ -51,15 +57,17 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState(useSettingsStore, ["ready", "baseUri"]),
|
||||||
|
...mapWritableState(useSettingsStore, ["disableStream", "waiting"]),
|
||||||
streamEnabled: function () {
|
streamEnabled: function () {
|
||||||
return this.$store.getters.ready && !this.$store.state.disableStream;
|
return this.ready && !this.disableStream;
|
||||||
},
|
},
|
||||||
thisStreamOpen: function () {
|
thisStreamOpen: function () {
|
||||||
// Only a single MJPEG connection should be open at a time
|
// Only a single MJPEG connection should be open at a time
|
||||||
return !(this.displaySize[0] == 0) && !(this.displaySize[1] == 0);
|
return !(this.displaySize[0] == 0) && !(this.displaySize[1] == 0);
|
||||||
},
|
},
|
||||||
streamImgUri: function () {
|
streamImgUri: function () {
|
||||||
return `${this.$store.getters.baseUri}/camera/mjpeg_stream`;
|
return `${this.baseUri}/camera/mjpeg_stream`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -101,7 +109,7 @@ export default {
|
||||||
// Disconnect the size observer
|
// Disconnect the size observer
|
||||||
this.sizeObserver.disconnect();
|
this.sizeObserver.disconnect();
|
||||||
// Remove from the array of active streams
|
// Remove from the array of active streams
|
||||||
this.$store.commit("removeStream", this._uid);
|
this.store.removeStream(this.$.uid);
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -154,12 +162,12 @@ export default {
|
||||||
// Handle closed stream
|
// Handle closed stream
|
||||||
if (this.displaySize[0] == 0 && this.displaySize[1] == 0) {
|
if (this.displaySize[0] == 0 && this.displaySize[1] == 0) {
|
||||||
// If this stream was previously active
|
// If this stream was previously active
|
||||||
if (this.$store.state.activeStreams[this._uid] == true) {
|
if (this.store.activeStreams[this.$.uid] == true) {
|
||||||
this.$store.commit("removeStream", this._uid);
|
this.store.removeStream(this.$.uid);
|
||||||
}
|
}
|
||||||
// If resized to anything other than zero
|
// If resized to anything other than zero
|
||||||
} else {
|
} else {
|
||||||
this.$store.commit("addStream", this._uid);
|
this.store.addStream(this.$.uid);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue