From 463934e9a5ea4f30da80fde1eb90af9c908ae724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C5=BEe=20Fortun?= Date: Thu, 1 Dec 2022 12:35:07 +0100 Subject: [PATCH] Remove customize filter checbox on compose charts --- .../components/Chart/Report/ReportEdit.vue | 45 ++++++++----------- locale/en/corteza-webapp-compose/chart.yaml | 2 + 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/client/web/compose/src/components/Chart/Report/ReportEdit.vue b/client/web/compose/src/components/Chart/Report/ReportEdit.vue index aff1f7959..febb3bc47 100644 --- a/client/web/compose/src/components/Chart/Report/ReportEdit.vue +++ b/client/web/compose/src/components/Chart/Report/ReportEdit.vue @@ -31,29 +31,31 @@ > - - {{ $t('edit.filter.customize') }} - - + + + + ${recordID} + ${ownerID} + ${userID} + + @@ -316,8 +318,6 @@ export default { data () { return { - customFilter: false, - metricAggregates: aggregateFunctions.map(af => ({ ...af, text: this.$t(`edit.metric.function.${af.text}`) })), dimensionModifiers: compose.chartUtil.dimensionFunctions.map(df => ({ ...df, text: this.$t(`edit.dimension.function.${df.text}`) })), predefinedFilters: compose.chartUtil.predefinedFilters.map(pf => ({ ...pf, text: this.$t(`edit.filter.${pf.text}`) })), @@ -329,6 +329,10 @@ 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 }, @@ -408,17 +412,6 @@ export default { }, }, - watch: { - 'report.filter': { - handler: function (v) { - // !! is required, since :disabled="..." marks the field as disabled if '' is provided - this.customFilter = (!!v && !!compose.chartUtil.predefinedFilters.find(({ value }) => value === v)) || - (!!v) - }, - immediate: true, - }, - }, - methods: { hasRelativeDisplay: compose.chartUtil.hasRelativeDisplay, diff --git a/locale/en/corteza-webapp-compose/chart.yaml b/locale/en/corteza-webapp-compose/chart.yaml index bbcb2bc5e..9ef9ebf1e 100644 --- a/locale/en/corteza-webapp-compose/chart.yaml +++ b/locale/en/corteza-webapp-compose/chart.yaml @@ -44,6 +44,8 @@ edit: filter: customize: Customize filter label: Filters + footnote: Simplified SQL condition (WHERE ...) syntax is supported. Variables like {{0}}, {{1}} and {{2}} are evaluated (when available) + placeholder: field1 = 1 AND field2 = 232 noFilter: Select a predefined filter or make a custom one recordsCreatedLastMonth: Records created last month recordsCreatedLastQuarter: Records created last quarter