Dedicated power menu
This commit is contained in:
parent
27ed10e27f
commit
14672c260f
3 changed files with 91 additions and 46 deletions
|
|
@ -138,6 +138,7 @@ import viewContent from "./tabContentComponents/viewContent.vue";
|
||||||
import settingsContent from "./tabContentComponents/settingsContent.vue";
|
import settingsContent from "./tabContentComponents/settingsContent.vue";
|
||||||
import aboutContent from "./tabContentComponents/aboutContent.vue";
|
import aboutContent from "./tabContentComponents/aboutContent.vue";
|
||||||
import loggingContent from "./tabContentComponents/loggingContent.vue";
|
import loggingContent from "./tabContentComponents/loggingContent.vue";
|
||||||
|
import powerContent from "./tabContentComponents/powerContent.vue";
|
||||||
// ImJoy is loaded asynchronously to allow it to be disabled if needed
|
// ImJoy is loaded asynchronously to allow it to be disabled if needed
|
||||||
const imjoyContent = () =>
|
const imjoyContent = () =>
|
||||||
import(
|
import(
|
||||||
|
|
@ -164,6 +165,7 @@ export default {
|
||||||
aboutContent,
|
aboutContent,
|
||||||
loggingContent,
|
loggingContent,
|
||||||
TabIcon,
|
TabIcon,
|
||||||
|
powerContent,
|
||||||
imjoyContent
|
imjoyContent
|
||||||
},
|
},
|
||||||
data: function() {
|
data: function() {
|
||||||
|
|
@ -185,6 +187,11 @@ export default {
|
||||||
id: "about",
|
id: "about",
|
||||||
icon: "info",
|
icon: "info",
|
||||||
component: aboutContent
|
component: aboutContent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "power",
|
||||||
|
icon: "power_settings_new",
|
||||||
|
component: powerContent
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
||||||
84
webapp/src/components/tabContentComponents/powerContent.vue
Normal file
84
webapp/src/components/tabContentComponents/powerContent.vue
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
<template>
|
||||||
|
<!-- Grid managing tab content -->
|
||||||
|
<div class="center">
|
||||||
|
<h1 style="text-align: center;"> Power</h1>
|
||||||
|
<p style="text-align: center;"> It's essential to turn off your OpenFlexure Microscope here before unplugging it.
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
Unplugging the microscope unexpectedly can damage the SD card or onboard computer.
|
||||||
|
</p>
|
||||||
|
<div class="buttons">
|
||||||
|
<button
|
||||||
|
v-show="'shutdown' in things.system_control.actions"
|
||||||
|
class="uk-button uk-button-primary uk-width-1-3"
|
||||||
|
@click="systemRequest('shutdown')"
|
||||||
|
>
|
||||||
|
Shutdown
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
v-show="'reboot' in things.system_control.actions"
|
||||||
|
class="uk-button uk-button-primary uk-width-1-3"
|
||||||
|
@click="systemRequest('reboot')"
|
||||||
|
>
|
||||||
|
Restart
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "PowerContent",
|
||||||
|
|
||||||
|
components: {},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
things: function() {
|
||||||
|
return this.$store.getters["wot/thingDescriptions"];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
systemRequest: function(action) {
|
||||||
|
let message = "";
|
||||||
|
if (action == "reboot") {
|
||||||
|
message = "Restart microscope?"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message = "Shutdown microscope?"
|
||||||
|
}
|
||||||
|
this.modalConfirm(message).then(
|
||||||
|
() => {
|
||||||
|
this.$store.commit("resetState");
|
||||||
|
this.$store.commit("wot/deleteAllThingDescriptions");
|
||||||
|
// Post and silence errors
|
||||||
|
axios
|
||||||
|
.post(this.thingActionUrl("system_control", action))
|
||||||
|
.catch(() => {});
|
||||||
|
},
|
||||||
|
() => {}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
// Custom UIkit CSS modifications
|
||||||
|
@import "../../assets/less/theme.less";
|
||||||
|
|
||||||
|
.center {
|
||||||
|
right: 50%;
|
||||||
|
bottom: 50%;
|
||||||
|
transform: translate(50%,50%);
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uk-button {
|
||||||
|
display: inline;
|
||||||
|
text-align:center;
|
||||||
|
margin: 30px 30px 30px 30px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -63,25 +63,6 @@
|
||||||
action="save_all_thing_settings"
|
action="save_all_thing_settings"
|
||||||
submit-label="Save All Settings"
|
submit-label="Save All Settings"
|
||||||
/>
|
/>
|
||||||
<div>
|
|
||||||
<button
|
|
||||||
v-show="'shutdown' in things.system_control.actions"
|
|
||||||
class="uk-button uk-button-primary uk-margin uk-margin-remove-top uk-width-1-1"
|
|
||||||
@click="systemRequest('shutdown')"
|
|
||||||
>
|
|
||||||
Shutdown
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<button
|
|
||||||
v-show="'reboot' in things.system_control.actions"
|
|
||||||
class="uk-button uk-button-primary uk-margin uk-margin-remove-top uk-width-1-1"
|
|
||||||
@click="systemRequest('reboot')"
|
|
||||||
>
|
|
||||||
Restart
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="view-component uk-width-expand uk-padding-small">
|
<div class="view-component uk-width-expand uk-padding-small">
|
||||||
<tabContent
|
<tabContent
|
||||||
|
|
@ -129,7 +110,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import axios from "axios";
|
|
||||||
import streamSettings from "./settingsComponents/streamSettings.vue";
|
import streamSettings from "./settingsComponents/streamSettings.vue";
|
||||||
import cameraSettings from "./settingsComponents/cameraSettings.vue";
|
import cameraSettings from "./settingsComponents/cameraSettings.vue";
|
||||||
import appSettings from "./settingsComponents/appSettings.vue";
|
import appSettings from "./settingsComponents/appSettings.vue";
|
||||||
|
|
@ -155,12 +135,6 @@ export default {
|
||||||
ActionButton
|
ActionButton
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
|
||||||
things: function() {
|
|
||||||
return this.$store.getters["wot/thingDescriptions"];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
selected: "display",
|
selected: "display",
|
||||||
|
|
@ -174,26 +148,6 @@ export default {
|
||||||
this.currentTab = tab;
|
this.currentTab = tab;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
systemRequest: function(action) {
|
|
||||||
let message = "";
|
|
||||||
if (action == "reboot") {
|
|
||||||
message = "Restart microscope?"
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
message = "Shutdown microscope?"
|
|
||||||
}
|
|
||||||
this.modalConfirm(message).then(
|
|
||||||
() => {
|
|
||||||
this.$store.commit("resetState");
|
|
||||||
this.$store.commit("wot/deleteAllThingDescriptions");
|
|
||||||
// Post and silence errors
|
|
||||||
axios
|
|
||||||
.post(this.thingActionUrl("system_control", action))
|
|
||||||
.catch(() => {});
|
|
||||||
},
|
|
||||||
() => {}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue