web/satellite: fix locked files calculation when pagination is enabled
The problem is that we always have to refetch objects with List command without Delimiter provided to count in objects inside folders. This change doesn't fix the main problem for recently deleted objects. Change-Id: Ia64579745999301c285358869e283dff09399f41
This commit is contained in:
parent
1c0b23a8d0
commit
d60e0f0036
@ -342,7 +342,7 @@ const currentPath = computed((): string => {
|
||||
* Return locked files number.
|
||||
*/
|
||||
const lockedFilesCount = computed((): number => {
|
||||
return objectsCount.value - (isPaginationEnabled.value ? fetchedObjectsCount.value : obStore.state.objectsCount);
|
||||
return objectsCount.value - obStore.state.objectsCount;
|
||||
});
|
||||
|
||||
/**
|
||||
@ -668,15 +668,18 @@ onBeforeMount(async () => {
|
||||
await withLoading(async () => {
|
||||
try {
|
||||
if (isPaginationEnabled.value) {
|
||||
await obStore.initList('');
|
||||
await Promise.all([
|
||||
obStore.initList(''),
|
||||
obStore.getObjectCount(),
|
||||
]);
|
||||
} else {
|
||||
await Promise.all([
|
||||
list(''),
|
||||
obStore.getObjectCount(),
|
||||
]);
|
||||
}
|
||||
} catch (err) {
|
||||
notify.error(err.message, AnalyticsErrorEventSource.FILE_BROWSER_LIST_CALL);
|
||||
} catch (error) {
|
||||
notify.error(error.message, AnalyticsErrorEventSource.FILE_BROWSER_LIST_CALL);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -117,18 +117,15 @@ watch(passphrase, async () => {
|
||||
});
|
||||
|
||||
try {
|
||||
let promises: Promise<void>[] = [
|
||||
const promises: Promise<void>[] = [
|
||||
bucketsStore.getBuckets(bucketPage.value.currentPage, projectID),
|
||||
obStore.getObjectCount(),
|
||||
];
|
||||
|
||||
if (isPaginationEnabled.value) {
|
||||
promises.push(obStore.initList(''));
|
||||
} else {
|
||||
promises = [
|
||||
...promises,
|
||||
obStore.list(''),
|
||||
obStore.getObjectCount(),
|
||||
];
|
||||
promises.push(obStore.list(''));
|
||||
}
|
||||
|
||||
await Promise.all(promises);
|
||||
|
@ -411,11 +411,17 @@ export const useObjectBrowserStore = defineStore('objectBrowser', () => {
|
||||
async function getObjectCount(): Promise<void> {
|
||||
assertIsInitialized(state);
|
||||
|
||||
const responseV2 = await state.s3.send(new ListObjectsV2Command({
|
||||
const paginator = paginateListObjectsV2({ client: state.s3, pageSize: MAX_KEY_COUNT }, {
|
||||
Bucket: state.bucket,
|
||||
}));
|
||||
MaxKeys: MAX_KEY_COUNT,
|
||||
});
|
||||
|
||||
state.objectsCount = responseV2.KeyCount === undefined ? 0 : responseV2.KeyCount;
|
||||
let keyCount = 0;
|
||||
for await (const response of paginator) {
|
||||
keyCount += response.KeyCount ?? 0;
|
||||
}
|
||||
|
||||
state.objectsCount = keyCount;
|
||||
}
|
||||
|
||||
async function upload({ e }: { e: DragEvent | Event }): Promise<void> {
|
||||
|
Loading…
Reference in New Issue
Block a user