Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ class LocalBaserowTableSerializer(serializers.ModelSerializer):
source="is_data_synced_table",
help_text="Whether this table is a data synced table or not.",
)
is_two_way_data_sync = serializers.BooleanField(
source="is_two_way_data_synced_table",
help_text="Whether this table is a two-way data synced table or not.",
)

class Meta:
model = Table
fields = ("id", "database_id", "name", "is_data_sync")
fields = ("id", "database_id", "name", "is_data_sync", "is_two_way_data_sync")


class LocalBaserowDatabaseSerializer(ApplicationSerializer):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def test_get_integrations_serializer(
"name": table.name,
"database_id": table.database_id,
"is_data_sync": table.is_data_synced_table,
"is_two_way_data_sync": table.is_two_way_data_synced_table,
}
],
"views": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "refactor",
"message": "Improved one-way and two-way data sync support in Local Baserow actions.",
"issue_origin": "github",
"issue_number": null,
"domain": "integration",
"bullet_points": [],
"created_at": "2025-12-09"
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
small
:loading="nodeLoading"
:service="node.service"
:service-type="nodeType.serviceType"
:application="automation"
enable-integration-picker
:default-values="node.service"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
ref="subForm"
:application="builder"
:service="dataSource"
:service-type="serviceType"
:default-values="defaultValues"
:context-data="integration.context_data"
@values-changed="emitChange($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
:is="serviceType.formComponent"
:application="builder"
:service="defaultValues.service"
:service-type="serviceType"
:loading="workflowActionLoading"
:default-values="defaultValues.service"
@values-changed="values.service = { ...workflowAction.service, ...$event }"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<div class="col col-12">
<LocalBaserowServiceForm
:application="application"
:service-type="serviceType"
:default-values="defaultValues"
:enable-integration-picker="enableIntegrationPicker"
@values-changed="values = { ...values, ...$event }"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<div class="col col-12">
<LocalBaserowServiceForm
:application="application"
:service-type="serviceType"
:default-values="defaultValues"
:enable-integration-picker="enableIntegrationPicker"
@values-changed="values = { ...values, ...$event }"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<div class="col col-12">
<LocalBaserowServiceForm
:application="application"
:service-type="serviceType"
:default-values="defaultValues"
:enable-integration-picker="enableIntegrationPicker"
@values-changed="values = { ...values, ...$event }"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
<LocalBaserowTableSelector
v-if="selectedIntegration"
v-model="fakeTableId"
:view-id.sync="values.view_id"
:databases="databases"
:service-type="serviceType"
:view-id.sync="values.view_id"
:display-view-dropdown="enableViewPicker"
:disallow-data-synced-tables="disallowDataSyncedTables"
/>
<FormGroup
v-if="enableRowId && values.integration_id"
Expand Down Expand Up @@ -64,6 +64,10 @@ export default {
type: Object,
required: true,
},
serviceType: {
type: Object,
required: true,
},
enableRowId: {
type: Boolean,
required: false,
Expand All @@ -89,15 +93,6 @@ export default {
required: false,
default: true,
},
/**
* Whether to disallow the selection of data synced tables. Data sources
* can select them, but a create-row workflow action cannot.
*/
disallowDataSyncedTables: {
type: Boolean,
required: false,
default: false,
},
},
data() {
const values = { table_id: null, integration_id: null }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<LocalBaserowServiceForm
ref="serviceForm"
:application="application"
:service-type="serviceType"
:default-values="defaultValues"
:enable-view-picker="false"
@values-changed="emitServiceChange($event)"
Expand All @@ -26,6 +27,10 @@ export default defineComponent({
type: Object,
required: true,
},
serviceType: {
type: Object,
required: true,
},
},
emits: ['values-changed'],
setup(props, { emit }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,11 @@
@input="$emit('input', $event)"
>
<DropdownItem
v-for="table in tables"
v-for="table in supportedServiceTables"
:key="table.id"
:name="table.name"
:value="table.id"
:description="
table.is_data_sync
? $t('localBaserowTableSelector.dataSyncedTableDescription')
: null
"
:description="getTableDescription(table)"
>
{{ table.name }}
</DropdownItem>
Expand Down Expand Up @@ -100,6 +96,10 @@ export default {
type: Array,
required: true,
},
serviceType: {
type: Object,
required: true,
},
displayViewDropdown: {
type: Boolean,
default: true,
Expand All @@ -112,11 +112,6 @@ export default {
},
default: 'regular',
},
disallowDataSyncedTables: {
type: Boolean,
required: false,
default: false,
},
},
data() {
return {
Expand All @@ -130,11 +125,10 @@ export default {
)
},
tables() {
return (
this.databaseSelected?.tables.filter(
(table) => !(this.disallowDataSyncedTables && table.is_data_sync)
) || []
)
return this.databaseSelected?.tables || []
},
supportedServiceTables() {
return this.serviceType.supportedTables(this.tables)
},
views() {
return (
Expand All @@ -159,5 +153,19 @@ export default {
immediate: true,
},
},
methods: {
getTableDescription(table) {
if (table.is_two_way_data_sync) {
return this.$t(
'localBaserowTableSelector.twoWayDataSyncedTableDescription'
)
} else if (table.is_data_sync) {
return this.$t(
'localBaserowTableSelector.oneWayDataSyncedTableDescription'
)
}
return null
},
},
}
</script>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<form @submit.prevent>
<LocalBaserowServiceForm
:service-type="serviceType"
:enable-row-id="enableRowId"
:application="application"
:enable-view-picker="false"
:default-values="defaultValues"
:disallow-data-synced-tables="disallowDataSyncedTables"
@table-changed="handleTableChange"
@values-changed="emitServiceChange($event)"
></LocalBaserowServiceForm>
Expand Down Expand Up @@ -57,23 +57,17 @@ export default {
service: {
type: Object,
required: false,
default: null,
default: () => ({}),
},
enableRowId: {
type: Boolean,
serviceType: {
type: Object,
required: false,
default: false,
default: () => ({}),
},
/**
* Whether to disallow selecting data synced tables. It defaults to
* true as this is the default behaviour for the create row action
* form. The update row action form allows data synced tables, assuming
* they have writable fields.
*/
disallowDataSyncedTables: {
enableRowId: {
type: Boolean,
required: false,
default: true,
default: false,
},
},
data() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ export default {
required: false,
default: () => ({}),
},
serviceType: {
type: Object,
required: false,
default: () => ({}),
},
contextData: {
type: Object,
required: false,
Expand Down
35 changes: 35 additions & 0 deletions web-frontend/modules/integrations/localBaserow/serviceTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ export class LocalBaserowTableServiceType extends ServiceType {
return service.context_data_schema
}

/**
* Given an array of tables, returns the supported tables for this service type.
* By default, we return all tables, but specific service types can override this
* method to restrict the tables that can be selected.
* @param {Array} tables - The array of tables to filter.
* @returns {Array} - The supported tables.
*/
supportedTables(tables) {
return tables
}

/**
* Responsible for determining if this service is in error. It will be if the
* `table_id` is missing.
Expand Down Expand Up @@ -414,6 +425,18 @@ export class LocalBaserowCreateRowWorkflowServiceType extends WorkflowActionServ
return 'local_baserow_create_row'
}

/**
* The Local Baserow create row service will only work on tables which are
* not data-synced, or are data-synced but are two-way synced.
* @param {Array} tables - The array of tables to filter.
* @returns {Array} - The supported tables.
*/
supportedTables(tables) {
return tables.filter(
(table) => !table.is_data_sync || table.is_two_way_data_sync
)
}

get icon() {
return 'iconoir-plus'
}
Expand Down Expand Up @@ -477,6 +500,18 @@ export class LocalBaserowDeleteRowWorkflowServiceType extends WorkflowActionServ
get formComponent() {
return LocalBaserowDeleteRowServiceForm
}

/**
* The Local Baserow delete row service will only work on tables which are
* not data-synced, or are data-synced but are two-way synced.
* @param {Array} tables - The array of tables to filter.
* @returns {Array} - The supported tables.
*/
supportedTables(tables) {
return tables.filter(
(table) => !table.is_data_sync || table.is_two_way_data_sync
)
}
}

export class LocalBaserowTriggerServiceType extends TriggerServiceTypeMixin(
Expand Down
3 changes: 2 additions & 1 deletion web-frontend/modules/integrations/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@
"tableFieldLabel": "Table",
"chooseNoView": "Not selected",
"databaseFieldLabel": "Database",
"dataSyncedTableDescription": "Data synced table"
"oneWayDataSyncedTableDescription": "One-way synced",
"twoWayDataSyncedTableDescription": "Two-way synced"
},
"smtpIntegrationType": {
"smtpSummary": "SMTP - {host}:{port}"
Expand Down
Loading
Loading