Fix charts processing if no field or module found

This commit is contained in:
Jože Fortun
2024-06-12 16:08:57 +02:00
parent 9784d401d1
commit 260629310d
2 changed files with 11 additions and 4 deletions
@@ -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) {
+4
View File
@@ -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))