2019-03-28 11:17:01 -05:00
|
|
|
import React, { useContext } from 'react';
|
|
|
|
import { css } from 'emotion';
|
2020-04-12 15:20:02 -05:00
|
|
|
import { ThemeContext, LinkButton, CallToActionCard, Icon } from '@grafana/ui';
|
2019-03-28 11:17:01 -05:00
|
|
|
|
|
|
|
export const NoDataSourceCallToAction = () => {
|
|
|
|
const theme = useContext(ThemeContext);
|
|
|
|
|
|
|
|
const message =
|
|
|
|
'Explore requires at least one data source. Once you have added a data source, you can query it here.';
|
|
|
|
const footer = (
|
|
|
|
<>
|
2020-04-12 15:20:02 -05:00
|
|
|
<Icon name="rocket" />
|
2019-03-28 11:17:01 -05:00
|
|
|
<> ProTip: You can also define data sources through configuration files. </>
|
|
|
|
<a
|
|
|
|
href="http://docs.grafana.org/administration/provisioning/#datasources?utm_source=explore"
|
|
|
|
target="_blank"
|
2020-11-18 08:36:35 -06:00
|
|
|
rel="noreferrer"
|
2019-03-28 11:17:01 -05:00
|
|
|
className="text-link"
|
|
|
|
>
|
|
|
|
Learn more
|
|
|
|
</a>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
|
|
|
const ctaElement = (
|
2020-07-01 14:04:06 -05:00
|
|
|
<LinkButton size="lg" href="datasources/new" icon="database">
|
2019-03-28 11:17:01 -05:00
|
|
|
Add data source
|
2019-06-17 09:15:49 -05:00
|
|
|
</LinkButton>
|
2019-03-28 11:17:01 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
const cardClassName = css`
|
|
|
|
max-width: ${theme.breakpoints.lg};
|
2019-08-28 03:26:48 -05:00
|
|
|
margin-top: ${theme.spacing.md};
|
|
|
|
align-self: center;
|
2019-03-28 11:17:01 -05:00
|
|
|
`;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<CallToActionCard
|
|
|
|
callToActionElement={ctaElement}
|
|
|
|
className={cardClassName}
|
|
|
|
footer={footer}
|
|
|
|
message={message}
|
|
|
|
theme={theme}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|