Manage default application using DomainConfig

This commit is contained in:
Tagada 2022-01-08 00:15:55 +01:00 committed by Tagadda
parent 00a8482762
commit 37a83eeab9
3 changed files with 23 additions and 2 deletions

View file

@ -115,7 +115,7 @@ export function formatYunoHostArgument (arg) {
props: ['id:name', 'choices'] props: ['id:name', 'choices']
}, },
{ {
types: ['user', 'domain'], types: ['user', 'domain', 'app'],
name: 'SelectItem', name: 'SelectItem',
props: ['id:name', 'choices'], props: ['id:name', 'choices'],
callback: function () { callback: function () {

View file

@ -11,6 +11,7 @@ export default {
users: undefined, // basic user data: Object {username: {data}} users: undefined, // basic user data: Object {username: {data}}
users_details: {}, // precise user data: Object {username: {data}} users_details: {}, // precise user data: Object {username: {data}}
groups: undefined, groups: undefined,
apps: undefined,
permissions: undefined permissions: undefined
}), }),
@ -44,6 +45,15 @@ export default {
Vue.set(state.users, user.username, user) 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]) { 'SET_USERS_DETAILS' (state, [username, userData]) {
Vue.set(state.users_details, username, userData) Vue.set(state.users_details, username, userData)
if (!state.users) return if (!state.users) return
@ -185,6 +195,16 @@ export default {
mainDomain: state => state.main_domain, 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 => { domainsAsChoices: state => {
const mainDomain = state.main_domain const mainDomain = state.main_domain
return state.domains.map(domain => { return state.domains.map(domain => {

View file

@ -58,7 +58,8 @@ export default {
data () { data () {
return { return {
queries: [ queries: [
['GET', `domains/${this.name}/config?full`] ['GET', `domains/${this.name}/config?full`],
['GET', { uri: 'apps', storeKey: 'apps' }]
], ],
panels: undefined, panels: undefined,
forms: undefined, forms: undefined,