Skip to content

Commit

Permalink
fix(ui): environnement setting on ui don't work
Browse files Browse the repository at this point in the history
close #1952
close #1941
  • Loading branch information
tchiotludo committed Aug 29, 2023
1 parent 01eae69 commit 55fb405
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
8 changes: 6 additions & 2 deletions ui/src/components/settings/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down
14 changes: 12 additions & 2 deletions ui/src/stores/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
},
Expand Down

0 comments on commit 55fb405

Please sign in to comment.