Skip to content

Commit 4cc352a

Browse files
authored
feat: Introduce syncLoading state to manage UI during table synchronization, replacing creatingJob. (baserow#4743)
1 parent 0f90f51 commit 4cc352a

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

web-frontend/modules/database/components/dataSync/SyncTableModal.vue

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<template>
2-
<Modal ref="modal" :can-close="!jobIsRunning" @hidden="hidden">
2+
<Modal
3+
ref="modal"
4+
:can-close="!syncLoading && !jobIsRunning"
5+
@hidden="hidden"
6+
>
37
<template #content>
48
<div class="import-modal__header">
59
<h2 class="import-modal__title">
@@ -12,17 +16,17 @@
1216
<Error :error="error"></Error>
1317
<div class="modal-progress__actions margin-top-2">
1418
<ProgressBar
15-
v-if="jobIsRunning || jobHasSucceeded"
16-
:value="job.progress_percentage"
19+
v-if="syncLoading || jobIsRunning || jobHasSucceeded"
20+
:value="job?.progress_percentage || 0"
1721
:status="jobHumanReadableState"
1822
/>
1923
<div class="align-right">
2024
<Button
2125
v-if="!jobHasSucceeded"
2226
type="primary"
2327
size="large"
24-
:disabled="jobIsRunning"
25-
:loading="jobIsRunning"
28+
:disabled="syncLoading || jobIsRunning"
29+
:loading="syncLoading || jobIsRunning"
2630
@click="syncTable(table)"
2731
>
2832
{{ $t('syncTableModal.sync') }}
@@ -49,11 +53,6 @@ export default {
4953
required: true,
5054
},
5155
},
52-
data() {
53-
return {
54-
creatingJob: false,
55-
}
56-
},
5756
methods: {
5857
show() {
5958
this.job = null

web-frontend/modules/database/mixins/dataSync.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default {
1212
properties: null,
1313
syncedProperties: [],
1414
updateLoading: false,
15+
syncLoading: false,
1516
}
1617
},
1718
beforeUnmount() {
@@ -106,6 +107,7 @@ export default {
106107

107108
this.hideError()
108109
this.job = null
110+
this.syncLoading = true
109111

110112
try {
111113
const { data: job } = await DataSyncService(this.$client).syncTable(
@@ -114,6 +116,8 @@ export default {
114116
this.startJobPoller(job)
115117
} catch (error) {
116118
this.handleError(error)
119+
} finally {
120+
this.syncLoading = false
117121
}
118122
},
119123
async update(table, values, syncTable = true) {

0 commit comments

Comments
 (0)