This commit is contained in:
Richard Bowman 2023-11-02 20:30:54 +00:00
parent 79752a2a4c
commit c5c02eb029
9 changed files with 235 additions and 227 deletions

View file

@ -351,7 +351,7 @@ export default {
.catch(error => { .catch(error => {
this.modalError(error); // Let mixin handle error this.modalError(error); // Let mixin handle error
});*/ });*/
return new Promise((resolve) => { return new Promise(resolve => {
resolve({}); resolve({});
}); });
}, },

View file

@ -4,10 +4,10 @@
<div class="input-and-buttons-container"> <div class="input-and-buttons-container">
<input <input
v-for="(_v, key) in value" v-for="(_v, key) in value"
:key="key"
v-model="value[key]"
class="uk-form-small numeric-setting-line-input" class="uk-form-small numeric-setting-line-input"
type="number" type="number"
v-model="value[key]"
:key="key"
@focusin="focusIn" @focusin="focusIn"
@focusout="focusOut" @focusout="focusOut"
@keydown="keyDown" @keydown="keyDown"
@ -38,14 +38,14 @@ props: {
type: Number, type: Number,
default: undefined, default: undefined,
required: false required: false
}, }
}, },
data: () => { data: () => {
return { return {
value: {}, value: {},
valueOnEnter: undefined valueOnEnter: undefined
} };
}, },
computed: { computed: {
@ -60,22 +60,24 @@ mounted() {
methods: { methods: {
readProperty: async function() { readProperty: async function() {
let response = await axios.get(this.propertyUrl) let response = await axios.get(this.propertyUrl);
this.value = response.data this.value = response.data;
console.log("Read property", this.propertyUrl, response.data) console.log("Read property", this.propertyUrl, response.data);
return response.data return response.data;
}, },
writeProperty: async function() { writeProperty: async function() {
try { try {
let requestedValue = Number(this.value) let requestedValue = Number(this.value);
await axios.post(this.propertyUrl, requestedValue) await axios.post(this.propertyUrl, requestedValue);
if (this.readBack) { if (this.readBack) {
await new Promise(r => setTimeout(r, this.readBackDelay)) await new Promise(r => setTimeout(r, this.readBackDelay));
let newVal = await this.readProperty() let newVal = await this.readProperty();
if (newVal == requestedValue) { if (newVal == requestedValue) {
await this.modalNotify(`Set ${this.label} to ${newVal}.`) await this.modalNotify(`Set ${this.label} to ${newVal}.`);
} else { } else {
await this.modalNotify(`Set ${this.label} to ${newVal} (requested ${requestedValue}).`) await this.modalNotify(
`Set ${this.label} to ${newVal} (requested ${requestedValue}).`
);
} }
} else { } else {
await this.modalNotify(`Set ${this.label} to ${this.value}.`); await this.modalNotify(`Set ${this.label} to ${this.value}.`);

View file

@ -4,10 +4,10 @@
<div class="input-and-buttons-container"> <div class="input-and-buttons-container">
<input <input
v-for="i in value.length" v-for="i in value.length"
:key="i"
v-model="value[i - 1]"
class="uk-form-small numeric-setting-line-input" class="uk-form-small numeric-setting-line-input"
type="number" type="number"
v-model="value[i - 1]"
:key="i"
@focusin="focusIn" @focusin="focusIn"
@focusout="focusOut" @focusout="focusOut"
@keydown="keyDown" @keydown="keyDown"
@ -38,14 +38,14 @@ props: {
type: Number, type: Number,
default: undefined, default: undefined,
required: false required: false
}, }
}, },
data: () => { data: () => {
return { return {
value: {}, value: {},
valueOnEnter: undefined valueOnEnter: undefined
} };
}, },
computed: { computed: {
@ -60,22 +60,24 @@ mounted() {
methods: { methods: {
readProperty: async function() { readProperty: async function() {
let response = await axios.get(this.propertyUrl) let response = await axios.get(this.propertyUrl);
this.value = response.data this.value = response.data;
console.log("Read property", this.propertyUrl, response.data) console.log("Read property", this.propertyUrl, response.data);
return response.data return response.data;
}, },
writeProperty: async function() { writeProperty: async function() {
try { try {
let requestedValue = this.value let requestedValue = this.value;
await axios.post(this.propertyUrl, requestedValue) await axios.post(this.propertyUrl, requestedValue);
if (this.readBack) { if (this.readBack) {
await new Promise(r => setTimeout(r, this.readBackDelay)) await new Promise(r => setTimeout(r, this.readBackDelay));
let newVal = await this.readProperty() let newVal = await this.readProperty();
if (newVal == requestedValue) { if (newVal == requestedValue) {
await this.modalNotify(`Set ${this.label} to ${newVal}.`) await this.modalNotify(`Set ${this.label} to ${newVal}.`);
} else { } else {
await this.modalNotify(`Set ${this.label} to ${newVal} (requested ${requestedValue}).`) await this.modalNotify(
`Set ${this.label} to ${newVal} (requested ${requestedValue}).`
);
} }
} else { } else {
await this.modalNotify(`Set ${this.label} to ${this.value}.`); await this.modalNotify(`Set ${this.label} to ${this.value}.`);

View file

@ -3,9 +3,9 @@
<label class="uk-form-label">{{ label }}</label> <label class="uk-form-label">{{ label }}</label>
<div class="input-and-buttons-container"> <div class="input-and-buttons-container">
<input <input
v-model="value"
class="uk-form-small numeric-setting-line-input" class="uk-form-small numeric-setting-line-input"
type="number" type="number"
v-model="value"
@focusin="focusIn" @focusin="focusIn"
@focusout="focusOut" @focusout="focusOut"
@keydown="keyDown" @keydown="keyDown"
@ -43,7 +43,7 @@ data: () => {
return { return {
value: undefined, value: undefined,
valueOnEnter: undefined valueOnEnter: undefined
} };
}, },
computed: { computed: {
@ -58,22 +58,24 @@ mounted() {
methods: { methods: {
readProperty: async function() { readProperty: async function() {
let response = await axios.get(this.propertyUrl) let response = await axios.get(this.propertyUrl);
this.value = response.data this.value = response.data;
console.log("Read property", this.propertyUrl, response.data) console.log("Read property", this.propertyUrl, response.data);
return response.data return response.data;
}, },
writeProperty: async function() { writeProperty: async function() {
try { try {
let requestedValue = Number(this.value) let requestedValue = Number(this.value);
await axios.post(this.propertyUrl, requestedValue) await axios.post(this.propertyUrl, requestedValue);
if (this.readBack) { if (this.readBack) {
await new Promise(r => setTimeout(r, this.readBackDelay)) await new Promise(r => setTimeout(r, this.readBackDelay));
let newVal = await this.readProperty() let newVal = await this.readProperty();
if (newVal == requestedValue) { if (newVal == requestedValue) {
await this.modalNotify(`Set ${this.label} to ${newVal}.`) await this.modalNotify(`Set ${this.label} to ${newVal}.`);
} else { } else {
await this.modalNotify(`Set ${this.label} to ${newVal} (requested ${requestedValue}).`) await this.modalNotify(
`Set ${this.label} to ${newVal} (requested ${requestedValue}).`
);
} }
} else { } else {
await this.modalNotify(`Set ${this.label} to ${this.value}.`); await this.modalNotify(`Set ${this.label} to ${this.value}.`);

View file

@ -142,7 +142,10 @@ export default {
if (task.status == "pending" || task.status == "running") { if (task.status == "pending" || task.status == "running") {
this.taskStarted = true; this.taskStarted = true;
this.$emit("taskStarted", this.taskId); this.$emit("taskStarted", this.taskId);
this.startPolling(task.id, task.links.find(t => t.rel==self).href); this.startPolling(
task.id,
task.links.find(t => t.rel == self).href
);
} }
} }
}); });
@ -219,10 +222,9 @@ export default {
var checkCondition = (resolve, reject) => { var checkCondition = (resolve, reject) => {
// If the condition is met, we're done! // If the condition is met, we're done!
axios.get( axios
this.taskUrl, .get(this.taskUrl, { baseURL: this.$store.getters.baseUri })
{baseURL: this.$store.getters.baseUri} .then(response => {
).then(response => {
var result = response.data.status; var result = response.data.status;
// If the task ends with success // If the task ends with success
if (result == "completed") { if (result == "completed") {

View file

@ -221,7 +221,10 @@
</select> </select>
</div> </div>
<div class="uk-margin-small uk-margin-remove-bottom" v-if="backgroundDetectUri"> <div
v-if="backgroundDetectUri"
class="uk-margin-small uk-margin-remove-bottom"
>
<label class="uk-form-label" for="form-stacked-text"> <label class="uk-form-label" for="form-stacked-text">
<input <input
v-model="detectEmptyFieldsAndSkipAutofocus" v-model="detectEmptyFieldsAndSkipAutofocus"
@ -475,7 +478,8 @@ export default {
namemode: this.namingStyle.toLowerCase(), namemode: this.namingStyle.toLowerCase(),
autofocus_dz: afDeltas[this.scanDeltaZ], autofocus_dz: afDeltas[this.scanDeltaZ],
fast_autofocus: this.scanDeltaZ == "Fast", fast_autofocus: this.scanDeltaZ == "Fast",
detect_empty_fields_and_skip_autofocus: this.detectEmptyFieldsAndSkipAutofocus detect_empty_fields_and_skip_autofocus: this
.detectEmptyFieldsAndSkipAutofocus
}; };
}, },
smartScanPayload: function() { smartScanPayload: function() {
@ -568,7 +572,8 @@ export default {
); );
if (foundExtension) { if (foundExtension) {
// Get plugin action link // Get plugin action link
this.backgroundDetectUri = foundExtension.links.grab_and_classify_image.href; this.backgroundDetectUri =
foundExtension.links.grab_and_classify_image.href;
} }
}) })
.catch(error => { .catch(error => {

View file

@ -15,10 +15,7 @@
> >
</taskSubmitter> </taskSubmitter>
</div> </div>
<div <div v-if="'auto_expose_from_minimum' in actions" class="uk-margin-small">
v-if="'auto_expose_from_minimum' in actions"
class="uk-margin-small"
>
<taskSubmitter <taskSubmitter
:can-terminate="false" :can-terminate="false"
:requires-confirmation="false" :requires-confirmation="false"
@ -29,10 +26,7 @@
> >
</taskSubmitter> </taskSubmitter>
</div> </div>
<div <div v-if="'calibrate_white_balance' in actions" class="uk-margin-small">
v-if="'calibrate_white_balance' in actions"
class="uk-margin-small"
>
<taskSubmitter <taskSubmitter
:can-terminate="false" :can-terminate="false"
:requires-confirmation="false" :requires-confirmation="false"
@ -43,10 +37,7 @@
> >
</taskSubmitter> </taskSubmitter>
</div> </div>
<div <div v-if="'calibrate_lens_shading' in actions" class="uk-margin-small">
v-if="'calibrate_lens_shading' in actions"
class="uk-margin-small"
>
<taskSubmitter <taskSubmitter
:can-terminate="false" :can-terminate="false"
:requires-confirmation="true" :requires-confirmation="true"
@ -81,7 +72,8 @@
v-show="showExtraSettings" v-show="showExtraSettings"
v-if="'reset_lens_shading' in actions" v-if="'reset_lens_shading' in actions"
class="uk-child-width-expand" class="uk-child-width-expand"
> <taskSubmitter >
<taskSubmitter
:can-terminate="false" :can-terminate="false"
:requires-confirmation="false" :requires-confirmation="false"
:submit-url="cameraUri + 'reset_lens_shading'" :submit-url="cameraUri + 'reset_lens_shading'"
@ -133,12 +125,15 @@ export default {
methods: { methods: {
updateActions: async function() { updateActions: async function() {
try { try {
let response = await axios.get(this.cameraUri) // Get the thing description let response = await axios.get(this.cameraUri); // Get the thing description
let td = response.data let td = response.data;
this.actions = td.actions this.actions = td.actions;
console.log("full auto calibrate in actions", 'full_auto_calibrate' in this.actions) console.log(
"full auto calibrate in actions",
"full_auto_calibrate" in this.actions
);
} catch (error) { } catch (error) {
this.modalError(error) // Let mixin handle error this.modalError(error); // Let mixin handle error
} }
}, },

View file

@ -1,3 +1,3 @@
module.exports = { module.exports = {
outputDir: '../openflexure_microscope/api/static/dist', outputDir: "../openflexure_microscope/api/static/dist"
}; };