NoDataSourceCallToAction.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. rel="noopener"
  16. className="text-link"
  17. >
  18. Learn more
  19. </a>
  20. </>
  21. );
  22. const ctaElement = (
  23. <LinkButton size="lg" href="/datasources/new" icon="gicon gicon-datasources">
  24. Add data source
  25. </LinkButton>
  26. );
  27. const cardClassName = css`
  28. max-width: ${theme.breakpoints.lg};
  29. margin-top: ${theme.spacing.md};
  30. align-self: center;
  31. `;
  32. return (
  33. <CallToActionCard
  34. callToActionElement={ctaElement}
  35. className={cardClassName}
  36. footer={footer}
  37. message={message}
  38. theme={theme}
  39. />
  40. );
  41. };