mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Config tracker - update link for default contact point (#94384)
Co-authored-by: Sonia Aguilar <soniaaguilarpeiron@gmail.com>
This commit is contained in:
parent
f6abde3328
commit
074831153a
@ -35,20 +35,9 @@ export function isOnCallContactPointReady(contactPoints: Receiver[]) {
|
||||
);
|
||||
}
|
||||
|
||||
export function useGetContactPoints() {
|
||||
const alertmanagerConfiguration = alertmanagerApi.endpoints.getAlertmanagerConfiguration.useQuery(
|
||||
GRAFANA_RULES_SOURCE_NAME,
|
||||
{
|
||||
refetchOnFocus: true,
|
||||
refetchOnReconnect: true,
|
||||
refetchOnMountOrArgChange: true,
|
||||
}
|
||||
);
|
||||
|
||||
const contactPoints = alertmanagerConfiguration.data?.alertmanager_config?.receivers ?? [];
|
||||
return { contactPoints, isLoading: alertmanagerConfiguration.isLoading };
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Will be removed when notification policies is moved to k8s API. Do not use!
|
||||
*/
|
||||
export function useGetDefaultContactPoint() {
|
||||
const alertmanagerConfiguration = alertmanagerApi.endpoints.getAlertmanagerConfiguration.useQuery(
|
||||
GRAFANA_RULES_SOURCE_NAME,
|
||||
|
@ -1,14 +1,10 @@
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import { locationService } from '@grafana/runtime';
|
||||
import { useGrafanaContactPoints } from 'app/features/alerting/unified/components/contact-points/useContactPoints';
|
||||
import { RelativeUrl, createRelativeUrl } from 'app/features/alerting/unified/utils/url';
|
||||
|
||||
import {
|
||||
isOnCallContactPointReady,
|
||||
useGetContactPoints,
|
||||
useGetDefaultContactPoint,
|
||||
useIsCreateAlertRuleDone,
|
||||
} from './alerting/hooks';
|
||||
import { isOnCallContactPointReady, useGetDefaultContactPoint, useIsCreateAlertRuleDone } from './alerting/hooks';
|
||||
import { isContactPointReady } from './alerting/utils';
|
||||
import { ConfigurationStepsEnum, DataSourceConfigurationData, IrmCardConfiguration } from './components/ConfigureIRM';
|
||||
import { useGetIncidentPluginConfig } from './incidents/hooks';
|
||||
@ -53,7 +49,8 @@ export interface EssentialsConfigurationData {
|
||||
|
||||
function useGetConfigurationForApps() {
|
||||
// configuration checks for alerting
|
||||
const { contactPoints, isLoading: isLoadingContactPoints } = useGetContactPoints();
|
||||
const { contactPoints, isLoading: isLoadingContactPoints } = useGrafanaContactPoints();
|
||||
// TODO: Switch to k8s API/refactored notification policies hook when available
|
||||
const { defaultContactpoint, isLoading: isLoadingDefaultContactPoint } = useGetDefaultContactPoint();
|
||||
const { isDone: isCreateAlertRuleDone, isLoading: isLoadingAlertCreatedDone } = useIsCreateAlertRuleDone();
|
||||
// configuration checks for incidents
|
||||
@ -132,8 +129,8 @@ export function useGetEssentialsConfiguration(): EssentialsConfigurationData {
|
||||
button: {
|
||||
type: 'openLink',
|
||||
urlLink: {
|
||||
url: `/alerting/notifications/receivers/${defaultContactpoint}/edit`,
|
||||
queryParams: { alertmanager: 'grafana' },
|
||||
url: `/alerting/notifications`,
|
||||
queryParams: { search: defaultContactpoint, alertmanager: 'grafana' },
|
||||
},
|
||||
label: 'Edit',
|
||||
labelOnDone: 'View',
|
||||
|
Loading…
Reference in New Issue
Block a user