Fix "About" page
This commit is contained in:
parent
4e7fa44a73
commit
65f467af64
3 changed files with 43 additions and 84 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="host-input">
|
<div class="host-input">
|
||||||
<div v-if="configuration">
|
<div v-if="$store.state.available">
|
||||||
<div>
|
<div>
|
||||||
<div class="uk-margin-small-bottom">
|
<div class="uk-margin-small-bottom">
|
||||||
<b>API origin:</b>
|
<b>API origin:</b>
|
||||||
|
|
@ -11,13 +11,9 @@
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<div v-if="settings">
|
|
||||||
<b>Device name:</b> <br />
|
|
||||||
{{ settings.name }}
|
|
||||||
</div>
|
|
||||||
<div>
|
<div>
|
||||||
<b>Server version:</b> <br />
|
<b>Server version:</b> <br />
|
||||||
{{ configuration.application.version }}
|
TODO
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
@ -25,18 +21,18 @@
|
||||||
<div class="uk-margin-small-bottom">
|
<div class="uk-margin-small-bottom">
|
||||||
<b>Camera:</b>
|
<b>Camera:</b>
|
||||||
<br />
|
<br />
|
||||||
<div v-if="configuration.camera.type != 'MissingCamera'">
|
<div v-if="'camera' in things">
|
||||||
{{ configuration.camera.type }}
|
{{ things.camera.title }}
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="uk-text-danger"><b>No camera connected</b></div>
|
<div v-else class="uk-text-danger"><b>No camera configured</b></div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<b>Stage:</b>
|
<b>Stage:</b>
|
||||||
<br />
|
<br />
|
||||||
<div v-if="configuration.stage.type != 'MissingStage'">
|
<div v-if="'stage' in things">
|
||||||
{{ configuration.stage.type }}
|
{{ things.stage.title }}
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="uk-text-danger"><b>No stage connected</b></div>
|
<div v-else class="uk-text-danger"><b>No stage configured</b></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
@ -44,7 +40,7 @@
|
||||||
<div class="uk-grid-small uk-child-width-1-2" uk-grid>
|
<div class="uk-grid-small uk-child-width-1-2" uk-grid>
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
v-show="'shutdown' in systemActionLinks"
|
v-show="'shutdown' in systemControlActions"
|
||||||
class="uk-button uk-button-danger uk-float-right uk-margin uk-margin-remove-top uk-width-1-1"
|
class="uk-button uk-button-danger uk-float-right uk-margin uk-margin-remove-top uk-width-1-1"
|
||||||
@click="shutdownRequest"
|
@click="shutdownRequest"
|
||||||
>
|
>
|
||||||
|
|
@ -54,7 +50,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
v-show="'reboot' in systemActionLinks"
|
v-show="'reboot' in systemControlActions"
|
||||||
class="uk-button uk-button-danger uk-float-right uk-margin uk-margin-remove-top uk-width-1-1"
|
class="uk-button uk-button-danger uk-float-right uk-margin uk-margin-remove-top uk-width-1-1"
|
||||||
@click="rebootRequest"
|
@click="rebootRequest"
|
||||||
>
|
>
|
||||||
|
|
@ -83,87 +79,52 @@ export default {
|
||||||
|
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
configuration: null,
|
things: {},
|
||||||
settings: null,
|
systemControlActions: {}
|
||||||
systemActionLinks: {}
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
settingsUri: function() {
|
baseUri: function() {
|
||||||
return `${this.$store.getters.baseUri}/api/v2/instrument/settings`;
|
return `${this.$store.getters.baseUri}/`;
|
||||||
},
|
},
|
||||||
configurationUri: function() {
|
|
||||||
return `${this.$store.getters.baseUri}/api/v2/instrument/configuration`;
|
|
||||||
},
|
|
||||||
rootUri: function() {
|
|
||||||
return `${this.$store.getters.baseUri}/api/v2`;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted: function() {
|
mounted: function() {
|
||||||
// Watch for host 'ready', then update configuration
|
// Watch for host 'ready', then update configuration
|
||||||
this.updateConfiguration();
|
this.updateConfiguration();
|
||||||
this.updateSettings();
|
this.updateActions();
|
||||||
this.updateSystemActions();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
updateConfiguration: function() {
|
updateConfiguration: async function() {
|
||||||
axios
|
console.log("Showing the configuration is not yet fully implemented")
|
||||||
.get(this.configurationUri)
|
// Retrieve TDs for camera and stage
|
||||||
.then(response => {
|
let things = {};
|
||||||
this.configuration = response.data;
|
for (let thing of ["camera", "stage"]) {
|
||||||
})
|
try {
|
||||||
.catch(error => {
|
let response = await axios.get(this.baseUri + thing); // Get Thing Description
|
||||||
this.modalError(error); // Let mixin handle error
|
things[thing] = response.data;
|
||||||
});
|
} catch (error) {
|
||||||
|
console.log(thing + " was missing", error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.things = things; // We must set this.things in order to trigger the UI update
|
||||||
},
|
},
|
||||||
updateSettings: function() {
|
updateActions: async function() {
|
||||||
axios
|
try {
|
||||||
.get(this.settingsUri)
|
let response = await axios.get(this.baseUri + "system_control"); // Get Thing Description
|
||||||
.then(response => {
|
this.systemControlActions = response.data.actions;
|
||||||
this.settings = response.data;
|
} catch (error) {
|
||||||
})
|
console.log("system control was missing - shutdown/restart buttons will not appear", error)
|
||||||
.catch(error => {
|
}
|
||||||
this.modalError(error); // Let mixin handle error
|
|
||||||
});
|
|
||||||
},
|
|
||||||
updateSystemActions: function() {
|
|
||||||
axios
|
|
||||||
.get(this.rootUri)
|
|
||||||
.then(response => {
|
|
||||||
if ("RebootAPI" in response.data.actions) {
|
|
||||||
this.$set(
|
|
||||||
this.systemActionLinks,
|
|
||||||
"reboot",
|
|
||||||
`${this.$store.getters.baseUri}/api/v2/actions/system/reboot/`
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
delete this.systemActionLinks.reboot;
|
|
||||||
}
|
|
||||||
if ("ShutdownAPI" in response.data.actions) {
|
|
||||||
this.$set(
|
|
||||||
this.systemActionLinks,
|
|
||||||
"shutdown",
|
|
||||||
`${this.$store.getters.baseUri}/api/v2/actions/system/shutdown/`
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
delete this.systemActionLinks.shutdown;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
this.modalError(error); // Let mixin handle error
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
shutdownRequest: function() {
|
shutdownRequest: function() {
|
||||||
this.modalConfirm("Shut down microscope?").then(
|
this.modalConfirm("Shut down microscope?").then(
|
||||||
() => {
|
() => {
|
||||||
if ("shutdown" in this.systemActionLinks) {
|
this.$store.commit("resetState");
|
||||||
this.$store.commit("resetState");
|
// Post and silence errors
|
||||||
// Post and silence errors
|
axios.post(this.baseUri + 'shutdown').catch(() => {});
|
||||||
axios.post(this.systemActionLinks.shutdown).catch(() => {});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
() => {}
|
() => {}
|
||||||
);
|
);
|
||||||
|
|
@ -171,11 +132,9 @@ export default {
|
||||||
rebootRequest: function() {
|
rebootRequest: function() {
|
||||||
this.modalConfirm("Restart microscope?").then(
|
this.modalConfirm("Restart microscope?").then(
|
||||||
() => {
|
() => {
|
||||||
if ("reboot" in this.systemActionLinks) {
|
this.$store.commit("resetState");
|
||||||
this.$store.commit("resetState");
|
// Post and silence errors
|
||||||
// Post and silence errors
|
axios.post(this.baseUri + 'restart').catch(() => {});
|
||||||
axios.post(this.systemActionLinks.reboot).catch(() => {});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
() => {}
|
() => {}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,9 @@
|
||||||
class="uk-link"
|
class="uk-link"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://gitlab.com/openflexure/openflexure-microscope-server/-/issues"
|
href="https://gitlab.com/openflexure/openflexure-microscope-server/-/issues"
|
||||||
>Report an issue</a
|
|
||||||
>
|
>
|
||||||
|
Report an issue
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-padding-small">
|
<div class="uk-padding-small">
|
||||||
<h2>Developer tools</h2>
|
<h2>Developer tools</h2>
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,6 @@ export default {
|
||||||
updateActions: async function() {
|
updateActions: async function() {
|
||||||
try {
|
try {
|
||||||
let response = await axios.get(this.thingUri); // Get Thing Description
|
let response = await axios.get(this.thingUri); // Get Thing Description
|
||||||
console.log("CSM TD", response.data);
|
|
||||||
this.actions = response.data.actions;
|
this.actions = response.data.actions;
|
||||||
this.properties = response.data.properties;
|
this.properties = response.data.properties;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue