NoSilencesCTA.tsx 955 B

12345678910111213141516171819202122232425262728
  1. import React, { FC } from 'react';
  2. import { CallToActionCard } from '@grafana/ui';
  3. import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
  4. import { contextSrv } from 'app/core/services/context_srv';
  5. import { getInstancesPermissions } from '../../utils/access-control';
  6. import { makeAMLink } from '../../utils/misc';
  7. type Props = {
  8. alertManagerSourceName: string;
  9. };
  10. export const NoSilencesSplash: FC<Props> = ({ alertManagerSourceName }) => {
  11. const permissions = getInstancesPermissions(alertManagerSourceName);
  12. if (contextSrv.hasAccess(permissions.create, contextSrv.isEditor)) {
  13. return (
  14. <EmptyListCTA
  15. title="You haven't created any silences yet"
  16. buttonIcon="bell-slash"
  17. buttonLink={makeAMLink('alerting/silence/new', alertManagerSourceName)}
  18. buttonTitle="New silence"
  19. />
  20. );
  21. }
  22. return <CallToActionCard callToActionElement={<div />} message="No silences found." />;
  23. };