From f28f21b2f67f5e152e6e9d13814150a4adf316c7 Mon Sep 17 00:00:00 2001 From: Udo Walter Date: Wed, 27 Nov 2019 17:20:15 +0000 Subject: [configloader] bugfixes in the beta configloader: add hook sources correct handeling of multiple sources remove merging of multiple sources with the same config --- webapp/src/components/ConfigChip.vue | 47 ++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 15 deletions(-) (limited to 'webapp') diff --git a/webapp/src/components/ConfigChip.vue b/webapp/src/components/ConfigChip.vue index f278fe3..7ae0d08 100644 --- a/webapp/src/components/ConfigChip.vue +++ b/webapp/src/components/ConfigChip.vue @@ -27,25 +27,18 @@
{{ $t('active') }}
{{ $t('assigned') }}
-
- - - - -
{{ $t('source') }}{{ config.source.type }}
{{ $t('id') }}{{ config.source.id }}
{{ $t('name') }}{{ config.source.name }}
-
-
-
+ +
+
-
[{{ subConfig.id}}] {{ subConfig.name }}
+
{{ source.title }}
- - - + + +
{{ $t('source') }}{{ subConfig.source.type }}
{{ $t('id') }}{{ subConfig.source.id }}
{{ $t('name') }}{{ subConfig.source.name }}
{{ $t('source') }}{{ source.data.type }}
{{ $t('id') }}{{ source.data.id }}
{{ $t('name') }}{{ source.data.name }}
- {{ config.name || config.id }}
@@ -79,10 +72,34 @@ export default { return '' }, isEvent () { - return this.config.source && (this.config.source.type === 'IMPORTANT_EVENT' || this.config.source.type === 'EVENT') + return this.sources.some(source => (source.data.type === 'IMPORTANT_EVENT' || source.data.type === 'EVENT')) + }, + sources () { + return this.getSources(this.config) } }, methods: { + getSources (config) { + const sources = [] + if (config.merged) { + config.configs.forEach(c => { + sources.push(...this.getSources(c)) + }) + } else { + if (Array.isArray(config.source)) { + sources.push(...config.source.map(source => ({ + title: '[' + config.id + '] ' + config.name, + data: source + }))) + } else { + sources.push({ + title: '[' + config.id + '] ' + config.name, + data: config.source + }) + } + } + return sources + } } } -- cgit v1.2.3-55-g7522