From aafff738994ead58077e76dc137e7577f6cb139e Mon Sep 17 00:00:00 2001 From: Kevin Yu Date: Tue, 6 Feb 2024 10:58:49 -0800 Subject: [PATCH] CloudWatch: Remove core imports from LegacyLogGroupSelector (#80843) --- .../shared/LogGroups/LegacyLogGroupSelector.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/public/app/plugins/datasource/cloudwatch/components/shared/LogGroups/LegacyLogGroupSelector.tsx b/public/app/plugins/datasource/cloudwatch/components/shared/LogGroups/LegacyLogGroupSelector.tsx index 3b3048c0125..8204ef25ca1 100644 --- a/public/app/plugins/datasource/cloudwatch/components/shared/LogGroups/LegacyLogGroupSelector.tsx +++ b/public/app/plugins/datasource/cloudwatch/components/shared/LogGroups/LegacyLogGroupSelector.tsx @@ -1,12 +1,10 @@ import { debounce, unionBy } from 'lodash'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; -import { SelectableValue, toOption } from '@grafana/data'; +import { AppEvents, SelectableValue, toOption } from '@grafana/data'; +import { getAppEvents } from '@grafana/runtime'; import { MultiSelect } from '@grafana/ui'; import { InputActionMeta } from '@grafana/ui/src/components/Select/types'; -import { notifyApp } from 'app/core/actions'; -import { createErrorNotification } from 'app/core/copy/appNotification'; -import { dispatch } from 'app/store/store'; import { CloudWatchDatasource } from '../../../datasource'; import { appendTemplateVariables } from '../../../utils/utils'; @@ -51,7 +49,10 @@ export const LogGroupSelector: React.FC = ({ const logGroups = await datasource.resources.legacyDescribeLogGroups(region, logGroupNamePrefix); return logGroups; } catch (err) { - dispatch(notifyApp(createErrorNotification(typeof err === 'string' ? err : JSON.stringify(err)))); + getAppEvents().publish({ + type: AppEvents.alertError.name, + payload: [typeof err === 'string' ? err : JSON.stringify(err)], + }); return []; } }, @@ -69,7 +70,10 @@ export const LogGroupSelector: React.FC = ({ const logGroupNamePattern = /^[\.\-_/#A-Za-z0-9]+$/; if (!logGroupNamePattern.test(searchTerm)) { if (searchTerm !== '') { - dispatch(notifyApp(createErrorNotification('Invalid Log Group name: ' + searchTerm))); + getAppEvents().publish({ + type: AppEvents.alertError.name, + payload: ['Invalid Log Group name: ' + searchTerm], + }); } return; }