|
1 | | -import React from 'react'; |
2 | | -import { GrafanaTheme2 } from '@grafana/data'; |
3 | 1 | import { EmbeddedScene, SceneReactObject } from '@grafana/scenes'; |
4 | | -import { Button, Card, TextLink, useStyles2 } from '@grafana/ui'; |
5 | 2 | import { css } from '@emotion/css'; |
6 | 3 |
|
7 | | -import { CheckType } from 'types'; |
8 | | -import { ROUTES } from 'routing/types'; |
9 | | -import { useNavigation } from 'hooks/useNavigation'; |
| 4 | +import { ChecksEmptyState } from 'components/ChecksEmptyState'; |
10 | 5 |
|
11 | | -function getStyles(theme: GrafanaTheme2) { |
12 | | - return { |
13 | | - container: css` |
14 | | - display: flex; |
15 | | - align-items: center; |
16 | | - justify-content: center; |
17 | | - width: 100%; |
18 | | - min-height: 100%; |
19 | | - `, |
20 | | - cardHeader: css` |
21 | | - text-align: center; |
22 | | - justify-content: center; |
23 | | - `, |
24 | | - emptyCard: css` |
25 | | - min-height: 200px; |
26 | | - max-width: 800px; |
27 | | - padding: ${theme.spacing(4)}; |
28 | | - `, |
29 | | - cardButtons: css` |
30 | | - display: flex; |
31 | | - justify-content: center; |
32 | | - `, |
33 | | - }; |
34 | | -} |
35 | | - |
36 | | -function EmptyScene({ checkType }: { checkType?: CheckType }) { |
37 | | - const styles = useStyles2(getStyles); |
38 | | - const navigate = useNavigation(); |
39 | | - |
40 | | - return ( |
41 | | - <div className={styles.container}> |
42 | | - <Card className={styles.emptyCard}> |
43 | | - <Card.Heading className={styles.cardHeader}> |
44 | | - <p> |
45 | | - You don't have any {checkType ? checkType.toUpperCase() : ''} checks running. Click the Create a check |
46 | | - button to start monitoring your services with Grafana Cloud, or{' '} |
47 | | - <TextLink href="https://grafana.com/docs/grafana-cloud/synthetic-monitoring/" external={true}> |
48 | | - check out the Synthetic Monitoring docs. |
49 | | - </TextLink> |
50 | | - </p> |
51 | | - </Card.Heading> |
52 | | - <Card.Actions className={styles.cardButtons}> |
53 | | - <Button |
54 | | - onClick={() => { |
55 | | - navigate(checkType ? ROUTES.NewCheck + '/' + checkType : ROUTES.ChooseCheckGroup); |
56 | | - }} |
57 | | - > |
58 | | - Create a check |
59 | | - </Button> |
60 | | - </Card.Actions> |
61 | | - </Card> |
62 | | - </div> |
63 | | - ); |
64 | | -} |
| 6 | +const wrapperStyles = css` |
| 7 | + width: 100%; |
| 8 | +`; |
65 | 9 |
|
66 | | -export function getEmptyScene(checkType?: CheckType) { |
| 10 | +export function getEmptyScene() { |
67 | 11 | return new EmbeddedScene({ |
68 | 12 | body: new SceneReactObject({ |
69 | | - component: EmptyScene, |
70 | | - props: { checkType }, |
| 13 | + component: ChecksEmptyState, |
| 14 | + props: { className: wrapperStyles }, |
71 | 15 | }), |
72 | 16 | }); |
73 | 17 | } |
0 commit comments