From e2e747229acf8093ae69fdf8a56b07d84d2ba83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C5=BEe=20Fortun?= Date: Mon, 3 Jun 2024 12:05:53 +0200 Subject: [PATCH] Fix chart save processing --- .../components/Chart/Report/ReportEdit.vue | 4 ---- .../compose/src/views/Admin/Charts/Edit.vue | 23 +++++++++++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/client/web/compose/src/components/Chart/Report/ReportEdit.vue b/client/web/compose/src/components/Chart/Report/ReportEdit.vue index ff22568b9..44c8d0be0 100644 --- a/client/web/compose/src/components/Chart/Report/ReportEdit.vue +++ b/client/web/compose/src/components/Chart/Report/ReportEdit.vue @@ -544,10 +544,6 @@ export default { return ({ field }) => (this.module.fields.filter(f => f.name === field)[0] || {}).kind === 'DateTime' ? 'date' : 'text' }, - defaultFilterOption () { - return this.predefinedFilters.some(({ value }) => value === this.report.filter) ? '' : this.report.filter - }, - canAddMetric () { return (this.supportedMetrics < 0 || this.metrics.length < this.supportedMetrics) && this.moduleID }, diff --git a/client/web/compose/src/views/Admin/Charts/Edit.vue b/client/web/compose/src/views/Admin/Charts/Edit.vue index abe864168..c5348af5c 100644 --- a/client/web/compose/src/views/Admin/Charts/Edit.vue +++ b/client/web/compose/src/views/Admin/Charts/Edit.vue @@ -758,7 +758,6 @@ export default { }, update () { - this.processing = true this.$refs.chart.updateChart() }, @@ -770,8 +769,20 @@ export default { this.processing = false }, + toggleProcessing ({ closeOnSuccess = false, isClone = false }) { + this.processing = !this.processing + + if (closeOnSuccess) { + this.processingSaveAndClose = !this.processingSaveAndClose + } else if (isClone) { + this.processingClone = !this.processingClone + } else { + this.processingSave = !this.processingSave + } + }, + handleSave ({ chart = this.chart, closeOnSuccess = false, isClone = false } = {}) { - const toggleProcessing = () => { + const toggleSaveProcessing = () => { this.processing = !this.processing if (closeOnSuccess) { @@ -783,7 +794,7 @@ export default { } } - toggleProcessing() + toggleSaveProcessing() /** * Pass a special tag alongside payload that @@ -807,7 +818,7 @@ export default { }) .catch(this.toastErrorHandler(this.$t('notification:chart.saveFailed'))) .finally(() => { - toggleProcessing() + toggleSaveProcessing() }) } else { this.updateChart(c).then((chart) => { @@ -821,12 +832,13 @@ export default { }) .catch(this.toastErrorHandler(this.$t('notification:chart.saveFailed'))) .finally(() => { - toggleProcessing() + toggleSaveProcessing() }) } }, handleDelete () { + this.processing = true this.processingDelete = true this.deleteChart(this.chart).then(() => { @@ -837,6 +849,7 @@ export default { }) .catch(this.toastErrorHandler(this.$t('notification:chart.deleteFailed'))) .finally(() => { + this.processing = false this.processingDelete = false }) },