Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion frontend/src/components/bucket/BucketConfigForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,13 @@ const onSubmit = async (values: any) => {
const bucketChanges = differential(formBucket, initialValues);
props.bucket
const bucketModel = props.bucket
? await bucketStore.updateBucket(props.bucket?.bucketId, bucketChanges)
: await bucketStore.createBucket(formBucket);
// if successfully added a new configuration, do a recursive sync of this bucket
if(!props.bucket) await bucketStore.syncBucket(bucketModel.bucketId, true);
// refresh bucket list
await bucketStore.fetchBuckets({ userId: getUserId.value, objectPerms: true });
// trim trailing "//", if present
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/components/bucket/BucketTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,7 @@ watch(getBuckets, () => {
}
}
// Expand all nodes and set tree state
bucketTreeNodeMap.forEach((_v, k) => (expandedKeys.value[k] = true));
//set tree state
treeData.value = tree;
});
</script>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/common/SyncButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const onSubmit = () => {
if (props.objectId) {
objectStore.syncObject(props.objectId);
} else if (props.bucketId) {
bucketStore.syncBucket(props.bucketId);
bucketStore.syncBucket(props.bucketId, false);
} else {
toast.error('', 'Unable to synchronize');
}
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/object/ObjectVersion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ const isDeleted: Ref<boolean> = computed(() => getIsDeleted.value(props.objectId
const tableData: Ref<Array<VersionDataSource>> = computed(() => {
return versions.value
.filter(v => !v.deleteMarker)
.sort((a, b) => {
return new Date(a.lastModifiedDate) < new Date(b.lastModifiedDate) ? 1 : -1;
})
.map((v: Version, index, arr) => ({
...v,
createdByName: getUser.value(v.createdBy)?.fullName,
versionNumber: arr.length - index,
isDeleted: isDeleted.value,
}));
});
// Highlight row for currently selected version
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/services/bucketService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ export default {
* @param {string} bucketId Bucket ID for the bucket to synchronize
* @returns {Promise} An axios response
*/
syncBucket(bucketId: string) {
return comsAxios().get(`${BUCKET_PATH}/${bucketId}/sync`);
syncBucket(bucketId: string, recursive: boolean ) {
return comsAxios().get(`${BUCKET_PATH}/${bucketId}/sync`, {
params: {
recursive: recursive,
}
});
}
};
4 changes: 2 additions & 2 deletions frontend/src/store/bucketStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ export const useBucketStore = defineStore('bucket', () => {
}
}

async function syncBucket(bucketId: string) {
async function syncBucket(bucketId: string, recursive: boolean) {
try {
appStore.beginIndeterminateLoading();

await bucketService.syncBucket(bucketId);
await bucketService.syncBucket(bucketId, recursive );
toast.success('', 'Sync is in queue and will begin soon');
} catch (error: any) {
toast.error('Unable to sync', error);
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types/Version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export type Version = {
mimeType: string;
objectId: string;
s3VersionId: string;
lastModifiedDate: string;
} & IAudit;
6 changes: 4 additions & 2 deletions frontend/tests/unit/store/versionStore.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const version: Version = {
objectId: '000',
s3VersionId: 's3123',
isLatest: true,
createdAt: '2023-05-01T22:18:12.553Z'
createdAt: '2023-05-01T22:18:12.553Z',
lastModifiedDate: '2023-05-01T22:18:12.553Z',
};

const versionOld: Version = {
Expand All @@ -41,7 +42,8 @@ const versionOld: Version = {
objectId: '000',
s3VersionId: 's2000',
isLatest: false,
createdAt: '2022-05-01T18:25:42.462Z'
createdAt: '2022-05-01T18:25:42.462Z',
lastModifiedDate: '2023-05-01T22:18:12.553Z',
};

const mockToast = vi.fn();
Expand Down
Loading