mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 16:45:43 -06:00
* Initial dashboard loading start * loading dashboard works and shows something * loading dashboard works and shows something * Minor tweaks * Add starred dashboards to scene list page * Use new SceneGridLayout * Allow switching directly from dashboard to a scene * Migrate basic dashboard rows to scene based dashboard * Review nit Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
33 lines
918 B
TypeScript
33 lines
918 B
TypeScript
// Libraries
|
|
import React, { FC, useEffect } from 'react';
|
|
|
|
import { Page } from 'app/core/components/Page/Page';
|
|
import PageLoader from 'app/core/components/PageLoader/PageLoader';
|
|
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
|
|
|
|
import { getDashboardLoader } from './DashboardsLoader';
|
|
|
|
export interface Props extends GrafanaRouteComponentProps<{ uid: string }> {}
|
|
|
|
export const DashboardScenePage: FC<Props> = ({ match }) => {
|
|
const loader = getDashboardLoader();
|
|
const { dashboard, isLoading } = loader.useState();
|
|
|
|
useEffect(() => {
|
|
loader.load(match.params.uid);
|
|
}, [loader, match.params.uid]);
|
|
|
|
if (!dashboard) {
|
|
return (
|
|
<Page navId="dashboards/browse">
|
|
{isLoading && <PageLoader />}
|
|
{!isLoading && <h2>Dashboard not found</h2>}
|
|
</Page>
|
|
);
|
|
}
|
|
|
|
return <dashboard.Component model={dashboard} />;
|
|
};
|
|
|
|
export default DashboardScenePage;
|