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: {
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,
// Set by user inputs
category: 'office',
category: null,
subtag: 'all',
search: '',
quality: 'all',
quality: 'isDecentQuality',
selectedApp: {
// Set some basic values to avoid modal errors
state: 'lowquality',
@ -345,7 +345,11 @@ export default {
},
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 + '/' }
})
}
},