Skip to content

Commit

Permalink
feat(ui): propagate the environment name to the page title (#2051)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuri1969 authored Sep 26, 2023
1 parent 6a38e7b commit b0459d8
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,18 @@
}
return true;
},
envName() {
return this.$store.getters["layout/envName"] || this.configs?.environment?.name;
}
},
async created() {
if (this.created === false) {
await this.loadGeneralRessources()
this.displayApp()
await this.loadGeneralResources();
this.displayApp();
this.initGuidedTour();
}
this.setTitleEnvSuffix();
},
methods: {
onMenuCollapse(collapse) {
Expand All @@ -74,7 +78,12 @@
document.getElementById("app-container").style.display = "block";
this.loaded = true;
},
async loadGeneralRessources() {
setTitleEnvSuffix() {
const envSuffix = this.envName ? ` - ${this.envName}` : "";
document.title = document.title.replace(/( - .+)?$/, envSuffix);
},
async loadGeneralResources() {
let uid = localStorage.getItem("uid");
if (uid === null) {
uid = Utils.uid();
Expand Down Expand Up @@ -108,6 +117,9 @@
if (this.user && to.name === "home" && this.overallTotal === 0) {
this.$router.push({name: "welcome"});
}
},
envName() {
this.setTitleEnvSuffix();
}
}
};
Expand Down

0 comments on commit b0459d8

Please sign in to comment.