Submit
Path:
~
/
/
usr
/
share
/
grafana
/
public
/
app
/
features
/
alerting
/
unified
/
components
/
receivers
/
grafanaAppReceivers
/
File Content:
grafanaApp.ts
import { Receiver } from 'app/plugins/datasource/alertmanager/types'; import { onCallApi } from '../../../api/onCallApi'; import { usePluginBridge } from '../../../hooks/usePluginBridge'; import { SupportedPlugin } from '../../../types/pluginBridges'; import { isOnCallReceiver } from './onCall/onCall'; import { AmRouteReceiver } from './types'; export const useGetGrafanaReceiverTypeChecker = () => { const { installed: isOnCallEnabled } = usePluginBridge(SupportedPlugin.OnCall); const { data } = onCallApi.useGrafanaOnCallIntegrationsQuery(undefined, { skip: !isOnCallEnabled, }); const getGrafanaReceiverType = (receiver: Receiver): SupportedPlugin | undefined => { //CHECK FOR ONCALL PLUGIN const onCallIntegrations = data ?? []; if (isOnCallEnabled && isOnCallReceiver(receiver, onCallIntegrations)) { return SupportedPlugin.OnCall; } //WE WILL ADD IN HERE IF THERE ARE MORE TYPES TO CHECK return undefined; }; return getGrafanaReceiverType; }; export const useGetAmRouteReceiverWithGrafanaAppTypes = (receivers: Receiver[]) => { const getGrafanaReceiverType = useGetGrafanaReceiverTypeChecker(); const receiverToSelectableContactPointValue = (receiver: Receiver): AmRouteReceiver => { const amRouteReceiverValue: AmRouteReceiver = { label: receiver.name, value: receiver.name, grafanaAppReceiverType: getGrafanaReceiverType(receiver), }; return amRouteReceiverValue; }; return receivers.map(receiverToSelectableContactPointValue); };
Edit
Rename
Chmod
Delete
FILE
FOLDER
INFO
Name
Size
Permission
Action
onCall
---
0755
ReceiverMetadataBadge.tsx
1143 bytes
0644
grafanaApp.ts
1532 bytes
0644
types.ts
412 bytes
0644
useReceiversMetadata.ts
1725 bytes
0644
N4ST4R_ID | Naxtarrr