diff --git a/web/satellite/src/components/browser/FileBrowser.vue b/web/satellite/src/components/browser/FileBrowser.vue index a9a06a7de..fd45934b1 100644 --- a/web/satellite/src/components/browser/FileBrowser.vue +++ b/web/satellite/src/components/browser/FileBrowser.vue @@ -111,6 +111,7 @@ :total-page-count="isPaginationEnabled ? pageCount : 0" :total-items-count="isPaginationEnabled ? fetchedObjectsCount : files.length" show-select + :loading="isLoading" class="file-browser-table" :on-page-change="isPaginationEnabled ? changePageAndLimit : null" @selectAllClicked="toggleSelectAllFiles" @@ -193,7 +194,7 @@
@@ -202,12 +203,6 @@ Drop Files Here to Upload

-
-
-
@@ -239,6 +234,7 @@ import { useBucketsStore } from '@/store/modules/bucketsStore'; import { useConfigStore } from '@/store/modules/configStore'; import { useAnalyticsStore } from '@/store/modules/analyticsStore'; import { DEFAULT_PAGE_LIMIT } from '@/types/pagination'; +import { useLoading } from '@/composables/useLoading'; import VButton from '@/components/common/VButton.vue'; import BucketSettingsNav from '@/components/objects/BucketSettingsNav.vue'; @@ -261,11 +257,11 @@ const analyticsStore = useAnalyticsStore(); const router = useRouter(); const route = useRoute(); const notify = useNotify(); +const { isLoading, withLoading } = useLoading(); const folderInput = ref(); const fileInput = ref(); -const fetchingFilesSpinner = ref(false); const isUploadDropDownShown = ref(false); const isLockedBanner = ref(true); const isTooManyObjectsBanner = ref(true); @@ -363,7 +359,7 @@ const objectsCount = computed((): number => { const lockedFilesEntryDisplayed = computed((): boolean => { return lockedFilesCount.value > 0 && objectsCount.value <= NUMBER_OF_DISPLAYED_OBJECTS && - !fetchingFilesSpinner.value && + !isLoading.value && !currentPath.value; }); @@ -444,7 +440,7 @@ const bucket = computed((): string => { /** * Changes table page and limit. */ -function changePageAndLimit(page: number, limit: number): void { +async function changePageAndLimit(page: number, limit: number): void { obStore.setCursor({ limit, page }); const lastObjectOnPage = page * limit; @@ -454,15 +450,17 @@ function changePageAndLimit(page: number, limit: number): void { return; } - const tokenKey = Math.ceil(lastObjectOnPage / MAX_KEY_COUNT) * MAX_KEY_COUNT; + await withLoading(async () => { + const tokenKey = Math.ceil(lastObjectOnPage / MAX_KEY_COUNT) * MAX_KEY_COUNT; - const tokenToBeFetched = obStore.state.continuationTokens.get(tokenKey); - if (!tokenToBeFetched) { - obStore.initList(routePath.value); - return; - } + const tokenToBeFetched = obStore.state.continuationTokens.get(tokenKey); + if (!tokenToBeFetched) { + await obStore.initList(routePath.value); + return; + } - obStore.listByToken(routePath.value, tokenKey, tokenToBeFetched); + await obStore.listByToken(routePath.value, tokenKey, tokenToBeFetched); + }); } /** @@ -496,11 +494,13 @@ async function onRouteChange(): Promise { routePath.value = calculateRoutePath(); obStore.closeDropdown(); - if (isPaginationEnabled.value) { - await obStore.initList(routePath.value); - } else { - await list(routePath.value); - } + await withLoading(async () => { + if (isPaginationEnabled.value) { + await obStore.initList(routePath.value); + } else { + await list(routePath.value); + } + }); } /** @@ -653,24 +653,20 @@ onBeforeMount(async () => { // clear previous file selections. obStore.clearAllSelectedFiles(); - // display the spinner while files are being fetched - fetchingFilesSpinner.value = true; - - try { - if (isPaginationEnabled.value) { - await obStore.initList(''); - } else { - await Promise.all([ - list(''), - obStore.getObjectCount(), - ]); + await withLoading(async () => { + try { + if (isPaginationEnabled.value) { + await obStore.initList(''); + } else { + await Promise.all([ + list(''), + obStore.getObjectCount(), + ]); + } + } catch (err) { + notify.error(err.message, AnalyticsErrorEventSource.FILE_BROWSER_LIST_CALL); } - } catch (err) { - notify.error(err.message, AnalyticsErrorEventSource.FILE_BROWSER_LIST_CALL); - } - - // remove the spinner after files have been fetched - fetchingFilesSpinner.value = false; + }); }); onBeforeUnmount(() => { diff --git a/web/satellite/src/components/common/TableSizeChanger.vue b/web/satellite/src/components/common/TableSizeChanger.vue index 9bfc1d3a5..ddd272eb3 100644 --- a/web/satellite/src/components/common/TableSizeChanger.vue +++ b/web/satellite/src/components/common/TableSizeChanger.vue @@ -10,7 +10,7 @@ -
+
{ { label: '50', value: 50 }, { label: '100', value: 100 }, ]; - if (props.itemCount && props.itemCount < 1000 && !props.simplePagination) { + if (props.itemCount && withAllOption.value) { return [{ label: 'All', value: props.itemCount }, ...opts]; } return opts; }); +const withAllOption = computed(() => { + return props.itemCount !== undefined && props.itemCount < 1000 && !props.simplePagination; +}); + /** * whether the selector drop down is open * */ @@ -191,4 +195,8 @@ function toggleSelector() { } } } + +.custom-top { + top: -150px; +} diff --git a/web/satellite/src/components/common/VTable.vue b/web/satellite/src/components/common/VTable.vue index 69fc7073d..bea3d12ce 100644 --- a/web/satellite/src/components/common/VTable.vue +++ b/web/satellite/src/components/common/VTable.vue @@ -3,6 +3,9 @@