Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions ui/src/components/header/ProjectMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ export default {
getNextPage()
}
}).finally(() => {
this.projects = _.orderBy(projects, ['displaytext'], ['asc'])
this.projects.unshift({ name: this.$t('label.default.view') })
this.loading = false
this.$store.commit('RELOAD_ALL_PROJECTS', projects)
})
}
getNextPage()
Expand All @@ -125,6 +124,17 @@ export default {
filterProject (input, option) {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
},
mounted () {
this.$store.watch(
(state, getters) => getters.allProjects,
(newValue, oldValue) => {
if (oldValue !== newValue && newValue !== undefined) {
this.projects = _.orderBy(newValue, ['displaytext'], ['asc'])
this.projects.unshift({ name: this.$t('label.default.view') })
}
}
)
}
}
</script>
Expand Down
3 changes: 2 additions & 1 deletion ui/src/store/getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ const getters = {
twoFaEnabled: state => state.user.twoFaEnabled,
twoFaProvider: state => state.user.twoFaProvider,
twoFaIssuer: state => state.user.twoFaIssuer,
loginFlag: state => state.user.loginFlag
loginFlag: state => state.user.loginFlag,
allProjects: (state) => state.app.allProjects
}

export default getters
13 changes: 11 additions & 2 deletions ui/src/store/modules/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import {
USE_BROWSER_TIMEZONE,
SERVER_MANAGER,
VUE_VERSION,
CUSTOM_COLUMNS
CUSTOM_COLUMNS,
RELOAD_ALL_PROJECTS
} from '@/store/mutation-types'

const app = {
Expand All @@ -50,7 +51,8 @@ const app = {
metrics: false,
listAllProjects: false,
server: '',
vueVersion: ''
vueVersion: '',
allProjects: []
},
mutations: {
SET_SIDEBAR_TYPE: (state, type) => {
Expand Down Expand Up @@ -121,6 +123,10 @@ const app = {
SET_CUSTOM_COLUMNS: (state, customColumns) => {
vueProps.$localStorage.set(CUSTOM_COLUMNS, customColumns)
state.customColumns = customColumns
},
RELOAD_ALL_PROJECTS: (state, allProjects = []) => {
vueProps.$localStorage.set(RELOAD_ALL_PROJECTS, allProjects)
state.allProjects = allProjects
}
},
actions: {
Expand Down Expand Up @@ -177,6 +183,9 @@ const app = {
},
SetCustomColumns ({ commit }, bool) {
commit('SET_CUSTOM_COLUMNS', bool)
},
ReloadAllProjects ({ commit, allProjects }) {
commit('RELOAD_ALL_PROJECTS', allProjects)
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion ui/src/views/AutogenView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,10 @@ export default {
}
api('listProjects', { id: projectId, listall: true, details: 'min' }).then(json => {
if (!json || !json.listprojectsresponse || !json.listprojectsresponse.project) return
const projects = json.listprojectsresponse.project
const project = json.listprojectsresponse.project[0]
this.$store.dispatch('SetProject', project)
this.$store.commit('RELOAD_ALL_PROJECTS', projects)
this.$store.dispatch('ToggleTheme', project.id === undefined ? 'light' : 'dark')
this.$message.success(`${this.$t('message.switch.to')} "${project.name}"`)
const query = Object.assign({}, this.$route.query)
Expand Down Expand Up @@ -937,6 +939,7 @@ export default {
}

if (this.apiName === 'listProjects' && this.items.length > 0) {
this.$store.commit('RELOAD_ALL_PROJECTS', this.items)
this.columns.map(col => {
if (col.title === 'Account') {
col.title = this.$t('label.project.owner')
Expand Down Expand Up @@ -1808,7 +1811,6 @@ export default {
this.rules[field.name].push(rule)
break
default:
console.log('hererere')
rule.required = field.required
rule.message = this.$t('message.error.required.input')
this.rules[field.name].push(rule)
Expand Down