3
0

Fix chart save processing

This commit is contained in:
Jože Fortun
2024-06-03 12:05:53 +02:00
parent 260629310d
commit e2e747229a
2 changed files with 18 additions and 9 deletions

View File

@@ -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
},

View File

@@ -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
})
},