NoDataSourceCallToAction.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import React, { useContext } from 'react';
  2. import { css } from 'emotion';
  3. import { ThemeContext, LargeLinkButton, 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. <LargeLinkButton href="/datasources/new" icon="gicon gicon-datasources">
  23. Add data source
  24. </LargeLinkButton>
  25. );
  26. const cardClassName = css`
  27. max-width: ${theme.breakpoints.lg};
  28. `;
  29. return (
  30. <CallToActionCard
  31. callToActionElement={ctaElement}
  32. className={cardClassName}
  33. footer={footer}
  34. message={message}
  35. theme={theme}
  36. />
  37. );
  38. };