From a4944233bf2bd32c76aceb8efb4f5574cc4eee4f Mon Sep 17 00:00:00 2001 From: Jonathan Cobb Date: Sun, 30 Aug 2020 11:23:53 -0400 Subject: [PATCH] add conditional display for config views --- src/account/AppPage.vue | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/account/AppPage.vue b/src/account/AppPage.vue index a81d7d7..fb051d7 100644 --- a/src/account/AppPage.vue +++ b/src/account/AppPage.vue @@ -94,7 +94,7 @@ }, computed: { ...mapState('apps', ['app', 'sites', 'site']), - ...mapState('system', ['messages']) + ...mapState('system', ['messages', 'configs']) }, created () { this.appId = this.$route.params.app; @@ -140,6 +140,15 @@ messages: this.messages, errors: this.errors }); + }, + viewIsAvailable(view) { + if (typeof view.when === 'undefined' || view.when === null) return true; + try { + return safeEval(view.when, {'configs': this.configs}) === true; + } catch (e) { + console.log('viewIsAvailable: error evaluating when='+view.when+': '+e); + return false; + } } }, watch: { @@ -162,7 +171,9 @@ const appConfigViews = []; for (let i=0; i