diff --git a/src/components/OpenwbBaseHeading.vue b/src/components/OpenwbBaseHeading.vue index b259289c..aee732b2 100644 --- a/src/components/OpenwbBaseHeading.vue +++ b/src/components/OpenwbBaseHeading.vue @@ -1,5 +1,5 @@ diff --git a/src/components/web_themes/OpenwbWebThemeProxy.vue b/src/components/web_themes/OpenwbWebThemeProxy.vue new file mode 100644 index 00000000..d479d08f --- /dev/null +++ b/src/components/web_themes/OpenwbWebThemeProxy.vue @@ -0,0 +1,36 @@ + + + diff --git a/src/views/GeneralConfig.vue b/src/views/GeneralConfig.vue index 25185157..6d2c0b37 100644 --- a/src/views/GeneralConfig.vue +++ b/src/views/GeneralConfig.vue @@ -411,7 +411,7 @@ --> - +
Diese Einstellungen sind nicht verfügbar, solange sich @@ -419,6 +419,48 @@
+ + Hauptseite + +
+ + +
+
+ Lade-Log import ComponentState from "../components/mixins/ComponentState.vue"; +import OpenwbWebThemeProxy from "../components/web_themes/OpenwbWebThemeProxy.vue"; export default { name: "OpenwbGeneralConfig", mixins: [ComponentState], + components: { OpenwbWebThemeProxy }, data() { return { mqttTopicsToSubscribe: [ @@ -482,8 +526,51 @@ export default { "openWB/general/notifications/smart_home", "openWB/general/price_kwh", "openWB/general/range_unit", + "openWB/general/web_theme", + "openWB/system/configurable/web_themes", ], }; }, + computed: { + webThemeList: { + get() { + return this.$store.state.mqtt[ + "openWB/system/configurable/web_themes" + ]; + }, + }, + }, + methods: { + getWebThemeDefaultConfiguration(webThemeType) { + const webThemeDefaults = this.webThemeList.find( + (element) => element.value == webThemeType + ); + if ( + Object.prototype.hasOwnProperty.call( + webThemeDefaults, + "defaults" + ) + ) { + return { ...webThemeDefaults.defaults.configuration }; + } + console.warn( + "no default configuration found for web theme type!", + webThemeType + ); + return {}; + }, + updateSelectedWebTheme($event) { + this.updateState("openWB/general/web_theme", $event, "type"); + this.updateState( + "openWB/general/web_theme", + this.getWebThemeDefaultConfiguration($event), + "configuration" + ); + }, + updateConfiguration(key, event) { + console.debug("updateConfiguration", key, event); + this.updateState(key, event.value, event.object); + }, + }, };