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

View file

@ -170,15 +170,6 @@ export default {
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
domains: state => state.domains,