From 37dcc2c796598ab99d9dd416343d93d0527eb327 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Mon, 4 Nov 2019 16:34:19 +0000 Subject: [PATCH] Updated tile scan to new taskSubmitter component --- .../controlComponents/paneCapture.vue | 96 ++++++++++--------- 1 file changed, 52 insertions(+), 44 deletions(-) diff --git a/src/components/controlComponents/paneCapture.vue b/src/components/controlComponents/paneCapture.vue index 734f56c0..f0e71bfb 100644 --- a/src/components/controlComponents/paneCapture.vue +++ b/src/components/controlComponents/paneCapture.vue @@ -63,12 +63,7 @@
  • Stack and Scan -
    -
    -
    -
    -
    -
    +
    @@ -147,7 +142,15 @@
  • - + + + @@ -159,13 +162,16 @@ import axios from 'axios' import tagList from "../fieldComponents/tagList" import keyvalList from "../fieldComponents/keyvalList" +import taskSubmitter from "../genericComponents/taskSubmitter" + // Export main app export default { name: 'paneCapture', components: { tagList, - keyvalList + keyvalList, + taskSubmitter }, @@ -178,7 +184,6 @@ export default { resizeCapture: false, captureNotes: "", scanCapture: false, - isScanning: false, scanDeltaZ: 'Medium', scanStyle: 'Raster', scanStepSize: { @@ -209,24 +214,7 @@ export default { }, handleScan: 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" + var payload = this.scanPayload // Do capture this.newScanRequest(payload) @@ -243,22 +231,18 @@ export default { }) }, - newScanRequest: function(params) { - axios.post(this.scanApiUri, params) - .then(response => { - console.log("Task ID: " + response.data.id) - this.isScanning = true - return this.$store.dispatch('pollTask', [response.data.id, 3600, 5]) - }) - .then(() => { - this.modalNotify("Finished scan.") - }) - .catch(error => { - this.modalError(error) - }) - .finally(() => { - this.isScanning = false - }) + 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) } }, @@ -306,7 +290,31 @@ export default { } 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 + }, + } }