mirror of
https://gitlab.com/bramw/baserow.git
synced 2025-01-15 21:18:41 +00:00
75 lines
1.8 KiB
Vue
75 lines
1.8 KiB
Vue
<template>
|
|
<AggregateRowsDataSourceForm
|
|
v-if="dataSource"
|
|
ref="dataSourceForm"
|
|
:dashboard="dashboard"
|
|
:widget="widget"
|
|
:data-source="dataSource"
|
|
:default-values="dataSource"
|
|
:store-prefix="storePrefix"
|
|
@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: {
|
|
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: {
|
|
async onDataSourceValuesChanged(changedDataSourceValues) {
|
|
if (this.$refs.dataSourceForm.isFormValid()) {
|
|
try {
|
|
await this.$store.dispatch(
|
|
`${this.storePrefix}dashboardApplication/updateDataSource`,
|
|
{
|
|
dataSourceId: this.dataSource.id,
|
|
values: changedDataSourceValues,
|
|
}
|
|
)
|
|
} catch (error) {
|
|
this.$refs.dataSourceForm.reset()
|
|
this.$refs.dataSourceForm.touch()
|
|
notifyIf(error, 'dashboard')
|
|
}
|
|
}
|
|
},
|
|
},
|
|
}
|
|
</script>
|