Skip to content

Commit 0040805

Browse files
committed
projectmenu: Use project displaytext and use name as fallback
This uses project displaytext instead of name when available. Fixes #38 Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 0b4b9b6 commit 0040805

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ui/src/components/tools/ProjectMenu.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
@change="changeProject"
1111
showSearch>
1212
<a-select-option v-for="(project, index) in projects" :key="index">
13-
{{ project.name }}
13+
{{ project.displaytext || project.name }}
1414
</a-select-option>
1515
</a-select>
1616
</span>
@@ -54,7 +54,7 @@ export default {
5454
const currentProject = Vue.ls.get(CURRENT_PROJECT)
5555
for (var project of this.projects) {
5656
if (project.id === currentProject.id) {
57-
this.selectedProject = project.name
57+
this.setSelectedProject(project)
5858
break
5959
}
6060
}
@@ -69,9 +69,12 @@ export default {
6969
isDisabled () {
7070
return !store.getters.apis.hasOwnProperty('listProjects')
7171
},
72+
setSelectedProject (project) {
73+
this.selectedProject = project.displaytext || project.name
74+
},
7275
changeProject (index) {
7376
const project = this.projects[index]
74-
this.selectedProject = project.name
77+
this.setSelectedProject(project)
7578
this.$store.dispatch('SetProject', project)
7679
this.$store.dispatch('ToggleTheme', project.id === undefined ? 'light' : 'dark')
7780
this.$message.success(`Switched to "${project.name}"`)

0 commit comments

Comments
 (0)