The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/features/scenes/ScenePage.tsx

32 lines
752 B

// Libraries
import React, { useEffect, useState } from 'react';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { getSceneByTitle } from './scenes';
export interface Props extends GrafanaRouteComponentProps<{ name: string }> {}
export const ScenePage = (props: Props) => {
const scene = getSceneByTitle(props.match.params.name);
const [isInitialized, setInitialized] = useState(false);
useEffect(() => {
if (scene && !isInitialized) {
scene.initUrlSync();
setInitialized(true);
}
}, [isInitialized, scene]);
if (!scene) {
return <h2>Scene not found</h2>;
}
if (!isInitialized) {
return null;
}
return <scene.Component model={scene} />;
};
export default ScenePage;