mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DynamicDashboards: Revert unnecessary empty page on new layouts (#100218)
Revert unnecessary empty page on new layouts
This commit is contained in:
parent
677060862c
commit
2b3ccfe5b9
@ -1,16 +1,8 @@
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import {
|
||||
SceneComponentProps,
|
||||
SceneCSSGridLayout,
|
||||
SceneObjectBase,
|
||||
SceneObjectState,
|
||||
useSceneObjectState,
|
||||
VizPanel,
|
||||
} from '@grafana/scenes';
|
||||
import { SceneComponentProps, SceneCSSGridLayout, SceneObjectBase, SceneObjectState, VizPanel } from '@grafana/scenes';
|
||||
import { Select } from '@grafana/ui';
|
||||
import { t } from 'app/core/internationalization';
|
||||
import { OptionsPaneItemDescriptor } from 'app/features/dashboard/components/PanelEditor/OptionsPaneItemDescriptor';
|
||||
import DashboardEmpty from 'app/features/dashboard/dashgrid/DashboardEmpty';
|
||||
|
||||
import { dashboardSceneGraph } from '../../utils/dashboardSceneGraph';
|
||||
import { getDashboardSceneFor, getGridItemKeyForPanelId, getVizPanelKeyForPanelId } from '../../utils/utils';
|
||||
@ -148,16 +140,6 @@ export class ResponsiveGridLayoutManager
|
||||
public activateRepeaters(): void {}
|
||||
|
||||
public static Component = ({ model }: SceneComponentProps<ResponsiveGridLayoutManager>) => {
|
||||
const { children } = useSceneObjectState(model.state.layout, { shouldActivateOrKeepAlive: true });
|
||||
const dashboard = getDashboardSceneFor(model);
|
||||
|
||||
// If we are top level layout and have no children, show empty state
|
||||
if (model.parent === dashboard && children.length === 0) {
|
||||
return (
|
||||
<DashboardEmpty dashboard={dashboard} canCreate={!!dashboard.state.meta.canEdit} key="dashboard-empty-state" />
|
||||
);
|
||||
}
|
||||
|
||||
return <model.state.layout.Component model={model.state.layout} />;
|
||||
};
|
||||
}
|
||||
|
@ -12,10 +12,8 @@ import {
|
||||
} from '@grafana/scenes';
|
||||
import { useStyles2 } from '@grafana/ui';
|
||||
import { t } from 'app/core/internationalization';
|
||||
import DashboardEmpty from 'app/features/dashboard/dashgrid/DashboardEmpty';
|
||||
|
||||
import { isClonedKey } from '../../utils/clone';
|
||||
import { getDashboardSceneFor } from '../../utils/utils';
|
||||
import { DashboardScene } from '../DashboardScene';
|
||||
import { DashboardGridItem } from '../layout-default/DashboardGridItem';
|
||||
import { DefaultGridLayoutManager } from '../layout-default/DefaultGridLayoutManager';
|
||||
@ -197,14 +195,6 @@ export class RowsLayoutManager extends SceneObjectBase<RowsLayoutManagerState> i
|
||||
public static Component = ({ model }: SceneComponentProps<RowsLayoutManager>) => {
|
||||
const { rows } = model.useState();
|
||||
const styles = useStyles2(getStyles);
|
||||
const dashboard = getDashboardSceneFor(model);
|
||||
|
||||
// If we are top level layout and have no children, show empty state
|
||||
if (model.parent === dashboard && rows.length === 0) {
|
||||
return (
|
||||
<DashboardEmpty dashboard={dashboard} canCreate={!!dashboard.state.meta.canEdit} key="dashboard-empty-state" />
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.wrapper}>
|
||||
|
Loading…
Reference in New Issue
Block a user