-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -83,158 +62,13 @@ import EnterPassphraseModal from '@/components/modals/EnterPassphraseModal.vue';
})
export default class AllModals extends Vue {
// TODO: add active modal indicator.
- /**
- * Indicates if create project prompt modal is shown.
- */
- public get isCreateProjectPromptModal(): boolean {
- return this.$store.state.appStateModule.appState.isCreateProjectPromptModalShown;
- }
/**
- * Indicates if create project prompt modal is shown.
- */
- public get isCreateProjectModal(): boolean {
- return this.$store.state.appStateModule.appState.isCreateProjectModalShown;
- }
-
- /**
- * Indicates if add payment method modal is shown.
- */
- public get isAddPMModal(): boolean {
- return this.$store.state.appStateModule.appState.isAddPMModalShown;
- }
-
- /**
- * Indicates if open bucket modal is shown.
- */
- public get isOpenBucketModal(): boolean {
- return this.$store.state.appStateModule.appState.isOpenBucketModalShown;
- }
-
- /**
- * Indicates if MFA recovery modal is shown.
- */
- public get isMFARecoveryModal(): boolean {
- return this.$store.state.appStateModule.appState.isMFARecoveryModalShown;
- }
-
- /**
- * Indicates if enable MFA modal is shown.
- */
- public get isEnableMFAModal(): boolean {
- return this.$store.state.appStateModule.appState.isEnableMFAModalShown;
- }
-
- /**
- * Indicates if disable MFA modal is shown.
- */
- public get isDisableMFAModal(): boolean {
- return this.$store.state.appStateModule.appState.isDisableMFAModalShown;
- }
-
- /**
- * Indicates if edit profile modal is shown.
- */
- public get isEditProfileModal(): boolean {
- return this.$store.state.appStateModule.appState.isEditProfileModalShown;
- }
-
- /**
- * Indicates if change password modal is shown.
- */
- public get isChangePasswordModal(): boolean {
- return this.$store.state.appStateModule.appState.isChangePasswordModalShown;
- }
-
- /**
- * Indicates if add team members modal is shown.
- */
- public get isAddTeamMembersModal(): boolean {
- return this.$store.state.appStateModule.appState.isAddTeamMembersModalShown;
- }
-
- /**
- * Indicates if add token funds modal is shown.
- */
- public get isAddTokenFundsModal(): boolean {
- return this.$store.state.appStateModule.appState.isAddTokenFundsModalShown;
- }
-
- /**
- * Indicates if share bucket modal is shown.
- */
- public get isShareBucketModal(): boolean {
- return this.$store.state.appStateModule.appState.isShareBucketModalShown;
- }
-
- /**
- * Indicates if share object modal is shown.
- */
- public get isShareObjectModal(): boolean {
- return this.$store.state.appStateModule.appState.isShareObjectModalShown;
- }
-
- /**
- * Indicates if delete bucket modal is shown.
- */
- public get isDeleteBucketModal(): boolean {
- return this.$store.state.appStateModule.appState.isDeleteBucketModalShown;
- }
-
- /**
- * Indicates if object details modal is shown.
- */
- public get isObjectDetailsModal(): boolean {
- return this.$store.state.appStateModule.appState.isObjectDetailsModalShown;
- }
-
- /**
- * Indicates if new folder modal is shown.
- */
- public get isNewFolderModal(): boolean {
- return this.$store.state.appStateModule.appState.isNewFolderModalShown;
- }
-
- /**
- * Indicates if add coupon modal is shown.
- */
- public get isAddCouponModal(): boolean {
- return this.$store.state.appStateModule.appState.isAddCouponModalShown;
- }
-
- /**
- * Indicates if new add coupon modal is shown.
- */
- public get isNewBillingAddCouponModal(): boolean {
- return this.$store.state.appStateModule.appState.isNewBillingAddCouponModalShown;
- }
-
- /**
- * Indicates if create project passphrase modal is shown.
- */
- public get isCreateProjectPassphraseModal(): boolean {
- return this.$store.state.appStateModule.appState.isCreateProjectPassphraseModalShown;
- }
-
- /**
- * Indicates if manage project passphrase modal is shown.
- */
- public get isManageProjectPassphraseModal(): boolean {
- return this.$store.state.appStateModule.appState.isManageProjectPassphraseModalShown;
- }
-
- /**
- * Indicates if create bucket modal is shown.
- */
- public get isCreateBucketModal(): boolean {
- return this.$store.state.appStateModule.appState.isCreateBucketModalShown;
- }
-
- /**
- * Indicates if enter passphrase modal is shown.
- */
- public get isEnterPassphraseModal(): boolean {
- return this.$store.state.appStateModule.appState.isEnterPassphraseModalShown;
+ * Indicates the current active modal.
+ */
+ public get activeModal(): unknown | null {
+ // modal could be of VueConstructor type or Object (for composition api components).
+ return this.$store.state.appStateModule.appState.activeModal;
}
}
diff --git a/web/satellite/src/components/modals/ChangePasswordModal.vue b/web/satellite/src/components/modals/ChangePasswordModal.vue
index 7e96ab46b..b6bb04cf2 100644
--- a/web/satellite/src/components/modals/ChangePasswordModal.vue
+++ b/web/satellite/src/components/modals/ChangePasswordModal.vue
@@ -69,6 +69,7 @@ import { Validator } from '@/utils/validation';
import { RouteConfig } from '@/router';
import { AnalyticsHttpApi } from '@/api/analytics';
import { AnalyticsErrorEventSource, AnalyticsEvent } from '@/utils/constants/analyticsEventNames';
+import { MODALS } from '@/utils/constants/appStatePopUps';
import { APP_STATE_MUTATIONS } from '@/store/mutationConstants';
import PasswordStrength from '@/components/common/PasswordStrength.vue';
@@ -203,7 +204,7 @@ export default class ChangePasswordModal extends Vue {
* Closes popup.
*/
public closeModal(): void {
- this.$store.commit(APP_STATE_MUTATIONS.TOGGLE_CHANGE_PASSWORD_MODAL_SHOWN);
+ this.$store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.changePassword);
}
}
diff --git a/web/satellite/src/components/modals/CreateBucketModal.vue b/web/satellite/src/components/modals/CreateBucketModal.vue
index 3e4b3e488..f094f54eb 100644
--- a/web/satellite/src/components/modals/CreateBucketModal.vue
+++ b/web/satellite/src/components/modals/CreateBucketModal.vue
@@ -52,7 +52,6 @@
diff --git a/web/satellite/src/components/modals/CreateProjectPromptModal.vue b/web/satellite/src/components/modals/CreateProjectPromptModal.vue
index 51b067e3a..aef2675ff 100644
--- a/web/satellite/src/components/modals/CreateProjectPromptModal.vue
+++ b/web/satellite/src/components/modals/CreateProjectPromptModal.vue
@@ -33,6 +33,7 @@
diff --git a/web/satellite/src/components/modals/DeleteBucketModal.vue b/web/satellite/src/components/modals/DeleteBucketModal.vue
index 12472781f..f98793aed 100644
--- a/web/satellite/src/components/modals/DeleteBucketModal.vue
+++ b/web/satellite/src/components/modals/DeleteBucketModal.vue
@@ -31,7 +31,7 @@
diff --git a/web/satellite/src/components/modals/NewFolderModal.vue b/web/satellite/src/components/modals/NewFolderModal.vue
index 84fb3c9b6..57b609ab9 100644
--- a/web/satellite/src/components/modals/NewFolderModal.vue
+++ b/web/satellite/src/components/modals/NewFolderModal.vue
@@ -41,8 +41,9 @@
import { Component, Vue } from 'vue-property-decorator';
import { BrowserFile } from '@/types/browser';
-import { APP_STATE_MUTATIONS } from '@/store/mutationConstants';
import { AnalyticsErrorEventSource } from '@/utils/constants/analyticsEventNames';
+import { MODALS } from '@/utils/constants/appStatePopUps';
+import { APP_STATE_MUTATIONS } from '@/store/mutationConstants';
import VModal from '@/components/common/VModal.vue';
import VButton from '@/components/common/VButton.vue';
@@ -72,7 +73,7 @@ export default class NewFolderModal extends Vue {
* Close the NewFolderModal.
*/
public close(): void {
- this.$store.commit(APP_STATE_MUTATIONS.TOGGLE_NEW_FOLDER_MODAL_SHOWN);
+ this.$store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.newFolder);
}
/**
diff --git a/web/satellite/src/components/modals/ObjectDetailsModal.vue b/web/satellite/src/components/modals/ObjectDetailsModal.vue
index ac86bd57c..6d622905c 100644
--- a/web/satellite/src/components/modals/ObjectDetailsModal.vue
+++ b/web/satellite/src/components/modals/ObjectDetailsModal.vue
@@ -118,8 +118,9 @@ import { Component, Vue, Watch } from 'vue-property-decorator';
import prettyBytes from 'pretty-bytes';
import { BrowserFile } from '@/types/browser';
-import { APP_STATE_MUTATIONS } from '@/store/mutationConstants';
import { AnalyticsErrorEventSource } from '@/utils/constants/analyticsEventNames';
+import { MODALS } from '@/utils/constants/appStatePopUps';
+import { APP_STATE_MUTATIONS } from '@/store/mutationConstants';
import VModal from '@/components/common/VModal.vue';
import VButton from '@/components/common/VButton.vue';
@@ -294,7 +295,7 @@ export default class ObjectDetailsModal extends Vue {
* Close the current opened file details modal.
*/
public closeModal(): void {
- this.$store.commit(APP_STATE_MUTATIONS.TOGGLE_OBJECT_DETAILS_MODAL_SHOWN);
+ this.$store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.objectDetails);
}
/**
diff --git a/web/satellite/src/components/modals/OpenBucketModal.vue b/web/satellite/src/components/modals/OpenBucketModal.vue
index 26d0a111c..4bd86f4d8 100644
--- a/web/satellite/src/components/modals/OpenBucketModal.vue
+++ b/web/satellite/src/components/modals/OpenBucketModal.vue
@@ -53,7 +53,6 @@
diff --git a/web/satellite/src/components/modals/createProjectPassphrase/CreateProjectPassphraseModal.vue b/web/satellite/src/components/modals/createProjectPassphrase/CreateProjectPassphraseModal.vue
index 59cbbc8e6..099acf001 100644
--- a/web/satellite/src/components/modals/createProjectPassphrase/CreateProjectPassphraseModal.vue
+++ b/web/satellite/src/components/modals/createProjectPassphrase/CreateProjectPassphraseModal.vue
@@ -61,14 +61,16 @@ import { computed, onMounted, ref } from 'vue';
import { generateMnemonic } from 'bip39';
import { useNotify, useRoute, useRouter, useStore } from '@/utils/hooks';
-import { APP_STATE_MUTATIONS } from '@/store/mutationConstants';
+import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
import { ACCESS_GRANTS_ACTIONS } from '@/store/modules/accessGrants';
import { AccessGrant, EdgeCredentials } from '@/types/accessGrants';
import { OBJECTS_ACTIONS, OBJECTS_MUTATIONS } from '@/store/modules/objects';
import { PROJECTS_ACTIONS } from '@/store/modules/projects';
import { MetaUtils } from '@/utils/meta';
import { AnalyticsErrorEventSource } from '@/utils/constants/analyticsEventNames';
+import { MODALS } from '@/utils/constants/appStatePopUps';
import { RouteConfig } from '@/router';
+import { APP_STATE_MUTATIONS } from '@/store/mutationConstants';
import VModal from '@/components/common/VModal.vue';
import VButton from '@/components/common/VButton.vue';
@@ -168,7 +170,7 @@ function toggleSaved(): void {
* Closes modal.
*/
function closeModal(): void {
- store.commit(APP_STATE_MUTATIONS.TOGGLE_CREATE_PROJECT_PASSPHRASE_MODAL_SHOWN);
+ store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.createProjectPassphrase);
}
/**
diff --git a/web/satellite/src/components/modals/manageProjectPassphrase/ClearStep.vue b/web/satellite/src/components/modals/manageProjectPassphrase/ClearStep.vue
index 5b4845a1d..ea158a8c5 100644
--- a/web/satellite/src/components/modals/manageProjectPassphrase/ClearStep.vue
+++ b/web/satellite/src/components/modals/manageProjectPassphrase/ClearStep.vue
@@ -28,8 +28,10 @@
diff --git a/web/satellite/src/components/modals/manageProjectPassphrase/CreateStep.vue b/web/satellite/src/components/modals/manageProjectPassphrase/CreateStep.vue
index e0adf7fa7..4a381e18f 100644
--- a/web/satellite/src/components/modals/manageProjectPassphrase/CreateStep.vue
+++ b/web/satellite/src/components/modals/manageProjectPassphrase/CreateStep.vue
@@ -28,6 +28,8 @@
diff --git a/web/satellite/src/components/modals/manageProjectPassphrase/ManageProjectPassphraseModal.vue b/web/satellite/src/components/modals/manageProjectPassphrase/ManageProjectPassphraseModal.vue
index ba1fec576..f6f219477 100644
--- a/web/satellite/src/components/modals/manageProjectPassphrase/ManageProjectPassphraseModal.vue
+++ b/web/satellite/src/components/modals/manageProjectPassphrase/ManageProjectPassphraseModal.vue
@@ -33,6 +33,8 @@
import { computed, onMounted, ref } from 'vue';
import { useNotify, useStore } from '@/utils/hooks';
+import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
+import { MODALS } from '@/utils/constants/appStatePopUps';
import { APP_STATE_MUTATIONS } from '@/store/mutationConstants';
import { ManageProjectPassphraseStep } from '@/types/managePassphrase';
@@ -88,7 +90,7 @@ function setManageOptions(): void {
* Closes modal.
*/
function closeModal(): void {
- store.commit(APP_STATE_MUTATIONS.TOGGLE_MANAGE_PROJECT_PASSPHRASE_MODAL_SHOWN);
+ store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.manageProjectPassphrase);
}
onMounted(() => {
diff --git a/web/satellite/src/components/modals/manageProjectPassphrase/SwitchStep.vue b/web/satellite/src/components/modals/manageProjectPassphrase/SwitchStep.vue
index 2706ca082..f37742a2a 100644
--- a/web/satellite/src/components/modals/manageProjectPassphrase/SwitchStep.vue
+++ b/web/satellite/src/components/modals/manageProjectPassphrase/SwitchStep.vue
@@ -39,7 +39,7 @@
diff --git a/web/satellite/src/components/objects/BucketsTable.vue b/web/satellite/src/components/objects/BucketsTable.vue
index b5d0a1643..98cdeb947 100644
--- a/web/satellite/src/components/objects/BucketsTable.vue
+++ b/web/satellite/src/components/objects/BucketsTable.vue
@@ -70,12 +70,14 @@ import { computed, onBeforeUnmount, ref } from 'vue';
import { BUCKET_ACTIONS } from '@/store/modules/buckets';
import { OBJECTS_ACTIONS } from '@/store/modules/objects';
-import { APP_STATE_MUTATIONS } from '@/store/mutationConstants';
+import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
import { BucketPage } from '@/types/buckets';
import { RouteConfig } from '@/router';
import { AnalyticsHttpApi } from '@/api/analytics';
import { useNotify, useRouter, useStore } from '@/utils/hooks';
import { AnalyticsErrorEventSource, AnalyticsEvent } from '@/utils/constants/analyticsEventNames';
+import { MODALS } from '@/utils/constants/appStatePopUps';
+import { APP_STATE_MUTATIONS } from '@/store/mutationConstants';
import VTable from '@/components/common/VTable.vue';
import BucketItem from '@/components/objects/BucketItem.vue';
@@ -147,14 +149,15 @@ const promptForPassphrase = computed((): boolean => {
* Toggles set passphrase modal visibility.
*/
function onSetClick() {
- store.commit(APP_STATE_MUTATIONS.TOGGLE_CREATE_PROJECT_PASSPHRASE_MODAL_SHOWN);
+ store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.CREATE_PROJECT_PASSPHRASE);
+
}
/**
* Toggles create bucket modal visibility.
*/
function onCreateBucketClick(): void {
- store.commit(APP_STATE_MUTATIONS.TOGGLE_CREATE_BUCKET_MODAL_SHOWN);
+ store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.CREATE_BUCKET);
}
/**
@@ -211,7 +214,7 @@ function openBucket(bucketName: string): void {
return;
}
- store.commit(APP_STATE_MUTATIONS.TOGGLE_OPEN_BUCKET_MODAL_SHOWN);
+ store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.openBucket);
}
onBeforeUnmount(() => {
diff --git a/web/satellite/src/components/objects/BucketsView.vue b/web/satellite/src/components/objects/BucketsView.vue
index 5956f75f3..6be0c488c 100644
--- a/web/satellite/src/components/objects/BucketsView.vue
+++ b/web/satellite/src/components/objects/BucketsView.vue
@@ -27,6 +27,8 @@ import { BUCKET_ACTIONS } from '@/store/modules/buckets';
import { BucketPage } from '@/types/buckets';
import { AnalyticsHttpApi } from '@/api/analytics';
import { AnalyticsErrorEventSource } from '@/utils/constants/analyticsEventNames';
+import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
+import { MODALS } from '@/utils/constants/appStatePopUps';
import { APP_STATE_MUTATIONS } from '@/store/mutationConstants';
import EncryptionBanner from '@/components/objects/EncryptionBanner.vue';
@@ -81,7 +83,7 @@ export default class BucketsView extends Vue {
}
if (!this.bucketsPage.buckets.length && !wasDemoBucketCreated && !this.promptForPassphrase) {
- this.$store.commit(APP_STATE_MUTATIONS.TOGGLE_CREATE_BUCKET_MODAL_SHOWN);
+ this.$store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.createBucket);
}
} catch (error) {
await this.$notify.error(`Failed to setup Buckets view. ${error.message}`, AnalyticsErrorEventSource.BUCKET_PAGE);
@@ -101,11 +103,18 @@ export default class BucketsView extends Vue {
}
}
+ /**
+ * Toggles create project passphrase modal visibility.
+ */
+ public onSetClick(): void {
+ this.$store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.createProjectPassphrase);
+ }
+
/**
* Toggles create bucket modal visibility.
*/
public onCreateBucketClick(): void {
- this.$store.commit(APP_STATE_MUTATIONS.TOGGLE_CREATE_BUCKET_MODAL_SHOWN);
+ this.$store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.createBucket);
}
/**
diff --git a/web/satellite/src/components/objects/UploadCancelPopup.vue b/web/satellite/src/components/objects/UploadCancelPopup.vue
index 422ac05ab..8cba679de 100644
--- a/web/satellite/src/components/objects/UploadCancelPopup.vue
+++ b/web/satellite/src/components/objects/UploadCancelPopup.vue
@@ -29,8 +29,9 @@