diff --git a/app/src/helpers/yunohostArguments.js b/app/src/helpers/yunohostArguments.js index 0fc02bbd..3ac6453b 100644 --- a/app/src/helpers/yunohostArguments.js +++ b/app/src/helpers/yunohostArguments.js @@ -115,7 +115,7 @@ export function formatYunoHostArgument (arg) { props: ['id:name', 'choices'] }, { - types: ['user', 'domain'], + types: ['user', 'domain', 'app'], name: 'SelectItem', props: ['id:name', 'choices'], callback: function () { diff --git a/app/src/store/data.js b/app/src/store/data.js index df2255f4..8f5ae10a 100644 --- a/app/src/store/data.js +++ b/app/src/store/data.js @@ -11,6 +11,7 @@ export default { users: undefined, // basic user data: Object {username: {data}} users_details: {}, // precise user data: Object {username: {data}} groups: undefined, + apps: undefined, permissions: undefined }), @@ -44,6 +45,15 @@ export default { Vue.set(state.users, user.username, user) }, + 'SET_APPS' (state, [apps]) { + state.apps = apps || null + }, + + 'ADD_APPS' (state, [app]) { + if (!state.apps) state.apps = {} + Vue.set(state.apps, app.id, app) + }, + 'SET_USERS_DETAILS' (state, [username, userData]) { Vue.set(state.users_details, username, userData) if (!state.users) return @@ -185,6 +195,16 @@ export default { mainDomain: state => state.main_domain, + appsAsChoices: state => { + const choices = [{ value: "_none", text: "---" }] + if (state.apps) { + return choices.concat(Object.values(state.apps).map(({ id, name, domain_path }) => { + return { value: id, text: `${name} (${domain_path})` } + })) + } + return choices + }, + domainsAsChoices: state => { const mainDomain = state.main_domain return state.domains.map(domain => { diff --git a/app/src/views/domain/DomainConfig.vue b/app/src/views/domain/DomainConfig.vue index fdf670f8..22e24675 100644 --- a/app/src/views/domain/DomainConfig.vue +++ b/app/src/views/domain/DomainConfig.vue @@ -58,7 +58,8 @@ export default { data () { return { queries: [ - ['GET', `domains/${this.name}/config?full`] + ['GET', `domains/${this.name}/config?full`], + ['GET', { uri: 'apps', storeKey: 'apps' }] ], panels: undefined, forms: undefined,