DashboardCommentsModal.tsx 811 B

123456789101112131415161718192021222324252627282930
  1. import { css } from '@emotion/css';
  2. import React from 'react';
  3. import { GrafanaTheme2 } from '@grafana/data';
  4. import { Modal, useStyles2 } from '@grafana/ui';
  5. import { CommentManager } from 'app/features/comments/CommentManager';
  6. import { DashboardModel } from '../../state/DashboardModel';
  7. type Props = {
  8. dashboard: DashboardModel;
  9. onDismiss: () => void;
  10. };
  11. export const DashboardCommentsModal = ({ dashboard, onDismiss }: Props) => {
  12. const styles = useStyles2(getStyles);
  13. return (
  14. <Modal isOpen={true} title="Dashboard comments" icon="save" onDismiss={onDismiss} className={styles.modal}>
  15. <CommentManager objectType={'dashboard'} objectId={dashboard.uid} />
  16. </Modal>
  17. );
  18. };
  19. const getStyles = (theme: GrafanaTheme2) => ({
  20. modal: css`
  21. width: 500px;
  22. height: 60vh;
  23. `,
  24. });