Files
baserow/web-frontend/modules/dashboard/components/widget/SummaryWidgetSettings.vue
Peter EvansandJeremie Pardou f07d8c895e feat: set up dashboard filters from a table and create the widgets they filter (#6771)
* feat: set up dashboard filters from a table and create the widgets they filter

* feat: refine dashboard filter setup and widget association

Support multi-table filters, guided widget configuration, same-table condition copying in display order, and automatic linking defaults. Preserve independent target settings and undo/redo behavior.

* fix: show copied filter conditions after widget association

* test: cover guided dashboard widget creation from a filter

* test: cover dashboard filter copying across tables

* refactor: simplify dashboard filter configuration

* fix: restore dashboard filter links exactly on undo and redo

* feat: set up a new widget and how a filter narrows it down in one modal

* feat: fold the add-widget modal into collapsible sections that fit chart settings

* fix: cancel queued updates when destroying dashboard charts

* fix: reference dashboard option context by table

* refactor: rename dashboard table context provider

* fix: label dashboard table context as field options

* fix: shorten dashboard table options label

---------

Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
2026-11-23 15:00:35 +00:00

100 lines
2.6 KiB
Vue

<template>
<AggregateRowsDataSourceForm
v-if="dataSource"
ref="dataSourceForm"
:dashboard="dashboard"
:widget="widget"
:data-source="dataSource"
:default-values="dataSource"
:store-prefix="storePrefix"
:small="small"
:show-own-filters="showOwnFilters"
@values-changed="onDataSourceValuesChanged"
/>
</template>
<script>
import AggregateRowsDataSourceForm from '@baserow/modules/dashboard/components/data_source/AggregateRowsDataSourceForm'
import error from '@baserow/modules/core/mixins/error'
import { notifyIf } from '@baserow/modules/core/utils/error'
export default {
name: 'SummaryWidgetSettings',
components: { AggregateRowsDataSourceForm },
mixins: [error],
props: {
linkFilterWidgetId: { type: Number, default: null },
/** Whether the widget's own filter conditions can be edited here. */
showOwnFilters: {
type: Boolean,
default: true,
},
small: {
type: Boolean,
default: true,
},
dashboard: {
type: Object,
required: true,
},
widget: {
type: Object,
required: true,
},
storePrefix: {
type: String,
required: false,
default: '',
},
},
data() {
return {
loading: false,
}
},
computed: {
dataSource() {
return this.$store.getters[
`${this.storePrefix}dashboardApplication/getDataSourceById`
](this.widget.data_source_id)
},
integration() {
return this.$store.getters[
`${this.storePrefix}dashboardApplication/getIntegrationById`
](this.dataSource.integration_id)
},
},
methods: {
/** Validate all data settings before completing guided widget creation. */
validate() {
const form = this.$refs.dataSourceForm
if (!form) return false
form.touch(true)
const valid = form.isFormValid(true)
if (!valid) form.focusOnFirstError()
return valid
},
async onDataSourceValuesChanged(changedDataSourceValues) {
if (this.$refs.dataSourceForm.isFormValid()) {
try {
await this.$store.dispatch(
`${this.storePrefix}dashboardApplication/updateDataSource`,
{
dataSourceId: this.dataSource.id,
values: changedDataSourceValues,
...(this.linkFilterWidgetId == null
? {}
: { linkFilterWidgetId: this.linkFilterWidgetId }),
}
)
} catch (error) {
this.$refs.dataSourceForm.reset()
this.$refs.dataSourceForm.touch()
notifyIf(error, 'dashboard')
}
}
},
},
}
</script>