From 101be80d7e6ea6dad7a45377062258ec1adeaa64 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 21 Jan 2022 20:07:11 +0100 Subject: [PATCH] configpanels: logic regarding dynamic-choices questions such as domain, user, should be handled by the core --- app/src/helpers/yunohostArguments.js | 20 ++++---------------- app/src/store/data.js | 9 --------- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/app/src/helpers/yunohostArguments.js b/app/src/helpers/yunohostArguments.js index 0fc02bbd..f68fadd6 100644 --- a/app/src/helpers/yunohostArguments.js +++ b/app/src/helpers/yunohostArguments.js @@ -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`) } + } } }, { diff --git a/app/src/store/data.js b/app/src/store/data.js index df2255f4..50e39b48 100644 --- a/app/src/store/data.js +++ b/app/src/store/data.js @@ -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,