web/satellite: use notifications pinia module instead of old vuex module
Change-Id: I03f14995d5315068582d357375365f0af8d63b8b
This commit is contained in:
parent
3f8eb58e4c
commit
4ae05afb24
@ -53,7 +53,6 @@ import { computed, ref } from 'vue';
|
||||
import { User } from '@/types/users';
|
||||
import { RouteConfig } from '@/router';
|
||||
import { AuthHttpApi } from '@/api/auth';
|
||||
import { NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames';
|
||||
import { AnalyticsHttpApi } from '@/api/analytics';
|
||||
import { AnalyticsErrorEventSource, AnalyticsEvent } from '@/utils/constants/analyticsEventNames';
|
||||
import { APP_STATE_DROPDOWNS } from '@/utils/constants/appStatePopUps';
|
||||
@ -66,6 +65,7 @@ import { useAppStore } from '@/store/modules/appStore';
|
||||
import { useAccessGrantsStore } from '@/store/modules/accessGrantsStore';
|
||||
import { useBucketsStore } from '@/store/modules/bucketsStore';
|
||||
import { useProjectsStore } from '@/store/modules/projectsStore';
|
||||
import { useNotificationsStore } from '@/store/modules/notificationsStore';
|
||||
|
||||
import BillingIcon from '@/../static/images/navigation/billing.svg';
|
||||
import InfoIcon from '@/../static/images/navigation/info.svg';
|
||||
@ -89,6 +89,7 @@ const billingStore = useBillingStore();
|
||||
const usersStore = useUsersStore();
|
||||
const abTestingStore = useABTestingStore();
|
||||
const pmStore = useProjectMembersStore();
|
||||
const notificationsStore = useNotificationsStore();
|
||||
|
||||
const auth: AuthHttpApi = new AuthHttpApi();
|
||||
const analytics: AnalyticsHttpApi = new AnalyticsHttpApi();
|
||||
@ -159,7 +160,7 @@ async function onLogout(): Promise<void> {
|
||||
usersStore.clear(),
|
||||
agStore.stopWorker(),
|
||||
agStore.clear(),
|
||||
store.dispatch(NOTIFICATION_ACTIONS.CLEAR),
|
||||
notificationsStore.clear(),
|
||||
bucketsStore.clear(),
|
||||
appStore.clear(),
|
||||
billingStore.clear(),
|
||||
|
@ -167,7 +167,6 @@ import { RouteConfig } from '@/router';
|
||||
import { NavigationLink } from '@/types/navigation';
|
||||
import { Project } from '@/types/projects';
|
||||
import { User } from '@/types/users';
|
||||
import { NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames';
|
||||
import { AnalyticsErrorEventSource, AnalyticsEvent } from '@/utils/constants/analyticsEventNames';
|
||||
import { LocalData } from '@/utils/localData';
|
||||
import { MODALS } from '@/utils/constants/appStatePopUps';
|
||||
@ -180,6 +179,7 @@ import { useAppStore } from '@/store/modules/appStore';
|
||||
import { useAccessGrantsStore } from '@/store/modules/accessGrantsStore';
|
||||
import { useBucketsStore } from '@/store/modules/bucketsStore';
|
||||
import { useProjectsStore } from '@/store/modules/projectsStore';
|
||||
import { useNotificationsStore } from '@/store/modules/notificationsStore';
|
||||
|
||||
import ResourcesLinks from '@/components/navigation/ResourcesLinks.vue';
|
||||
import QuickStartLinks from '@/components/navigation/QuickStartLinks.vue';
|
||||
@ -224,6 +224,7 @@ const pmStore = useProjectMembersStore();
|
||||
const billingStore = useBillingStore();
|
||||
const usersStore = useUsersStore();
|
||||
const abTestingStore = useABTestingStore();
|
||||
const notificationsStore = useNotificationsStore();
|
||||
const projectsStore = useProjectsStore();
|
||||
const store = useStore();
|
||||
const router = useRouter();
|
||||
@ -471,7 +472,7 @@ async function onLogout(): Promise<void> {
|
||||
usersStore.clear(),
|
||||
agStore.stopWorker(),
|
||||
agStore.clear(),
|
||||
store.dispatch(NOTIFICATION_ACTIONS.CLEAR),
|
||||
notificationsStore.clear(),
|
||||
bucketsStore.clear(),
|
||||
appStore.clear(),
|
||||
billingStore.clear(),
|
||||
|
@ -15,17 +15,17 @@
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { DelayedNotification } from '@/types/DelayedNotification';
|
||||
import { useStore } from '@/utils/hooks';
|
||||
import { useNotificationsStore } from '@/store/modules/notificationsStore';
|
||||
|
||||
import NotificationItem from '@/components/notifications/NotificationItem.vue';
|
||||
|
||||
const store = useStore();
|
||||
const notificationsStore = useNotificationsStore();
|
||||
|
||||
/**
|
||||
* Returns all notification queue from store.
|
||||
*/
|
||||
const notifications = computed((): DelayedNotification[] => {
|
||||
return store.state.notificationsModule.notificationQueue;
|
||||
return notificationsStore.state.notificationQueue as DelayedNotification[];
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -31,14 +31,13 @@
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
|
||||
import { DelayedNotification } from '@/types/DelayedNotification';
|
||||
import { NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames';
|
||||
import { useStore } from '@/utils/hooks';
|
||||
import { useNotificationsStore } from '@/store/modules/notificationsStore';
|
||||
import { useAppStore } from '@/store/modules/appStore';
|
||||
|
||||
import CloseIcon from '@/../static/images/notifications/close.svg';
|
||||
|
||||
const store = useStore();
|
||||
const appStore = useAppStore();
|
||||
const notificationsStore = useNotificationsStore();
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
notification: DelayedNotification;
|
||||
@ -67,21 +66,21 @@ const isSupportLinkMentioned = computed((): boolean => {
|
||||
* Forces notification deletion.
|
||||
*/
|
||||
function onCloseClick(): void {
|
||||
store.dispatch(NOTIFICATION_ACTIONS.DELETE, props.notification.id);
|
||||
notificationsStore.deleteNotification(props.notification.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces notification to stay on page on mouse over it.
|
||||
*/
|
||||
function onMouseOver(): void {
|
||||
store.dispatch(NOTIFICATION_ACTIONS.PAUSE, props.notification.id);
|
||||
notificationsStore.pauseNotification(props.notification.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resume notification flow when mouse leaves notification.
|
||||
*/
|
||||
function onMouseLeave(): void {
|
||||
store.dispatch(NOTIFICATION_ACTIONS.RESUME, props.notification.id);
|
||||
notificationsStore.resumeNotification(props.notification.id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ Vue.config.devtools = true;
|
||||
Vue.config.performance = true;
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
Vue.use(new NotificatorPlugin(store));
|
||||
Vue.use(new NotificatorPlugin());
|
||||
Vue.use(VueClipboard);
|
||||
Vue.use(PiniaVuePlugin);
|
||||
const pinia = createPinia();
|
||||
|
@ -4,20 +4,17 @@
|
||||
import Vue from 'vue';
|
||||
import Vuex from 'vuex';
|
||||
|
||||
import { makeNotificationsModule, NotificationsState } from '@/store/modules/notifications';
|
||||
import { FilesState, makeFilesModule } from '@/store/modules/files';
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
export interface ModulesState {
|
||||
notificationsModule: NotificationsState;
|
||||
files: FilesState;
|
||||
}
|
||||
|
||||
// Satellite store (vuex)
|
||||
export const store = new Vuex.Store<ModulesState>({
|
||||
modules: {
|
||||
notificationsModule: makeNotificationsModule(),
|
||||
files: makeFilesModule(),
|
||||
},
|
||||
});
|
||||
|
@ -1,128 +0,0 @@
|
||||
// Copyright (C) 2019 Storj Labs, Inc.
|
||||
// See LICENSE for copying information.
|
||||
|
||||
import { NOTIFICATION_MUTATIONS } from '../mutationConstants';
|
||||
|
||||
import { DelayedNotification } from '@/types/DelayedNotification';
|
||||
import { NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames';
|
||||
import { NOTIFICATION_TYPES } from '@/utils/constants/notification';
|
||||
import { StoreModule } from '@/types/store';
|
||||
import { AnalyticsHttpApi } from '@/api/analytics';
|
||||
import { AnalyticsErrorEventSource } from '@/utils/constants/analyticsEventNames';
|
||||
|
||||
export class NotificationsState {
|
||||
public notificationQueue: DelayedNotification[] = [];
|
||||
public analytics: AnalyticsHttpApi = new AnalyticsHttpApi();
|
||||
}
|
||||
|
||||
interface NotificationsContext {
|
||||
state: NotificationsState
|
||||
commit: (string, ...unknown) => void
|
||||
}
|
||||
|
||||
interface ErrorPayload {
|
||||
message: string,
|
||||
source: AnalyticsErrorEventSource | null,
|
||||
}
|
||||
|
||||
export function makeNotificationsModule(): StoreModule<NotificationsState, NotificationsContext> {
|
||||
return {
|
||||
state: new NotificationsState(),
|
||||
mutations: {
|
||||
// Mutation for adding notification to queue
|
||||
[NOTIFICATION_MUTATIONS.ADD](state: NotificationsState, notification: DelayedNotification): void {
|
||||
state.notificationQueue.push(notification);
|
||||
},
|
||||
// Mutation for deleting notification to queue
|
||||
[NOTIFICATION_MUTATIONS.DELETE](state: NotificationsState, id: string): void {
|
||||
if (state.notificationQueue.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
const selectedNotification = getNotificationById(state.notificationQueue, id);
|
||||
if (selectedNotification) {
|
||||
selectedNotification.pause();
|
||||
state.notificationQueue.splice(state.notificationQueue.indexOf(selectedNotification), 1);
|
||||
}
|
||||
},
|
||||
[NOTIFICATION_MUTATIONS.PAUSE](state: NotificationsState, id: string): void {
|
||||
const selectedNotification = getNotificationById(state.notificationQueue, id);
|
||||
if (selectedNotification) {
|
||||
selectedNotification.pause();
|
||||
}
|
||||
},
|
||||
[NOTIFICATION_MUTATIONS.RESUME](state: NotificationsState, id: string): void {
|
||||
const selectedNotification = getNotificationById(state.notificationQueue, id);
|
||||
if (selectedNotification) {
|
||||
selectedNotification.start();
|
||||
}
|
||||
},
|
||||
[NOTIFICATION_MUTATIONS.CLEAR](state: NotificationsState): void {
|
||||
state.notificationQueue = [];
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
// Commits mutation for adding success notification
|
||||
[NOTIFICATION_ACTIONS.SUCCESS]: function ({ commit }: NotificationsContext, message: string): void {
|
||||
const notification = new DelayedNotification(
|
||||
() => commit(NOTIFICATION_MUTATIONS.DELETE, notification.id),
|
||||
NOTIFICATION_TYPES.SUCCESS,
|
||||
message,
|
||||
);
|
||||
|
||||
commit(NOTIFICATION_MUTATIONS.ADD, notification);
|
||||
},
|
||||
// Commits mutation for adding info notification
|
||||
[NOTIFICATION_ACTIONS.NOTIFY]: function ({ commit }: NotificationsContext, message: string): void {
|
||||
const notification = new DelayedNotification(
|
||||
() => commit(NOTIFICATION_MUTATIONS.DELETE, notification.id),
|
||||
NOTIFICATION_TYPES.NOTIFICATION,
|
||||
message,
|
||||
);
|
||||
|
||||
commit(NOTIFICATION_MUTATIONS.ADD, notification);
|
||||
},
|
||||
// Commits mutation for adding error notification
|
||||
[NOTIFICATION_ACTIONS.ERROR]: function ({ commit, state }: NotificationsContext, payload: ErrorPayload): void {
|
||||
if (payload.source) {
|
||||
state.analytics.errorEventTriggered(payload.source);
|
||||
}
|
||||
|
||||
const notification = new DelayedNotification(
|
||||
() => commit(NOTIFICATION_MUTATIONS.DELETE, notification.id),
|
||||
NOTIFICATION_TYPES.ERROR,
|
||||
payload.message,
|
||||
);
|
||||
|
||||
commit(NOTIFICATION_MUTATIONS.ADD, notification);
|
||||
},
|
||||
// Commits mutation for adding error notification
|
||||
[NOTIFICATION_ACTIONS.WARNING]: function ({ commit }: NotificationsContext, message: string): void {
|
||||
const notification = new DelayedNotification(
|
||||
() => commit(NOTIFICATION_MUTATIONS.DELETE, notification.id),
|
||||
NOTIFICATION_TYPES.WARNING,
|
||||
message,
|
||||
);
|
||||
|
||||
commit(NOTIFICATION_MUTATIONS.ADD, notification);
|
||||
},
|
||||
[NOTIFICATION_ACTIONS.DELETE]: function ({ commit }: NotificationsContext, id: string): void {
|
||||
commit(NOTIFICATION_MUTATIONS.DELETE, id);
|
||||
},
|
||||
[NOTIFICATION_ACTIONS.PAUSE]: function ({ commit }: NotificationsContext, id: string): void {
|
||||
commit(NOTIFICATION_MUTATIONS.PAUSE, id);
|
||||
},
|
||||
[NOTIFICATION_ACTIONS.RESUME]: function ({ commit }: NotificationsContext, id: string): void {
|
||||
commit(NOTIFICATION_MUTATIONS.RESUME, id);
|
||||
},
|
||||
[NOTIFICATION_ACTIONS.CLEAR]: function ({ commit }): void {
|
||||
commit(NOTIFICATION_MUTATIONS.CLEAR);
|
||||
},
|
||||
},
|
||||
getters: {},
|
||||
};
|
||||
}
|
||||
|
||||
function getNotificationById(notifications: DelayedNotification[], id: string): DelayedNotification | undefined {
|
||||
return notifications.find((notification: DelayedNotification) => notification.id === id);
|
||||
}
|
@ -4,8 +4,7 @@
|
||||
import { reactive } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
import { DelayedNotification } from '@/types/DelayedNotification';
|
||||
import { NOTIFICATION_TYPES } from '@/utils/constants/notification';
|
||||
import { DelayedNotification, NOTIFICATION_TYPES } from '@/types/DelayedNotification';
|
||||
import { AnalyticsHttpApi } from '@/api/analytics';
|
||||
import { AnalyticsErrorEventSource } from '@/utils/constants/analyticsEventNames';
|
||||
|
||||
@ -101,9 +100,14 @@ export const useNotificationsStore = defineStore('notifications', () => {
|
||||
}
|
||||
|
||||
return {
|
||||
state,
|
||||
notifyInfo,
|
||||
notifyWarning,
|
||||
notifySuccess,
|
||||
notifyError,
|
||||
pauseNotification,
|
||||
resumeNotification,
|
||||
deleteNotification,
|
||||
clear,
|
||||
};
|
||||
});
|
||||
|
@ -1,10 +0,0 @@
|
||||
// Copyright (C) 2019 Storj Labs, Inc.
|
||||
// See LICENSE for copying information.
|
||||
|
||||
export const NOTIFICATION_MUTATIONS = {
|
||||
ADD: 'ADD_NOTIFICATION',
|
||||
DELETE: 'DELETE_NOTIFICATION',
|
||||
PAUSE: 'PAUSE_NOTIFICATION',
|
||||
RESUME: 'RESUME_NOTIFICATION',
|
||||
CLEAR: 'CLEAR_NOTIFICATIONS',
|
||||
};
|
@ -3,7 +3,6 @@
|
||||
|
||||
import Vue, { VueConstructor } from 'vue';
|
||||
|
||||
import { NOTIFICATION_TYPES } from '@/utils/constants/notification';
|
||||
import { getId } from '@/utils/idGenerator';
|
||||
|
||||
import SuccessIcon from '@/../static/images/notifications/success.svg';
|
||||
@ -11,6 +10,13 @@ import NotificationIcon from '@/../static/images/notifications/notification.svg'
|
||||
import ErrorIcon from '@/../static/images/notifications/error.svg';
|
||||
import WarningIcon from '@/../static/images/notifications/warning.svg';
|
||||
|
||||
export const NOTIFICATION_TYPES = {
|
||||
SUCCESS: 'SUCCESS',
|
||||
NOTIFICATION: 'NOTIFICATION',
|
||||
ERROR: 'ERROR',
|
||||
WARNING: 'WARNING',
|
||||
};
|
||||
|
||||
export class DelayedNotification {
|
||||
private readonly successColor: string = '#DBF1D3';
|
||||
private readonly errorColor: string = '#FFD4D2';
|
||||
|
@ -1,13 +0,0 @@
|
||||
// Copyright (C) 2019 Storj Labs, Inc.
|
||||
// See LICENSE for copying information.
|
||||
|
||||
export const NOTIFICATION_ACTIONS = {
|
||||
SUCCESS: 'success',
|
||||
ERROR: 'error',
|
||||
NOTIFY: 'notify',
|
||||
WARNING: 'WARNING',
|
||||
DELETE: 'deleteNotification',
|
||||
PAUSE: 'pauseNotification',
|
||||
RESUME: 'resumeNotification',
|
||||
CLEAR: 'clearNotifications',
|
||||
};
|
@ -1,8 +0,0 @@
|
||||
// Copyright (C) 2019 Storj Labs, Inc.
|
||||
// See LICENSE for copying information.
|
||||
|
||||
export enum PaymentMethodsBlockState {
|
||||
DEFAULT = 1,
|
||||
ADDING_CARD,
|
||||
ADDING_STORJ,
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
// Copyright (C) 2019 Storj Labs, Inc.
|
||||
// See LICENSE for copying information.
|
||||
|
||||
export const NOTIFICATION_TYPES = {
|
||||
SUCCESS: 'SUCCESS',
|
||||
NOTIFICATION: 'NOTIFICATION',
|
||||
ERROR: 'ERROR',
|
||||
WARNING: 'WARNING',
|
||||
};
|
@ -1,33 +1,33 @@
|
||||
// Copyright (C) 2019 Storj Labs, Inc.
|
||||
// See LICENSE for copying information.
|
||||
|
||||
import { NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames';
|
||||
import { AnalyticsErrorEventSource } from '@/utils/constants/analyticsEventNames';
|
||||
|
||||
interface Dispatcher {
|
||||
dispatch(key: string, payload: string | object)
|
||||
}
|
||||
import { useNotificationsStore } from '@/store/modules/notificationsStore';
|
||||
|
||||
/**
|
||||
* Exposes UI notifications functionality.
|
||||
*/
|
||||
export class Notificator {
|
||||
public constructor(private store: Dispatcher) {}
|
||||
public constructor() {}
|
||||
|
||||
public async success(message: string): Promise<void> {
|
||||
await this.store.dispatch(NOTIFICATION_ACTIONS.SUCCESS, message);
|
||||
public success(message: string): void {
|
||||
const notificationsStore = useNotificationsStore();
|
||||
notificationsStore.notifySuccess(message);
|
||||
}
|
||||
|
||||
public async error(message: string, source: AnalyticsErrorEventSource | null): Promise<void> {
|
||||
await this.store.dispatch(NOTIFICATION_ACTIONS.ERROR, { message, source });
|
||||
public error(message: string, source: AnalyticsErrorEventSource | null): void {
|
||||
const notificationsStore = useNotificationsStore();
|
||||
notificationsStore.notifyError({ message, source });
|
||||
}
|
||||
|
||||
public async notify(message: string): Promise<void> {
|
||||
await this.store.dispatch(NOTIFICATION_ACTIONS.NOTIFY, message);
|
||||
public notify(message: string): void {
|
||||
const notificationsStore = useNotificationsStore();
|
||||
notificationsStore.notifyInfo(message);
|
||||
}
|
||||
|
||||
public async warning(message: string): Promise<void> {
|
||||
await this.store.dispatch(NOTIFICATION_ACTIONS.WARNING, message);
|
||||
public warning(message: string): void {
|
||||
const notificationsStore = useNotificationsStore();
|
||||
notificationsStore.notifyWarning(message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,8 +35,8 @@ export class Notificator {
|
||||
* Registers plugin in Vue instance.
|
||||
*/
|
||||
export class NotificatorPlugin {
|
||||
constructor(private store: Dispatcher) {}
|
||||
constructor() {}
|
||||
public install(localVue: { prototype: { $notify: Notificator } }): void {
|
||||
localVue.prototype.$notify = new Notificator(this.store);
|
||||
localVue.prototype.$notify = new Notificator();
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,6 @@ import { ErrorUnauthorized } from '@/api/errors/ErrorUnauthorized';
|
||||
import { RouteConfig } from '@/router';
|
||||
import { CouponType } from '@/types/coupons';
|
||||
import { Project } from '@/types/projects';
|
||||
import { NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames';
|
||||
import { FetchState } from '@/utils/constants/fetchStateEnum';
|
||||
import { LocalData } from '@/utils/localData';
|
||||
import { User } from '@/types/users';
|
||||
@ -139,6 +138,7 @@ import { useAppStore } from '@/store/modules/appStore';
|
||||
import { useAccessGrantsStore } from '@/store/modules/accessGrantsStore';
|
||||
import { useBucketsStore } from '@/store/modules/bucketsStore';
|
||||
import { useProjectsStore } from '@/store/modules/projectsStore';
|
||||
import { useNotificationsStore } from '@/store/modules/notificationsStore';
|
||||
|
||||
import UploadNotification from '@/components/notifications/UploadNotification.vue';
|
||||
import NavigationArea from '@/components/navigation/NavigationArea.vue';
|
||||
@ -165,6 +165,7 @@ const pmStore = useProjectMembersStore();
|
||||
const usersStore = useUsersStore();
|
||||
const abTestingStore = useABTestingStore();
|
||||
const projectsStore = useProjectsStore();
|
||||
const notificationsStore = useNotificationsStore();
|
||||
const store = useStore();
|
||||
const notify = useNotify();
|
||||
const nativeRouter = useRouter();
|
||||
@ -560,7 +561,7 @@ async function handleInactive(): Promise<void> {
|
||||
usersStore.clear(),
|
||||
agStore.stopWorker(),
|
||||
agStore.clear(),
|
||||
store.dispatch(NOTIFICATION_ACTIONS.CLEAR),
|
||||
notificationsStore.clear(),
|
||||
bucketsStore.clear(),
|
||||
appStore.clear(),
|
||||
billingStore.clear(),
|
||||
|
@ -111,7 +111,6 @@ import {
|
||||
import { AnalyticsHttpApi } from '@/api/analytics';
|
||||
import { useNotify, useRouter, useStore } from '@/utils/hooks';
|
||||
import { RouteConfig } from '@/router';
|
||||
import { NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames';
|
||||
import { ErrorUnauthorized } from '@/api/errors/ErrorUnauthorized';
|
||||
import { FetchState } from '@/utils/constants/fetchStateEnum';
|
||||
import { LocalData } from '@/utils/localData';
|
||||
@ -126,6 +125,7 @@ import { useAppStore } from '@/store/modules/appStore';
|
||||
import { useAccessGrantsStore } from '@/store/modules/accessGrantsStore';
|
||||
import { useBucketsStore } from '@/store/modules/bucketsStore';
|
||||
import { useProjectsStore } from '@/store/modules/projectsStore';
|
||||
import { useNotificationsStore } from '@/store/modules/notificationsStore';
|
||||
|
||||
import InactivityModal from '@/components/modals/InactivityModal.vue';
|
||||
import BetaSatBar from '@/components/infoBars/BetaSatBar.vue';
|
||||
@ -151,6 +151,7 @@ const billingStore = useBillingStore();
|
||||
const agStore = useAccessGrantsStore();
|
||||
const appStore = useAppStore();
|
||||
const projectsStore = useProjectsStore();
|
||||
const notificationsStore = useNotificationsStore();
|
||||
|
||||
const analytics = new AnalyticsHttpApi();
|
||||
const auth: AuthHttpApi = new AuthHttpApi();
|
||||
@ -362,7 +363,7 @@ async function handleInactive(): Promise<void> {
|
||||
usersStore.clear(),
|
||||
agStore.stopWorker(),
|
||||
agStore.clear(),
|
||||
store.dispatch(NOTIFICATION_ACTIONS.CLEAR),
|
||||
notificationsStore.clear(),
|
||||
bucketsStore.clear(),
|
||||
appStore.clear(),
|
||||
billingStore.clear(),
|
||||
|
@ -102,7 +102,6 @@ import {
|
||||
import { AnalyticsHttpApi } from '@/api/analytics';
|
||||
import { RouteConfig } from '@/router';
|
||||
import { User } from '@/types/users';
|
||||
import { NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames';
|
||||
import { AuthHttpApi } from '@/api/auth';
|
||||
import { useABTestingStore } from '@/store/modules/abTestingStore';
|
||||
import { useUsersStore } from '@/store/modules/usersStore';
|
||||
@ -112,6 +111,7 @@ import { useAppStore } from '@/store/modules/appStore';
|
||||
import { useAccessGrantsStore } from '@/store/modules/accessGrantsStore';
|
||||
import { useBucketsStore } from '@/store/modules/bucketsStore';
|
||||
import { useProjectsStore } from '@/store/modules/projectsStore';
|
||||
import { useNotificationsStore } from '@/store/modules/notificationsStore';
|
||||
|
||||
import VButton from '@/components/common/VButton.vue';
|
||||
|
||||
@ -141,6 +141,7 @@ const usersStore = useUsersStore();
|
||||
const abTestingStore = useABTestingStore();
|
||||
const billingStore = useBillingStore();
|
||||
const projectsStore = useProjectsStore();
|
||||
const notificationsStore = useNotificationsStore();
|
||||
|
||||
const analytics = new AnalyticsHttpApi();
|
||||
const auth = new AuthHttpApi();
|
||||
@ -236,7 +237,7 @@ async function onLogout(): Promise<void> {
|
||||
usersStore.clear(),
|
||||
agStore.stopWorker(),
|
||||
agStore.clear(),
|
||||
store.dispatch(NOTIFICATION_ACTIONS.CLEAR),
|
||||
notificationsStore.clear(),
|
||||
bucketsStore.clear(),
|
||||
appStore.clear(),
|
||||
billingStore.clear(),
|
||||
|
@ -53,7 +53,6 @@ import { computed, ref } from 'vue';
|
||||
|
||||
import { RouteConfig } from '@/router';
|
||||
import { useNotify, useRouter, useStore } from '@/utils/hooks';
|
||||
import { NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames';
|
||||
import {
|
||||
AnalyticsErrorEventSource,
|
||||
AnalyticsEvent,
|
||||
@ -69,6 +68,7 @@ import { useAppStore } from '@/store/modules/appStore';
|
||||
import { useAccessGrantsStore } from '@/store/modules/accessGrantsStore';
|
||||
import { useBucketsStore } from '@/store/modules/bucketsStore';
|
||||
import { useProjectsStore } from '@/store/modules/projectsStore';
|
||||
import { useNotificationsStore } from '@/store/modules/notificationsStore';
|
||||
|
||||
import AccountIcon from '@/../static/images/navigation/account.svg';
|
||||
import ArrowDownIcon from '@/../static/images/common/dropIcon.svg';
|
||||
@ -93,6 +93,7 @@ const pmStore = useProjectMembersStore();
|
||||
const billingStore = useBillingStore();
|
||||
const usersStore = useUsersStore();
|
||||
const abTestingStore = useABTestingStore();
|
||||
const notificationsStore = useNotificationsStore();
|
||||
|
||||
const isHoveredOver = ref(false);
|
||||
|
||||
@ -161,7 +162,7 @@ async function onLogout(): Promise<void> {
|
||||
usersStore.clear(),
|
||||
agStore.stopWorker(),
|
||||
agStore.clear(),
|
||||
store.dispatch(NOTIFICATION_ACTIONS.CLEAR),
|
||||
notificationsStore.clear(),
|
||||
bucketsStore.clear(),
|
||||
appStore.clear(),
|
||||
billingStore.clear(),
|
||||
|
@ -4,18 +4,14 @@
|
||||
import Vuex from 'vuex';
|
||||
import { createLocalVue, shallowMount } from '@vue/test-utils';
|
||||
|
||||
import { makeNotificationsModule } from '@/store/modules/notifications';
|
||||
import { ProjectMemberHeaderState } from '@/types/projectMembers';
|
||||
|
||||
import HeaderArea from '@/components/team/HeaderArea.vue';
|
||||
|
||||
const localVue = createLocalVue();
|
||||
|
||||
const notificationsModule = makeNotificationsModule();
|
||||
|
||||
localVue.use(Vuex);
|
||||
|
||||
const store = new Vuex.Store({ modules: { notificationsModule } });
|
||||
const store = new Vuex.Store({});
|
||||
|
||||
describe('Team HeaderArea', () => {
|
||||
it('renders correctly', () => {
|
||||
|
@ -14,7 +14,7 @@ localVue.use(Vuex);
|
||||
|
||||
const store = new Vuex.Store({});
|
||||
|
||||
localVue.use(new NotificatorPlugin(store));
|
||||
localVue.use(new NotificatorPlugin());
|
||||
|
||||
describe('CreateProject.vue', (): void => {
|
||||
it('renders correctly', (): void => {
|
||||
|
@ -5,9 +5,8 @@ import Vuex from 'vuex';
|
||||
import { createLocalVue, shallowMount } from '@vue/test-utils';
|
||||
|
||||
import { ProjectsApiMock } from '@/../tests/unit/mock/api/projects';
|
||||
import { Project, ProjectLimits } from '@/types/projects';
|
||||
import { ProjectLimits } from '@/types/projects';
|
||||
import { NotificatorPlugin } from '@/utils/plugins/notificator';
|
||||
import { makeNotificationsModule } from '@/store/modules/notifications';
|
||||
|
||||
import EditProjectDetails from '@/components/project/EditProjectDetails.vue';
|
||||
|
||||
@ -17,11 +16,9 @@ localVue.use(Vuex);
|
||||
const projectLimits = new ProjectLimits(1000, 100, 1000, 100);
|
||||
const projectsApi = new ProjectsApiMock();
|
||||
projectsApi.setMockLimits(projectLimits);
|
||||
const notificationsModule = makeNotificationsModule();
|
||||
|
||||
const store = new Vuex.Store({
|
||||
modules: {
|
||||
notificationsModule,
|
||||
usersModule: {
|
||||
state: {
|
||||
user: { paidTier: false },
|
||||
@ -29,9 +26,7 @@ const store = new Vuex.Store({
|
||||
},
|
||||
} });
|
||||
|
||||
localVue.use(new NotificatorPlugin(store));
|
||||
|
||||
const project = new Project('id', 'test', 'test', 'test', 'ownedId', false);
|
||||
localVue.use(new NotificatorPlugin());
|
||||
|
||||
describe('EditProjectDetails.vue', () => {
|
||||
it('renders correctly', (): void => {
|
||||
|
@ -5,7 +5,6 @@ import Vuex from 'vuex';
|
||||
import { createLocalVue, shallowMount } from '@vue/test-utils';
|
||||
|
||||
import { RouteConfig, router } from '@/router';
|
||||
import { makeNotificationsModule } from '@/store/modules/notifications';
|
||||
import { NotificatorPlugin } from '@/utils/plugins/notificator';
|
||||
import { AnalyticsHttpApi } from '@/api/analytics';
|
||||
import DashboardArea from '@/views/DashboardArea.vue';
|
||||
@ -13,15 +12,9 @@ import DashboardArea from '@/views/DashboardArea.vue';
|
||||
const localVue = createLocalVue();
|
||||
localVue.use(Vuex);
|
||||
|
||||
const notificationsModule = makeNotificationsModule();
|
||||
const store = new Vuex.Store({});
|
||||
|
||||
const store = new Vuex.Store({
|
||||
modules: {
|
||||
notificationsModule,
|
||||
},
|
||||
});
|
||||
|
||||
localVue.use(new NotificatorPlugin(store));
|
||||
localVue.use(new NotificatorPlugin());
|
||||
|
||||
describe('Dashboard', () => {
|
||||
beforeEach(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user