From 0432f8f14d114538510f2e5fbad46367554d9f10 Mon Sep 17 00:00:00 2001 From: Yehor Butko Date: Wed, 20 Mar 2019 13:31:00 +0200 Subject: [PATCH] V3-1289 API keys fetch bug (#1531) --- .../src/components/header/AccountDropdown.vue | 4 +++- .../src/store/modules/notifications.ts | 19 +++++++++++++------ web/satellite/src/store/mutationConstants.ts | 1 + .../src/utils/constants/actionNames.ts | 1 + 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/web/satellite/src/components/header/AccountDropdown.vue b/web/satellite/src/components/header/AccountDropdown.vue index 6a4c344cb..8a5228787 100644 --- a/web/satellite/src/components/header/AccountDropdown.vue +++ b/web/satellite/src/components/header/AccountDropdown.vue @@ -47,7 +47,7 @@ import { Component, Vue } from 'vue-property-decorator'; import { removeToken } from '@/utils/tokenManager'; import ROUTES from '@/utils/constants/routerConstants'; -import { APP_STATE_ACTIONS, PROJETS_ACTIONS, PM_ACTIONS, USER_ACTIONS } from '@/utils/constants/actionNames'; +import { APP_STATE_ACTIONS, PROJETS_ACTIONS, PM_ACTIONS, USER_ACTIONS, API_KEYS_ACTIONS, NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames'; @Component( { @@ -68,6 +68,8 @@ import { APP_STATE_ACTIONS, PROJETS_ACTIONS, PM_ACTIONS, USER_ACTIONS } from '@/ this.$store.dispatch(PM_ACTIONS.CLEAR); this.$store.dispatch(PROJETS_ACTIONS.CLEAR); this.$store.dispatch(USER_ACTIONS.CLEAR); + this.$store.dispatch(API_KEYS_ACTIONS.CLEAR); + this.$store.dispatch(NOTIFICATION_ACTIONS.CLEAR); } }, } diff --git a/web/satellite/src/store/modules/notifications.ts b/web/satellite/src/store/modules/notifications.ts index c4c7f68cd..2c32f8e63 100644 --- a/web/satellite/src/store/modules/notifications.ts +++ b/web/satellite/src/store/modules/notifications.ts @@ -4,6 +4,7 @@ import { NOTIFICATION_MUTATIONS } from '../mutationConstants'; import { NOTIFICATION_TYPES } from '@/utils/constants/notification'; import { DelayedNotification } from '@/types/DelayedNotification'; +import { NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames'; export const notificationsModule = { state: { @@ -36,10 +37,13 @@ export const notificationsModule = { [NOTIFICATION_MUTATIONS.RESUME](state: any): void { state.notificationQueue[0].start(); }, + [NOTIFICATION_MUTATIONS.CLEAR](state: any): void { + state.notificationQueue = []; + }, }, actions: { // Commits muttation for adding success notification - success: function ({commit}: any, message: string): void { + [NOTIFICATION_ACTIONS.SUCCESS]: function ({commit}: any, message: string): void { const notification = new DelayedNotification( () => commit(NOTIFICATION_MUTATIONS.DELETE), NOTIFICATION_TYPES.SUCCESS, @@ -49,7 +53,7 @@ export const notificationsModule = { commit(NOTIFICATION_MUTATIONS.ADD, notification); }, // Commits muttation for adding info notification - notify: function ({commit}: any, message: string): void { + [NOTIFICATION_ACTIONS.NOTIFY]: function ({commit}: any, message: string): void { const notification = new DelayedNotification( () => commit(NOTIFICATION_MUTATIONS.DELETE), @@ -60,7 +64,7 @@ export const notificationsModule = { commit(NOTIFICATION_MUTATIONS.ADD, notification); }, // Commits muttation for adding error notification - error: function ({commit}: any, message: string): void { + [NOTIFICATION_ACTIONS.ERROR]: function ({commit}: any, message: string): void { const notification = new DelayedNotification( () => commit(NOTIFICATION_MUTATIONS.DELETE), NOTIFICATION_TYPES.ERROR, @@ -69,15 +73,18 @@ export const notificationsModule = { commit(NOTIFICATION_MUTATIONS.ADD, notification); }, - deleteNotification: function ({commit}: any): void { + [NOTIFICATION_ACTIONS.DELETE]: function ({commit}: any): void { commit(NOTIFICATION_MUTATIONS.DELETE); }, - pauseNotification: function ({commit}: any): void { + [NOTIFICATION_ACTIONS.PAUSE]: function ({commit}: any): void { commit(NOTIFICATION_MUTATIONS.PAUSE); }, - resumeNotification: function ({commit}: any): void { + [NOTIFICATION_ACTIONS.RESUME]: function ({commit}: any): void { commit(NOTIFICATION_MUTATIONS.RESUME); }, + [NOTIFICATION_ACTIONS.CLEAR]: function ({commit}): void { + commit(NOTIFICATION_MUTATIONS.CLEAR); + }, }, getters: { currentNotification: (state: any) => { diff --git a/web/satellite/src/store/mutationConstants.ts b/web/satellite/src/store/mutationConstants.ts index 3b644f699..ae4ff6b20 100644 --- a/web/satellite/src/store/mutationConstants.ts +++ b/web/satellite/src/store/mutationConstants.ts @@ -44,6 +44,7 @@ export const NOTIFICATION_MUTATIONS = { DELETE: 'DELETE_NOTIFICATION', PAUSE: 'PAUSE_NOTIFICATION', RESUME: 'RESUME_NOTIFICATION', + CLEAR: 'CLEAR_NOTIFICATIONS', }; export const APP_STATE_MUTATIONS = { diff --git a/web/satellite/src/utils/constants/actionNames.ts b/web/satellite/src/utils/constants/actionNames.ts index 4e02030b2..299b9302b 100644 --- a/web/satellite/src/utils/constants/actionNames.ts +++ b/web/satellite/src/utils/constants/actionNames.ts @@ -22,6 +22,7 @@ export const NOTIFICATION_ACTIONS = { DELETE: 'deleteNotification', PAUSE: 'pauseNotification', RESUME: 'resumeNotification', + CLEAR: 'clearNotifications', }; export const PM_ACTIONS = {