mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 08:18:42 +00:00
* feat: add dynamic concurrency limit for file import jobs Override can_schedule_or_raise() on FileImportJobType to enforce: - max 1 running import per table (existing table imports) - max 1 running new-table-creation per database - global max_count cap Follows the same pattern as GenerateAIValuesJobType. * refactor: migrate table import and data sync to centralized job store Replace the deprecated jobProgress mixin with the job mixin in ImportFileModal, CreateTable, CreateDataSync, and the shared dataSync mixin. This enables: - Restore running jobs after page refresh via loadRunningJob() - Cancel support via the job mixin's cancelJob() - Centralized polling through the Vuex job store Also enriches FileImportJobType with lifecycle callbacks, disables type selectors during import/sync, and exposes table_id in DataSyncSerializer for job matching. * feat: store importer metadata on FileImportJob for UI restore Add importer_type and original_file_name fields to FileImportJob so the frontend can show which importer and file were used when restoring a running job after page reload. Both fields are passed through from the table create and import API endpoints. * test: add e2e test for CSV import restore after page reload Uploads a large CSV, starts the import, reloads the page, reopens the modal, and verifies the file name and cancel button are visible. * fix: defensive handling when backend job data is missing new fields (pre-deploy jobs) * test: verify cancel button stops the running import job * test: add e2e test for CSV import into existing table restore after reload * fix: address PR review — filter data sync jobs by database, restore importer type, prevent chooser click during import * fix: reset importer selection after cancelling an import job * address copilot feedback; fix tests * fix: address review — database=table.database, opaque importer_type docs, avoid double goto for Firefox * fix: stabilize e2e tests for Firefox — wait for job in store, use larger CSV * feat: add on_cancelled hook and data sync cancellation support Add on_cancelled lifecycle hook to the job system, invoked after a job is cancelled. The data sync job type uses it to trash the table when a first sync is cancelled before completing. Bump max_count to 3 and add can_schedule_or_raise for per-data-sync concurrency. Frontend gets a cancel button, optimistic table cleanup, and store lifecycle hooks. Rework importer metadata migration to use ZDM-safe TextField(null=True). * address copilot feedback * address feedback
136 lines
3.6 KiB
Vue
136 lines
3.6 KiB
Vue
<template>
|
|
<div>
|
|
<h2 class="box__title">{{ $t('configureDataSyncSettings.title') }}</h2>
|
|
<div v-if="fetchLoading">
|
|
<div class="loading"></div>
|
|
</div>
|
|
<div v-if="!fetchLoaded">
|
|
<Error :error="error"></Error>
|
|
</div>
|
|
<div v-else-if="fetchLoaded">
|
|
<component
|
|
:is="dataSyncComponent"
|
|
ref="form"
|
|
:default-values="dataSync"
|
|
:update="true"
|
|
:disabled="updateLoading || jobIsRunning"
|
|
class="margin-bottom-2"
|
|
@submitted="submitted"
|
|
@values-changed="completed = false"
|
|
/>
|
|
|
|
<Error :error="error"></Error>
|
|
<div class="modal-progress__actions">
|
|
<ProgressBar
|
|
v-if="jobIsRunning || jobIsFinished"
|
|
:value="job.progress_percentage"
|
|
:status="jobHumanReadableState"
|
|
/>
|
|
<div class="align-right">
|
|
<div class="flex">
|
|
<Button
|
|
v-if="completed"
|
|
tag="a"
|
|
type="secondary"
|
|
size="large"
|
|
@click="$emit('hide')"
|
|
>{{ $t('action.hide') }}</Button
|
|
>
|
|
<template v-if="!completed">
|
|
<Checkbox
|
|
v-model="syncTableValue"
|
|
:disabled="updateLoading || jobIsRunning"
|
|
>{{ $t('configureDataSyncSettings.syncTable') }}</Checkbox
|
|
>
|
|
<Button
|
|
type="primary"
|
|
size="large"
|
|
:loading="updateLoading || jobIsRunning"
|
|
:disabled="updateLoading || jobIsRunning"
|
|
@click="$refs.form.submit()"
|
|
>
|
|
{{ $t('action.save') }}
|
|
</Button>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import dataSync from '@baserow/modules/database/mixins/dataSync'
|
|
import DataSyncService from '@baserow/modules/database/services/dataSync'
|
|
import TableForm from '@baserow/modules/database/components/table/TableForm.vue'
|
|
|
|
export default {
|
|
name: 'ConfigureDataSyncSettings',
|
|
components: { TableForm },
|
|
mixins: [dataSync],
|
|
props: {
|
|
database: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
table: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
},
|
|
emits: ['hide'],
|
|
data() {
|
|
return {
|
|
fetchLoading: false,
|
|
fetchLoaded: false,
|
|
dataSync: null,
|
|
completed: false,
|
|
syncTableValue: true,
|
|
}
|
|
},
|
|
computed: {
|
|
dataSyncComponent() {
|
|
return this.$registry
|
|
.get('dataSync', this.dataSync.type)
|
|
.getFormComponent()
|
|
},
|
|
},
|
|
mounted() {
|
|
this.hideError()
|
|
this.fetchDataSource(this.table)
|
|
},
|
|
methods: {
|
|
onJobFinished() {
|
|
this.completed = true
|
|
},
|
|
async fetchDataSource(table) {
|
|
this.fetchLoading = true
|
|
|
|
try {
|
|
const { data } = await DataSyncService(this.$client).get(
|
|
table.data_sync.id
|
|
)
|
|
this.dataSync = data
|
|
this.fetchLoaded = true
|
|
} catch (error) {
|
|
this.handleError(error)
|
|
} finally {
|
|
this.fetchLoading = false
|
|
}
|
|
},
|
|
async submitted(values) {
|
|
// Remove the `undefined` values, because those contain not updated secrets that
|
|
// are only meant to be included in the update request if they've changed
|
|
// because they're not exposed by the backend.
|
|
const valuesWithoutUndefined = Object.fromEntries(
|
|
Object.entries(values).filter(([_, v]) => v !== undefined)
|
|
)
|
|
await this.update(this.table, valuesWithoutUndefined, this.syncTableValue)
|
|
if (!this.syncTableValue) {
|
|
this.completed = true
|
|
}
|
|
},
|
|
},
|
|
}
|
|
</script>
|