DeleteDashboardButton.tsx 701 B

123456789101112131415161718192021222324252627282930
  1. import React from 'react';
  2. import { Button, ModalsController } from '@grafana/ui';
  3. import { DashboardModel } from '../../state';
  4. import { DeleteDashboardModal } from './DeleteDashboardModal';
  5. type Props = {
  6. dashboard: DashboardModel;
  7. };
  8. export const DeleteDashboardButton = ({ dashboard }: Props) => (
  9. <ModalsController>
  10. {({ showModal, hideModal }) => (
  11. <Button
  12. variant="destructive"
  13. onClick={() => {
  14. showModal(DeleteDashboardModal, {
  15. dashboard,
  16. hideModal,
  17. });
  18. }}
  19. aria-label="Dashboard settings page delete dashboard button"
  20. >
  21. Delete Dashboard
  22. </Button>
  23. )}
  24. </ModalsController>
  25. );