PanelAlertTab.tsx 640 B

1234567891011121314151617
  1. import React, { FC } from 'react';
  2. import { Tab, TabProps } from '@grafana/ui/src/components/Tabs/Tab';
  3. import { DashboardModel, PanelModel } from 'app/features/dashboard/state';
  4. import { usePanelCombinedRules } from './hooks/usePanelCombinedRules';
  5. interface Props extends Omit<TabProps, 'counter' | 'ref'> {
  6. panel: PanelModel;
  7. dashboard: DashboardModel;
  8. }
  9. // it will load rule count from backend
  10. export const PanelAlertTab: FC<Props> = ({ panel, dashboard, ...otherProps }) => {
  11. const { rules, loading } = usePanelCombinedRules({ panel, dashboard });
  12. return <Tab {...otherProps} counter={loading ? null : rules.length} />;
  13. };