web/satellite: clean up popup constants

This change removes unused modal and dropdown action/mutation constants

Change-Id: Ib4f789ec967727d3619e9fd7769caf99dc9531ac
This commit is contained in:
Wilfred Asomani 2023-02-17 16:20:39 +00:00 committed by Vitalii Shpital
parent 19d4fcc530
commit 81d7f751da
9 changed files with 13 additions and 94 deletions

View File

@ -374,7 +374,7 @@ function setShiftSelectedFiles(): void {
function share(): void {
store.dispatch('files/closeDropdown');
store.commit('files/setObjectPathForModal', props.path + props.file.Key);
store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.SHARE_OBJECT);
store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.shareObject);
}
/**

View File

@ -156,7 +156,7 @@ export default class CreateProjectModal extends Vue {
this.closeModal();
this.$store.commit(OBJECTS_MUTATIONS.CLEAR);
this.$store.commit(APP_STATE_MUTATIONS.TOGGLE_CREATE_PROJECT_PASSPHRASE_MODAL_SHOWN);
this.$store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.createProjectPassphrase);
this.analytics.pageVisit(RouteConfig.ProjectDashboard.path);
await this.$router.push(RouteConfig.ProjectDashboard.path);

View File

@ -149,7 +149,7 @@ const promptForPassphrase = computed((): boolean => {
* Toggles set passphrase modal visibility.
*/
function onSetClick() {
store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.CREATE_PROJECT_PASSPHRASE);
store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.createProjectPassphrase);
}
@ -157,7 +157,7 @@ function onSetClick() {
* Toggles create bucket modal visibility.
*/
function onCreateBucketClick(): void {
store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.CREATE_BUCKET);
store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.createBucket);
}
/**

View File

@ -119,7 +119,7 @@ const bucketsPage = computed((): BucketPage => {
* Toggles create project passphrase modal visibility.
*/
function onSetClick() {
store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.CREATE_PROJECT_PASSPHRASE);
store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.createProjectPassphrase);
}
/**

View File

@ -55,12 +55,6 @@ export const appStateModule = {
[APP_STATE_MUTATIONS.TOGGLE_HAS_JUST_LOGGED_IN](state: State): void {
state.appState.hasJustLoggedIn = !state.appState.hasJustLoggedIn;
},
[APP_STATE_MUTATIONS.SHOW_SET_DEFAULT_PAYMENT_METHOD_POPUP](state: State, id: string): void {
state.appState.setDefaultPaymentMethodID = id;
},
[APP_STATE_MUTATIONS.SHOW_DELETE_PAYMENT_METHOD_POPUP](state: State, id: string): void {
state.appState.deletePaymentMethodID = id;
},
[APP_STATE_MUTATIONS.CLOSE_BILLING_NOTIFICATION](state: State): void {
state.appState.isBillingNotificationShown = false;
},
@ -149,22 +143,6 @@ export const appStateModule = {
commit(APP_STATE_MUTATIONS.TOGGLE_SUCCESSFUL_PASSWORD_RESET);
},
[APP_STATE_ACTIONS.SHOW_SET_DEFAULT_PAYMENT_METHOD_POPUP]: function ({ commit, state }: AppContext, methodID: string): void {
if (!state.appState.setDefaultPaymentMethodID) {
commit(APP_STATE_MUTATIONS.TOGGLE_ACTIVE_DROPDOWN, '');
}
commit(APP_STATE_MUTATIONS.SHOW_SET_DEFAULT_PAYMENT_METHOD_POPUP, methodID);
},
[APP_STATE_ACTIONS.SHOW_DELETE_PAYMENT_METHOD_POPUP]: function ({ commit, state }: AppContext, methodID: string): void {
if (!state.appState.deletePaymentMethodID) {
commit(APP_STATE_MUTATIONS.TOGGLE_ACTIVE_DROPDOWN, '');
}
commit(APP_STATE_MUTATIONS.SHOW_DELETE_PAYMENT_METHOD_POPUP, methodID);
},
[APP_STATE_ACTIONS.CLOSE_POPUPS]: function ({ commit }: AppContext): void {
commit(APP_STATE_MUTATIONS.TOGGLE_ACTIVE_DROPDOWN, '');
},

View File

@ -4,9 +4,9 @@
import S3, { CommonPrefix } from 'aws-sdk/clients/s3';
import { StoreModule } from '@/types/store';
import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
import { AnalyticsErrorEventSource } from '@/utils/constants/analyticsEventNames';
import { APP_STATE_MUTATIONS } from '@/store/mutationConstants';
import { MODALS } from '@/utils/constants/appStatePopUps';
const listCache = new Map();
@ -547,7 +547,7 @@ export const makeFilesModule = (): FilesModule => ({
if (uploadedFiles.length === 1) {
if (state.openModalOnFirstUpload === true) {
commit('setObjectPathForModal', params.Key);
commit(APP_STATE_MUTATIONS.TOGGLE_OBJECT_DETAILS_MODAL_SHOWN, null, { root: true });
commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.objectDetails, { root: true });
}
}

View File

@ -10,51 +10,11 @@ export const NOTIFICATION_MUTATIONS = {
};
export const APP_STATE_MUTATIONS = {
TOGGLE_ADD_TEAM_MEMBERS_MODAL: 'TOGGLE_ADD_TEAM_MEMBERS_MODAL',
TOGGLE_ACCOUNT_DROPDOWN: 'TOGGLE_ACCOUNT_DROPDOWN',
TOGGLE_SELECT_PROJECT_DROPDOWN: 'TOGGLE_SELECT_PROJECT_DROPDOWN',
TOGGLE_RESOURCES_DROPDOWN: 'TOGGLE_RESOURCES_DROPDOWN',
TOGGLE_QUICK_START_DROPDOWN: 'TOGGLE_QUICK_START_DROPDOWN',
TOGGLE_SETTINGS_DROPDOWN: 'TOGGLE_SETTINGS_DROPDOWN',
TOGGLE_EDIT_PROJECT_DROPDOWN: 'TOGGLE_EDIT_PROJECT_DROPDOWN',
TOGGLE_FREE_CREDITS_DROPDOWN: 'TOGGLE_FREE_CREDITS_DROPDOWN',
TOGGLE_AVAILABLE_BALANCE_DROPDOWN: 'TOGGLE_AVAILABLE_BALANCE_DROPDOWN',
TOGGLE_PERIODS_DROPDOWN: 'TOGGLE_PERIODS_DROPDOWN',
TOGGLE_AG_DATEPICKER_DROPDOWN: 'TOGGLE_AG_DATEPICKER_DROPDOWN',
TOGGLE_CHARTS_DATEPICKER_DROPDOWN: 'TOGGLE_CHARTS_DATEPICKER_DROPDOWN',
TOGGLE_BUCKET_NAMES_DROPDOWN: 'TOGGLE_BUCKET_NAMES_DROPDOWN',
TOGGLE_PERMISSIONS_DROPDOWN: 'TOGGLE_PERMISSIONS_DROPDOWN',
TOGGLE_SUCCESSFUL_PASSWORD_RESET: 'TOGGLE_SUCCESSFUL_PASSWORD_RESET',
TOGGLE_SUCCESSFUL_PROJECT_CREATION_POPUP: 'TOGGLE_SUCCESSFUL_PROJECT_CREATION_POPUP',
TOGGLE_EDIT_PROFILE_MODAL_SHOWN: 'TOGGLE_EDIT_PROFILE_MODAL_SHOWN',
TOGGLE_CHANGE_PASSWORD_MODAL_SHOWN: 'TOGGLE_CHANGE_PASSWORD_MODAL_SHOWN',
TOGGLE_UPLOAD_CANCEL_POPUP: 'TOGGLE_UPLOAD_CANCEL_POPUP',
TOGGLE_CREATE_PROJECT_PROMPT_POPUP: 'TOGGLE_CREATE_PROJECT_PROMPT_POPUP',
TOGGLE_CREATE_PROJECT_POPUP: 'TOGGLE_CREATE_PROJECT_POPUP',
TOGGLE_IS_ADD_PM_MODAL_SHOWN: 'TOGGLE_IS_ADD_PM_MODAL_SHOWN',
TOGGLE_OPEN_BUCKET_MODAL_SHOWN: 'TOGGLE_OPEN_BUCKET_MODAL_SHOWN',
TOGGLE_ENTER_PASSPHRASE_MODAL_SHOWN: 'TOGGLE_ENTER_PASSPHRASE_MODAL_SHOWN',
TOGGLE_HAS_JUST_LOGGED_IN: 'TOGGLE_HAS_JUST_LOGGED_IN',
TOGGLE_MFA_RECOVERY_MODAL_SHOWN: 'TOGGLE_MFA_RECOVERY_MODAL_SHOWN',
TOGGLE_ENABLE_MFA_MODAL_SHOWN: 'TOGGLE_ENABLE_MFA_MODAL_SHOWN',
TOGGLE_DISABLE_MFA_MODAL_SHOWN: 'TOGGLE_DISABLE_MFA_MODAL_SHOWN',
TOGGLE_ADD_TOKEN_FUNDS_MODAL_SHOWN: 'TOGGLE_ADD_TOKEN_FUNDS_MODAL_SHOWN',
TOGGLE_SHARE_BUCKET_MODAL_SHOWN: 'TOGGLE_SHARE_BUCKET_MODAL_SHOWN',
TOGGLE_SHARE_OBJECT_MODAL_SHOWN: 'TOGGLE_SHARE_OBJECT_MODAL_SHOWN',
TOGGLE_DELETE_BUCKET_MODAL_SHOWN: 'TOGGLE_DELETE_BUCKET_MODAL_SHOWN',
TOGGLE_OBJECT_DETAILS_MODAL_SHOWN: 'TOGGLE_OBJECT_DETAILS_MODAL_SHOWN',
TOGGLE_ADD_COUPON_MODAL_SHOWN: 'TOGGLE_ADD_COUPON_MODAL_SHOWN',
TOGGLE_NEW_BILLING_ADD_COUPON_MODAL_SHOWN: 'TOGGLE_NEW_BILLING_ADD_COUPON_MODAL_SHOWN',
TOGGLE_NEW_FOLDER_MODAL_SHOWN: 'TOGGLE_NEW_FOLDER_MODAL_SHOWN',
TOGGLE_CREATE_PROJECT_PASSPHRASE_MODAL_SHOWN: 'TOGGLE_CREATE_PROJECT_PASSPHRASE_MODAL_SHOWN',
TOGGLE_MANAGE_PROJECT_PASSPHRASE_MODAL_SHOWN: 'TOGGLE_MANAGE_PROJECT_PASSPHRASE_MODAL_SHOWN',
TOGGLE_CREATE_BUCKET_MODAL_SHOWN: 'TOGGLE_CREATE_BUCKET_MODAL_SHOWN',
SHOW_DELETE_PAYMENT_METHOD_POPUP: 'SHOW_DELETE_PAYMENT_METHOD_POPUP',
SHOW_SET_DEFAULT_PAYMENT_METHOD_POPUP: 'SHOW_SET_DEFAULT_PAYMENT_METHOD_POPUP',
CLEAR: 'CLEAR_APPSTATE',
CLOSE_BILLING_NOTIFICATION: 'closeBillingNotification',
CHANGE_STATE: 'CHANGE_STATE',
TOGGLE_PAYMENT_SELECTION: 'TOGGLE_PAYMENT_SELECTION',
SET_SATELLITE_NAME: 'SET_SATELLITE_NAME',
SET_PARTNERED_SATELLITES: 'SET_PARTNERED_SATELLITES',
SET_SATELLITE_STATUS: 'SET_SATELLITE_STATUS',

View File

@ -2,30 +2,10 @@
// See LICENSE for copying information.
export const APP_STATE_ACTIONS = {
TOGGLE_ACCOUNT: 'toggleAccountDropdown',
TOGGLE_SELECT_PROJECT_DROPDOWN: 'toggleSelectProjectDropdown',
TOGGLE_RESOURCES_DROPDOWN: 'toggleResourcesDropdown',
TOGGLE_QUICK_START_DROPDOWN: 'toggleQuickStartDropdown',
TOGGLE_SETTINGS_DROPDOWN: 'toggleSettingsDropdown',
TOGGLE_EDIT_PROJECT_DROPDOWN: 'toggleEditProjectDropdown',
TOGGLE_FREE_CREDITS_DROPDOWN: 'toggleFreeCreditsDropdown',
TOGGLE_AVAILABLE_BALANCE_DROPDOWN: 'toggleAvailableBalanceDropdown',
TOGGLE_PERIODS_DROPDOWN: 'togglePeriodsDropdown',
TOGGLE_AG_DATEPICKER_DROPDOWN: 'toggleAGDatepickerDropdown',
TOGGLE_CHARTS_DATEPICKER_DROPDOWN: 'toggleChartsDatepickerDropdown',
TOGGLE_BUCKET_NAMES_DROPDOWN: 'toggleBucketNamesDropdown',
TOGGLE_PERMISSIONS_DROPDOWN: 'togglePermissionsDropdown',
TOGGLE_SUCCESSFUL_PASSWORD_RESET: 'TOGGLE_SUCCESSFUL_PASSWORD_RESET',
TOGGLE_SUCCESSFUL_PROJECT_CREATION_POPUP: 'toggleSuccessfulProjectCreationPopup',
TOGGLE_UPLOAD_CANCEL_POPUP: 'toggleUploadCancelPopup',
SHOW_SET_DEFAULT_PAYMENT_METHOD_POPUP: 'showSetDefaultPaymentMethodPopup',
CLOSE_SET_DEFAULT_PAYMENT_METHOD_POPUP: 'closeSetDefaultPaymentMethodPopup',
SHOW_DELETE_PAYMENT_METHOD_POPUP: 'showDeletePaymentMethodPopup',
CLOSE_DELETE_PAYMENT_METHOD_POPUP: 'closeDeletePaymentMethodPopup',
CLOSE_POPUPS: 'closePopups',
CLEAR: 'clearAppstate',
CHANGE_STATE: 'changeFetchState',
TOGGLE_PAYMENT_SELECTION: 'TOGGLE_PAYMENT_SELECTION',
SET_SATELLITE_NAME: 'SET_SATELLITE_NAME',
SET_PARTNERED_SATELLITES: 'SET_PARTNERED_SATELLITES',
SET_SATELLITE_STATUS: 'SET_SATELLITE_STATUS',

View File

@ -11,6 +11,7 @@ import { makeNotificationsModule } from '@/store/modules/notifications';
import { makeProjectMembersModule } from '@/store/modules/projectMembers';
import { ProjectMember, ProjectMemberHeaderState, ProjectMembersPage } from '@/types/projectMembers';
import { APP_STATE_MUTATIONS } from '@/store/mutationConstants';
import { MODALS } from '@/utils/constants/appStatePopUps';
import HeaderArea from '@/components/team/HeaderArea.vue';
@ -50,7 +51,7 @@ describe('Team HeaderArea', () => {
});
it('renders correctly with opened Add team member popup', () => {
store.commit(APP_STATE_MUTATIONS.TOGGLE_ADD_TEAM_MEMBERS_MODAL);
store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.addTeamMember);
const wrapper = shallowMount<HeaderArea>(HeaderArea, {
store,
@ -63,11 +64,11 @@ describe('Team HeaderArea', () => {
expect(wrapper.findAll('.blur-content').length).toBe(0);
expect(wrapper.findAll('.blur-search').length).toBe(0);
store.commit(APP_STATE_MUTATIONS.TOGGLE_ADD_TEAM_MEMBERS_MODAL);
store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.addTeamMember);
});
it('renders correctly with selected users', () => {
store.commit(APP_STATE_MUTATIONS.TOGGLE_ADD_TEAM_MEMBERS_MODAL);
store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.addTeamMember);
const selectedUsersCount = 2;
@ -90,7 +91,7 @@ describe('Team HeaderArea', () => {
});
it('renders correctly with 2 selected users and delete clicked once', async () => {
store.commit(APP_STATE_MUTATIONS.TOGGLE_ADD_TEAM_MEMBERS_MODAL);
store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.addTeamMember);
const selectedUsersCount = 2;
@ -117,7 +118,7 @@ describe('Team HeaderArea', () => {
});
it('renders correctly with 1 selected user and delete clicked once', async () => {
store.commit(APP_STATE_MUTATIONS.TOGGLE_ADD_TEAM_MEMBERS_MODAL);
store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.addTeamMember);
const selectedUsersCount = 1;