Upgraded to API v2
This commit is contained in:
parent
6b9d83f26a
commit
a0cd7fc39a
1 changed files with 38 additions and 21 deletions
|
|
@ -101,8 +101,8 @@
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<ul uk-accordion="multiple: true; animation: false">
|
<ul uk-accordion="multiple: true; animation: false">
|
||||||
<!--Show stack and scan if default plugin is enabled-->
|
<!--Show stack and scan if scan plugin is enabled-->
|
||||||
<li v-if="this.$store.state.apiState.plugin.includes('default_scan')">
|
<li v-if="scanUri">
|
||||||
<a class="uk-accordion-title" href="#">Stack and Scan</a>
|
<a class="uk-accordion-title" href="#">Stack and Scan</a>
|
||||||
<div class="uk-accordion-content">
|
<div class="uk-accordion-content">
|
||||||
<div class="uk-margin">
|
<div class="uk-margin">
|
||||||
|
|
@ -234,7 +234,7 @@
|
||||||
|
|
||||||
<taskSubmitter
|
<taskSubmitter
|
||||||
v-if="scanCapture"
|
v-if="scanCapture"
|
||||||
:submit-url="scanApiUri"
|
:submit-url="scanUri"
|
||||||
:submit-data="scanPayload"
|
:submit-data="scanPayload"
|
||||||
:submit-label="'Start Scan'"
|
:submit-label="'Start Scan'"
|
||||||
@submit="onScanSubmit"
|
@submit="onScanSubmit"
|
||||||
|
|
@ -296,7 +296,8 @@ export default {
|
||||||
tags: [],
|
tags: [],
|
||||||
metadata: {
|
metadata: {
|
||||||
Client: `${process.env.PACKAGE.name}.${process.env.PACKAGE.version}`
|
Client: `${process.env.PACKAGE.name}.${process.env.PACKAGE.version}`
|
||||||
}
|
},
|
||||||
|
scanUri: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -306,11 +307,15 @@ export default {
|
||||||
"uk-disabled": !this.resizeCapture
|
"uk-disabled": !this.resizeCapture
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
captureApiUri: function() {
|
captureActionUri: function() {
|
||||||
return this.$store.getters.uri + "/camera/capture";
|
return `http://${this.$store.state.host}:${
|
||||||
|
this.$store.state.port
|
||||||
|
}/api/v2/actions/camera/capture`;
|
||||||
},
|
},
|
||||||
scanApiUri: function() {
|
pluginsUri: function() {
|
||||||
return this.$store.getters.uri + "/plugin/default/scan/tile";
|
return `http://${this.$store.state.host}:${
|
||||||
|
this.$store.state.port
|
||||||
|
}/api/v2/plugins`;
|
||||||
},
|
},
|
||||||
basePayload: function() {
|
basePayload: function() {
|
||||||
var payload = {};
|
var payload = {};
|
||||||
|
|
@ -373,25 +378,17 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.updateScanUri();
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
handleCapture: function() {
|
handleCapture: function() {
|
||||||
var payload = this.basePayload;
|
var payload = this.basePayload;
|
||||||
|
|
||||||
// Do capture
|
// Do capture
|
||||||
this.newCaptureRequest(payload);
|
|
||||||
},
|
|
||||||
|
|
||||||
handleScan: function() {
|
|
||||||
var payload = this.scanPayload;
|
|
||||||
|
|
||||||
// Do capture
|
|
||||||
this.newScanRequest(payload);
|
|
||||||
},
|
|
||||||
|
|
||||||
newCaptureRequest: function(params) {
|
|
||||||
// Send move request
|
|
||||||
axios
|
axios
|
||||||
.post(this.captureApiUri, params)
|
.post(this.captureActionUri, payload)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// Flash the stream (capture animation)
|
// Flash the stream (capture animation)
|
||||||
this.$root.$emit("globalFlashStream");
|
this.$root.$emit("globalFlashStream");
|
||||||
|
|
@ -403,6 +400,26 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateScanUri: function() {
|
||||||
|
axios
|
||||||
|
.get(this.pluginsUri) // Get a list of plugins
|
||||||
|
.then(response => {
|
||||||
|
var plugins = response.data;
|
||||||
|
// if ScanPlugin is enabled
|
||||||
|
if ("ScanPlugin" in plugins) {
|
||||||
|
// Get plugin action link
|
||||||
|
var link = plugins.ScanPlugin.views.tile.links.self;
|
||||||
|
// Store plugin action URI
|
||||||
|
this.scanUri = `http://${this.$store.state.host}:${
|
||||||
|
this.$store.state.port
|
||||||
|
}${link}`;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
this.modalError(error); // Let mixin handle error
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
onScanSubmit: function() {},
|
onScanSubmit: function() {},
|
||||||
|
|
||||||
onScanResponse: function(responseData) {
|
onScanResponse: function(responseData) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue