add state users and domains as options getter to be used with selects

This commit is contained in:
Axolotle 2020-10-06 23:49:52 +02:00
parent f7e47e620c
commit 84374cdd53
2 changed files with 20 additions and 3 deletions

View file

@ -143,6 +143,19 @@ export default {
}, },
getters: { getters: {
usersAsOptions: state => {
const choices = Object.values(state.users).map(({ username, fullname, mail }) => {
return { text: `${fullname} (${mail})`, value: username }
})
return { choices, value: choices[0].value }
},
domainsAsOptions: state => {
const mainDomain = state.main_domain
const choices = state.domains.map(domain => {
return { value: domain, text: domain === mainDomain ? domain + ' ★' : domain }
})
return { choices, value: mainDomain }
}
} }
} }

View file

@ -188,10 +188,10 @@ export default {
], ],
apps: undefined, apps: undefined,
// Set by user inputs // Set by user inputs
category: 'office', category: null,
subtag: 'all', subtag: 'all',
search: '', search: '',
quality: 'all', quality: 'isDecentQuality',
selectedApp: { selectedApp: {
// Set some basic values to avoid modal errors // Set some basic values to avoid modal errors
state: 'lowquality', state: 'lowquality',
@ -345,7 +345,11 @@ export default {
}, },
goToCustomAppInstallForm () { goToCustomAppInstallForm () {
this.$router.push({ name: 'app-install-custom', params: { id: this.form.url } }) const url = this.form.url
this.$router.push({
name: 'app-install-custom',
params: { id: url.endsWith('/') ? url : url + '/' }
})
} }
}, },