2019-09-20 20:56:24 +03:00
|
|
|
<template>
|
2020-06-26 04:39:14 -07:00
|
|
|
<div>
|
2020-07-31 13:50:50 -07:00
|
|
|
<v-row
|
|
|
|
|
class="pa-3"
|
|
|
|
|
no-gutters
|
|
|
|
|
>
|
2020-06-26 04:39:14 -07:00
|
|
|
<v-col
|
2020-07-31 13:50:50 -07:00
|
|
|
cols="12"
|
|
|
|
|
style="max-width: 1400px"
|
2020-06-26 04:39:14 -07:00
|
|
|
>
|
2020-07-31 13:50:50 -07:00
|
|
|
<v-form
|
|
|
|
|
ref="form"
|
|
|
|
|
v-model="valid"
|
2020-06-26 04:39:14 -07:00
|
|
|
>
|
2020-07-31 13:50:50 -07:00
|
|
|
<v-card
|
|
|
|
|
v-for="item in tabList"
|
|
|
|
|
:key="item.name"
|
|
|
|
|
dark
|
|
|
|
|
class="mb-3 pr-6 pb-3"
|
|
|
|
|
style="background-color: #006492;"
|
|
|
|
|
>
|
|
|
|
|
<v-card-title>{{ item.name }}</v-card-title>
|
|
|
|
|
<component
|
|
|
|
|
:is="item"
|
|
|
|
|
class="ml-5"
|
|
|
|
|
/>
|
|
|
|
|
</v-card>
|
|
|
|
|
<v-btn
|
|
|
|
|
color="accent"
|
|
|
|
|
style="color: black; width: 100%;"
|
|
|
|
|
:disabled="!valid"
|
|
|
|
|
@click="sendGeneralSettings()"
|
|
|
|
|
>
|
|
|
|
|
Save
|
|
|
|
|
</v-btn>
|
|
|
|
|
</v-form>
|
2020-06-26 04:39:14 -07:00
|
|
|
</v-col>
|
|
|
|
|
</v-row>
|
2020-07-31 13:50:50 -07:00
|
|
|
<v-snackbar
|
|
|
|
|
v-model="snack"
|
|
|
|
|
top
|
|
|
|
|
:color="snackbar.color"
|
|
|
|
|
>
|
|
|
|
|
<span>{{ snackbar.text }}</span>
|
|
|
|
|
</v-snackbar>
|
2020-06-26 04:39:14 -07:00
|
|
|
</div>
|
2019-09-20 20:56:24 +03:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-07-31 13:50:50 -07:00
|
|
|
import Networking from './SettingsViews/Networking'
|
|
|
|
|
import Lighting from "./SettingsViews/Lighting";
|
2020-05-25 22:46:44 +03:00
|
|
|
import cvImage from '../components/common/cv-image'
|
2020-07-31 13:50:50 -07:00
|
|
|
import General from "./SettingsViews/General";
|
2019-11-30 19:24:03 +02:00
|
|
|
|
2019-10-02 23:37:35 +03:00
|
|
|
|
2019-09-20 20:56:24 +03:00
|
|
|
export default {
|
2019-09-22 00:14:12 +03:00
|
|
|
name: 'SettingsTab',
|
2019-10-29 23:58:06 +02:00
|
|
|
components: {
|
2020-05-25 22:46:44 +03:00
|
|
|
cvImage,
|
2020-07-31 13:50:50 -07:00
|
|
|
// General,
|
2019-09-28 21:42:04 +03:00
|
|
|
},
|
2019-09-20 20:56:24 +03:00
|
|
|
data() {
|
|
|
|
|
return {
|
2019-10-29 23:58:06 +02:00
|
|
|
selectedTab: 0,
|
2020-07-31 13:50:50 -07:00
|
|
|
valid: true, // Are all settings valid
|
|
|
|
|
snack: false,
|
|
|
|
|
snackbar: {
|
|
|
|
|
color: "accent",
|
|
|
|
|
text: ""
|
|
|
|
|
},
|
2019-09-28 21:42:04 +03:00
|
|
|
}
|
|
|
|
|
},
|
2019-10-29 23:58:06 +02:00
|
|
|
computed: {
|
2019-11-01 17:10:48 +02:00
|
|
|
selectedComponent: {
|
|
|
|
|
get() {
|
2020-01-28 10:44:52 -08:00
|
|
|
return this.tabList[this.selectedTab];
|
2019-09-28 21:42:04 +03:00
|
|
|
}
|
2019-10-02 22:07:04 +03:00
|
|
|
},
|
2020-07-31 13:50:50 -07:00
|
|
|
settings: {
|
|
|
|
|
get() {
|
|
|
|
|
return this.$store.state.settings;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
tabList: {
|
|
|
|
|
get() {
|
|
|
|
|
return [General, Networking].concat(this.$store.state.settings.lighting.supported ? Lighting : []);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
sendGeneralSettings() {
|
|
|
|
|
const self = this;
|
|
|
|
|
this.axios.post("http://" + this.$address + "/api/settings/general", this.settings).then(
|
|
|
|
|
function (response) {
|
|
|
|
|
if (response.status === 200) {
|
|
|
|
|
self.snackbar = {
|
|
|
|
|
color: "success",
|
|
|
|
|
text: "Settings updated successfully"
|
|
|
|
|
};
|
|
|
|
|
self.snack = true;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
function (error) {
|
|
|
|
|
self.snackbar = {
|
|
|
|
|
color: "error",
|
|
|
|
|
text: (error.response || {data: "Couldn't save settings"}).data
|
|
|
|
|
};
|
|
|
|
|
self.snack = true;
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
},
|
2019-09-20 20:56:24 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
2019-09-28 02:17:18 +03:00
|
|
|
<style scoped>
|
2019-10-29 23:58:06 +02:00
|
|
|
.videoClass {
|
2019-10-02 23:37:35 +03:00
|
|
|
text-align: center;
|
|
|
|
|
}
|
2019-10-29 23:58:06 +02:00
|
|
|
|
|
|
|
|
.videoClass img {
|
2019-10-24 21:27:49 +03:00
|
|
|
padding-top: 10px;
|
2019-10-02 23:37:35 +03:00
|
|
|
height: auto !important;
|
|
|
|
|
vertical-align: middle;
|
2019-09-28 02:17:18 +03:00
|
|
|
}
|
2019-09-20 20:56:24 +03:00
|
|
|
</style>
|