Great big ESLint

This commit is contained in:
Joel Collins 2019-11-11 16:33:43 +00:00
parent 051eabbdc3
commit ebcb938da1
48 changed files with 3890 additions and 2536 deletions

View file

@ -1,30 +1,70 @@
<template>
<div id="paneCapture">
<div>
<label class="uk-form-label" for="form-stacked-text">Filename</label>
<input v-model="filename" class="uk-input uk-width-1-1 uk-form-small" name="inputFilename" placeholder="Leave blank for default">
<input
v-model="filename"
class="uk-input uk-width-1-1 uk-form-small"
name="inputFilename"
placeholder="Leave blank for default"
/>
</div>
<p uk-tooltip="title: Capture will be removed automatically; delay: 500"><label><input v-model="temporary" class="uk-checkbox" type="checkbox"> Temporary</label></p>
<p uk-tooltip="title: Capture will be removed automatically; delay: 500">
<label
><input v-model="temporary" class="uk-checkbox" type="checkbox" />
Temporary</label
>
</p>
<hr>
<hr />
<div class="uk-child-width-1-2" uk-grid>
<p><label><input v-model="fullResolution" class="uk-checkbox" type="checkbox"> Full resolution</label></p>
<p><label><input v-model="storeBayer" class="uk-checkbox" type="checkbox"> Store raw data</label></p>
<p>
<label
><input
v-model="fullResolution"
class="uk-checkbox"
type="checkbox"
/>
Full resolution</label
>
</p>
<p>
<label
><input v-model="storeBayer" class="uk-checkbox" type="checkbox" />
Store raw data</label
>
</p>
</div>
<hr>
<hr />
<p><label><input v-model="resizeCapture" class="uk-checkbox" type="checkbox"> Resize capture</label></p>
<p>
<label
><input v-model="resizeCapture" class="uk-checkbox" type="checkbox" />
Resize capture</label
>
</p>
<div class="uk-child-width-1-2" uk-grid>
<div>
<input v-bind:class="resizeClass" v-model="resizeDims[0]" class="uk-input uk-form-width-medium uk-form-small" type="number" name="inputResizeW">
<input
v-model="resizeDims[0]"
:class="resizeClass"
class="uk-input uk-form-width-medium uk-form-small"
type="number"
name="inputResizeW"
/>
</div>
<div>
<input v-bind:class="resizeClass" v-model="resizeDims[1]" class="uk-input uk-form-width-medium uk-form-small" type="number" name="inputResizeH">
<input
v-model="resizeDims[1]"
:class="resizeClass"
class="uk-input uk-form-width-medium uk-form-small"
type="number"
name="inputResizeH"
/>
</div>
</div>
@ -33,7 +73,12 @@
<a class="uk-accordion-title" href="#">Notes</a>
<div class="uk-accordion-content">
<div class="uk-margin-small">
<textarea v-model="captureNotes" class="uk-textarea" rows="5" placeholder="Capture notes"></textarea>
<textarea
v-model="captureNotes"
class="uk-textarea"
rows="5"
placeholder="Capture notes"
></textarea>
</div>
</div>
</li>
@ -41,84 +86,129 @@
<li>
<a class="uk-accordion-title" href="#">Metadata</a>
<div class="uk-accordion-content">
<keyvalList v-model="metadata"/>
<keyvalList v-model="metadata" />
</div>
</li>
<li>
<a class="uk-accordion-title" href="#">Tags</a>
<div class="uk-accordion-content">
<tagList v-model="tags"/>
<tagList v-model="tags" />
</div>
</li>
</ul>
<hr>
<hr />
<ul uk-accordion="multiple: true; animation: false">
<!--Show stack and scan if default plugin is enabled-->
<li v-if="this.$store.state.apiState.plugin.includes('default_scan')">
<a class="uk-accordion-title" href="#">Stack and Scan</a>
<div class="uk-accordion-content">
<div class="uk-margin">
<label><input v-model="scanCapture" class="uk-checkbox" type="checkbox"> Scan capture</label>
<label
><input
v-model="scanCapture"
class="uk-checkbox"
type="checkbox"
/>
Scan capture</label
>
</div>
<div v-bind:class="{ 'uk-disabled': !scanCapture }" >
<div :class="{ 'uk-disabled': !scanCapture }">
<div class="uk-grid-small uk-child-width-1-3" uk-grid>
<div>
<label class="uk-form-label" for="form-stacked-text">x step-size</label>
<label class="uk-form-label" for="form-stacked-text"
>x step-size</label
>
<div class="uk-form-controls">
<input v-model="scanStepSize.x" class="uk-input uk-form-small" type="number" name="inputPositionX">
<input
v-model="scanStepSize.x"
class="uk-input uk-form-small"
type="number"
name="inputPositionX"
/>
</div>
</div>
<div>
<label class="uk-form-label" for="form-stacked-text">y step-size</label>
<label class="uk-form-label" for="form-stacked-text"
>y step-size</label
>
<div class="uk-form-controls">
<input v-model="scanStepSize.y" class="uk-input uk-form-small" type="number" name="inputPositionY">
<input
v-model="scanStepSize.y"
class="uk-input uk-form-small"
type="number"
name="inputPositionY"
/>
</div>
</div>
<div>
<label class="uk-form-label" for="form-stacked-text">z step-size</label>
<label class="uk-form-label" for="form-stacked-text"
>z step-size</label
>
<div class="uk-form-controls">
<input v-model="scanStepSize.z" class="uk-input uk-form-small" type="number" name="inputPositionZx">
<input
v-model="scanStepSize.z"
class="uk-input uk-form-small"
type="number"
name="inputPositionZx"
/>
</div>
</div>
</div>
<div class="uk-grid-small uk-child-width-1-3" uk-grid>
<div>
<label class="uk-form-label" for="form-stacked-text">x steps</label>
<label class="uk-form-label" for="form-stacked-text"
>x steps</label
>
<div class="uk-form-controls">
<input v-model="scanSteps.x" class="uk-input uk-form-small" type="number" name="inputPositionX">
<input
v-model="scanSteps.x"
class="uk-input uk-form-small"
type="number"
name="inputPositionX"
/>
</div>
</div>
<div>
<label class="uk-form-label" for="form-stacked-text">y steps</label>
<label class="uk-form-label" for="form-stacked-text"
>y steps</label
>
<div class="uk-form-controls">
<input v-model="scanSteps.y" class="uk-input uk-form-small" type="number" name="inputPositionY">
<input
v-model="scanSteps.y"
class="uk-input uk-form-small"
type="number"
name="inputPositionY"
/>
</div>
</div>
<div>
<label class="uk-form-label" for="form-stacked-text">z steps</label>
<label class="uk-form-label" for="form-stacked-text"
>z steps</label
>
<div class="uk-form-controls">
<input v-model="scanSteps.z" class="uk-input uk-form-small" type="number" name="inputPositionZx">
<input
v-model="scanSteps.z"
class="uk-input uk-form-small"
type="number"
name="inputPositionZx"
/>
</div>
</div>
</div>
<div class="uk-margin-small uk-margin-remove-bottom">
<label class="uk-form-label" for="form-stacked-text">Autofocus</label>
<label class="uk-form-label" for="form-stacked-text"
>Autofocus</label
>
<select v-model="scanDeltaZ" class="uk-select">
<option>Off</option>
<option>Coarse</option>
@ -129,44 +219,51 @@
</div>
<div class="uk-margin-small uk-margin-remove-bottom">
<label class="uk-form-label" for="form-stacked-text">Scan Style</label>
<label class="uk-form-label" for="form-stacked-text"
>Scan Style</label
>
<select v-model="scanStyle" class="uk-select">
<option>Raster</option>
<option>Snake</option>
</select>
</div>
</div>
</div>
</li>
</ul>
<taskSubmitter v-if="scanCapture"
v-bind:submitURL="scanApiUri"
v-bind:submitData="scanPayload"
v-bind:submitLabel="'Start Scan'"
v-on:submit="onScanSubmit"
v-on:response="onScanResponse"
v-on:error="onScanError">
<taskSubmitter
v-if="scanCapture"
:submit-u-r-l="scanApiUri"
:submit-data="scanPayload"
:submit-label="'Start Scan'"
@submit="onScanSubmit"
@response="onScanResponse"
@error="onScanError"
>
</taskSubmitter>
<button v-else v-on:click="handleCapture()" class="uk-button uk-button-primary uk-form-small uk-margin uk-margin-remove-top uk-float-right uk-width-1-1">Capture</button>
<button
v-else
class="uk-button uk-button-primary uk-form-small uk-margin uk-margin-remove-top uk-float-right uk-width-1-1"
@click="handleCapture()"
>
Capture
</button>
</div>
</template>
<script>
import axios from 'axios'
import axios from "axios";
import tagList from "../fieldComponents/tagList"
import keyvalList from "../fieldComponents/keyvalList"
import tagList from "../fieldComponents/tagList";
import keyvalList from "../fieldComponents/keyvalList";
import taskSubmitter from "../genericComponents/taskSubmitter"
import taskSubmitter from "../genericComponents/taskSubmitter";
// Export main app
export default {
name: 'paneCapture',
name: "PaneCapture",
components: {
tagList,
@ -174,26 +271,25 @@ export default {
taskSubmitter
},
data: function () {
data: function() {
return {
filename: '',
filename: "",
temporary: false,
fullResolution: false,
storeBayer: false,
resizeCapture: false,
captureNotes: "",
scanCapture: false,
scanDeltaZ: 'Medium',
scanStyle: 'Raster',
scanDeltaZ: "Medium",
scanStyle: "Raster",
scanStepSize: {
x: parseInt(0.8*this.$store.state.apiConfig.fov[0]),
y: parseInt(0.8*this.$store.state.apiConfig.fov[1]),
x: parseInt(0.8 * this.$store.state.apiConfig.fov[0]),
y: parseInt(0.8 * this.$store.state.apiConfig.fov[1]),
z: 50
},
scanSteps: {
x: 3,
y: 3,
x: 3,
y: 3,
z: 5
},
resizeDims: [640, 480],
@ -201,73 +297,27 @@ export default {
metadata: {
Client: `${process.env.PACKAGE.name}.${process.env.PACKAGE.version}`
}
}
},
methods: {
handleCapture: function() {
var payload = this.basePayload
// Do capture
this.newCaptureRequest(payload)
},
handleScan: function() {
var payload = this.scanPayload
// Do capture
this.newScanRequest(payload)
},
newCaptureRequest: function(params) {
// Send move request
axios.post(this.captureApiUri, params)
.then(response => {
// Flash the stream (capture animation)
this.$root.$emit('globalFlashStream')
// Update the global capture list
this.$root.$emit('globalUpdateCaptureList')
})
.catch(error => {
this.modalError(error) // Let mixin handle error
})
},
onScanSubmit: function(submitData) {
// We don't need to do anything on this event yet
console.log("onScanSubmit event triggered")
},
onScanResponse: function(responseData) {
console.log("Scan finished with response data: ", responseData)
this.modalNotify("Finished scan.")
},
onScanError: function(error) {
this.modalError(error)
}
};
},
computed: {
resizeClass: function () {
resizeClass: function() {
return {
'uk-disabled': !this.resizeCapture
}
"uk-disabled": !this.resizeCapture
};
},
captureApiUri: function () {
return this.$store.getters.uri + "/camera/capture"
captureApiUri: function() {
return this.$store.getters.uri + "/camera/capture";
},
scanApiUri: function () {
return this.$store.getters.uri + "/plugin/default/scan/tile"
scanApiUri: function() {
return this.$store.getters.uri + "/plugin/default/scan/tile";
},
basePayload: function () {
var payload = {}
basePayload: function() {
var payload = {};
// Filename
if (Boolean(this.filename)) {
payload.filename = this.filename
if (this.filename) {
payload.filename = this.filename;
}
// Basic boolean params
@ -280,28 +330,32 @@ export default {
payload.size = {
width: this.resizeDims[0],
height: this.resizeDims[1]
}
};
}
// Additional metadata
payload.metadata = this.metadata
payload.tags = this.tags
payload.metadata = this.metadata;
payload.tags = this.tags;
// Attach notes
if (this.captureNotes) {
payload.metadata['Notes'] = this.captureNotes
payload.metadata["Notes"] = this.captureNotes;
}
return payload
return payload;
},
scanPayload: function() {
var payload = this.basePayload
var payload = this.basePayload;
// Scan params
payload.grid = [this.scanSteps.x, this.scanSteps.y, this.scanSteps.z]
payload.step_size = [this.scanStepSize.x, this.scanStepSize.y, this.scanStepSize.z]
payload.style = this.scanStyle.toLowerCase()
payload.grid = [this.scanSteps.x, this.scanSteps.y, this.scanSteps.z];
payload.step_size = [
this.scanStepSize.x,
this.scanStepSize.y,
this.scanStepSize.z
];
payload.style = this.scanStyle.toLowerCase();
// Convert AF selector to dz
var afDeltas = {
@ -310,17 +364,57 @@ export default {
Medium: 30,
Fine: 10,
Fast: 1500
}
};
payload.autofocus_dz = afDeltas[this.scanDeltaZ]
payload.fast_autofocus = this.scanDeltaZ == "Fast"
payload.autofocus_dz = afDeltas[this.scanDeltaZ];
payload.fast_autofocus = this.scanDeltaZ == "Fast";
return payload
return payload;
}
},
methods: {
handleCapture: function() {
var payload = this.basePayload;
// Do capture
this.newCaptureRequest(payload);
},
}
handleScan: function() {
var payload = this.scanPayload;
}
// Do capture
this.newScanRequest(payload);
},
newCaptureRequest: function(params) {
// Send move request
axios
.post(this.captureApiUri, params)
.then(() => {
// Flash the stream (capture animation)
this.$root.$emit("globalFlashStream");
// Update the global capture list
this.$root.$emit("globalUpdateCaptureList");
})
.catch(error => {
this.modalError(error); // Let mixin handle error
});
},
onScanSubmit: function() {},
onScanResponse: function(responseData) {
console.log("Scan finished with response data: ", responseData);
this.modalNotify("Finished scan.");
},
onScanError: function(error) {
this.modalError(error);
}
}
};
</script>
<style lang="less">
@ -331,5 +425,4 @@ export default {
.deletable-label:hover {
background-color: #f0506e;
}
</style>
</style>

View file

@ -1,98 +1,144 @@
<template>
<div id="paneNavigate">
<ul uk-accordion="multiple: true; animation: false">
<li>
<a class="uk-accordion-title" href="#">Configure</a>
<div class="uk-accordion-content">
<div class="uk-child-width-1-2" uk-grid>
<div>
<label class="uk-form-label" for="form-stacked-text">x-y step size</label>
<div class="uk-form-controls">
<input v-model="stepXy" class="uk-input uk-form-width-medium uk-form-small" type="number" name="inputStepXy">
</div>
</div>
<div>
<label class="uk-form-label" for="form-stacked-text">z step size</label>
<div class="uk-form-controls">
<input v-model="stepZz" class="uk-input uk-form-width-medium uk-form-small" type="number" name="inputStepZz">
</div>
</div>
</div>
</div>
</li>
<li class="uk-open">
<a class="uk-accordion-title" href="#">Move-to</a>
<div class="uk-accordion-content">
<form @submit.prevent="handleSubmit">
<div class="uk-grid-small uk-child-width-1-3" uk-grid>
<div id="paneNavigate">
<ul uk-accordion="multiple: true; animation: false">
<li>
<a class="uk-accordion-title" href="#">Configure</a>
<div class="uk-accordion-content">
<div class="uk-child-width-1-2" uk-grid>
<div>
<label class="uk-form-label" for="form-stacked-text">x</label>
<label class="uk-form-label" for="form-stacked-text"
>x-y step size</label
>
<div class="uk-form-controls">
<input v-model="setPosition.x" class="uk-input uk-form-small" type="number" name="inputPositionX">
<input
v-model="stepXy"
class="uk-input uk-form-width-medium uk-form-small"
type="number"
name="inputStepXy"
/>
</div>
</div>
<div>
<label class="uk-form-label" for="form-stacked-text">y</label>
<label class="uk-form-label" for="form-stacked-text"
>z step size</label
>
<div class="uk-form-controls">
<input v-model="setPosition.y" class="uk-input uk-form-small" type="number" name="inputPositionY">
<input
v-model="stepZz"
class="uk-input uk-form-width-medium uk-form-small"
type="number"
name="inputStepZz"
/>
</div>
</div>
</div>
</div>
</li>
<li class="uk-open">
<a class="uk-accordion-title" href="#">Move-to</a>
<div class="uk-accordion-content">
<form @submit.prevent="handleSubmit">
<div class="uk-grid-small uk-child-width-1-3" uk-grid>
<div>
<label class="uk-form-label" for="form-stacked-text">x</label>
<div class="uk-form-controls">
<input
v-model="setPosition.x"
class="uk-input uk-form-small"
type="number"
name="inputPositionX"
/>
</div>
</div>
<div>
<label class="uk-form-label" for="form-stacked-text">y</label>
<div class="uk-form-controls">
<input
v-model="setPosition.y"
class="uk-input uk-form-small"
type="number"
name="inputPositionY"
/>
</div>
</div>
<div>
<label class="uk-form-label" for="form-stacked-text">z</label>
<div class="uk-form-controls">
<input
v-model="setPosition.z"
class="uk-input uk-form-small"
type="number"
name="inputPositionZx"
/>
</div>
</div>
</div>
<p>
<button
class="uk-button uk-button-primary uk-form-small uk-float-right uk-width-1-1"
>
Move
</button>
</p>
</form>
</div>
</li>
<!--Show autofocus if default plugin is enabled-->
<li
v-if="this.$store.state.apiState.plugin.includes('default_autofocus')"
class="uk-open"
>
<a class="uk-accordion-title" href="#">Autofocus</a>
<div class="uk-accordion-content">
<div v-if="isAutofocusing">
<progressBar />
</div>
<div
class="uk-grid-small uk-child-width-1-3"
:hidden="isAutofocusing"
uk-grid
>
<div>
<label class="uk-form-label" for="form-stacked-text">z</label>
<div class="uk-form-controls">
<input v-model="setPosition.z" class="uk-input uk-form-small" type="number" name="inputPositionZx">
</div>
<button
class="uk-button uk-button-default uk-form-small uk-float-right uk-width-1-1"
@click="runFastAutofocus(2000, 300)"
>
Fast
</button>
</div>
<div>
<button
class="uk-button uk-button-default uk-form-small uk-float-right uk-width-1-1"
@click="runAutofocus([-60, -30, 0, 30, 60])"
>
Medium
</button>
</div>
<div>
<button
class="uk-button uk-button-default uk-form-small uk-float-right uk-width-1-1"
@click="runAutofocus([-20, -10, 0, 10, 20])"
>
Fine
</button>
</div>
</div>
<p>
<button class="uk-button uk-button-primary uk-form-small uk-float-right uk-width-1-1">Move</button>
</p>
</form>
</div>
</li>
<!--Show autofocus if default plugin is enabled-->
<li v-if="this.$store.state.apiState.plugin.includes('default_autofocus')" class="uk-open">
<a class="uk-accordion-title" href="#">Autofocus</a>
<div class="uk-accordion-content">
<div v-if="isAutofocusing">
<progressBar/>
</div>
<div class="uk-grid-small uk-child-width-1-3" v-bind:hidden="isAutofocusing" uk-grid>
<div>
<button v-on:click="runFastAutofocus(2000, 300);" class="uk-button uk-button-default uk-form-small uk-float-right uk-width-1-1">Fast</button>
</div>
<div>
<button v-on:click="runAutofocus([-60,-30,0,30,60]);" class="uk-button uk-button-default uk-form-small uk-float-right uk-width-1-1">Medium</button>
</div>
<div>
<button v-on:click="runAutofocus([-20,-10,0,10,20]);" class="uk-button uk-button-default uk-form-small uk-float-right uk-width-1-1">Fine</button>
</div>
</div>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
</template>
<script>
import axios from 'axios'
import progressBar from "../genericComponents/progressBar"
import axios from "axios";
import progressBar from "../genericComponents/progressBar";
// Key Codes
const keyCodes = {
@ -104,17 +150,17 @@ const keyCodes = {
down: 40,
enter: 13,
esc: 27
}
};
// Export main app
export default {
name: 'paneNavigate',
name: "PaneNavigate",
components: {
progressBar
},
data: function () {
data: function() {
return {
keysDown: {},
stepXy: 200,
@ -122,40 +168,57 @@ export default {
setPosition: this.$store.state.apiState.stage.position,
isAutofocusing: false,
moveLock: false
};
},
computed: {
positionApiUri: function() {
return this.$store.getters.uri + "/stage/position";
},
autofocusApiUri: function() {
return this.$store.getters.uri + "/plugin/default/autofocus/autofocus";
},
fastAutofocusApiUri: function() {
return (
this.$store.getters.uri + "/plugin/default/autofocus/fast_autofocus"
);
}
},
created: function () {
window.addEventListener('keydown', this.keyDownMonitor);
created: function() {
window.addEventListener("keydown", this.keyDownMonitor);
window.addEventListener("keyup", this.keyUpMonitor);
window.addEventListener('wheel', this.wheelMonitor);
window.addEventListener("wheel", this.wheelMonitor);
},
mounted() {
// A global signal listener to perform a move action
this.$root.$on('globalMoveEvent', (x, y, z, absolute) => {
this.moveRequest(x, y, z, absolute)
})
this.$root.$on("globalMoveEvent", (x, y, z, absolute) => {
this.moveRequest(x, y, z, absolute);
});
},
beforeDestroy () {
beforeDestroy() {
// Remove global signal listener to perform a move action
this.$root.$off('globalMoveEvent')
this.$root.$off("globalMoveEvent");
},
destroyed: function () {
window.removeEventListener('keydown', this.keyDownMonitor);
destroyed: function() {
window.removeEventListener("keydown", this.keyDownMonitor);
window.removeEventListener("keyup", this.keyUpMonitor);
window.removeEventListener('wheel', this.wheelMonitor);
window.removeEventListener("wheel", this.wheelMonitor);
},
methods: {
// Handle global mouse wheel events to be associated with navigation
wheelMonitor: function(event) {
// Only capture scroll if the event target's parent contains the "scrollTarget" class
if (event.target.parentNode.classList.contains("scrollTarget") || event.target.classList.contains("scrollTarget")) {
var z_rel = (event.deltaY)/100 * this.stepZz
this.moveRequest(0, 0, z_rel, false)
if (
event.target.parentNode.classList.contains("scrollTarget") ||
event.target.classList.contains("scrollTarget")
) {
var z_rel = (event.deltaY / 100) * this.stepZz;
this.moveRequest(0, 0, z_rel, false);
}
},
@ -164,9 +227,15 @@ export default {
this.keysDown[event.keyCode] = true; //Add key to array
// Convert keyCode dict into a list of key codes
var keyCodeList = Object.keys(keyCodes).map(function(key){return keyCodes[key];});
var keyCodeList = Object.keys(keyCodes).map(function(key) {
return keyCodes[key];
});
if (!(event.target instanceof HTMLInputElement) && !(event.target.classList.contains('lightbox-link')) && keyCodeList.includes(event.keyCode)) {
if (
!(event.target instanceof HTMLInputElement) &&
!event.target.classList.contains("lightbox-link") &&
keyCodeList.includes(event.keyCode)
) {
//console.log(this.keysDown)
// Calculate movement array
var x_rel = 0;
@ -192,7 +261,7 @@ export default {
}
// Make a position request
this.moveRequest(x_rel, y_rel, z_rel, false)
this.moveRequest(x_rel, y_rel, z_rel, false);
}
},
@ -200,105 +269,102 @@ export default {
delete this.keysDown[event.keyCode]; //Remove key from array
},
handleSubmit: function(event) {
handleSubmit: function() {
this.moveRequest(
this.setPosition.x,
this.setPosition.y,
this.setPosition.z,
true,
)
true
);
},
moveRequest: function(x, y, z, absolute) {
console.log(`Sending move request of ${x}, ${y}, ${z}`)
console.log(`Sending move request of ${x}, ${y}, ${z}`);
// If not movement-locked
if (!this.moveLock) {
// Lock move requests
this.moveLock = true
this.moveLock = true;
// Send move request
axios.post(this.positionApiUri, {
x: x,
y: y,
z: z,
absolute: absolute
})
.then(response => {
this.$store.dispatch('updateState'); // Update store state
this.setPosition = response.data.stage.position; // Update boxes from response
})
.catch(error => {
this.modalError(error) // Let mixin handle error
})
.then(() => {
this.moveLock = false // Release the move lock
})
axios
.post(this.positionApiUri, {
x: x,
y: y,
z: z,
absolute: absolute
})
.then(response => {
this.$store.dispatch("updateState"); // Update store state
this.setPosition = response.data.stage.position; // Update boxes from response
})
.catch(error => {
this.modalError(error); // Let mixin handle error
})
.then(() => {
this.moveLock = false; // Release the move lock
});
}
},
runAutofocus: function(dz) {
if (!this.moveLock) {
// Lock move requests
this.moveLock = true
this.isAutofocusing = true
axios.post(this.autofocusApiUri, {dz: dz})
.then(response => {
console.log("Autofocus Task ID: " + response.data.id)
// Start the store polling TaskId for success
return this.$store.dispatch('pollTask', [response.data.id, null, null])
})
.then(() => {
console.log("Successfully finished autofocus")
})
.catch(error => {
this.modalError(error) // Let mixin handle error
})
.finally(() => {
console.log("Cleaning up after autofocus.")
this.isAutofocusing = false;
this.moveLock = false // Release the move lock
})
this.moveLock = true;
this.isAutofocusing = true;
axios
.post(this.autofocusApiUri, { dz: dz })
.then(response => {
console.log("Autofocus Task ID: " + response.data.id);
// Start the store polling TaskId for success
return this.$store.dispatch("pollTask", [
response.data.id,
null,
null
]);
})
.then(() => {
console.log("Successfully finished autofocus");
})
.catch(error => {
this.modalError(error); // Let mixin handle error
})
.finally(() => {
console.log("Cleaning up after autofocus.");
this.isAutofocusing = false;
this.moveLock = false; // Release the move lock
});
}
},
runFastAutofocus: function(dz, backlash) {
if (!this.moveLock) {
// Lock move requests
this.moveLock = true
this.isAutofocusing = true
axios.post(this.fastAutofocusApiUri, {dz: dz, backlash: backlash})
.then(response => {
console.log("Autofocus Task ID: " + response.data.id)
// Start the store polling TaskId for success
return this.$store.dispatch('pollTask', [response.data.id, null, null])
})
.then(() => {
console.log("Successfully finished autofocus")
})
.catch(error => {
this.modalError(error) // Let mixin handle error
})
.finally(() => {
console.log("Cleaning up after autofocus.")
this.isAutofocusing = false
this.moveLock = false // Release the move lock
})
this.moveLock = true;
this.isAutofocusing = true;
axios
.post(this.fastAutofocusApiUri, { dz: dz, backlash: backlash })
.then(response => {
console.log("Autofocus Task ID: " + response.data.id);
// Start the store polling TaskId for success
return this.$store.dispatch("pollTask", [
response.data.id,
null,
null
]);
})
.then(() => {
console.log("Successfully finished autofocus");
})
.catch(error => {
this.modalError(error); // Let mixin handle error
})
.finally(() => {
console.log("Cleaning up after autofocus.");
this.isAutofocusing = false;
this.moveLock = false; // Release the move lock
});
}
}
},
computed: {
positionApiUri: function () {
return this.$store.getters.uri + "/stage/position"
},
autofocusApiUri: function () {
return this.$store.getters.uri + "/plugin/default/autofocus/autofocus"
},
fastAutofocusApiUri: function () {
return this.$store.getters.uri + "/plugin/default/autofocus/fast_autofocus"
}
}
}
</script>
};
</script>

View file

@ -1,17 +1,17 @@
<template>
<div id="panePlugins">
<h3>Plugins</h3>
<div class="uk-placeholder uk-text-center">Plugin support coming soon...</div>
<div class="uk-placeholder uk-text-center">
Plugin support coming soon...
</div>
</div>
</template>
<script>
// Export main app
export default {
name: 'panePlugins',
}
name: "PanePlugins"
};
</script>
<style lang="less">
</style>
<style lang="less"></style>

View file

@ -1,38 +1,35 @@
<template>
<div id="paneSettings">
<appSettings/>
<appSettings />
<ul uk-accordion="multiple: true; animation: false">
<li>
<a class="uk-accordion-title" href="#">Stream settings</a>
<div class="uk-accordion-content"><streamSettings/></div>
<div class="uk-accordion-content"><streamSettings /></div>
</li>
<li v-if="$store.getters.ready">
<a class="uk-accordion-title" href="#">Camera settings</a>
<div class="uk-accordion-content"><cameraSettings/></div>
<div class="uk-accordion-content"><cameraSettings /></div>
</li>
<li v-if="$store.getters.ready">
<a class="uk-accordion-title" href="#">Microscope settings</a>
<div class="uk-accordion-content"><microscopeSettings/></div>
<div class="uk-accordion-content"><microscopeSettings /></div>
</li>
</ul>
</div>
</template>
<script>
import streamSettings from './settingsComponents/streamSettings.vue'
import microscopeSettings from './settingsComponents/microscopeSettings.vue'
import cameraSettings from './settingsComponents/cameraSettings.vue'
import appSettings from './settingsComponents/appSettings.vue'
import streamSettings from "./settingsComponents/streamSettings.vue";
import microscopeSettings from "./settingsComponents/microscopeSettings.vue";
import cameraSettings from "./settingsComponents/cameraSettings.vue";
import appSettings from "./settingsComponents/appSettings.vue";
// Export main app
export default {
name: 'paneSettings',
name: "PaneSettings",
components: {
streamSettings,
@ -40,9 +37,7 @@ export default {
microscopeSettings,
appSettings
}
}
};
</script>
<style lang="less">
</style>
<style lang="less"></style>

View file

@ -1,70 +1,71 @@
<template>
<div class="host-input">
<div v-if="$store.getters.ready">
<div v-if="$store.state.apiConfig.name"><b>Device name:</b> <br> {{ $store.state.apiConfig.name }}</div>
<hr>
<div class="uk-margin-small-bottom">
<b>Host:</b>
<br>
{{ $store.state.host }}
<div class="host-input">
<div v-if="$store.getters.ready">
<div v-if="$store.state.apiConfig.name">
<b>Device name:</b> <br />
{{ $store.state.apiConfig.name }}
</div>
<hr />
<div class="uk-margin-small-bottom">
<b>Host:</b>
<br />
{{ $store.state.host }}
</div>
<div>
<b>Server version:</b> <br />
{{ $store.state.apiState.version }}
</div>
<hr />
<div class="uk-margin-small-bottom">
<b>Camera:</b>
<br />
<div v-if="$store.state.apiState.camera.board">
{{ $store.state.apiState.camera.board }}
</div>
<div v-else class="uk-text-danger"><b>No camera connected</b></div>
</div>
<div>
<b>Stage:</b>
<br />
<div v-if="$store.state.apiState.stage.board">
{{ $store.state.apiState.stage.board }}
</div>
<div v-else class="uk-text-danger"><b>No stage connected</b></div>
</div>
</div>
<div><b>Server version:</b> <br> {{ $store.state.apiState.version }}</div>
<hr>
<div class="uk-margin-small-bottom">
<b>Camera:</b>
<br>
<div v-if="$store.state.apiState.camera.board">{{ $store.state.apiState.camera.board }}</div>
<div v-else class="uk-text-danger"><b>No camera connected</b></div>
<div v-else-if="$store.state.waiting">
<progressBar></progressBar>
</div>
<div>
<b>Stage:</b>
<br>
<div v-if="$store.state.apiState.stage.board">{{ $store.state.apiState.stage.board }}</div>
<div v-else class="uk-text-danger"><b>No stage connected</b></div>
<div v-else-if="$store.state.error">
<b>Error:</b> {{ $store.state.error }}
</div>
<div v-else>No active connection</div>
</div>
<div v-else-if="$store.state.waiting">
<progressBar></progressBar>
</div>
<div v-else-if="$store.state.error"><b>Error:</b> {{ $store.state.error }}</div>
<div v-else>No active connection</div>
</div>
</template>
<script>
import progressBar from "../genericComponents/progressBar"
import progressBar from "../genericComponents/progressBar";
export default {
name: 'paneStatus',
name: "PaneStatus",
components: {
progressBar
},
data: function () {
return {
}
data: function() {
return {};
},
mounted() {
},
computed: {},
watch: {
},
watch: {},
methods: {
},
mounted() {},
computed: {
}
}
methods: {}
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
</style>
<style scoped lang="less"></style>

View file

@ -1,31 +1,21 @@
<template>
<div id="appSettings">
<p><label><input v-model="darkMode" class="uk-checkbox" type="checkbox"> Enable dark theme</label></p>
</div>
<div id="appSettings">
<p>
<label
><input v-model="darkMode" class="uk-checkbox" type="checkbox" /> Enable
dark theme</label
>
</p>
</div>
</template>
<script>
// Export main app
export default {
name: 'appSettings',
name: "AppSettings",
data: function () {
return {}
},
mounted() {
// Try loading settings from localStorage. If null, don't change.
this.darkMode = this.getLocalStorageObj('darkMode') || this.darkMode
},
watch: {
darkMode(newdarkMode) {
console.log("Saving darkmode setting")
this.setLocalStorageObj('darkMode', this.darkMode)
}
data: function() {
return {};
},
computed: {
@ -34,13 +24,23 @@ export default {
return this.$store.state.globalSettings.darkMode;
},
set(value) {
this.$store.commit("changeSetting", ['darkMode', value]);
this.$store.commit("changeSetting", ["darkMode", value]);
}
}
}
},
}
watch: {
darkMode() {
console.log("Saving darkmode setting");
this.setLocalStorageObj("darkMode", this.darkMode);
}
},
mounted() {
// Try loading settings from localStorage. If null, don't change.
this.darkMode = this.getLocalStorageObj("darkMode") || this.darkMode;
}
};
</script>
<style lang="less">
</style>
<style lang="less"></style>

View file

@ -1,138 +1,181 @@
<template>
<div id="cameraSettings">
<form @submit.prevent="applyConfigRequest">
<div id="cameraSettings">
<form @submit.prevent="applyConfigRequest">
<div>
<label class="uk-form-label" for="form-stacked-text">Exposure time</label>
<label class="uk-form-label" for="form-stacked-text"
>Exposure time</label
>
<div class="uk-form-controls">
<input v-bind:value="displayShutterSpeed" v-on:input="shutterSpeed = $event.target.value" class="uk-input uk-form-small" type="number">
<input
:value="displayShutterSpeed"
class="uk-input uk-form-small"
type="number"
@input="shutterSpeed = $event.target.value"
/>
</div>
</div>
<div>
<label class="uk-form-label" for="form-stacked-text">Analogue gain</label>
<label class="uk-form-label" for="form-stacked-text"
>Analogue gain</label
>
<div class="uk-form-controls">
<input v-bind:value="displayAnalogGain" v-on:input="analogGain = $event.target.value" class="uk-input uk-form-small" type="number" step="0.1">
<input
:value="displayAnalogGain"
class="uk-input uk-form-small"
type="number"
step="0.1"
@input="analogGain = $event.target.value"
/>
</div>
</div>
<div>
<label class="uk-form-label" for="form-stacked-text">Digital gain</label>
<label class="uk-form-label" for="form-stacked-text"
>Digital gain</label
>
<div class="uk-form-controls">
<input v-bind:value="displayDigitalGain" v-on:input="digitalGain = $event.target.value" class="uk-input uk-form-small" type="number" step="0.1">
<input
:value="displayDigitalGain"
class="uk-input uk-form-small"
type="number"
step="0.1"
@input="digitalGain = $event.target.value"
/>
</div>
</div>
<button type="submit" class="uk-button uk-button-primary uk-form-small uk-float-right uk-margin-small uk-width-1-1">Apply Settings</button>
<!--Show auto calibrate if default plugin is enabled-->
<div v-if="this.$store.state.apiState.plugin.includes('default_camera_calibration')">
<taskSubmitter
v-bind:canTerminate="false"
v-bind:requiresConfirmation="true"
v-bind:confirmationMessage="'Start recalibration? This may take a while, and the microscope will be locked during this time.'"
v-bind:submitURL="recalibrateApiUri"
v-bind:submitLabel="'Auto-Calibrate (Task)'"
v-on:response="onRecalibrateResponse"
v-on:error="onRecalibrateError">
</taskSubmitter>
</div>
</form>
</div>
<button
type="submit"
class="uk-button uk-button-primary uk-form-small uk-float-right uk-margin-small uk-width-1-1"
>
Apply Settings
</button>
<!--Show auto calibrate if default plugin is enabled-->
<div
v-if="
this.$store.state.apiState.plugin.includes(
'default_camera_calibration'
)
"
>
<taskSubmitter
:can-terminate="false"
:requires-confirmation="true"
:confirmation-message="
'Start recalibration? This may take a while, and the microscope will be locked during this time.'
"
:submit-u-r-l="recalibrateApiUri"
:submit-label="'Auto-Calibrate (Task)'"
@response="onRecalibrateResponse"
@error="onRecalibrateError"
>
</taskSubmitter>
</div>
</form>
</div>
</template>
<script>
import axios from 'axios'
import taskSubmitter from "../../genericComponents/taskSubmitter"
import axios from "axios";
import taskSubmitter from "../../genericComponents/taskSubmitter";
// Export main app
export default {
name: 'microscopeSettings',
name: "MicroscopeSettings",
components: {
taskSubmitter
},
data: function () {
data: function() {
return {
shutterSpeed: this.$store.state.apiConfig.camera_settings.picamera_settings.shutter_speed,
analogGain: this.$store.state.apiConfig.camera_settings.picamera_settings.analog_gain,
digitalGain: this.$store.state.apiConfig.camera_settings.picamera_settings.digital_gain,
shutterSpeed: this.$store.state.apiConfig.camera_settings
.picamera_settings.shutter_speed,
analogGain: this.$store.state.apiConfig.camera_settings.picamera_settings
.analog_gain,
digitalGain: this.$store.state.apiConfig.camera_settings.picamera_settings
.digital_gain,
isCalibrating: false
};
},
computed: {
displayDigitalGain: function() {
return Number(this.digitalGain).toFixed(2);
},
displayAnalogGain: function() {
return Number(this.analogGain).toFixed(2);
},
displayShutterSpeed: function() {
return this.shutterSpeed != "0" ? this.shutterSpeed : "auto";
},
recalibrateApiUri: function() {
return (
this.$store.getters.uri +
"/plugin/default/camera_calibration/recalibrate"
);
},
configApiUri: function() {
return this.$store.getters.uri + "/config";
}
},
methods: {
updateInputValues: function () {
this.shutterSpeed = this.$store.state.apiConfig.camera_settings.picamera_settings.shutter_speed
this.digitalGain = this.$store.state.apiConfig.camera_settings.picamera_settings.digital_gain
this.analogGain = this.$store.state.apiConfig.camera_settings.picamera_settings.analog_gain
updateInputValues: function() {
this.shutterSpeed = this.$store.state.apiConfig.camera_settings.picamera_settings.shutter_speed;
this.digitalGain = this.$store.state.apiConfig.camera_settings.picamera_settings.digital_gain;
this.analogGain = this.$store.state.apiConfig.camera_settings.picamera_settings.analog_gain;
},
applyConfigRequest: function() {
console.log("Applying config to the microscope")
console.log("Applying config to the microscope");
var payload = {
camera_settings: {
picamera_settings: {}
}
}
};
//if (this.shutterSpeed != this.$store.state.apiConfig.picamera_settings.shutter_speed) {
payload.camera_settings.picamera_settings.shutter_speed = this.shutterSpeed
payload.camera_settings.picamera_settings.analog_gain = this.analogGain
payload.camera_settings.picamera_settings.digital_gain = this.digitalGain
payload.camera_settings.picamera_settings.shutter_speed = this.shutterSpeed;
payload.camera_settings.picamera_settings.analog_gain = this.analogGain;
payload.camera_settings.picamera_settings.digital_gain = this.digitalGain;
//};
// Send request
axios.post(this.configApiUri, payload)
.then(response => { return new Promise(r => setTimeout(r, 500))}) // why is there no built-in for this??!
.then(response => {
return this.$store.dispatch('updateConfig');
axios
.post(this.configApiUri, payload)
.then(() => {
return new Promise(r => setTimeout(r, 500));
}) // why is there no built-in for this??!
.then(() => {
return this.$store.dispatch("updateConfig");
})
.then(this.updateInputValues)
.then(r=>{console.log("Updated Config: ", payload)})
.catch(error => {
this.modalError(error) // Let mixin handle error
.then(() => {
console.log("Updated Config: ", payload);
})
.catch(error => {
this.modalError(error); // Let mixin handle error
});
},
onRecalibrateResponse: function() {
this.modalNotify("Finished recalibration.")
return new Promise(r => setTimeout(r, 500)) // wait 500ms before updating config, so it's fresh
this.modalNotify("Finished recalibration.");
return new Promise(r => setTimeout(r, 500)); // wait 500ms before updating config, so it's fresh
},
onRecalibrateError: function(error) {
this.modalError(error) // Let mixin handle error
}
},
computed: {
displayDigitalGain: function () {
return Number(this.digitalGain).toFixed(2)
},
displayAnalogGain: function () {
return Number(this.analogGain).toFixed(2)
},
displayShutterSpeed: function () {
return (this.shutterSpeed != "0") ? this.shutterSpeed : "auto"
},
recalibrateApiUri: function () {
return this.$store.getters.uri + "/plugin/default/camera_calibration/recalibrate"
},
configApiUri: function () {
return this.$store.getters.uri + "/config"
this.modalError(error); // Let mixin handle error
}
}
}
};
</script>
<style lang="less">
.center-spinner {
margin-left: auto;
margin-right: auto
margin-right: auto;
}
</style>

View file

@ -1,108 +1,133 @@
<template>
<div id="microscopeSettings">
<form @submit.prevent="applyConfigRequest">
<h4>Stage</h4>
<div id="microscopeSettings">
<form @submit.prevent="applyConfigRequest">
<h4>Stage</h4>
<label class="uk-form-label" for="form-stacked-text">Backlash compensation</label>
<div class="uk-grid-small uk-child-width-1-3" uk-grid>
<div>
<label class="uk-form-label" for="form-stacked-text">x</label>
<div class="uk-form-controls">
<input v-model="stageBacklash.x" class="uk-input uk-form-small" type="number">
<label class="uk-form-label" for="form-stacked-text"
>Backlash compensation</label
>
<div class="uk-grid-small uk-child-width-1-3" uk-grid>
<div>
<label class="uk-form-label" for="form-stacked-text">x</label>
<div class="uk-form-controls">
<input
v-model="stageBacklash.x"
class="uk-input uk-form-small"
type="number"
/>
</div>
</div>
<div>
<label class="uk-form-label" for="form-stacked-text">y</label>
<div class="uk-form-controls">
<input
v-model="stageBacklash.y"
class="uk-input uk-form-small"
type="number"
/>
</div>
</div>
<div>
<label class="uk-form-label" for="form-stacked-text">z</label>
<div class="uk-form-controls">
<input
v-model="stageBacklash.z"
class="uk-input uk-form-small"
type="number"
/>
</div>
</div>
</div>
<div>
<label class="uk-form-label" for="form-stacked-text">y</label>
<div class="uk-form-controls">
<input v-model="stageBacklash.y" class="uk-input uk-form-small" type="number">
</div>
</div>
<h4>Microscope</h4>
<div>
<label class="uk-form-label" for="form-stacked-text">z</label>
<div class="uk-form-controls">
<input v-model="stageBacklash.z" class="uk-input uk-form-small" type="number">
</div>
<label class="uk-form-label" for="form-stacked-text"
>Microscope name</label
>
<input
v-model="microscopeName"
class="uk-input uk-width-1-1 uk-form-small"
name="inputFilename"
placeholder="Leave blank for default"
/>
</div>
</div>
<h4>Microscope</h4>
<div>
<label class="uk-form-label" for="form-stacked-text">Microscope name</label>
<input v-model="microscopeName" class="uk-input uk-width-1-1 uk-form-small" name="inputFilename" placeholder="Leave blank for default">
</div>
<button type="submit" class="uk-button uk-button-primary uk-form-small uk-float-right uk-margin-small uk-width-1-1">Apply Settings</button>
</form>
</div>
<button
type="submit"
class="uk-button uk-button-primary uk-form-small uk-float-right uk-margin-small uk-width-1-1"
>
Apply Settings
</button>
</form>
</div>
</template>
<script>
import axios from 'axios'
import axios from "axios";
// Export main app
export default {
name: 'microscopeSettings',
name: "MicroscopeSettings",
data: function () {
data: function() {
return {
microscopeName: this.$store.state.apiConfig.name,
stageBacklash: this.$store.state.apiConfig.stage_settings.backlash
};
},
computed: {
configApiUri: function() {
return this.$store.getters.uri + "/config";
}
},
methods: {
updateInputValues: function () {
updateInputValues: function() {
this.microscopeName = this.$store.state.apiConfig.name;
this.stageBacklash = this.$store.state.apiConfig.stage_settings.backlash
this.stageBacklash = this.$store.state.apiConfig.stage_settings.backlash;
},
applyConfigRequest: function() {
var payload = {
stage_settings: {}
}
if (this.microscopeName != this.$store.state.apiConfig.name) {
payload.name = this.microscopeName
};
if (this.stageBacklash != this.$store.state.apiConfig.stage_settings.backlash) {
payload.stage_settings.backlash = this.stageBacklash
if (this.microscopeName != this.$store.state.apiConfig.name) {
payload.name = this.microscopeName;
}
console.log(payload)
if (
this.stageBacklash !=
this.$store.state.apiConfig.stage_settings.backlash
) {
payload.stage_settings.backlash = this.stageBacklash;
}
console.log(payload);
// Send request to update config
axios.post(this.configApiUri, payload)
.then(response => {
this.$store.dispatch('updateConfig');
this.updateInputValues
this.modalNotify("Microscope config applied.")
axios
.post(this.configApiUri, payload)
.then(() => {
this.$store.dispatch("updateConfig");
this.updateInputValues;
this.modalNotify("Microscope config applied.");
})
.catch(error => {
this.modalError(error) // Let mixin handle error
})
}
},
computed: {
configApiUri: function () {
return this.$store.getters.uri + "/config"
this.modalError(error); // Let mixin handle error
});
}
}
}
};
</script>
<style lang="less">
.center-spinner {
margin-left: auto;
margin-right: auto
margin-right: auto;
}
</style>

View file

@ -1,34 +1,49 @@
<template>
<div id="streamSettings">
<div id="streamSettings">
<p>
<label
><input v-model="disableStream" class="uk-checkbox" type="checkbox" />
Disable live stream</label
>
</p>
<p><label><input v-model="disableStream" class="uk-checkbox" type="checkbox"> Disable live stream</label></p>
<div class="uk-child-width-1-2" uk-grid>
<p><label v-bind:class="[{'uk-disabled': !this.$store.getters.ready}]"><input v-model="autoGpuPreview" class="uk-checkbox" type="checkbox"> GPU preview</label></p>
<p><label v-bind:class="[{'uk-disabled': !this.$store.getters.ready}]"><input v-model="trackWindow" class="uk-checkbox" type="checkbox"> Track window</label></p>
<div class="uk-child-width-1-2" uk-grid>
<p>
<label :class="[{ 'uk-disabled': !this.$store.getters.ready }]"
><input
v-model="autoGpuPreview"
class="uk-checkbox"
type="checkbox"
/>
GPU preview</label
>
</p>
<p>
<label :class="[{ 'uk-disabled': !this.$store.getters.ready }]"
><input v-model="trackWindow" class="uk-checkbox" type="checkbox" />
Track window</label
>
</p>
</div>
</div>
</div>
</template>
<script>
// Export main app
export default {
name: 'streamSettings',
name: "StreamSettings",
data: function () {
return {}
data: function() {
return {};
},
computed: {
disableStream: {
get() {
return this.$store.state.globalSettings.disableStream;
},
set(value) {
this.$store.commit("changeSetting", ['disableStream', value]);
this.$store.commit("changeSetting", ["disableStream", value]);
}
},
@ -37,8 +52,8 @@ export default {
return this.$store.state.globalSettings.autoGpuPreview;
},
set(value) {
this.$store.commit("changeSetting", ['autoGpuPreview', value]);
this.$root.$emit('globalTogglePreview', value)
this.$store.commit("changeSetting", ["autoGpuPreview", value]);
this.$root.$emit("globalTogglePreview", value);
}
},
@ -47,13 +62,11 @@ export default {
return this.$store.state.globalSettings.trackWindow;
},
set(value) {
this.$store.commit("changeSetting", ['trackWindow', value]);
this.$store.commit("changeSetting", ["trackWindow", value]);
}
}
}
}
};
</script>
<style lang="less">
</style>
<style lang="less"></style>