dashboardImport.tsx 731 B

1234567891011121314151617181920212223242526272829
  1. import {Button} from 'sentry/components/button';
  2. import {IconDownload} from 'sentry/icons';
  3. import {t} from 'sentry/locale';
  4. import useOrganization from 'sentry/utils/useOrganization';
  5. import {useUser} from 'sentry/utils/useUser';
  6. import {openDashboardImport} from '../../metrics/dashboardImportModal';
  7. // Allows easy import of dashboards. Visible to superusers only.
  8. export function DashboardImportButton() {
  9. const organization = useOrganization();
  10. const user = useUser();
  11. if (!user.isSuperuser) {
  12. return null;
  13. }
  14. return (
  15. <Button
  16. onClick={() => {
  17. openDashboardImport(organization);
  18. }}
  19. size="sm"
  20. icon={<IconDownload />}
  21. >
  22. {t('Import Dashboard')}
  23. </Button>
  24. );
  25. }