mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
fix several user errors when no users created
This commit is contained in:
parent
4e8dad0435
commit
40ef5b4c26
2 changed files with 12 additions and 5 deletions
|
@ -98,7 +98,11 @@ export function formatYunoHostArgument (arg) {
|
|||
field.component = 'SelectItem'
|
||||
field.link = { name: arg.type + '-list', text: i18n.t(`manage_${arg.type}s`) }
|
||||
field.props.choices = store.getters[arg.type + 'sAsChoices']
|
||||
value = arg.type === 'domain' ? store.getters.mainDomain : field.props.choices[0].value
|
||||
if (arg.type === 'domain') {
|
||||
value = store.getters.mainDomain
|
||||
} else {
|
||||
value = field.props.choices.length ? field.props.choices[0].value : null
|
||||
}
|
||||
|
||||
// Unknown from the specs, try to display it as an input[text]
|
||||
// FIXME throw an error instead ?
|
||||
|
|
|
@ -36,7 +36,7 @@ export default {
|
|||
},
|
||||
|
||||
'SET_USERS' (state, [users]) {
|
||||
state.users = Object.keys(users).length === 0 ? null : users
|
||||
state.users = users || null
|
||||
},
|
||||
|
||||
'ADD_USERS' (state, [user]) {
|
||||
|
@ -161,9 +161,12 @@ export default {
|
|||
},
|
||||
|
||||
usersAsChoices: state => {
|
||||
if (state.users) {
|
||||
return Object.values(state.users).map(({ username, fullname, mail }) => {
|
||||
return { text: `${fullname} (${mail})`, value: username }
|
||||
})
|
||||
}
|
||||
return []
|
||||
},
|
||||
|
||||
user: state => name => state.users_details[name], // not cached
|
||||
|
|
Loading…
Reference in a new issue