From 58e649a956b1b39364da5d371857ae28f5e4e0a4 Mon Sep 17 00:00:00 2001 From: Sonia Aguilar <33540275+soniaAguilarPeiron@users.noreply.github.com> Date: Thu, 28 Aug 2025 14:11:19 +0200 Subject: [PATCH] Alerting: Move alerting file to an alerting folder (#110257) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * move alerting.ts to alerting folder * fix CODEOWNERS * update betterer * prettier ✨ * lint --------- Co-authored-by: Gilles De Mey --- .betterer.results | 14 +++++++------- .github/CODEOWNERS | 1 - .../app/features/alerting/state/reducers.test.ts | 7 ++++++- public/app/features/alerting/state/reducers.ts | 2 +- .../app/features/alerting/state/selectors.test.ts | 2 +- public/app/features/alerting/state/selectors.ts | 2 +- .../alerting/unified/api/alertmanagerApi.ts | 6 +++++- .../features/alerting/unified/api/grafana.test.ts | 2 +- .../app/features/alerting/unified/api/grafana.ts | 2 +- .../features/alerting/unified/api/receiversApi.ts | 2 +- .../components/contact-points/ContactPoint.tsx | 2 +- .../unified/components/contact-points/utils.ts | 2 +- .../notification-policies/Policy.test.tsx | 2 +- .../components/notification-policies/Policy.tsx | 2 +- .../components/receivers/form/ChannelOptions.tsx | 6 +++++- .../components/receivers/form/ChannelSubForm.tsx | 2 +- .../receivers/form/fields/OptionField.tsx | 6 +++++- .../receivers/form/fields/SubformArrayField.tsx | 6 +++++- .../receivers/form/fields/SubformField.tsx | 6 +++++- .../form/fields/TemplateSelector.test.tsx | 2 +- .../receivers/form/fields/TemplateSelector.tsx | 2 +- .../unified/components/receivers/form/notifiers.ts | 2 +- .../onCall/useOnCallIntegration.tsx | 2 +- .../alerting/unified/mockGrafanaNotifiers.ts | 2 +- public/app/features/alerting/unified/mocks.ts | 2 +- .../alerting/unified}/types/alerting.ts | 0 .../alerting/unified/types/receiver-form.ts | 2 +- .../utils/cloud-alertmanager-notifier-types.ts | 6 +++++- .../alerting/unified/utils/notifier-types.ts | 2 +- .../alerting/unified/utils/receiver-form.ts | 7 ++++++- 30 files changed, 68 insertions(+), 35 deletions(-) rename public/app/{ => features/alerting/unified}/types/alerting.ts (100%) diff --git a/.betterer.results b/.betterer.results index 5e0e90ddd4f..1a4c5338c06 100644 --- a/.betterer.results +++ b/.betterer.results @@ -1534,6 +1534,13 @@ exports[`better eslint`] = { "public/app/features/alerting/unified/rule-list/StateView.tsx:5381": [ [0, 0, 0, "Using localeCompare() can cause performance issues when sorting large datasets. Consider using Intl.Collator for better performance when sorting arrays, or add an eslint-disable comment if sorting a small, known dataset.", "0"] ], + "public/app/features/alerting/unified/types/alerting.ts:5381": [ + [0, 0, 0, "Unexpected any. Specify a different type.", "0"], + [0, 0, 0, "Unexpected any. Specify a different type.", "1"], + [0, 0, 0, "Unexpected any. Specify a different type.", "2"], + [0, 0, 0, "Unexpected any. Specify a different type.", "3"], + [0, 0, 0, "Unexpected any. Specify a different type.", "4"] + ], "public/app/features/alerting/unified/types/receiver-form.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], @@ -4064,13 +4071,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], - "public/app/types/alerting.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Unexpected any. Specify a different type.", "4"] - ], "public/app/types/dashboard.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b00c55226b1..6124342bb89 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -969,7 +969,6 @@ playwright.storybook.config.ts @grafana/grafana-frontend-platform /public/app/routes/ @grafana/grafana-search-navigate-organise /public/app/store/ @grafana/grafana-frontend-platform /public/app/types/ @grafana/grafana-frontend-platform -/public/app/types/alerting.ts @grafana/alerting-frontend /public/app/types/unified-alerting-dto.ts @grafana/alerting-frontend /public/app/types/unified-alerting.ts @grafana/alerting-frontend /public/dashboards/ @grafana/dashboards-squad diff --git a/public/app/features/alerting/state/reducers.test.ts b/public/app/features/alerting/state/reducers.test.ts index 7afd5eee5e7..970ccf99a10 100644 --- a/public/app/features/alerting/state/reducers.test.ts +++ b/public/app/features/alerting/state/reducers.test.ts @@ -1,5 +1,10 @@ import { dateTime } from '@grafana/data'; -import { AlertRuleDTO, AlertRulesState, NotificationChannelState, NotifierDTO } from 'app/types/alerting'; +import { + AlertRuleDTO, + AlertRulesState, + NotificationChannelState, + NotifierDTO, +} from 'app/features/alerting/unified/types/alerting'; import { reducerTester } from '../../../../test/core/redux/reducerTester'; diff --git a/public/app/features/alerting/state/reducers.ts b/public/app/features/alerting/state/reducers.ts index ffba9aa8c89..929f1e21e7d 100644 --- a/public/app/features/alerting/state/reducers.ts +++ b/public/app/features/alerting/state/reducers.ts @@ -8,7 +8,7 @@ import { NotificationChannelOption, NotificationChannelState, NotifierDTO, -} from 'app/types/alerting'; +} from 'app/features/alerting/unified/types/alerting'; import unifiedAlertingReducer from '../unified/state/reducers'; diff --git a/public/app/features/alerting/state/selectors.test.ts b/public/app/features/alerting/state/selectors.test.ts index 0463a99be8e..91245a89282 100644 --- a/public/app/features/alerting/state/selectors.test.ts +++ b/public/app/features/alerting/state/selectors.test.ts @@ -1,4 +1,4 @@ -import { AlertRulesState } from 'app/types/alerting'; +import { AlertRulesState } from 'app/features/alerting/unified/types/alerting'; import { StoreState } from 'app/types/store'; import { getAlertRuleItems, getSearchQuery } from './selectors'; diff --git a/public/app/features/alerting/state/selectors.ts b/public/app/features/alerting/state/selectors.ts index 0e2c897e7bb..1bdd9e693eb 100644 --- a/public/app/features/alerting/state/selectors.ts +++ b/public/app/features/alerting/state/selectors.ts @@ -1,4 +1,4 @@ -import { AlertRule, AlertRulesState, NotificationChannelState } from 'app/types/alerting'; +import { AlertRule, AlertRulesState, NotificationChannelState } from 'app/features/alerting/unified/types/alerting'; import { StoreState } from 'app/types/store'; export const getSearchQuery = (state: AlertRulesState) => state.searchQuery; diff --git a/public/app/features/alerting/unified/api/alertmanagerApi.ts b/public/app/features/alerting/unified/api/alertmanagerApi.ts index 0c8940725fa..6f9a99194cc 100644 --- a/public/app/features/alerting/unified/api/alertmanagerApi.ts +++ b/public/app/features/alerting/unified/api/alertmanagerApi.ts @@ -1,8 +1,12 @@ import { isEmpty } from 'lodash'; +import { + NotificationChannelOption, + NotifierDTO, + ReceiversStateDTO, +} from 'app/features/alerting/unified/types/alerting'; import { encodeMatcher } from 'app/features/alerting/unified/utils/matchers'; import { dispatch } from 'app/store/store'; -import { NotificationChannelOption, NotifierDTO, ReceiversStateDTO } from 'app/types/alerting'; import { AlertManagerCortexConfig, diff --git a/public/app/features/alerting/unified/api/grafana.test.ts b/public/app/features/alerting/unified/api/grafana.test.ts index 3f3e8e79acc..130e5797e07 100644 --- a/public/app/features/alerting/unified/api/grafana.test.ts +++ b/public/app/features/alerting/unified/api/grafana.test.ts @@ -1,4 +1,4 @@ -import { ReceiversStateDTO } from 'app/types/alerting'; +import { ReceiversStateDTO } from 'app/features/alerting/unified/types/alerting'; import { contactPointsStateDtoToModel, getIntegrationType, parseIntegrationName } from './grafana'; diff --git a/public/app/features/alerting/unified/api/grafana.ts b/public/app/features/alerting/unified/api/grafana.ts index 771ec80301f..c76bcbad7e8 100644 --- a/public/app/features/alerting/unified/api/grafana.ts +++ b/public/app/features/alerting/unified/api/grafana.ts @@ -1,7 +1,7 @@ import { lastValueFrom } from 'rxjs'; import { getBackendSrv } from '@grafana/runtime'; -import { ContactPointsState, ReceiverState, ReceiversStateDTO } from 'app/types/alerting'; +import { ContactPointsState, ReceiverState, ReceiversStateDTO } from 'app/features/alerting/unified/types/alerting'; import { getDatasourceAPIUid } from '../utils/datasource'; diff --git a/public/app/features/alerting/unified/api/receiversApi.ts b/public/app/features/alerting/unified/api/receiversApi.ts index 7b22a1507e3..17d32398b04 100644 --- a/public/app/features/alerting/unified/api/receiversApi.ts +++ b/public/app/features/alerting/unified/api/receiversApi.ts @@ -1,6 +1,6 @@ /** @deprecated To be deleted - use alertingApiServer API instead */ -import { ContactPointsState } from 'app/types/alerting'; +import { ContactPointsState } from 'app/features/alerting/unified/types/alerting'; import { CONTACT_POINTS_STATE_INTERVAL_MS } from '../utils/constants'; diff --git a/public/app/features/alerting/unified/components/contact-points/ContactPoint.tsx b/public/app/features/alerting/unified/components/contact-points/ContactPoint.tsx index b4d5ecfb953..580491250f6 100644 --- a/public/app/features/alerting/unified/components/contact-points/ContactPoint.tsx +++ b/public/app/features/alerting/unified/components/contact-points/ContactPoint.tsx @@ -10,8 +10,8 @@ import { ContactPointHeader } from 'app/features/alerting/unified/components/con import { useDeleteContactPointModal } from 'app/features/alerting/unified/components/contact-points/components/Modals'; import { useDeleteContactPoint } from 'app/features/alerting/unified/components/contact-points/useContactPoints'; import { useAlertmanager } from 'app/features/alerting/unified/state/AlertmanagerContext'; +import { GrafanaNotifierType, NotifierStatus } from 'app/features/alerting/unified/types/alerting'; import { receiverTypeNames } from 'app/plugins/datasource/alertmanager/consts'; -import { GrafanaNotifierType, NotifierStatus } from 'app/types/alerting'; import { INTEGRATION_ICONS } from '../../types/contact-points'; import { MetaText } from '../MetaText'; diff --git a/public/app/features/alerting/unified/components/contact-points/utils.ts b/public/app/features/alerting/unified/components/contact-points/utils.ts index 034ee098894..24441564615 100644 --- a/public/app/features/alerting/unified/components/contact-points/utils.ts +++ b/public/app/features/alerting/unified/components/contact-points/utils.ts @@ -2,6 +2,7 @@ import { difference, groupBy, take, trim, upperFirst } from 'lodash'; import { ReactNode } from 'react'; import { t } from '@grafana/i18n'; +import { NotifierDTO, NotifierStatus, ReceiversStateDTO } from 'app/features/alerting/unified/types/alerting'; import { canAdminEntity, shouldUseK8sApi } from 'app/features/alerting/unified/utils/k8s/utils'; import { AlertManagerCortexConfig, @@ -11,7 +12,6 @@ import { Receiver, Route, } from 'app/plugins/datasource/alertmanager/types'; -import { NotifierDTO, NotifierStatus, ReceiversStateDTO } from 'app/types/alerting'; import { OnCallIntegrationDTO } from '../../api/onCallApi'; import { computeInheritedTree } from '../../utils/notification-policies'; diff --git a/public/app/features/alerting/unified/components/notification-policies/Policy.test.tsx b/public/app/features/alerting/unified/components/notification-policies/Policy.test.tsx index b28d6faf96f..4e0c1d4ca4f 100644 --- a/public/app/features/alerting/unified/components/notification-policies/Policy.test.tsx +++ b/public/app/features/alerting/unified/components/notification-policies/Policy.test.tsx @@ -5,13 +5,13 @@ import { Route, Routes } from 'react-router-dom-v5-compat'; import { render } from 'test/test-utils'; import { contextSrv } from 'app/core/core'; +import { ReceiversState } from 'app/features/alerting/unified/types/alerting'; import { AlertmanagerGroup, MatcherOperator, ObjectMatcher, RouteWithID, } from 'app/plugins/datasource/alertmanager/types'; -import { ReceiversState } from 'app/types/alerting'; import { useAlertmanagerAbilities } from '../../hooks/useAbilities'; import { mockReceiversState } from '../../mocks'; diff --git a/public/app/features/alerting/unified/components/notification-policies/Policy.tsx b/public/app/features/alerting/unified/components/notification-policies/Policy.tsx index ff037ca21f2..a2a25fcc8d0 100644 --- a/public/app/features/alerting/unified/components/notification-policies/Policy.tsx +++ b/public/app/features/alerting/unified/components/notification-policies/Policy.tsx @@ -25,6 +25,7 @@ import ConditionalWrap from 'app/features/alerting/unified/components/Conditiona import MoreButton from 'app/features/alerting/unified/components/MoreButton'; import { PrimaryText } from 'app/features/alerting/unified/components/common/TextVariants'; import { ContactPointReceiverSummary } from 'app/features/alerting/unified/components/contact-points/ContactPoint'; +import { ReceiversState } from 'app/features/alerting/unified/types/alerting'; import { AlertmanagerGroup, MatcherOperator, @@ -32,7 +33,6 @@ import { Receiver, RouteWithID, } from 'app/plugins/datasource/alertmanager/types'; -import { ReceiversState } from 'app/types/alerting'; import { AlertmanagerAction, useAlertmanagerAbilities, useAlertmanagerAbility } from '../../hooks/useAbilities'; import { getAmMatcherFormatter } from '../../utils/alertmanager'; diff --git a/public/app/features/alerting/unified/components/receivers/form/ChannelOptions.tsx b/public/app/features/alerting/unified/components/receivers/form/ChannelOptions.tsx index e65dd9f0f38..fbdfdbbf493 100644 --- a/public/app/features/alerting/unified/components/receivers/form/ChannelOptions.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/ChannelOptions.tsx @@ -2,7 +2,11 @@ import * as React from 'react'; import { DeepMap, FieldError, FieldErrors, useFormContext } from 'react-hook-form'; import { Field, SecretInput } from '@grafana/ui'; -import { NotificationChannelOption, NotificationChannelSecureFields, OptionMeta } from 'app/types/alerting'; +import { + NotificationChannelOption, + NotificationChannelSecureFields, + OptionMeta, +} from 'app/features/alerting/unified/types/alerting'; import { ChannelValues, diff --git a/public/app/features/alerting/unified/components/receivers/form/ChannelSubForm.tsx b/public/app/features/alerting/unified/components/receivers/form/ChannelSubForm.tsx index 93dfa812d85..ca939d25d38 100644 --- a/public/app/features/alerting/unified/components/receivers/form/ChannelSubForm.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/ChannelSubForm.tsx @@ -7,7 +7,7 @@ import { Controller, FieldErrors, useFormContext } from 'react-hook-form'; import { GrafanaTheme2, SelectableValue } from '@grafana/data'; import { Trans, t } from '@grafana/i18n'; import { Alert, Button, Field, Select, Stack, Text, useStyles2 } from '@grafana/ui'; -import { NotificationChannelOption } from 'app/types/alerting'; +import { NotificationChannelOption } from 'app/features/alerting/unified/types/alerting'; import { useUnifiedAlertingSelector } from '../../../hooks/useUnifiedAlertingSelector'; import { diff --git a/public/app/features/alerting/unified/components/receivers/form/fields/OptionField.tsx b/public/app/features/alerting/unified/components/receivers/form/fields/OptionField.tsx index 4bad7a8639f..955d0bae209 100644 --- a/public/app/features/alerting/unified/components/receivers/form/fields/OptionField.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/fields/OptionField.tsx @@ -14,7 +14,11 @@ import { TextArea, useStyles2, } from '@grafana/ui'; -import { NotificationChannelOption, NotificationChannelSecureFields, OptionMeta } from 'app/types/alerting'; +import { + NotificationChannelOption, + NotificationChannelSecureFields, + OptionMeta, +} from 'app/features/alerting/unified/types/alerting'; import { KeyValueMapInput } from './KeyValueMapInput'; import { StringArrayInput } from './StringArrayInput'; diff --git a/public/app/features/alerting/unified/components/receivers/form/fields/SubformArrayField.tsx b/public/app/features/alerting/unified/components/receivers/form/fields/SubformArrayField.tsx index 02177df1bae..6119aacc151 100644 --- a/public/app/features/alerting/unified/components/receivers/form/fields/SubformArrayField.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/fields/SubformArrayField.tsx @@ -3,7 +3,11 @@ import { DeepMap, FieldError, useFormContext } from 'react-hook-form'; import { Trans, t } from '@grafana/i18n'; import { Button, useStyles2 } from '@grafana/ui'; import { useControlledFieldArray } from 'app/features/alerting/unified/hooks/useControlledFieldArray'; -import { NotificationChannelOption, NotificationChannelSecureFields, OptionMeta } from 'app/types/alerting'; +import { + NotificationChannelOption, + NotificationChannelSecureFields, + OptionMeta, +} from 'app/features/alerting/unified/types/alerting'; import { ActionIcon } from '../../../rules/ActionIcon'; import { CollapsibleSection } from '../CollapsibleSection'; diff --git a/public/app/features/alerting/unified/components/receivers/form/fields/SubformField.tsx b/public/app/features/alerting/unified/components/receivers/form/fields/SubformField.tsx index 32118e6bc4c..db45abbbbfe 100644 --- a/public/app/features/alerting/unified/components/receivers/form/fields/SubformField.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/fields/SubformField.tsx @@ -3,7 +3,11 @@ import { DeepMap, FieldError, useFormContext } from 'react-hook-form'; import { Trans, t } from '@grafana/i18n'; import { Button, useStyles2 } from '@grafana/ui'; -import { NotificationChannelOption, NotificationChannelSecureFields, OptionMeta } from 'app/types/alerting'; +import { + NotificationChannelOption, + NotificationChannelSecureFields, + OptionMeta, +} from 'app/features/alerting/unified/types/alerting'; import { ActionIcon } from '../../../rules/ActionIcon'; diff --git a/public/app/features/alerting/unified/components/receivers/form/fields/TemplateSelector.test.tsx b/public/app/features/alerting/unified/components/receivers/form/fields/TemplateSelector.test.tsx index 74f574ac549..6134ace8fbb 100644 --- a/public/app/features/alerting/unified/components/receivers/form/fields/TemplateSelector.test.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/fields/TemplateSelector.test.tsx @@ -6,11 +6,11 @@ import { setupMswServer } from 'app/features/alerting/unified/mockApi'; import { grantUserPermissions } from 'app/features/alerting/unified/mocks'; import { getAlertmanagerConfig } from 'app/features/alerting/unified/mocks/server/entities/alertmanagers'; import { AlertmanagerProvider } from 'app/features/alerting/unified/state/AlertmanagerContext'; +import { NotificationChannelOption } from 'app/features/alerting/unified/types/alerting'; import { GRAFANA_RULES_SOURCE_NAME } from 'app/features/alerting/unified/utils/datasource'; import { PROVENANCE_NONE } from 'app/features/alerting/unified/utils/k8s/constants'; import { DEFAULT_TEMPLATES } from 'app/features/alerting/unified/utils/template-constants'; import { AccessControlAction } from 'app/types/accessControl'; -import { NotificationChannelOption } from 'app/types/alerting'; import { TemplatesPicker, getTemplateOptions } from './TemplateSelector'; import { parseTemplates } from './utils'; diff --git a/public/app/features/alerting/unified/components/receivers/form/fields/TemplateSelector.tsx b/public/app/features/alerting/unified/components/receivers/form/fields/TemplateSelector.tsx index 6cfea24cd83..2af4f973bed 100644 --- a/public/app/features/alerting/unified/components/receivers/form/fields/TemplateSelector.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/fields/TemplateSelector.tsx @@ -28,7 +28,7 @@ import { useNotificationTemplates, } from 'app/features/alerting/unified/components/contact-points/useNotificationTemplates'; import { useAlertmanager } from 'app/features/alerting/unified/state/AlertmanagerContext'; -import { NotificationChannelOption } from 'app/types/alerting'; +import { NotificationChannelOption } from 'app/features/alerting/unified/types/alerting'; import { defaultPayloadString } from '../../TemplateForm'; diff --git a/public/app/features/alerting/unified/components/receivers/form/notifiers.ts b/public/app/features/alerting/unified/components/receivers/form/notifiers.ts index d84e8bc2f9d..e3ffd06c0ec 100644 --- a/public/app/features/alerting/unified/components/receivers/form/notifiers.ts +++ b/public/app/features/alerting/unified/components/receivers/form/notifiers.ts @@ -1,6 +1,6 @@ import { ReactElement } from 'react'; -import { NotifierDTO } from 'app/types/alerting'; +import { NotifierDTO } from 'app/features/alerting/unified/types/alerting'; export interface NotifierMetadata { enabled: boolean; diff --git a/public/app/features/alerting/unified/components/receivers/grafanaAppReceivers/onCall/useOnCallIntegration.tsx b/public/app/features/alerting/unified/components/receivers/grafanaAppReceivers/onCall/useOnCallIntegration.tsx index 2f84d394b9f..6f962f36805 100644 --- a/public/app/features/alerting/unified/components/receivers/grafanaAppReceivers/onCall/useOnCallIntegration.tsx +++ b/public/app/features/alerting/unified/components/receivers/grafanaAppReceivers/onCall/useOnCallIntegration.tsx @@ -5,8 +5,8 @@ import { SelectableValue } from '@grafana/data'; import { t } from '@grafana/i18n'; import { isFetchError } from '@grafana/runtime'; import { Badge } from '@grafana/ui'; +import { NotifierDTO } from 'app/features/alerting/unified/types/alerting'; import { getIrmIfPresentOrOnCallPluginId } from 'app/features/alerting/unified/utils/config'; -import { NotifierDTO } from 'app/types/alerting'; import { useAppNotification } from '../../../../../../../core/copy/appNotification'; import { Receiver } from '../../../../../../../plugins/datasource/alertmanager/types'; diff --git a/public/app/features/alerting/unified/mockGrafanaNotifiers.ts b/public/app/features/alerting/unified/mockGrafanaNotifiers.ts index fd058176867..7c1ec72cf4f 100644 --- a/public/app/features/alerting/unified/mockGrafanaNotifiers.ts +++ b/public/app/features/alerting/unified/mockGrafanaNotifiers.ts @@ -1,4 +1,4 @@ -import { GrafanaNotifierType, NotifierDTO } from 'app/types/alerting'; +import { GrafanaNotifierType, NotifierDTO } from 'app/features/alerting/unified/types/alerting'; export const grafanaAlertNotifiers: Record = { dingding: { diff --git a/public/app/features/alerting/unified/mocks.ts b/public/app/features/alerting/unified/mocks.ts index ff0a8f11d2e..3c5e2e472df 100644 --- a/public/app/features/alerting/unified/mocks.ts +++ b/public/app/features/alerting/unified/mocks.ts @@ -12,6 +12,7 @@ import { import { DataQuery, defaultDashboard } from '@grafana/schema'; import { contextSrv } from 'app/core/services/context_srv'; import { MOCK_GRAFANA_ALERT_RULE_TITLE } from 'app/features/alerting/unified/mocks/server/handlers/grafanaRuler'; +import { NotifiersState, ReceiversState } from 'app/features/alerting/unified/types/alerting'; import { ExpressionQuery, ExpressionQueryType, ReducerMode } from 'app/features/expressions/types'; import { AlertManagerCortexConfig, @@ -26,7 +27,6 @@ import { } from 'app/plugins/datasource/alertmanager/types'; import { configureStore } from 'app/store/configureStore'; import { AccessControlAction } from 'app/types/accessControl'; -import { NotifiersState, ReceiversState } from 'app/types/alerting'; import { DashboardDTO } from 'app/types/dashboard'; import { FolderDTO } from 'app/types/folders'; import { StoreState } from 'app/types/store'; diff --git a/public/app/types/alerting.ts b/public/app/features/alerting/unified/types/alerting.ts similarity index 100% rename from public/app/types/alerting.ts rename to public/app/features/alerting/unified/types/alerting.ts diff --git a/public/app/features/alerting/unified/types/receiver-form.ts b/public/app/features/alerting/unified/types/receiver-form.ts index d2045a2c2a6..09d87d06845 100644 --- a/public/app/features/alerting/unified/types/receiver-form.ts +++ b/public/app/features/alerting/unified/types/receiver-form.ts @@ -1,7 +1,7 @@ import * as React from 'react'; +import { CloudNotifierType, NotifierType } from 'app/features/alerting/unified/types/alerting'; import { GrafanaManagedReceiverConfig } from 'app/plugins/datasource/alertmanager/types'; -import { CloudNotifierType, NotifierType } from 'app/types/alerting'; import { ControlledField } from '../hooks/useControlledFieldArray'; diff --git a/public/app/features/alerting/unified/utils/cloud-alertmanager-notifier-types.ts b/public/app/features/alerting/unified/utils/cloud-alertmanager-notifier-types.ts index 2475248dc34..c29cbd6cc3a 100644 --- a/public/app/features/alerting/unified/utils/cloud-alertmanager-notifier-types.ts +++ b/public/app/features/alerting/unified/utils/cloud-alertmanager-notifier-types.ts @@ -1,5 +1,9 @@ import { config } from '@grafana/runtime'; -import { CloudNotifierType, NotificationChannelOption, NotifierDTO } from 'app/types/alerting'; +import { + CloudNotifierType, + NotificationChannelOption, + NotifierDTO, +} from 'app/features/alerting/unified/types/alerting'; import { option } from './notifier-types'; diff --git a/public/app/features/alerting/unified/utils/notifier-types.ts b/public/app/features/alerting/unified/utils/notifier-types.ts index eeb2f30dae9..065f852bb3f 100644 --- a/public/app/features/alerting/unified/utils/notifier-types.ts +++ b/public/app/features/alerting/unified/utils/notifier-types.ts @@ -1,4 +1,4 @@ -import { NotificationChannelOption } from 'app/types/alerting'; +import { NotificationChannelOption } from 'app/features/alerting/unified/types/alerting'; export function option( propertyName: string, diff --git a/public/app/features/alerting/unified/utils/receiver-form.ts b/public/app/features/alerting/unified/utils/receiver-form.ts index 689bfe07c26..bea5503ad85 100644 --- a/public/app/features/alerting/unified/utils/receiver-form.ts +++ b/public/app/features/alerting/unified/utils/receiver-form.ts @@ -1,5 +1,11 @@ import { has, isArray, isNil, omitBy, pickBy } from 'lodash'; +import { + CloudNotifierType, + NotificationChannelOption, + NotifierDTO, + NotifierType, +} from 'app/features/alerting/unified/types/alerting'; import { AlertmanagerReceiver, GrafanaManagedContactPoint, @@ -7,7 +13,6 @@ import { GrafanaManagedReceiverSecureFields, Receiver, } from 'app/plugins/datasource/alertmanager/types'; -import { CloudNotifierType, NotificationChannelOption, NotifierDTO, NotifierType } from 'app/types/alerting'; import { ChannelValues,