diff --git a/web/satellite/src/components/accessGrants/createFlow/CreateAccessGrantFlow.vue b/web/satellite/src/components/accessGrants/createFlow/CreateAccessGrantFlow.vue index de9db6dab..295f02f4f 100644 --- a/web/satellite/src/components/accessGrants/createFlow/CreateAccessGrantFlow.vue +++ b/web/satellite/src/components/accessGrants/createFlow/CreateAccessGrantFlow.vue @@ -107,10 +107,10 @@ diff --git a/web/satellite/src/components/navigation/AccountArea.vue b/web/satellite/src/components/navigation/AccountArea.vue index cbab3b7be..20f471d64 100644 --- a/web/satellite/src/components/navigation/AccountArea.vue +++ b/web/satellite/src/components/navigation/AccountArea.vue @@ -55,8 +55,6 @@ import { RouteConfig } from '@/router'; import { AuthHttpApi } from '@/api/auth'; import { NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames'; import { PROJECTS_ACTIONS } from '@/store/modules/projects'; -import { BUCKET_ACTIONS } from '@/store/modules/buckets'; -import { OBJECTS_ACTIONS } from '@/store/modules/objects'; import { AnalyticsHttpApi } from '@/api/analytics'; import { AnalyticsErrorEventSource, AnalyticsEvent } from '@/utils/constants/analyticsEventNames'; import { APP_STATE_DROPDOWNS } from '@/utils/constants/appStatePopUps'; @@ -67,6 +65,7 @@ import { useProjectMembersStore } from '@/store/modules/projectMembersStore'; import { useBillingStore } from '@/store/modules/billingStore'; import { useAppStore } from '@/store/modules/appStore'; import { useAccessGrantsStore } from '@/store/modules/accessGrantsStore'; +import { useBucketsStore } from '@/store/modules/bucketsStore'; import BillingIcon from '@/../static/images/navigation/billing.svg'; import InfoIcon from '@/../static/images/navigation/info.svg'; @@ -78,6 +77,7 @@ import LogoutIcon from '@/../static/images/navigation/logout.svg'; import TierBadgeFree from '@/../static/images/navigation/tierBadgeFree.svg'; import TierBadgePro from '@/../static/images/navigation/tierBadgePro.svg'; +const bucketsStore = useBucketsStore(); const appStore = useAppStore(); const agStore = useAccessGrantsStore(); const store = useStore(); @@ -159,8 +159,7 @@ async function onLogout(): Promise { agStore.stopWorker(), agStore.clear(), store.dispatch(NOTIFICATION_ACTIONS.CLEAR), - store.dispatch(BUCKET_ACTIONS.CLEAR), - store.dispatch(OBJECTS_ACTIONS.CLEAR), + bucketsStore.clear(), appStore.clear(), billingStore.clear(), abTestingStore.reset(), diff --git a/web/satellite/src/components/navigation/MobileNavigation.vue b/web/satellite/src/components/navigation/MobileNavigation.vue index 099790d36..4c06cad4f 100644 --- a/web/satellite/src/components/navigation/MobileNavigation.vue +++ b/web/satellite/src/components/navigation/MobileNavigation.vue @@ -164,8 +164,6 @@ import { computed, ref } from 'vue'; import { AuthHttpApi } from '@/api/auth'; import { AnalyticsHttpApi } from '@/api/analytics'; import { RouteConfig } from '@/router'; -import { BUCKET_ACTIONS } from '@/store/modules/buckets'; -import { OBJECTS_ACTIONS } from '@/store/modules/objects'; import { PROJECTS_ACTIONS } from '@/store/modules/projects'; import { NavigationLink } from '@/types/navigation'; import { Project } from '@/types/projects'; @@ -181,6 +179,7 @@ import { useProjectMembersStore } from '@/store/modules/projectMembersStore'; import { useBillingStore } from '@/store/modules/billingStore'; import { useAppStore } from '@/store/modules/appStore'; import { useAccessGrantsStore } from '@/store/modules/accessGrantsStore'; +import { useBucketsStore } from '@/store/modules/bucketsStore'; import ResourcesLinks from '@/components/navigation/ResourcesLinks.vue'; import QuickStartLinks from '@/components/navigation/QuickStartLinks.vue'; @@ -218,6 +217,7 @@ const navigation: NavigationLink[] = [ RouteConfig.Users.withIcon(UsersIcon), ]; +const bucketsStore = useBucketsStore(); const appStore = useAppStore(); const agStore = useAccessGrantsStore(); const pmStore = useProjectMembersStore(); @@ -381,7 +381,7 @@ async function onProjectSelected(projectID: string): Promise { isProjectDropdownShown.value = false; if (isBucketsView.value) { - await store.dispatch(OBJECTS_ACTIONS.CLEAR); + bucketsStore.clear(); analytics.pageVisit(RouteConfig.Buckets.path); await router.push(RouteConfig.Buckets.path).catch(() => {return; }); } @@ -389,10 +389,10 @@ async function onProjectSelected(projectID: string): Promise { try { await Promise.all([ billingStore.getProjectUsageAndChargesCurrentRollup(), - pmStore.getProjectMembers(FIRST_PAGE, store.getters.selectedProject.id), - agStore.getAccessGrants(FIRST_PAGE, store.getters.selectedProject.id), - store.dispatch(BUCKET_ACTIONS.FETCH, FIRST_PAGE), - store.dispatch(PROJECTS_ACTIONS.GET_LIMITS, store.getters.selectedProject.id), + pmStore.getProjectMembers(FIRST_PAGE, projectID), + agStore.getAccessGrants(FIRST_PAGE, projectID), + bucketsStore.getBuckets(FIRST_PAGE, projectID), + store.dispatch(PROJECTS_ACTIONS.GET_LIMITS, projectID), ]); } catch (error) { await notify.error(`Unable to select project. ${error.message}`, AnalyticsErrorEventSource.MOBILE_NAVIGATION); @@ -471,8 +471,7 @@ async function onLogout(): Promise { agStore.stopWorker(), agStore.clear(), store.dispatch(NOTIFICATION_ACTIONS.CLEAR), - store.dispatch(BUCKET_ACTIONS.CLEAR), - store.dispatch(OBJECTS_ACTIONS.CLEAR), + bucketsStore.clear(), appStore.clear(), billingStore.clear(), abTestingStore.reset(), diff --git a/web/satellite/src/components/navigation/ProjectSelection.vue b/web/satellite/src/components/navigation/ProjectSelection.vue index 954921579..d842b7a5f 100644 --- a/web/satellite/src/components/navigation/ProjectSelection.vue +++ b/web/satellite/src/components/navigation/ProjectSelection.vue @@ -66,10 +66,8 @@ import { RouteConfig } from '@/router'; import { PROJECTS_ACTIONS } from '@/store/modules/projects'; import { AnalyticsErrorEventSource, AnalyticsEvent } from '@/utils/constants/analyticsEventNames'; import { LocalData } from '@/utils/localData'; -import { BUCKET_ACTIONS } from '@/store/modules/buckets'; import { Project } from '@/types/projects'; import { User } from '@/types/users'; -import { OBJECTS_MUTATIONS } from '@/store/modules/objects'; import { APP_STATE_DROPDOWNS, MODALS } from '@/utils/constants/appStatePopUps'; import { useNotify, useRouter, useStore } from '@/utils/hooks'; import { useUsersStore } from '@/store/modules/usersStore'; @@ -77,6 +75,7 @@ import { useProjectMembersStore } from '@/store/modules/projectMembersStore'; import { useBillingStore } from '@/store/modules/billingStore'; import { useAppStore } from '@/store/modules/appStore'; import { useAccessGrantsStore } from '@/store/modules/accessGrantsStore'; +import { useBucketsStore } from '@/store/modules/bucketsStore'; import VLoader from '@/components/common/VLoader.vue'; @@ -87,6 +86,7 @@ import PassphraseIcon from '@/../static/images/navigation/passphrase.svg'; import ManageIcon from '@/../static/images/navigation/manage.svg'; import CreateProjectIcon from '@/../static/images/navigation/createProject.svg'; +const bucketsStore = useBucketsStore(); const appStore = useAppStore(); const agStore = useAccessGrantsStore(); const pmStore = useProjectMembersStore(); @@ -202,10 +202,14 @@ async function onProjectSelected(projectID: string): Promise { pmStore.setSearchQuery(''); closeDropdown(); - store.commit(OBJECTS_MUTATIONS.CLEAR); + bucketsStore.clearS3Data(); appStore.updateActiveModal(MODALS.enterPassphrase); if (isBucketsView.value) { + if (router.currentRoute.name === RouteConfig.BucketsManagement.name) { + await bucketsStore.getBuckets(FIRST_PAGE, projectID); + } + await router.push(RouteConfig.Buckets.path).catch(() => {return; }); return; @@ -220,8 +224,8 @@ async function onProjectSelected(projectID: string): Promise { await Promise.all([ store.dispatch(PROJECTS_ACTIONS.FETCH_DAILY_DATA, { since: past, before: now }), billingStore.getProjectUsageAndChargesCurrentRollup(), - store.dispatch(PROJECTS_ACTIONS.GET_LIMITS, store.getters.selectedProject.id), - store.dispatch(BUCKET_ACTIONS.FETCH, FIRST_PAGE), + store.dispatch(PROJECTS_ACTIONS.GET_LIMITS, projectID), + bucketsStore.getBuckets(FIRST_PAGE, projectID), ]); } catch (error) { await notify.error(error.message, AnalyticsErrorEventSource.NAVIGATION_PROJECT_SELECTION); diff --git a/web/satellite/src/components/objects/BucketDetails.vue b/web/satellite/src/components/objects/BucketDetails.vue index 4975f721d..757224f04 100644 --- a/web/satellite/src/components/objects/BucketDetails.vue +++ b/web/satellite/src/components/objects/BucketDetails.vue @@ -26,19 +26,20 @@ import { computed, onBeforeMount, reactive, ref } from 'vue'; import { Bucket } from '@/types/buckets'; import { RouteConfig } from '@/router'; import { MONTHS_NAMES } from '@/utils/constants/date'; -import { OBJECTS_ACTIONS } from '@/store/modules/objects'; import { AnalyticsHttpApi } from '@/api/analytics'; import { MODALS } from '@/utils/constants/appStatePopUps'; import { EdgeCredentials } from '@/types/accessGrants'; import { AnalyticsErrorEventSource } from '@/utils/constants/analyticsEventNames'; import { useNotify, useRouter, useStore } from '@/utils/hooks'; import { useAppStore } from '@/store/modules/appStore'; +import { useBucketsStore } from '@/store/modules/bucketsStore'; import BucketDetailsOverview from '@/components/objects/BucketDetailsOverview.vue'; import VOverallLoader from '@/components/common/VOverallLoader.vue'; import ArrowRightIcon from '@/../static/images/common/arrowRight.svg'; +const bucketsStore = useBucketsStore(); const appStore = useAppStore(); const store = useStore(); const notify = useNotify(); @@ -53,21 +54,23 @@ const isLoading = ref(false); * Returns condition if user has to be prompt for passphrase from store. */ const promptForPassphrase = computed((): boolean => { - return store.state.objectsModule.promptForPassphrase; + return bucketsStore.state.promptForPassphrase; }); /** * Returns edge credentials from store. */ const edgeCredentials = computed((): EdgeCredentials => { - return store.state.objectsModule.gatewayCredentials; + return bucketsStore.state.edgeCredentials; }); /** * Bucket from store found by router prop. */ const bucket = computed((): Bucket => { - const data = store.state.bucketUsageModule.page.buckets.find((bucket: Bucket) => bucket.name === router.currentRoute.params.bucketName); + const data = bucketsStore.state.page.buckets.find( + (bucket: Bucket) => bucket.name === router.currentRoute.params.bucketName, + ); if (!data) { redirectToBucketsPage(); @@ -90,14 +93,14 @@ function redirectToBucketsPage(): void { * Holds on bucket click. Proceeds to file browser. */ async function openBucket(): Promise { - await store.dispatch(OBJECTS_ACTIONS.SET_FILE_COMPONENT_BUCKET_NAME, bucket.value.name); + bucketsStore.setFileComponentBucketName(bucket.value.name); if (router.currentRoute.params.backRoute === RouteConfig.UploadFileChildren.name || !promptForPassphrase.value) { if (!edgeCredentials.value.accessKeyId) { isLoading.value = true; try { - await store.dispatch(OBJECTS_ACTIONS.SET_S3_CLIENT); + await bucketsStore.setS3Client(store.getters.selectedProject.id); isLoading.value = false; } catch (error) { await notify.error(error.message, AnalyticsErrorEventSource.BUCKET_DETAILS_PAGE); diff --git a/web/satellite/src/components/objects/BucketsTable.vue b/web/satellite/src/components/objects/BucketsTable.vue index 3d8128d7b..44ec43bce 100644 --- a/web/satellite/src/components/objects/BucketsTable.vue +++ b/web/satellite/src/components/objects/BucketsTable.vue @@ -69,8 +69,6 @@ diff --git a/web/satellite/src/components/objects/BucketsView.vue b/web/satellite/src/components/objects/BucketsView.vue index 523b28662..30bd83028 100644 --- a/web/satellite/src/components/objects/BucketsView.vue +++ b/web/satellite/src/components/objects/BucketsView.vue @@ -21,21 +21,21 @@ diff --git a/web/satellite/src/components/objects/UploadCancelPopup.vue b/web/satellite/src/components/objects/UploadCancelPopup.vue index f8b9a646d..1be04f4ff 100644 --- a/web/satellite/src/components/objects/UploadCancelPopup.vue +++ b/web/satellite/src/components/objects/UploadCancelPopup.vue @@ -31,15 +31,16 @@ import { computed } from 'vue'; import { AnalyticsHttpApi } from '@/api/analytics'; import { MODALS } from '@/utils/constants/appStatePopUps'; -import { useRouter, useStore } from '@/utils/hooks'; +import { useRouter } from '@/utils/hooks'; import { useAppStore } from '@/store/modules/appStore'; +import { useBucketsStore } from '@/store/modules/bucketsStore'; import VButton from '@/components/common/VButton.vue'; import WarningIcon from '@/../static/images/objects/cancelWarning.svg'; +const bucketsStore = useBucketsStore(); const appStore = useAppStore(); -const store = useStore(); const router = useRouter(); const analytics: AnalyticsHttpApi = new AnalyticsHttpApi(); @@ -48,7 +49,7 @@ const analytics: AnalyticsHttpApi = new AnalyticsHttpApi(); * Returns leave attempt's route path from store. */ const leaveRoute = computed((): string => { - return store.state.objectsModule.leaveRoute; + return bucketsStore.state.leaveRoute; }); /** diff --git a/web/satellite/src/components/objects/UploadFile.vue b/web/satellite/src/components/objects/UploadFile.vue index d135d8c5b..b99378fc1 100644 --- a/web/satellite/src/components/objects/UploadFile.vue +++ b/web/satellite/src/components/objects/UploadFile.vue @@ -20,15 +20,15 @@ import { AccessGrant, EdgeCredentials } from '@/types/accessGrants'; import { AnalyticsErrorEventSource, AnalyticsEvent } from '@/utils/constants/analyticsEventNames'; import { MODALS } from '@/utils/constants/appStatePopUps'; import { BucketPage } from '@/types/buckets'; -import { BUCKET_ACTIONS } from '@/store/modules/buckets'; -import { OBJECTS_ACTIONS } from '@/store/modules/objects'; import { useNotify, useRouter, useStore } from '@/utils/hooks'; import { useAppStore } from '@/store/modules/appStore'; import { useAccessGrantsStore } from '@/store/modules/accessGrantsStore'; +import { useBucketsStore } from '@/store/modules/bucketsStore'; import FileBrowser from '@/components/browser/FileBrowser.vue'; import UploadCancelPopup from '@/components/objects/UploadCancelPopup.vue'; +const bucketsStore = useBucketsStore(); const appStore = useAppStore(); const agStore = useAccessGrantsStore(); const store = useStore(); @@ -50,35 +50,35 @@ const isCancelUploadPopupVisible = computed((): boolean => { * Returns passphrase from store. */ const passphrase = computed((): string => { - return store.state.objectsModule.passphrase; + return bucketsStore.state.passphrase; }); /** * Returns apiKey from store. */ const apiKey = computed((): string => { - return store.state.objectsModule.apiKey; + return bucketsStore.state.apiKey; }); /** * Returns bucket name from store. */ const bucket = computed((): string => { - return store.state.objectsModule.fileComponentBucketName; + return bucketsStore.state.fileComponentBucketName; }); /** * Returns current bucket page from store. */ const bucketPage = computed((): BucketPage => { - return store.state.bucketUsageModule.page; + return bucketsStore.state.page; }); /** * Returns edge credentials from store. */ const edgeCredentials = computed((): EdgeCredentials => { - return store.state.objectsModule.gatewayCredentials; + return bucketsStore.state.edgeCredentials; }); /** @@ -231,8 +231,10 @@ watch(passphrase, async () => { return; } + const projectID = store.getters.selectedProject.id; + try { - await store.dispatch(OBJECTS_ACTIONS.SET_S3_CLIENT); + await bucketsStore.setS3Client(projectID); } catch (error) { await notify.error(error.message, AnalyticsErrorEventSource.UPLOAD_FILE_VIEW); return; @@ -246,7 +248,7 @@ watch(passphrase, async () => { }); try { await Promise.all([ - store.dispatch(BUCKET_ACTIONS.FETCH, bucketPage.value.currentPage), + bucketsStore.getBuckets(bucketPage.value.currentPage, projectID), store.dispatch('files/list', ''), store.dispatch('files/getObjectCount'), ]); diff --git a/web/satellite/src/components/onboardingTour/steps/cliFlow/AGPermissions.vue b/web/satellite/src/components/onboardingTour/steps/cliFlow/AGPermissions.vue index f704d7827..526ed542f 100644 --- a/web/satellite/src/components/onboardingTour/steps/cliFlow/AGPermissions.vue +++ b/web/satellite/src/components/onboardingTour/steps/cliFlow/AGPermissions.vue @@ -42,12 +42,12 @@ import { computed, onMounted, reactive, ref } from 'vue'; import { RouteConfig } from '@/router'; -import { BUCKET_ACTIONS } from '@/store/modules/buckets'; import { AnalyticsErrorEventSource, AnalyticsEvent } from '@/utils/constants/analyticsEventNames'; import { AnalyticsHttpApi } from '@/api/analytics'; import { useNotify, useRouter, useStore } from '@/utils/hooks'; import { useAppStore } from '@/store/modules/appStore'; import { useAccessGrantsStore } from '@/store/modules/accessGrantsStore'; +import { useBucketsStore } from '@/store/modules/bucketsStore'; import CLIFlowContainer from '@/components/onboardingTour/steps/common/CLIFlowContainer.vue'; import PermissionsSelect from '@/components/onboardingTour/steps/cliFlow/PermissionsSelect.vue'; @@ -58,6 +58,7 @@ import DurationSelection from '@/components/onboardingTour/steps/cliFlow/permiss import Icon from '@/../static/images/onboardingTour/accessGrant.svg'; +const bucketsStore = useBucketsStore(); const appStore = useAppStore(); const agStore = useAccessGrantsStore(); const store = useStore(); @@ -235,7 +236,7 @@ onMounted(async (): Promise => { setWorker(); try { - await store.dispatch(BUCKET_ACTIONS.FETCH_ALL_BUCKET_NAMES); + await bucketsStore.getAllBucketsNames(store.getters.selectedProject.id); areBucketNamesFetching.value = false; } catch (error) { diff --git a/web/satellite/src/components/onboardingTour/steps/cliFlow/permissions/BucketsDropdown.vue b/web/satellite/src/components/onboardingTour/steps/cliFlow/permissions/BucketsDropdown.vue index f6bb28ce7..edfcf335a 100644 --- a/web/satellite/src/components/onboardingTour/steps/cliFlow/permissions/BucketsDropdown.vue +++ b/web/satellite/src/components/onboardingTour/steps/cliFlow/permissions/BucketsDropdown.vue @@ -47,16 +47,16 @@