Skip to content

Commit df08f0e

Browse files
committed
trigger recursive sync when connecting a new storage location
1 parent 410ae8b commit df08f0e

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

frontend/src/components/bucket/BucketConfigForm.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,13 @@ const onSubmit = async (values: any) => {
7878
7979
const bucketChanges = differential(formBucket, initialValues);
8080
81-
props.bucket
81+
const bucketModel = props.bucket
8282
? await bucketStore.updateBucket(props.bucket?.bucketId, bucketChanges)
8383
: await bucketStore.createBucket(formBucket);
8484
85+
// if successfully added a new configuration, do a recursive sync of this bucket
86+
if(!props.bucket) await bucketStore.syncBucket(bucketModel.bucketId, true);
87+
// refresh bucket list
8588
await bucketStore.fetchBuckets({ userId: getUserId.value, objectPerms: true });
8689
8790
// trim trailing "//", if present

frontend/src/components/common/SyncButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const onSubmit = () => {
4141
if (props.objectId) {
4242
objectStore.syncObject(props.objectId);
4343
} else if (props.bucketId) {
44-
bucketStore.syncBucket(props.bucketId);
44+
bucketStore.syncBucket(props.bucketId, false);
4545
} else {
4646
toast.error('', 'Unable to synchronize');
4747
}

frontend/src/services/bucketService.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ export default {
6464
* @param {string} bucketId Bucket ID for the bucket to synchronize
6565
* @returns {Promise} An axios response
6666
*/
67-
syncBucket(bucketId: string) {
68-
return comsAxios().get(`${BUCKET_PATH}/${bucketId}/sync`);
67+
syncBucket(bucketId: string, recursive: boolean ) {
68+
return comsAxios().get(`${BUCKET_PATH}/${bucketId}/sync`, {
69+
params: {
70+
recursive: recursive,
71+
}
72+
});
6973
}
7074
};

frontend/src/store/bucketStore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@ export const useBucketStore = defineStore('bucket', () => {
112112
}
113113
}
114114

115-
async function syncBucket(bucketId: string) {
115+
async function syncBucket(bucketId: string, recursive: boolean) {
116116
try {
117117
appStore.beginIndeterminateLoading();
118118

119-
await bucketService.syncBucket(bucketId);
119+
await bucketService.syncBucket(bucketId, recursive );
120120
toast.success('', 'Sync is in queue and will begin soon');
121121
} catch (error: any) {
122122
toast.error('Unable to sync', error);

0 commit comments

Comments
 (0)