Cleaned up store and removed unused FoV setting

This commit is contained in:
Joel Collins 2020-11-22 16:52:30 +00:00
parent f187a3a00d
commit a1ae94792e
13 changed files with 42 additions and 119 deletions

View file

@ -1,30 +1,14 @@
module.exports = { module.exports = {
root: true, root: true,
env: { env: {
node: true node: true
}, },
extends: ["plugin:vue/recommended", "eslint:recommended", "@vue/prettier"],
extends: [
"plugin:vue/recommended",
"eslint:recommended",
"prettier/vue",
"plugin:prettier/recommended",
"plugin:vue/essential",
"@vue/prettier"
],
rules: {
"vue/component-name-in-template-casing": ["error", "PascalCase"],
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off"
},
globals: {
$nuxt: true
},
parserOptions: { parserOptions: {
parser: "babel-eslint" parser: "babel-eslint"
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off"
} }
}; };

View file

@ -13760,9 +13760,9 @@
} }
}, },
"vue-loader-v16": { "vue-loader-v16": {
"version": "npm:vue-loader@16.0.0-rc.1", "version": "npm:vue-loader@16.0.0-rc.2",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-rc.1.tgz", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-rc.2.tgz",
"integrity": "sha512-yR+BS90EOXTNieasf8ce9J3TFCpm2DGqoqdbtiwQ33hon3FyIznLX7sKavAq1VmfBnOeV6It0Htg4aniv8ph1g==", "integrity": "sha512-cz8GK4dgIf1UTC+do80pGvh8BHcCRHLIQVHV9ONVQ8wtoqS9t/+H02rKcQP+TVNg7khgLyQV2+8eHUq7/AFq3g==",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
@ -13862,12 +13862,6 @@
"resolved": "https://registry.npmjs.org/vue-observe-visibility/-/vue-observe-visibility-0.4.6.tgz", "resolved": "https://registry.npmjs.org/vue-observe-visibility/-/vue-observe-visibility-0.4.6.tgz",
"integrity": "sha512-xo0CEVdkjSjhJoDdLSvoZoQrw/H2BlzB5jrCBKGZNXN2zdZgMuZ9BKrxXDjNP2AxlcCoKc8OahI3F3r3JGLv2Q==" "integrity": "sha512-xo0CEVdkjSjhJoDdLSvoZoQrw/H2BlzB5jrCBKGZNXN2zdZgMuZ9BKrxXDjNP2AxlcCoKc8OahI3F3r3JGLv2Q=="
}, },
"vue-plugin-load-script": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/vue-plugin-load-script/-/vue-plugin-load-script-1.3.2.tgz",
"integrity": "sha512-UQcFanuWBf72/339LxgsPZbMsT5LKUjBzkQfV3xf4ni5fc6Nnx5GNYclODFaQ9FHtOjWhu423bhHrlBHz4MIFg==",
"dev": true
},
"vue-style-loader": { "vue-style-loader": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.2.tgz", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.2.tgz",

View file

@ -7,8 +7,8 @@
"scripts": { "scripts": {
"serve": "vue-cli-service serve --mode development", "serve": "vue-cli-service serve --mode development",
"build": "vue-cli-service build --mode production", "build": "vue-cli-service build --mode production",
"lint": "vue-cli-service lint", "lint": "vue-cli-service lint --no-fix",
"prettier": "vue-cli-service lint --fix" "lint:fix": "vue-cli-service lint --fix"
}, },
"dependencies": { "dependencies": {
"material-design-icons": "^3.0.1", "material-design-icons": "^3.0.1",
@ -24,7 +24,6 @@
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"css-loader": "^3.6.0", "css-loader": "^3.6.0",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.1.4", "eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-vue": "^6.2.2", "eslint-plugin-vue": "^6.2.2",
"less": "^3.12.2", "less": "^3.12.2",
@ -34,7 +33,6 @@
"uikit": "^3.5.9", "uikit": "^3.5.9",
"vue": "^2.6.12", "vue": "^2.6.12",
"vue-friendly-iframe": "^0.17.0", "vue-friendly-iframe": "^0.17.0",
"vue-plugin-load-script": "^1.3.2",
"vue-template-compiler": "^2.6.12", "vue-template-compiler": "^2.6.12",
"vue-tour": "^1.5.0", "vue-tour": "^1.5.0",
"vuejs-paginate": "^2.1.0", "vuejs-paginate": "^2.1.0",

View file

@ -1,18 +0,0 @@
// Theming specific to the electron app
.menubar-menu-container {
box-shadow: 0.5px 1px 4px 0px rgba(0, 0, 0, 0.3) !important;
}
.menubar-menu-container>* {
box-shadow: none !important;
}
.menubar-menu-container .action-menu-item,
.menubar-menu-container .action-label {
cursor: default
}
.menubar-menu-container a:hover {
text-decoration: none;
}

View file

@ -4,9 +4,6 @@
// Highlight.js // Highlight.js
@import "./highlight.less"; @import "./highlight.less";
// Electron app theming
@import "./app.less";
// Custom OpenFlexure theming // Custom OpenFlexure theming
// //

View file

@ -267,9 +267,9 @@ export default {
window.location.hostname window.location.hostname
) )
) { ) {
this.$store.commit("changeSetting", ["disableStream", true]); this.$store.commit("changeDisableStream", true);
this.$store.commit("changeSetting", ["autoGpuPreview", true]); this.$store.commit("changeAutoGpuPreview", true);
this.$store.commit("changeSetting", ["trackWindow", true]); this.$store.commit("changeTrackWindow", true);
} }
// Update plugins // Update plugins
this.updatePlugins().then(() => { this.updatePlugins().then(() => {

View file

@ -242,7 +242,7 @@
</li> </li>
</ul> </ul>
<div v-if="scanCapture" class="uk-margin uk-margin-remove-top "> <div v-if="scanCapture" class="uk-margin uk-margin-remove-top">
<taskSubmitter <taskSubmitter
:submit-url="scanUri" :submit-url="scanUri"
:submit-data="scanPayload" :submit-data="scanPayload"
@ -296,9 +296,9 @@ export default {
scanStyle: "Raster", scanStyle: "Raster",
namingStyle: "Coordinates", namingStyle: "Coordinates",
scanStepSize: { scanStepSize: {
x: 0, x: 800,
y: 0, y: 640,
z: 0 z: 50
}, },
scanSteps: { scanSteps: {
x: 3, x: 3,
@ -326,9 +326,6 @@ export default {
pluginsUri: function() { pluginsUri: function() {
return `${this.$store.getters.baseUri}/api/v2/extensions`; return `${this.$store.getters.baseUri}/api/v2/extensions`;
}, },
settingsFovUri: function() {
return `${this.$store.getters.baseUri}/api/v2/instrument/settings/fov`;
},
basePayload: function() { basePayload: function() {
var payload = {}; var payload = {};
@ -395,7 +392,6 @@ export default {
mounted() { mounted() {
this.updateScanUri(); this.updateScanUri();
this.updateScanStepSize();
// A global signal listener to perform a capture action // A global signal listener to perform a capture action
this.$root.$on("globalCaptureEvent", () => { this.$root.$on("globalCaptureEvent", () => {
this.handleCapture(); this.handleCapture();
@ -439,21 +435,6 @@ export default {
}); });
}, },
updateScanStepSize: function() {
axios
.get(this.settingsFovUri) // Get the microscope FOV
.then(response => {
this.scanStepSize = {
x: parseInt(0.5 * response.data[0]),
y: parseInt(0.5 * response.data[1]),
z: 50
};
})
.catch(error => {
this.modalError(error); // Let mixin handle error
});
},
onScanSubmit: function() {}, onScanSubmit: function() {},
onScanResponse: function(responseData) { onScanResponse: function(responseData) {

View file

@ -29,7 +29,7 @@ export default {
return this.$store.state.globalSettings.appTheme; return this.$store.state.globalSettings.appTheme;
}, },
set(value) { set(value) {
this.$store.commit("changeSetting", ["appTheme", value]); this.$store.commit("changeAppTheme", value);
} }
} }
}, },

View file

@ -32,7 +32,7 @@ export default {
return this.$store.state.globalSettings.IHIEnabled; return this.$store.state.globalSettings.IHIEnabled;
}, },
set(value) { set(value) {
this.$store.commit("changeSetting", ["IHIEnabled", value]); this.$store.commit("changeIHIEnabled", value);
this.$root.$emit("globalSafeTogglePreview", value); this.$root.$emit("globalSafeTogglePreview", value);
} }
} }

View file

@ -64,7 +64,7 @@ export default {
return this.$store.state.globalSettings.disableStream; return this.$store.state.globalSettings.disableStream;
}, },
set(value) { set(value) {
this.$store.commit("changeSetting", ["disableStream", value]); this.$store.commit("changeDisableStream", value);
} }
}, },
@ -73,7 +73,7 @@ export default {
return this.$store.state.globalSettings.autoGpuPreview; return this.$store.state.globalSettings.autoGpuPreview;
}, },
set(value) { set(value) {
this.$store.commit("changeSetting", ["autoGpuPreview", value]); this.$store.commit("changeAutoGpuPreview", value);
this.$root.$emit("globalSafeTogglePreview", value); this.$root.$emit("globalSafeTogglePreview", value);
} }
}, },
@ -83,7 +83,7 @@ export default {
return this.$store.state.globalSettings.trackWindow; return this.$store.state.globalSettings.trackWindow;
}, },
set(value) { set(value) {
this.$store.commit("changeSetting", ["trackWindow", value]); this.$store.commit("changeTrackWindow", value);
} }
} }
} }

View file

@ -46,7 +46,6 @@ export default {
isVisible: false, isVisible: false,
displaySize: [0, 0], displaySize: [0, 0],
displayPosition: [0, 0], displayPosition: [0, 0],
fov: [0, 0],
resizeTimeoutId: setTimeout(this.doneResizing, 500) resizeTimeoutId: setTimeout(this.doneResizing, 500)
}; };
}, },
@ -104,8 +103,6 @@ export default {
console.log(`${this._uid} created`); console.log(`${this._uid} created`);
// Send a request to start/stop GPU preview based on global setting // Send a request to start/stop GPU preview based on global setting
this.safePreviewRequest(this.$store.state.globalSettings.autoGpuPreview); this.safePreviewRequest(this.$store.state.globalSettings.autoGpuPreview);
// Get FOV from settings
this.updateFov();
}, },
beforeDestroy: function() { beforeDestroy: function() {
@ -136,7 +133,7 @@ export default {
}, },
clickMonitor: function(event) { clickMonitor: function(event) {
// Calculate steps from event coordinates and store config FOV // Calculate steps from event coordinates
let xCoordinate = event.offsetX; let xCoordinate = event.offsetX;
let yCoordinate = event.offsetY; let yCoordinate = event.offsetY;
@ -299,21 +296,6 @@ export default {
this.modalError(error); // Let mixin handle error this.modalError(error); // Let mixin handle error
}); });
} }
},
updateFov: function() {
console.log("Updating FOV");
// Get the current field-of-view setting from the server
axios
.get(`${this.settingsUri}/fov`)
.then(response => {
if (response.data) {
this.fov = response.data;
}
})
.catch(error => {
this.modalError(error); // Let mixin handle error
});
} }
} }
}; };

View file

@ -9,13 +9,11 @@ export default new Vuex.Store({
available: false, available: false,
waiting: false, waiting: false,
error: "", error: "",
globalSettings: { disableStream: false,
disableStream: false, autoGpuPreview: false,
autoGpuPreview: false, trackWindow: true,
trackWindow: true, IHIEnabled: false,
IHIEnabled: false, appTheme: "system",
appTheme: "system"
},
activeStreams: {} activeStreams: {}
}, },
@ -26,8 +24,20 @@ export default new Vuex.Store({
changeWaiting(state, waiting) { changeWaiting(state, waiting) {
state.waiting = waiting; state.waiting = waiting;
}, },
changeSetting(state, [key, value]) { changeDisableStream(state, disabled) {
state.globalSettings[key] = value; state.disableStream = disabled;
},
changeAutoGpuPreview(state, enabled) {
state.autoGpuPreview = enabled;
},
changeTrackWindow(state, enabled) {
state.trackWindow = enabled;
},
changeAppTheme(state, theme) {
state.appTheme = theme;
},
changeIHIEnabled(state, enabled) {
state.IHIEnabled = enabled;
}, },
resetState(state) { resetState(state) {
state.waiting = false; state.waiting = false;

View file

@ -37,8 +37,6 @@ class Microscope:
self.captures = CaptureManager() self.captures = CaptureManager()
self.fov = [0, 0] #: Microscope field-of-view in stage motor steps
# Store settings and configuration files # Store settings and configuration files
self.settings_file = settings self.settings_file = settings
self.configuration_file = configuration self.configuration_file = configuration
@ -217,8 +215,6 @@ class Microscope:
self.id = settings.pop("id") self.id = settings.pop("id")
if "name" in settings: if "name" in settings:
self.name = settings.pop("name") self.name = settings.pop("name")
if "fov" in settings:
self.fov = settings.pop("fov")
# Extension settings # Extension settings
if "extensions" in settings: if "extensions" in settings:
@ -241,7 +237,6 @@ class Microscope:
settings_current = { settings_current = {
"id": self.id, "id": self.id,
"name": self.name, "name": self.name,
"fov": self.fov,
"extensions": self.extension_settings, "extensions": self.extension_settings,
} }