From 55fb40552d75d203b71509342604703a9dff88a9 Mon Sep 17 00:00:00 2001 From: Ludovic DEHON Date: Tue, 29 Aug 2023 09:19:47 +0200 Subject: [PATCH] fix(ui): environnement setting on ui don't work close #1952 close #1941 --- ui/src/components/settings/Settings.vue | 8 ++++++-- ui/src/stores/layout.js | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ui/src/components/settings/Settings.vue b/ui/src/components/settings/Settings.vue index 46b388c6bec..086ce7f0267 100644 --- a/ui/src/components/settings/Settings.vue +++ b/ui/src/components/settings/Settings.vue @@ -196,6 +196,8 @@ this.editorFontFamily = localStorage.getItem("editorFontFamily") || "'Source Code Pro', monospace"; this.envName = store.getters["layout/envName"] || this.configs?.environment?.name; this.envColor = store.getters["layout/envColor"] || this.configs?.environment?.color; + + console.log(store.getters["layout/envColor"] , this.configs?.environment?.color) }, methods: { onNamespaceSelect(value) { @@ -280,14 +282,16 @@ this.$toast().saved(); }, onEnvNameChange(value) { - if (value && value !== this.configs?.environment?.name) { + if (value !== this.configs?.environment?.name) { this.$store.commit("layout/setEnvName", value); } this.$toast().saved(); }, onEnvColorChange(value) { - if (value && value !== this.configs?.environment?.color) { + console.log(value); + + if (value !== this.configs?.environment?.color) { this.$store.commit("layout/setEnvColor", value); } diff --git a/ui/src/stores/layout.js b/ui/src/stores/layout.js index 537c808d54b..3d79452942f 100644 --- a/ui/src/stores/layout.js +++ b/ui/src/stores/layout.js @@ -11,11 +11,21 @@ export default { state.topNavbar = value }, setEnvName(state, value) { - localStorage.setItem("envName", value); + if (value) { + localStorage.setItem("envName", value); + } else { + localStorage.removeItem("envName"); + } + state.envName = value; }, setEnvColor(state, value) { - localStorage.setItem("envColor", value); + if (value) { + localStorage.setItem("envColor", value); + } else { + localStorage.removeItem("envColor"); + } + state.envColor = value; } },