ReportsUpgradePage.tsx 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import { css } from '@emotion/css';
  2. import React from 'react';
  3. import { connect, ConnectedProps } from 'react-redux';
  4. import { GrafanaTheme2 } from '@grafana/data';
  5. import { useStyles2 } from '@grafana/ui';
  6. import Page from 'app/core/components/Page/Page';
  7. import { UpgradeBox, UpgradeContent, UpgradeContentProps } from 'app/core/components/Upgrade/UpgradeBox';
  8. import { getNavModel } from 'app/core/selectors/navModel';
  9. import { EnterpriseStoreState } from '../types';
  10. function mapStateToProps(state: EnterpriseStoreState) {
  11. return {
  12. navModel: getNavModel(state.navIndex, 'reports'),
  13. };
  14. }
  15. const connector = connect(mapStateToProps);
  16. export type Props = ConnectedProps<typeof connector>;
  17. const ReportsUpgradePage = ({ navModel }: Props) => {
  18. const styles = useStyles2(getStyles);
  19. return (
  20. <Page navModel={navModel}>
  21. <div className={styles.box}>
  22. <UpgradeBox featureName={'reporting'} featureId={'reporting'} />
  23. </div>
  24. <Page.Contents className={styles.contents}>
  25. <ReportUpgradeContent />
  26. </Page.Contents>
  27. {/*Push down the page footer*/}
  28. <div className={styles.spacer} />
  29. </Page>
  30. );
  31. };
  32. export const ReportUpgradeContent = ({ action }: { action?: UpgradeContentProps['action'] }) => {
  33. return (
  34. <UpgradeContent
  35. featureName={'reporting'}
  36. description={
  37. 'Reporting allows you to automatically generate PDFs from any of your dashboards and have Grafana email them to interested parties on a schedule.'
  38. }
  39. listItems={[
  40. 'Customize your exact layout and orientation',
  41. 'Personalize with your unique branding',
  42. 'Specify permissions for users across your company',
  43. 'Choose to send a report at custom intervals',
  44. ]}
  45. featureUrl={'https://grafana.com/docs/grafana/latest/enterprise/reporting/'}
  46. image={'reporting-email.png'}
  47. caption={
  48. 'Create reports to share your SLO performance, business metrics, cost and utilization metrics or anything else you can express in a Grafana dashboard.'
  49. }
  50. action={action}
  51. />
  52. );
  53. };
  54. const getStyles = (theme: GrafanaTheme2) => {
  55. return {
  56. contents: css`
  57. &.page-body {
  58. flex: 0;
  59. }
  60. `,
  61. spacer: css`
  62. flex: 1;
  63. `,
  64. box: css`
  65. ${theme.breakpoints.up('sm')} {
  66. padding: ${theme.spacing(0, 1)};
  67. }
  68. ${theme.breakpoints.up('md')} {
  69. padding: ${theme.spacing(0, 2)};
  70. }
  71. `,
  72. };
  73. };
  74. export default connector(ReportsUpgradePage);