configpanels: logic regarding dynamic-choices questions such as domain, user, should be handled by the core

This commit is contained in:
Alexandre Aubin 2022-01-21 20:07:11 +01:00
parent 00a8482762
commit 101be80d7e
2 changed files with 4 additions and 25 deletions

View file

@ -110,25 +110,13 @@ export function formatYunoHostArgument (arg) {
} }
}, },
{ {
types: ['select'], types: ['select', 'user', 'domain'],
name: 'SelectItem',
props: ['id:name', 'choices']
},
{
types: ['user', 'domain'],
name: 'SelectItem', name: 'SelectItem',
props: ['id:name', 'choices'], props: ['id:name', 'choices'],
callback: function () { callback: function () {
field.link = { name: arg.type + '-list', text: i18n.t(`manage_${arg.type}s`) } if ((arg.type === 'domain') || (arg.type === 'user')) {
field.props.choices = store.getters[arg.type + 'sAsChoices'] field.link = { name: arg.type + '-list', text: i18n.t(`manage_${arg.type}s`) }
if (value) { }
return
}
if (arg.type === 'domain') {
value = store.getters.mainDomain
} else {
value = field.props.choices.length ? field.props.choices[0].value : null
}
} }
}, },
{ {

View file

@ -170,15 +170,6 @@ export default {
return [] return []
}, },
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 user: state => name => state.users_details[name], // not cached
domains: state => state.domains, domains: state => state.domains,