NoDataSourceCallToAction.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import React, { useContext } from 'react';
  2. import { css } from 'emotion';
  3. import { ThemeContext, LinkButton, CallToActionCard } from '@grafana/ui';
  4. export const NoDataSourceCallToAction = () => {
  5. const theme = useContext(ThemeContext);
  6. const message =
  7. 'Explore requires at least one data source. Once you have added a data source, you can query it here.';
  8. const footer = (
  9. <>
  10. <i className="fa fa-rocket" />
  11. <> ProTip: You can also define data sources through configuration files. </>
  12. <a
  13. href="http://docs.grafana.org/administration/provisioning/#datasources?utm_source=explore"
  14. target="_blank"
  15. className="text-link"
  16. >
  17. Learn more
  18. </a>
  19. </>
  20. );
  21. const ctaElement = (
  22. <LinkButton size="lg" href="/datasources/new" icon="gicon gicon-datasources">
  23. Add data source
  24. </LinkButton>
  25. );
  26. const cardClassName = css`
  27. max-width: ${theme.breakpoints.lg};
  28. margin-top: ${theme.spacing.md};
  29. align-self: center;
  30. `;
  31. return (
  32. <CallToActionCard
  33. callToActionElement={ctaElement}
  34. className={cardClassName}
  35. footer={footer}
  36. message={message}
  37. theme={theme}
  38. />
  39. );
  40. };