From bd0e5697edd662671286c6e0206f97efabbb6714 Mon Sep 17 00:00:00 2001 From: "maciej.moscicki" Date: Wed, 14 Aug 2024 10:29:02 +0200 Subject: [PATCH] remove unused error message --- .../composables/sync/use-sync/useSync.spec.ts | 12 +++++------ .../src/composables/sync/use-sync/useSync.ts | 20 ++++++------------- hermes-console/src/i18n/en-US/index.ts | 8 +++++--- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/hermes-console/src/composables/sync/use-sync/useSync.spec.ts b/hermes-console/src/composables/sync/use-sync/useSync.spec.ts index 307d3f6edd..e9c57240e4 100644 --- a/hermes-console/src/composables/sync/use-sync/useSync.spec.ts +++ b/hermes-console/src/composables/sync/use-sync/useSync.spec.ts @@ -47,7 +47,7 @@ describe('useSync', () => { await waitFor(() => { expectNotificationDispatched(notificationStore, { type: 'error', - title: 'notifications.sync.failure', + title: 'notifications.consistency.sync.failure', }); }); }); @@ -70,7 +70,7 @@ describe('useSync', () => { await waitFor(() => { expectNotificationDispatched(notificationStore, { type: 'error', - title: 'notifications.sync.failure', + title: 'notifications.consistency.sync.failure', }); }); }); @@ -96,7 +96,7 @@ describe('useSync', () => { await waitFor(() => { expectNotificationDispatched(notificationStore, { type: 'error', - title: 'notifications.sync.failure', + title: 'notifications.consistency.sync.failure', }); }); }); @@ -119,7 +119,7 @@ describe('useSync', () => { await waitFor(() => { expectNotificationDispatched(notificationStore, { type: 'success', - text: 'notifications.sync.success', + text: 'notifications.consistency.sync.success', }); }); }); @@ -142,7 +142,7 @@ describe('useSync', () => { await waitFor(() => { expectNotificationDispatched(notificationStore, { type: 'success', - text: 'notifications.sync.success', + text: 'notifications.consistency.sync.success', }); }); }); @@ -168,7 +168,7 @@ describe('useSync', () => { await waitFor(() => { expectNotificationDispatched(notificationStore, { type: 'success', - text: 'notifications.sync.success', + text: 'notifications.consistency.sync.success', }); }); }); diff --git a/hermes-console/src/composables/sync/use-sync/useSync.ts b/hermes-console/src/composables/sync/use-sync/useSync.ts index 4b60dcbc4d..ff6ed46f9e 100644 --- a/hermes-console/src/composables/sync/use-sync/useSync.ts +++ b/hermes-console/src/composables/sync/use-sync/useSync.ts @@ -5,13 +5,11 @@ import { syncTopic as doSyncTopic, } from '@/api/hermes-client'; import { groupName } from '@/utils/topic-utils/topic-utils'; -import { ref, type Ref } from 'vue'; import { useConsistencyStore } from '@/store/consistency/useConsistencyStore'; import { useGlobalI18n } from '@/i18n'; import { useNotificationsStore } from '@/store/app-notifications/useAppNotifications'; export interface UseSync { - errorMessage: Ref; syncGroup: (groupName: string, primaryDatacenter: string) => Promise; syncTopic: ( topicQualifiedName: string, @@ -25,8 +23,6 @@ export interface UseSync { } export function useSync(): UseSync { - const errorMessage: Ref = ref(); - const notificationStore = useNotificationsStore(); const consistencyStore = useConsistencyStore(); @@ -34,7 +30,7 @@ export function useSync(): UseSync { try { await doSyncGroup(groupName, primaryDatacenter); await notificationStore.dispatchNotification({ - text: useGlobalI18n().t('notifications.sync.success', { + text: useGlobalI18n().t('notifications.consistency.sync.success', { group: groupName, }), type: 'success', @@ -42,11 +38,10 @@ export function useSync(): UseSync { await consistencyStore.refresh(groupName); return true; } catch (e: any) { - errorMessage.value = e as Error; dispatchErrorNotification( e, notificationStore, - useGlobalI18n().t('notifications.sync.failure', { + useGlobalI18n().t('notifications.consistency.sync.failure', { group: groupName, }), ); @@ -62,7 +57,7 @@ export function useSync(): UseSync { try { await doSyncTopic(topicQualifiedName, primaryDatacenter); await notificationStore.dispatchNotification({ - text: useGlobalI18n().t('notifications.sync.success', { + text: useGlobalI18n().t('notifications.consistency.sync.success', { group, }), type: 'success', @@ -70,11 +65,10 @@ export function useSync(): UseSync { await consistencyStore.refresh(group); return true; } catch (e: any) { - errorMessage.value = e as Error; dispatchErrorNotification( e, notificationStore, - useGlobalI18n().t('notifications.sync.failure', { + useGlobalI18n().t('notifications.consistency.sync.failure', { group, }), ); @@ -95,7 +89,7 @@ export function useSync(): UseSync { primaryDatacenter, ); await notificationStore.dispatchNotification({ - text: useGlobalI18n().t('notifications.sync.success', { + text: useGlobalI18n().t('notifications.consistency.sync.success', { group, }), type: 'success', @@ -103,11 +97,10 @@ export function useSync(): UseSync { await consistencyStore.refresh(group); return true; } catch (e: any) { - errorMessage.value = e as Error; dispatchErrorNotification( e, notificationStore, - useGlobalI18n().t('notifications.sync.failure', { + useGlobalI18n().t('notifications.consistency.sync.failure', { group, }), ); @@ -116,7 +109,6 @@ export function useSync(): UseSync { }; return { - errorMessage, syncGroup, syncSubscription, syncTopic, diff --git a/hermes-console/src/i18n/en-US/index.ts b/hermes-console/src/i18n/en-US/index.ts index 4d84c99b52..b9c0372cb7 100644 --- a/hermes-console/src/i18n/en-US/index.ts +++ b/hermes-console/src/i18n/en-US/index.ts @@ -708,9 +708,11 @@ const en_US = { failure: "Couldn't delete topic {topic}", }, }, - sync: { - success: 'Synchronization of {group} succeeded', - failure: 'Synchronization of {group} failed', + consistency: { + sync: { + success: 'Synchronization of {group} succeeded', + failure: 'Synchronization of {group} failed', + }, }, subscription: { create: {