import { Button, LinkButton, Menu, Tooltip } from '@grafana/ui'; import { usePluginBridge } from '../../hooks/usePluginBridge'; import { getIrmIfPresentOrIncidentPluginId } from '../../utils/config'; import { createBridgeURL } from '../PluginBridge'; interface Props { title?: string; severity?: 'minor' | 'major' | 'critical' | ''; url?: string; } const pluginId = getIrmIfPresentOrIncidentPluginId(); export const DeclareIncidentButton = ({ title = '', severity = '', url = '' }: Props) => { const bridgeURL = createBridgeURL(pluginId, '/incidents/declare', { title, severity, url, }); const { loading, installed, settings } = usePluginBridge(pluginId); return ( <> {loading === true && ( )} {installed === false && ( )} {settings && ( Declare Incident )} ); }; export const DeclareIncidentMenuItem = ({ title = '', severity = '', url = '' }: Props) => { const bridgeURL = createBridgeURL(pluginId, '/incidents/declare', { title, severity, url, }); const { loading, installed, settings } = usePluginBridge(pluginId); return ( <> {loading === true && } {installed === false && ( )} {settings && } ); };