From 260629310d09655e5e70dba681d0001d8d5a7084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C5=BEe=20Fortun?= Date: Mon, 3 Jun 2024 11:26:50 +0200 Subject: [PATCH] Fix charts processing if no field or module found --- client/web/compose/src/components/Chart/index.vue | 11 +++++++---- lib/js/src/compose/types/chart/base.ts | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/client/web/compose/src/components/Chart/index.vue b/client/web/compose/src/components/Chart/index.vue index dc1fa3a46..b1d430f07 100644 --- a/client/web/compose/src/components/Chart/index.vue +++ b/client/web/compose/src/components/Chart/index.vue @@ -115,11 +115,11 @@ export default { const [dimension = {}] = report.dimensions let { field } = dimension - if (!module) return + if (!module) throw new Error('Module not found') field = fields.find(({ name }) => name === field) - if (!field) return + if (!field) throw new Error('Dimension field not found') if (field.kind === 'Bool') { const { trueLabel, falseLabel } = field.options @@ -206,8 +206,11 @@ export default { this.processing = false this.toastErrorHandler(this.$t('chart.optionsBuildFailed'))(e) } - this.processing = false - this.$emit('updated') + + setTimeout(() => { + this.processing = false + this.$emit('updated') + }, 300) }, drillDown (e) { diff --git a/lib/js/src/compose/types/chart/base.ts b/lib/js/src/compose/types/chart/base.ts index 87a1908b8..b5e01f327 100644 --- a/lib/js/src/compose/types/chart/base.ts +++ b/lib/js/src/compose/types/chart/base.ts @@ -125,6 +125,10 @@ export class BaseChart { d.modifier = '(no grouping / buckets)' } + if (d.field === 'created_at') { + d.field = 'createdAt' + } + return _.merge(this.defDimension(), d) }) report.metrics = metrics.map(m => _.merge(this.defMetrics(), m))