From 84374cdd53f350d24388d9e88f6ced0e493bde6b Mon Sep 17 00:00:00 2001 From: Axolotle Date: Tue, 6 Oct 2020 23:49:52 +0200 Subject: [PATCH] add state users and domains as options getter to be used with selects --- app/src/store/data.js | 13 +++++++++++++ app/src/views/app/AppCatalog.vue | 10 +++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/app/src/store/data.js b/app/src/store/data.js index 4dbb7d60..8506c42d 100644 --- a/app/src/store/data.js +++ b/app/src/store/data.js @@ -143,6 +143,19 @@ export default { }, getters: { + usersAsOptions: state => { + const choices = Object.values(state.users).map(({ username, fullname, mail }) => { + return { text: `${fullname} (${mail})`, value: username } + }) + return { choices, value: choices[0].value } + }, + domainsAsOptions: state => { + const mainDomain = state.main_domain + const choices = state.domains.map(domain => { + return { value: domain, text: domain === mainDomain ? domain + ' ★' : domain } + }) + return { choices, value: mainDomain } + } } } diff --git a/app/src/views/app/AppCatalog.vue b/app/src/views/app/AppCatalog.vue index 6bbd4f0c..bed10e7c 100644 --- a/app/src/views/app/AppCatalog.vue +++ b/app/src/views/app/AppCatalog.vue @@ -188,10 +188,10 @@ export default { ], apps: undefined, // Set by user inputs - category: 'office', + category: null, subtag: 'all', search: '', - quality: 'all', + quality: 'isDecentQuality', selectedApp: { // Set some basic values to avoid modal errors state: 'lowquality', @@ -345,7 +345,11 @@ export default { }, goToCustomAppInstallForm () { - this.$router.push({ name: 'app-install-custom', params: { id: this.form.url } }) + const url = this.form.url + this.$router.push({ + name: 'app-install-custom', + params: { id: url.endsWith('/') ? url : url + '/' } + }) } },