Updated to new API structure

This commit is contained in:
Joel Collins 2020-01-14 16:10:05 +00:00
parent 733b6f4b61
commit fcdb30eedf
11 changed files with 113 additions and 115 deletions

View file

@ -313,7 +313,7 @@ export default {
return `${this.$store.getters.baseUri}/api/v2/actions/camera/capture`;
},
pluginsUri: function() {
return `${this.$store.getters.baseUri}/api/v2/plugins`;
return `${this.$store.getters.baseUri}/api/v2/extensions`;
},
settingsFovUri: function() {
return `${this.$store.getters.baseUri}/api/v2/settings/fov`;
@ -395,7 +395,7 @@ export default {
// Flash the stream (capture animation)
this.$root.$emit("globalFlashStream");
// Update the global capture list
this.$root.$emit("globalUpdateCaptureList");
this.$root.$emit("globalUpdateCaptures");
})
.catch(error => {
this.modalError(error); // Let mixin handle error
@ -407,12 +407,13 @@ export default {
.get(this.pluginsUri) // Get a list of plugins
.then(response => {
var plugins = response.data;
var foundExtension = plugins.find(
e => e.title === "org.openflexure.scan"
);
// if ScanPlugin is enabled
if ("ScanPlugin" in plugins) {
if (foundExtension) {
// Get plugin action link
var link = plugins.ScanPlugin.views.tile.links.self;
// Store plugin action URI
this.scanUri = `${this.$store.getters.baseUri}${link}`;
this.scanUri = foundExtension.links.tile.href;
}
})
.catch(error => {
@ -422,7 +423,7 @@ export default {
updateScanStepSize: function() {
axios
.get(this.settingsFovUri) // Get a list of plugins
.get(this.settingsFovUri) // Get the microscope FOV
.then(response => {
this.scanStepSize = {
x: parseInt(0.5 * response.data[0]),

View file

@ -196,7 +196,7 @@ export default {
return `${this.$store.getters.baseUri}/api/v2/status/stage/position`;
},
pluginsUri: function() {
return `${this.$store.getters.baseUri}/api/v2/plugins`;
return `${this.$store.getters.baseUri}/api/v2/extensions`;
}
},
@ -352,17 +352,14 @@ export default {
.get(this.pluginsUri) // Get a list of plugins
.then(response => {
var plugins = response.data;
var foundExtension = plugins.find(
e => e.title === "org.openflexure.autofocus"
);
// if ScanPlugin is enabled
if ("AutofocusPlugin" in plugins) {
if (foundExtension) {
// Get plugin action link
var fastLink =
plugins.AutofocusPlugin.views.fast_autofocus.links.self;
var normalLink = plugins.AutofocusPlugin.views.autofocus.links.self;
// Store plugin action URI
this.fastAutofocusUri = `${this.$store.getters.baseUri}${fastLink}`;
this.normalAutofocusUri = `${
this.$store.getters.baseUri
}${normalLink}`;
this.fastAutofocusUri = foundExtension.links.fast_autofocus.href;
this.normalAutofocusUri = foundExtension.links.autofocus.href;
}
})
.catch(error => {

View file

@ -144,16 +144,14 @@ export default {
.get(this.actionsUri)
.then(response => {
if ("reboot" in response.data) {
this.systemActionLinks.reboot = `${this.$store.getters.baseUri}${
response.data.reboot.links.self
}`;
this.systemActionLinks.reboot =
response.data.reboot.links.self.href;
} else {
delete this.systemActionLinks.reboot;
}
if ("shutdown" in response.data) {
this.systemActionLinks.shutdown = `${this.$store.getters.baseUri}${
response.data.shutdown.links.self
}`;
this.systemActionLinks.shutdown =
response.data.shutdown.links.self.href;
} else {
delete this.systemActionLinks.shutdown;
}

View file

@ -96,7 +96,7 @@ export default {
return `${this.$store.getters.baseUri}/api/v2/settings`;
},
pluginsUri: function() {
return `${this.$store.getters.baseUri}/api/v2/plugins`;
return `${this.$store.getters.baseUri}/api/v2/extensions`;
}
},
@ -122,13 +122,13 @@ export default {
.get(this.pluginsUri) // Get a list of plugins
.then(response => {
var plugins = response.data;
var foundExtension = plugins.find(
e => e.title === "org.openflexure.calibration.picamera"
);
// if AutocalibrationPlugin is enabled
if ("AutocalibrationPlugin" in plugins) {
if (foundExtension) {
// Get plugin action link
var link =
plugins.AutocalibrationPlugin.views.recalibrate.links.self;
// Store plugin action URI
this.recalibrationUri = `${this.$store.getters.baseUri}${link}`;
this.recalibrationUri = foundExtension.links.recalibrate.href;
}
})
.catch(error => {