From 1601bdd12392633a7e4d0c536210836b61dbb2eb Mon Sep 17 00:00:00 2001 From: Julian Stirling Date: Sun, 2 Nov 2025 18:15:02 +0000 Subject: [PATCH] Let prettier change a load of things because new prettier has new rules :( --- webapp/.eslintrc.js | 9 ++- webapp/src/App.vue | 24 +++---- webapp/src/components/appContent.vue | 22 +++---- .../genericComponents/miniStreamDisplay.vue | 4 +- .../genericComponents/progressBar.vue | 4 +- .../components/genericComponents/tabIcon.vue | 6 +- .../labThingsComponents/actionButton.vue | 18 +++--- .../labThingsComponents/actionLogDisplay.vue | 8 +-- .../labThingsComponents/actionProgressBar.vue | 4 +- .../labThingsComponents/inputFromSchema.vue | 28 ++++----- .../labThingsComponents/propertyControl.vue | 14 ++--- .../serverSpecifiedActionButton.vue | 2 +- webapp/src/components/loadingContent.vue | 2 +- .../modalComponents/calibrationWizard.vue | 20 +++--- .../calibrationWizardTask.vue | 4 +- .../camCalibrationExplanation.vue | 4 +- .../cameraMainCalibrationStep.vue | 2 +- .../cameraCalibrationTask.vue | 2 +- .../cameraStageMappingTask.vue | 2 +- .../csmSteps/csmExplanation.vue | 8 +-- .../csmSteps/focusStep.vue | 4 +- .../calibrationWizardComponents/finalStep.vue | 8 +-- .../singleStepTask.vue | 2 +- .../welcomeStep.vue | 4 +- .../aboutComponents/devTools.vue | 8 +-- .../aboutComponents/statusPane.vue | 8 +-- .../paneBackgroundDetect.vue | 6 +- .../controlComponents/paneControl.vue | 20 +++--- .../tabContentComponents/loggingContent.vue | 18 +++--- .../tabContentComponents/powerContent.vue | 6 +- .../openSeadragonViewer.vue | 2 +- .../scanListComponents/scanCard.vue | 14 +---- .../tabContentComponents/scanListContent.vue | 16 ++--- .../CSMCalibrationSettings.vue | 16 +++-- .../settingsComponents/appSettings.vue | 2 +- .../settingsComponents/cameraSettings.vue | 2 +- .../settingsComponents/stageSettings.vue | 12 ++-- .../settingsComponents/streamSettings.vue | 6 +- .../tabContentComponents/settingsContent.vue | 6 +- .../tabContentComponents/slideScanContent.vue | 10 +-- .../tabContentComponents/streamContent.vue | 24 +++---- webapp/src/main.js | 28 ++++----- webapp/src/store.js | 8 +-- webapp/src/wot-client.js | 63 +++++++++---------- 44 files changed, 218 insertions(+), 262 deletions(-) diff --git a/webapp/.eslintrc.js b/webapp/.eslintrc.js index 5599ee0b..0216ac10 100644 --- a/webapp/.eslintrc.js +++ b/webapp/.eslintrc.js @@ -5,14 +5,19 @@ module.exports = { node: true, }, + parser: "vue-eslint-parser", + parserOptions: { parser: "@babel/eslint-parser", + requireConfigFile: false, + ecmaVersion: 2020, + sourceType: "module", }, + extends: ["plugin:vue/recommended", "eslint:recommended", "@vue/prettier"], + rules: { "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", }, - - extends: ["plugin:vue/recommended", "eslint:recommended", "@vue/prettier"], }; diff --git a/webapp/src/App.vue b/webapp/src/App.vue index dde959f6..b798e568 100644 --- a/webapp/src/App.vue +++ b/webapp/src/App.vue @@ -27,7 +27,7 @@ import loadingContent from "./components/loadingContent.vue"; var Mousetrap = require("mousetrap"); -Mousetrap.prototype.stopCallback = function(e, element) { +Mousetrap.prototype.stopCallback = function (e, element) { // if the element has the class "mousetrap" then no need to stop if ((" " + element.className + " ").indexOf(" mousetrap ") > -1) { return false; @@ -56,7 +56,7 @@ export default { loadingContent, }, - data: function() { + data: function () { return { appAvailable: false, arrowKeysDown: {}, @@ -67,14 +67,14 @@ export default { }, computed: { - isSystemDark: function() { + isSystemDark: function () { if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) { return true; } else { return false; } }, - handleTheme: function() { + handleTheme: function () { var isDark = false; if (this.$store.state.appTheme == "dark") { isDark = true; @@ -98,7 +98,7 @@ export default { this.systemDark = true; } // Create a theme observer to watch for changes - this.themeObserver = mql.addListener(e => { + this.themeObserver = mql.addListener((e) => { if (e.matches) { this.systemDark = true; } else { @@ -109,7 +109,7 @@ export default { this.checkConnection(); }, - created: function() { + created: function () { window.addEventListener("beforeunload", this.handleExit); // Scrollwheel listener window.addEventListener("wheel", this.wheelMonitor); @@ -131,7 +131,7 @@ export default { // Arrow keys Mousetrap.bind( ["up", "down", "left", "right"], - event => { + (event) => { this.arrowKeysDown[event.keyCode] = true; //Add key to array this.navigateKeyHandler(); }, @@ -139,7 +139,7 @@ export default { ); Mousetrap.bind( ["up", "down", "left", "right"], - event => { + (event) => { delete this.arrowKeysDown[event.keyCode]; //Remove key from array }, "keyup", @@ -192,7 +192,7 @@ export default { }); }, - beforeDestroy: function() { + beforeDestroy: function () { // Disconnect the theme observer if (this.themeObserver) { this.themeObserver.disconnect(); @@ -233,12 +233,12 @@ export default { this.$store.commit("changeWaiting", false); } }, - handleExit: function() { + handleExit: function () { this.$root.$emit("globalTogglePreview", false); }, // Handle global mouse wheel events to be associated with navigation - wheelMonitor: function(event) { + wheelMonitor: function (event) { // Only capture scroll if the event target's parent contains the "scrollTarget" class if ( event.target.parentNode.classList.contains("scrollTarget") || @@ -250,7 +250,7 @@ export default { } }, - navigateKeyHandler: function() { + navigateKeyHandler: function () { // Calculate movement array var x_rel = 0; var y_rel = 0; diff --git a/webapp/src/components/appContent.vue b/webapp/src/components/appContent.vue index eb084c09..401b6d16 100644 --- a/webapp/src/components/appContent.vue +++ b/webapp/src/components/appContent.vue @@ -22,7 +22,7 @@ > @@ -112,7 +112,7 @@ export default { TabIcon, powerContent, }, - data: function() { + data: function () { return { currentTab: "view", bottomTabs: [ @@ -142,7 +142,7 @@ export default { }, computed: { - tabOrder: function() { + tabOrder: function () { var ind = []; for (const tab of this.topTabs) { ind.push(tab.id); @@ -153,7 +153,7 @@ export default { return ind; }, - topTabs: function() { + topTabs: function () { let tabs = [ { id: "view", @@ -182,21 +182,21 @@ export default { }, ]; if (!this.$store.state.galleryEnabled) { - tabs = tabs.filter(tab => tab.id != "gallery"); + tabs = tabs.filter((tab) => tab.id != "gallery"); } return tabs; }, allTabs() { return [...this.topTabs, ...this.bottomTabs]; }, - currentTabIndex: function() { + currentTabIndex: function () { return this.tabOrder.indexOf(this.currentTab); }, }, mounted() { // A global signal listener to switch tab - this.$root.$on("globalSwitchTab", tabID => { + this.$root.$on("globalSwitchTab", (tabID) => { this.currentTab = tabID; }); // A global signal listener to increment tab @@ -213,22 +213,22 @@ export default { }, methods: { - setTab: function(event, tab) { + setTab: function (event, tab) { if (!(this.currentTab == tab)) { this.currentTab = tab; } }, - incrementTabBy: function(n) { + incrementTabBy: function (n) { const newIndex = (((this.currentTabIndex + n) % this.tabOrder.length) + this.tabOrder.length) % this.tabOrder.length; const newId = this.tabOrder[newIndex]; this.currentTab = newId; }, - startModals: function() { + startModals: function () { this.$refs.calibrationWizard.show_if_needed(); }, - enterApp: function() { + enterApp: function () { // Stuff to do once connected and all init modals are finished }, scrollToTop() { diff --git a/webapp/src/components/genericComponents/miniStreamDisplay.vue b/webapp/src/components/genericComponents/miniStreamDisplay.vue index 401ae5fb..d2623334 100644 --- a/webapp/src/components/genericComponents/miniStreamDisplay.vue +++ b/webapp/src/components/genericComponents/miniStreamDisplay.vue @@ -20,14 +20,14 @@ export default { name: "MiniStreamDisplay", - data: function() { + data: function () { return { isVisible: false, }; }, computed: { - streamImgUri: function() { + streamImgUri: function () { return `${this.$store.getters.baseUri}/camera/mjpeg_stream`; }, }, diff --git a/webapp/src/components/genericComponents/progressBar.vue b/webapp/src/components/genericComponents/progressBar.vue index 58794ad2..f56655f1 100644 --- a/webapp/src/components/genericComponents/progressBar.vue +++ b/webapp/src/components/genericComponents/progressBar.vue @@ -11,12 +11,12 @@ export default { props: {}, computed: { - tooltipOptions: function() { + tooltipOptions: function () { var title = this.id.charAt(0).toUpperCase() + this.id.slice(1); return `pos: right; title: ${title}; delay: 500`; }, - classObject: function() { + classObject: function () { return { "tabicon-active": this.currentTab == this.id, "uk-disabled": this.requireConnection && !this.$store.getters.ready, diff --git a/webapp/src/components/genericComponents/tabIcon.vue b/webapp/src/components/genericComponents/tabIcon.vue index 4f448904..538496fc 100644 --- a/webapp/src/components/genericComponents/tabIcon.vue +++ b/webapp/src/components/genericComponents/tabIcon.vue @@ -44,7 +44,7 @@ export default { }, computed: { - computedTitle: function() { + computedTitle: function () { if (this.title !== undefined) { return this.title; } else { @@ -55,7 +55,7 @@ export default { } }, - tooltipOptions: function() { + tooltipOptions: function () { if (this.showTooltip) { return `pos: right; title: ${this.computedTitle}; delay: 500`; } else { @@ -63,7 +63,7 @@ export default { } }, - classObject: function() { + classObject: function () { return { "tabicon-active": this.currentTab == this.tabID, "uk-disabled": this.requireConnection && !this.$store.getters.ready, diff --git a/webapp/src/components/labThingsComponents/actionButton.vue b/webapp/src/components/labThingsComponents/actionButton.vue index b37abc89..fad5f5fb 100644 --- a/webapp/src/components/labThingsComponents/actionButton.vue +++ b/webapp/src/components/labThingsComponents/actionButton.vue @@ -145,7 +145,7 @@ export default { }, }, - data: function() { + data: function () { return { taskUrl: null, progress: null, @@ -245,13 +245,13 @@ export default { } // Check for a task that is ongoing. // We can't handle multiple tasks ongoing, so this picks the first. - const ongoingTask = response.data.find(t => ["pending", "running"].includes(t.status)); + const ongoingTask = response.data.find((t) => ["pending", "running"].includes(t.status)); if (ongoingTask) { // There is a started task this.taskStarted = true; this.$emit("taskStarted"); // Find its URL - const taskUrl = ongoingTask.links.find(t => t.rel == "self").href; + const taskUrl = ongoingTask.links.find((t) => t.rel == "self").href; try { await this.pollOngoingTask(ongoingTask.id, taskUrl); } catch (error) { @@ -262,7 +262,7 @@ export default { } }, - bootstrapTask: function() { + bootstrapTask: function () { // Starts the process of creating a new Actiont ask if (this.requiresConfirmation) { this.modalConfirm(this.confirmationMessage).then( @@ -309,14 +309,14 @@ export default { } }, - onTaskEnd: function() { + onTaskEnd: function () { // Reset taskRunning and taskId this.taskRunning = false; this.taskStarted = false; this.$emit("finished"); }, - startPolling: function(taskId, taskUrl) { + startPolling: function (taskId, taskUrl) { if (this.taskRunning != true) { // Starts polling an existing Action task this.taskUrl = taskUrl; @@ -327,12 +327,12 @@ export default { } }, - pollTask: function(taskId, interval) { + pollTask: function (taskId, interval) { interval = interval * 1000 || 500; var checkCondition = (resolve, reject) => { // If the condition is met, we're done! - axios.get(this.taskUrl, { baseURL: this.$store.getters.baseUri }).then(response => { + axios.get(this.taskUrl, { baseURL: this.$store.getters.baseUri }).then((response) => { var result = response.data.status; this.taskStatus = result; if ((result == "running") | (result == "pending")) { @@ -382,7 +382,7 @@ export default { this.$root.$emit("modalClosed"); }, - terminateTask: function() { + terminateTask: function () { axios.delete(this.taskUrl, { baseURL: this.$store.getters.baseUri }); this.$root.$emit("modalClosed"); }, diff --git a/webapp/src/components/labThingsComponents/actionLogDisplay.vue b/webapp/src/components/labThingsComponents/actionLogDisplay.vue index 71778497..3602baa4 100644 --- a/webapp/src/components/labThingsComponents/actionLogDisplay.vue +++ b/webapp/src/components/labThingsComponents/actionLogDisplay.vue @@ -17,9 +17,7 @@ -
- Auto-scroll paused -
+
Auto-scroll paused
@@ -46,10 +44,10 @@ export default { }, watch: { - log: function() { + log: function () { this.scrollToBottom(); }, - taskStatus: function() { + taskStatus: function () { this.scrollToBottom(); }, }, diff --git a/webapp/src/components/labThingsComponents/actionProgressBar.vue b/webapp/src/components/labThingsComponents/actionProgressBar.vue index d83f6bc5..00afc787 100644 --- a/webapp/src/components/labThingsComponents/actionProgressBar.vue +++ b/webapp/src/components/labThingsComponents/actionProgressBar.vue @@ -22,12 +22,12 @@ export default { }, computed: { - barWidthFromProgress: function() { + barWidthFromProgress: function () { var progress = this.progress <= 100 ? this.progress : 100; var styleString = `width: ${progress}%`; return styleString; }, - indeterminateProgressBar: function() { + indeterminateProgressBar: function () { if (this.taskStatus == "pending") return true; if ((this.taskStatus == "running") & !this.progress) { return true; diff --git a/webapp/src/components/labThingsComponents/inputFromSchema.vue b/webapp/src/components/labThingsComponents/inputFromSchema.vue index 30f14857..ea5e6e4d 100644 --- a/webapp/src/components/labThingsComponents/inputFromSchema.vue +++ b/webapp/src/components/labThingsComponents/inputFromSchema.vue @@ -128,7 +128,7 @@ export default { }; }, computed: { - internalLabels: function() { + internalLabels: function () { if (this.dataType == "number_object") { let labels = {}; for (const key in this.internalValue) { @@ -138,7 +138,7 @@ export default { } return []; }, - valueLength: function() { + valueLength: function () { if (this.dataType == "number_array") { if (this.internalValue == undefined) { return 0; @@ -148,7 +148,7 @@ export default { return 1; } }, - dataType: function() { + dataType: function () { let prop = this.dataSchema; if (prop == undefined) { return "undefined"; @@ -162,7 +162,7 @@ export default { return "number_array"; } if (Array.isArray(prop.items)) { - if (prop.items.every(t => num_types.includes(t.type))) { + if (prop.items.every((t) => num_types.includes(t.type))) { return "number_array"; } } @@ -210,46 +210,46 @@ export default { }, methods: { - resetInternalValue: function() { + resetInternalValue: function () { // Whenever updatirng th internal value stringify and parse as a form of deepcopy. // This ensure that the this.value prop is not mutated for when elements of arrays // or objects are updated. this.internalValue = JSON.parse(JSON.stringify(this.value)); }, - requestUpdate: async function() { + requestUpdate: async function () { this.$emit("requestUpdate"); }, - sendValue: async function() { + sendValue: async function () { this.$emit("sendValue", this.internalValue); }, - checkboxUpdated: function() { + checkboxUpdated: function () { if (this.internalValue != this.$refs.checkbox.checked) { this.internalValue = this.$refs.checkbox.checked; this.sendValue(); } }, - focusIn: function(event) { + focusIn: function (event) { this.valueOnEnter = event.target.value; }, - focusOut: function(event) { + focusOut: function (event) { if (this.valueOnEnter != event.target.value) { this.sendValue(event.target.value); } }, - keyDown: function(event) { + keyDown: function (event) { // Pressing enter should set the property, whether or not we think it's changed. if (event.keyCode == 13) { this.sendValue(); } }, - updateIsEdited: function() { + updateIsEdited: function () { this.isEdited = this.deepStringify(this.internalValue) !== this.deepStringify(this.value); }, - animationEnd: function() { + animationEnd: function () { this.animateUpdate = false; this.$emit("animationShown"); }, - deepStringify: function(val) { + deepStringify: function (val) { // Create a json string where all internal numbers are also JSON strings. This is // needed to robustly check if the value is updated because the raw value may be a // number but anything typed in the input is a string. In the case of arrays or diff --git a/webapp/src/components/labThingsComponents/propertyControl.vue b/webapp/src/components/labThingsComponents/propertyControl.vue index 530f72a5..e60b21b4 100644 --- a/webapp/src/components/labThingsComponents/propertyControl.vue +++ b/webapp/src/components/labThingsComponents/propertyControl.vue @@ -54,7 +54,7 @@ export default { }, computed: { - propertyDescription: function() { + propertyDescription: function () { try { return this.thingDescription(this.thingName).properties[this.propertyName]; } catch (error) { @@ -64,13 +64,13 @@ export default { }, watch: { - propertyDescription: function() { + propertyDescription: function () { // Ensure we read the property once the URL is known this.readProperty(); }, }, - mounted: function() { + mounted: function () { // Read the property when we're mounted - usually this won't // work because the URL isn't set yet. However, it's helpful if // the app is reloaded (e.g. from a dev server). @@ -80,17 +80,17 @@ export default { }, methods: { - readProperty: async function() { + readProperty: async function () { let data = await this.readThingProperty(this.thingName, this.propertyName); this.value = data; return data; }, - writeProperty: async function(requestedValue) { + writeProperty: async function (requestedValue) { try { this.value = requestedValue; await this.writeThingProperty(this.thingName, this.propertyName, requestedValue); if (this.readBack) { - await new Promise(r => setTimeout(r, this.readBackDelay)); + await new Promise((r) => setTimeout(r, this.readBackDelay)); let newVal = await this.readProperty(); if (newVal == requestedValue) { this.animate = true; @@ -112,7 +112,7 @@ export default { this.readProperty(); } }, - resetAnimate: function() { + resetAnimate: function () { this.animate = false; }, }, diff --git a/webapp/src/components/labThingsComponents/serverSpecifiedActionButton.vue b/webapp/src/components/labThingsComponents/serverSpecifiedActionButton.vue index a38cf1d4..d855092b 100644 --- a/webapp/src/components/labThingsComponents/serverSpecifiedActionButton.vue +++ b/webapp/src/components/labThingsComponents/serverSpecifiedActionButton.vue @@ -33,7 +33,7 @@ export default { }, methods: { - actionResponse: function() { + actionResponse: function () { if (this.actionData.notify_on_success) { this.modalNotify(this.actionData.success_message); } diff --git a/webapp/src/components/loadingContent.vue b/webapp/src/components/loadingContent.vue index a0b4e8b2..863ea4a4 100644 --- a/webapp/src/components/loadingContent.vue +++ b/webapp/src/components/loadingContent.vue @@ -21,7 +21,7 @@ export default { components: { devTools }, - data: function() { + data: function () { return {}; }, }; diff --git a/webapp/src/components/modalComponents/calibrationWizard.vue b/webapp/src/components/modalComponents/calibrationWizard.vue index 8163633b..6deb09ed 100644 --- a/webapp/src/components/modalComponents/calibrationWizard.vue +++ b/webapp/src/components/modalComponents/calibrationWizard.vue @@ -30,7 +30,7 @@ export default { components: {}, - data: function() { + data: function () { return { isNeeded: undefined, availableCalibrationTasks: {}, @@ -91,7 +91,7 @@ export default { return needsCalibration; }, - resetData: function() { + resetData: function () { this.movingBackward = false; this.taskIndex = 0; }, @@ -99,7 +99,7 @@ export default { /** * Create the calibration wizard task list dynamically. */ - create_task_list: function(thingsToCal, includeWelcome = true) { + create_task_list: function (thingsToCal, includeWelcome = true) { const tasks = []; // Optionally include the welcome screen @@ -125,7 +125,7 @@ export default { this.tasks = tasks; }, - show_if_needed: async function() { + show_if_needed: async function () { // Check if the calibration modal is needed, and only show it if it is. let thingsToCal = await this.check_things_needing_calibration(); const needed = thingsToCal.length > 0; @@ -142,7 +142,7 @@ export default { }, // Forces modal to show on button press - force_show: function() { + force_show: function () { const allThings = Object.keys(this.availableCalibrationTasks); this.resetData(); @@ -150,26 +150,26 @@ export default { this.show(); }, - show: function() { + show: function () { // Show the modal element var el = this.$refs["calibrationModalEl"]; this.showModalElement(el); // Calls the mixin }, - hide: function() { + hide: function () { // Show the modal var el = this.$refs["calibrationModalEl"]; this.hideModalElement(el); // Calls the mixin }, - onHide: function() { + onHide: function () { this.$emit("onClose"); }, /* * Move to the previous task. */ - previousTask: function() { + previousTask: function () { this.movingBackward = true; if (this.taskIndex > 0) { this.taskIndex = this.taskIndex - 1; @@ -179,7 +179,7 @@ export default { /* * Move to the next task or close the modal if this is the final task. */ - nextTask: function() { + nextTask: function () { this.movingBackward = false; if (this.taskIndex < this.tasks.length - 1) { this.taskIndex = this.taskIndex + 1; diff --git a/webapp/src/components/modalComponents/calibrationWizardComponents/calibrationWizardTask.vue b/webapp/src/components/modalComponents/calibrationWizardComponents/calibrationWizardTask.vue index 62c821b4..57151b7b 100644 --- a/webapp/src/components/modalComponents/calibrationWizardComponents/calibrationWizardTask.vue +++ b/webapp/src/components/modalComponents/calibrationWizardComponents/calibrationWizardTask.vue @@ -87,7 +87,7 @@ export default { /* * Move to the previous step in this task, or the previous task if first step. */ - previousStep: function() { + previousStep: function () { if (this.stepIndex > 0) { this.stepIndex = this.stepIndex - 1; } else { @@ -98,7 +98,7 @@ export default { /* * Move to the next step in this task, or the next task if final step. */ - nextStep: function() { + nextStep: function () { if (this.stepIndex < this.steps.length - 1) { this.stepIndex = this.stepIndex + 1; return true; diff --git a/webapp/src/components/modalComponents/calibrationWizardComponents/cameraCalibrationSteps/camCalibrationExplanation.vue b/webapp/src/components/modalComponents/calibrationWizardComponents/cameraCalibrationSteps/camCalibrationExplanation.vue index 9b7e7bbc..28243aa3 100644 --- a/webapp/src/components/modalComponents/calibrationWizardComponents/cameraCalibrationSteps/camCalibrationExplanation.vue +++ b/webapp/src/components/modalComponents/calibrationWizardComponents/cameraCalibrationSteps/camCalibrationExplanation.vue @@ -1,9 +1,7 @@