-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHome.tsx
39 lines (35 loc) · 1.45 KB
/
Home.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { SceneApp, SceneAppPage } from '@grafana/scenes';
import * as React from 'react';
import { getBasicScene } from './scenes';
import { prefixRoute } from '../../utils/utils.routing';
import { DATASOURCE_REF, ROUTES } from '../../constants';
import { config } from '@grafana/runtime';
import { Alert } from '@grafana/ui';
const getScene = () => {
return new SceneApp({
pages: [
new SceneAppPage({
title: 'Home page',
subTitle:
'This scene showcases a basic scene functionality, including query runner, variable and a custom scene object.',
url: prefixRoute(ROUTES.Home),
getScene: () => {
return getBasicScene();
},
}),
],
});
};
export const HomePage = () => {
const scene = getScene();
return <>
{!config.featureToggles.topnav && <Alert title='Missing topnav feature toggle'>
Scenes are designed to work with the new navigation wrapper that will be standard in grafana 10
</Alert>}
{!config.datasources[DATASOURCE_REF.uid] && <Alert title={`Missing ${DATASOURCE_REF.uid} datasource`}>
These demos depend on <b>testdata</b> datasource: <code>{JSON.stringify(DATASOURCE_REF)}</code>.
See <a href="https://github.com/grafana/grafana/tree/main/devenv#set-up-your-development-environment">https://github.com/grafana/grafana/tree/main/devenv#set-up-your-development-environment</a> for more details.
</Alert>}
<scene.Component model={scene} />
</>;
};