Updated tile scan to new taskSubmitter component
This commit is contained in:
parent
77098f54d8
commit
37dcc2c796
1 changed files with 52 additions and 44 deletions
|
|
@ -63,12 +63,7 @@
|
||||||
<!--Show stack and scan if default plugin is enabled-->
|
<!--Show stack and scan if default plugin is enabled-->
|
||||||
<li v-if="this.$store.state.apiState.plugin.includes('default_scan')">
|
<li v-if="this.$store.state.apiState.plugin.includes('default_scan')">
|
||||||
<a class="uk-accordion-title" href="#">Stack and Scan</a>
|
<a class="uk-accordion-title" href="#">Stack and Scan</a>
|
||||||
<div v-if="isScanning" class="uk-accordion-content">
|
<div class="uk-accordion-content">
|
||||||
<div class="uk-text-center uk-container" >
|
|
||||||
<div class="center-spinner" uk-spinner></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else class="uk-accordion-content">
|
|
||||||
|
|
||||||
<div class="uk-margin">
|
<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>
|
||||||
|
|
@ -147,7 +142,15 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<button v-if="scanCapture" v-on:click="handleScan()" v-bind:class="{ 'uk-disabled': isScanning }" class="uk-button uk-button-primary uk-form-small uk-margin uk-float-right uk-width-1-1">Start Scan</button>
|
<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>
|
||||||
|
|
||||||
<button v-else v-on:click="handleCapture()" class="uk-button uk-button-primary uk-form-small uk-margin uk-float-right uk-width-1-1">Capture</button>
|
<button v-else v-on:click="handleCapture()" class="uk-button uk-button-primary uk-form-small uk-margin uk-float-right uk-width-1-1">Capture</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -159,13 +162,16 @@ import axios from 'axios'
|
||||||
import tagList from "../fieldComponents/tagList"
|
import tagList from "../fieldComponents/tagList"
|
||||||
import keyvalList from "../fieldComponents/keyvalList"
|
import keyvalList from "../fieldComponents/keyvalList"
|
||||||
|
|
||||||
|
import taskSubmitter from "../genericComponents/taskSubmitter"
|
||||||
|
|
||||||
// Export main app
|
// Export main app
|
||||||
export default {
|
export default {
|
||||||
name: 'paneCapture',
|
name: 'paneCapture',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
tagList,
|
tagList,
|
||||||
keyvalList
|
keyvalList,
|
||||||
|
taskSubmitter
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -178,7 +184,6 @@ export default {
|
||||||
resizeCapture: false,
|
resizeCapture: false,
|
||||||
captureNotes: "",
|
captureNotes: "",
|
||||||
scanCapture: false,
|
scanCapture: false,
|
||||||
isScanning: false,
|
|
||||||
scanDeltaZ: 'Medium',
|
scanDeltaZ: 'Medium',
|
||||||
scanStyle: 'Raster',
|
scanStyle: 'Raster',
|
||||||
scanStepSize: {
|
scanStepSize: {
|
||||||
|
|
@ -209,24 +214,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
handleScan: function() {
|
handleScan: function() {
|
||||||
var payload = this.basePayload
|
var payload = this.scanPayload
|
||||||
|
|
||||||
// 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()
|
|
||||||
|
|
||||||
// Convert AF selector to dz
|
|
||||||
var afDeltas = {
|
|
||||||
Off: 0,
|
|
||||||
Coarse: 100,
|
|
||||||
Medium: 30,
|
|
||||||
Fine: 10,
|
|
||||||
Fast: 1500
|
|
||||||
}
|
|
||||||
|
|
||||||
payload.autofocus_dz = afDeltas[this.scanDeltaZ]
|
|
||||||
payload.fast_autofocus = this.scanDeltaZ == "Fast"
|
|
||||||
|
|
||||||
// Do capture
|
// Do capture
|
||||||
this.newScanRequest(payload)
|
this.newScanRequest(payload)
|
||||||
|
|
@ -243,22 +231,18 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
newScanRequest: function(params) {
|
onScanSubmit: function(submitData) {
|
||||||
axios.post(this.scanApiUri, params)
|
// We don't need to do anything on this event yet
|
||||||
.then(response => {
|
console.log("onScanSubmit event triggered")
|
||||||
console.log("Task ID: " + response.data.id)
|
},
|
||||||
this.isScanning = true
|
|
||||||
return this.$store.dispatch('pollTask', [response.data.id, 3600, 5])
|
onScanResponse: function(responseData) {
|
||||||
})
|
console.log("Scan finished with response data: ", responseData)
|
||||||
.then(() => {
|
this.modalNotify("Finished scan.")
|
||||||
this.modalNotify("Finished scan.")
|
},
|
||||||
})
|
|
||||||
.catch(error => {
|
onScanError: function(error) {
|
||||||
this.modalError(error)
|
this.modalError(error)
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
this.isScanning = false
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
@ -306,7 +290,31 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
return payload
|
return payload
|
||||||
}
|
},
|
||||||
|
|
||||||
|
scanPayload: function() {
|
||||||
|
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()
|
||||||
|
|
||||||
|
// Convert AF selector to dz
|
||||||
|
var afDeltas = {
|
||||||
|
Off: 0,
|
||||||
|
Coarse: 100,
|
||||||
|
Medium: 30,
|
||||||
|
Fine: 10,
|
||||||
|
Fast: 1500
|
||||||
|
}
|
||||||
|
|
||||||
|
payload.autofocus_dz = afDeltas[this.scanDeltaZ]
|
||||||
|
payload.fast_autofocus = this.scanDeltaZ == "Fast"
|
||||||
|
|
||||||
|
return payload
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue