2019-09-28 21:42:04 +03:00
|
|
|
<template>
|
2020-06-26 04:39:14 -07:00
|
|
|
<div>
|
2020-07-31 13:50:50 -07:00
|
|
|
<span>Version: {{ settings.version }}</span>
|
|
|
|
|
—
|
2020-09-10 19:20:16 -07:00
|
|
|
<div v-if="settings.hardwareModel !== ''">
|
|
|
|
|
<span>Hardware model: {{ settings.hardwareModel }}</span>
|
|
|
|
|
—
|
|
|
|
|
</div>
|
2020-07-31 13:50:50 -07:00
|
|
|
<span>Platform: {{ settings.hardwarePlatform }}</span>
|
|
|
|
|
—
|
|
|
|
|
<span>GPU Acceleration: {{ settings.gpuAcceleration ? "Enabled" : "Unsupported" }}{{ settings.gpuAcceleration ? " (" + settings.gpuAcceleration + " mode)" : "" }}</span>
|
|
|
|
|
<v-row>
|
|
|
|
|
<v-col
|
|
|
|
|
cols="12"
|
|
|
|
|
sm="6"
|
2020-08-14 12:39:21 -07:00
|
|
|
lg="3"
|
2020-06-26 04:39:14 -07:00
|
|
|
>
|
2020-07-31 13:50:50 -07:00
|
|
|
<v-btn
|
|
|
|
|
color="secondary"
|
|
|
|
|
@click="$refs.exportSettings.click()"
|
|
|
|
|
>
|
|
|
|
|
<v-icon left>
|
|
|
|
|
mdi-download
|
|
|
|
|
</v-icon> Export Settings
|
|
|
|
|
</v-btn>
|
|
|
|
|
</v-col>
|
|
|
|
|
<v-col
|
|
|
|
|
cols="12"
|
|
|
|
|
sm="6"
|
2020-08-14 12:39:21 -07:00
|
|
|
lg="3"
|
2020-06-26 04:39:14 -07:00
|
|
|
>
|
2020-07-31 13:50:50 -07:00
|
|
|
<v-btn
|
|
|
|
|
color="secondary"
|
|
|
|
|
@click="$refs.importSettings.click()"
|
|
|
|
|
>
|
|
|
|
|
<v-icon left>
|
|
|
|
|
mdi-upload
|
|
|
|
|
</v-icon> Import Settings
|
|
|
|
|
</v-btn>
|
|
|
|
|
</v-col>
|
|
|
|
|
<v-col
|
|
|
|
|
cols="12"
|
2020-08-14 12:39:21 -07:00
|
|
|
lg="3"
|
2020-07-31 13:50:50 -07:00
|
|
|
>
|
|
|
|
|
<v-btn
|
|
|
|
|
color="red"
|
2020-09-10 19:20:16 -07:00
|
|
|
@click="restartProgram()"
|
2020-08-14 12:39:21 -07:00
|
|
|
>
|
|
|
|
|
<v-icon left>
|
|
|
|
|
mdi-restart
|
|
|
|
|
</v-icon> Restart Photon
|
|
|
|
|
</v-btn>
|
|
|
|
|
</v-col>
|
|
|
|
|
<v-col
|
|
|
|
|
cols="12"
|
|
|
|
|
lg="3"
|
|
|
|
|
>
|
|
|
|
|
<v-btn
|
|
|
|
|
color="red"
|
2020-09-10 19:20:16 -07:00
|
|
|
@click="restartDevice()"
|
2020-07-31 13:50:50 -07:00
|
|
|
>
|
|
|
|
|
<v-icon left>
|
|
|
|
|
mdi-restart
|
|
|
|
|
</v-icon> Restart Device
|
|
|
|
|
</v-btn>
|
|
|
|
|
</v-col>
|
|
|
|
|
</v-row>
|
2020-06-26 04:39:14 -07:00
|
|
|
<v-snackbar
|
|
|
|
|
v-model="snack"
|
|
|
|
|
top
|
|
|
|
|
:color="snackbar.color"
|
2020-09-04 18:18:44 -07:00
|
|
|
timeout="0"
|
2020-06-26 04:39:14 -07:00
|
|
|
>
|
|
|
|
|
<span>{{ snackbar.text }}</span>
|
|
|
|
|
</v-snackbar>
|
2020-07-31 13:50:50 -07:00
|
|
|
|
|
|
|
|
<!-- Special hidden upload input that gets 'clicked' when the user imports settings -->
|
|
|
|
|
<input
|
|
|
|
|
ref="importSettings"
|
|
|
|
|
type="file"
|
|
|
|
|
accept=".zip"
|
|
|
|
|
style="display: none;"
|
|
|
|
|
|
|
|
|
|
@change="readImportedSettings"
|
|
|
|
|
>
|
|
|
|
|
<!-- Special hidden link that gets 'clicked' when the user exports settings -->
|
|
|
|
|
<a
|
|
|
|
|
ref="exportSettings"
|
|
|
|
|
style="color: black; text-decoration: none; display: none"
|
2020-08-14 12:39:21 -07:00
|
|
|
:href="'http://' + this.$address + '/api/settings/photonvision_config.zip'"
|
2020-07-31 13:50:50 -07:00
|
|
|
download="photonvision-settings.zip"
|
|
|
|
|
/>
|
2020-06-26 04:39:14 -07:00
|
|
|
</div>
|
2019-09-28 21:42:04 +03:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-08-14 12:39:21 -07:00
|
|
|
export default {
|
|
|
|
|
name: 'General',
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2020-07-31 13:50:50 -07:00
|
|
|
snack: false,
|
|
|
|
|
snackbar: {
|
2020-08-14 12:39:21 -07:00
|
|
|
color: "success",
|
|
|
|
|
text: ""
|
2020-07-31 13:50:50 -07:00
|
|
|
},
|
2020-08-14 12:39:21 -07:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
settings() {
|
2020-07-31 13:50:50 -07:00
|
|
|
return this.$store.state.settings.general;
|
2020-08-14 12:39:21 -07:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2020-09-10 19:20:16 -07:00
|
|
|
restartProgram() {
|
|
|
|
|
this.axios.post('http://' + this.$address + '/api/restartProgram', {});
|
|
|
|
|
},
|
|
|
|
|
restartDevice() {
|
|
|
|
|
this.axios.post('http://' + this.$address + '/api/restartDevice', {});
|
|
|
|
|
},
|
2020-08-14 12:39:21 -07:00
|
|
|
readImportedSettings(event) {
|
2020-07-31 13:50:50 -07:00
|
|
|
let formData = new FormData();
|
|
|
|
|
formData.append("zipData", event.target.files[0]);
|
|
|
|
|
this.axios.post("http://" + this.$address + "/api/settings/import", formData,
|
2020-08-14 12:39:21 -07:00
|
|
|
{headers: {"Content-Type": "multipart/form-data"}}).then(() => {
|
|
|
|
|
this.snackbar = {
|
|
|
|
|
color: "success",
|
2020-09-04 18:18:44 -07:00
|
|
|
text: "Settings imported successfully! Program will now exit...",
|
2020-08-14 12:39:21 -07:00
|
|
|
};
|
2020-09-04 18:18:44 -07:00
|
|
|
this.snack = true;
|
2020-07-31 13:50:50 -07:00
|
|
|
}).catch(() => {
|
2020-08-14 12:39:21 -07:00
|
|
|
this.snackbar = {
|
2020-09-04 18:18:44 -07:00
|
|
|
color: "success",
|
|
|
|
|
text: "Settings imported successfully! Program will now exit...",
|
|
|
|
|
};
|
|
|
|
|
this.snack = true;
|
2020-07-31 13:50:50 -07:00
|
|
|
});
|
2020-08-14 12:39:21 -07:00
|
|
|
},
|
2019-09-28 21:42:04 +03:00
|
|
|
}
|
2020-08-14 12:39:21 -07:00
|
|
|
}
|
2019-09-28 21:42:04 +03:00
|
|
|
</script>
|
|
|
|
|
|
2020-07-31 13:50:50 -07:00
|
|
|
<style lang="css" scoped>
|
2020-08-14 12:39:21 -07:00
|
|
|
.v-btn {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
2019-09-28 21:42:04 +03:00
|
|
|
</style>
|