();
@@ -233,14 +232,12 @@ const FlameGraph = ({
);
};
-const getStyles = (selectedView: SelectedView, app: CoreApp, flameGraphHeight: number | undefined) => ({
+const getStyles = () => ({
graph: css`
- float: left;
overflow: scroll;
- width: ${selectedView === SelectedView.FlameGraph ? '100%' : '50%'};
- ${app !== CoreApp.Explore
- ? `height: calc(${flameGraphHeight}px - 50px)`
- : ''}; // 50px to adjust for header pushing content down
+ height: 100%;
+ flex-grow: 1;
+ flex-basis: 50%;
`,
canvasContainer: css`
cursor: pointer;
diff --git a/public/app/plugins/panel/flamegraph/components/FlameGraphContainer.tsx b/public/app/plugins/panel/flamegraph/components/FlameGraphContainer.tsx
index df4368b782f..ae3724c4f0b 100644
--- a/public/app/plugins/panel/flamegraph/components/FlameGraphContainer.tsx
+++ b/public/app/plugins/panel/flamegraph/components/FlameGraphContainer.tsx
@@ -2,10 +2,10 @@ import { css } from '@emotion/css';
import React, { useEffect, useMemo, useState } from 'react';
import { useMeasure } from 'react-use';
-import { DataFrame, CoreApp } from '@grafana/data';
+import { DataFrame, CoreApp, GrafanaTheme2 } from '@grafana/data';
import { useStyles2, useTheme2 } from '@grafana/ui';
-import { MIN_WIDTH_TO_SHOW_BOTH_TOPTABLE_AND_FLAMEGRAPH, PIXELS_PER_LEVEL } from '../constants';
+import { MIN_WIDTH_TO_SHOW_BOTH_TOPTABLE_AND_FLAMEGRAPH } from '../constants';
import FlameGraph from './FlameGraph/FlameGraph';
import { FlameGraphDataContainer, LevelItem, nestedSetToLevels } from './FlameGraph/dataTransform';
@@ -16,10 +16,6 @@ import { SelectedView } from './types';
type Props = {
data?: DataFrame;
app: CoreApp;
- // Height for flame graph when not used in explore.
- // This needs to be different to explore flame graph height as we
- // use panels with user adjustable heights in dashboards etc.
- flameGraphHeight?: number;
};
const FlameGraphContainer = (props: Props) => {
@@ -44,7 +40,7 @@ const FlameGraphContainer = (props: Props) => {
return [container, nestedSetToLevels(container)];
}, [props.data, theme]);
- const styles = useStyles2(() => getStyles(props.app, PIXELS_PER_LEVEL * (levels?.length ?? 0)));
+ const styles = useStyles2(getStyles);
// If user resizes window with both as the selected view
useEffect(() => {
@@ -81,49 +77,62 @@ const FlameGraphContainer = (props: Props) => {
containerWidth={containerWidth}
/>
- {selectedView !== SelectedView.FlameGraph && (
-
- )}
+
+ {selectedView !== SelectedView.FlameGraph && (
+
+ )}
- {selectedView !== SelectedView.TopTable && (
-
- )}
+ {selectedView !== SelectedView.TopTable && (
+
+ )}
+
)}
>
);
};
-const getStyles = (app: CoreApp, height: number) => ({
- container: css`
- height: ${app === CoreApp.Explore ? height + 'px' : '100%'};
- `,
-});
+function getStyles(theme: GrafanaTheme2) {
+ return {
+ container: css({
+ height: '100%',
+ display: 'flex',
+ flex: '1 1 0',
+ flexDirection: 'column',
+ minHeight: 0,
+ gap: theme.spacing(2),
+ }),
+ body: css({
+ display: 'flex',
+ flexGrow: 1,
+ minHeight: 0,
+ }),
+ };
+}
export default FlameGraphContainer;
diff --git a/public/app/plugins/panel/flamegraph/components/TopTable/FlameGraphTopTableContainer.tsx b/public/app/plugins/panel/flamegraph/components/TopTable/FlameGraphTopTableContainer.tsx
index 3ef85d5e51b..5e7c4a78e5e 100644
--- a/public/app/plugins/panel/flamegraph/components/TopTable/FlameGraphTopTableContainer.tsx
+++ b/public/app/plugins/panel/flamegraph/components/TopTable/FlameGraphTopTableContainer.tsx
@@ -43,7 +43,7 @@ const FlameGraphTopTableContainer = ({
setRangeMin,
setRangeMax,
}: Props) => {
- const styles = useStyles2(() => getStyles(selectedView, app));
+ const styles = useStyles2(getStyles);
const onSymbolClick = (symbol: string) => {
if (search === symbol) {
@@ -148,18 +148,12 @@ function buildTableDataFrame(
return dataFrames[0];
}
-const getStyles = (selectedView: SelectedView, app: CoreApp) => {
- const marginRight = '20px';
-
+const getStyles = () => {
return {
topTableContainer: css`
- cursor: pointer;
- float: left;
- margin-right: ${marginRight};
- width: ${selectedView === SelectedView.TopTable ? '100%' : `calc(50% - ${marginRight})`};
- ${app !== CoreApp.Explore
- ? 'height: calc(100% - 50px)'
- : 'height: calc(100% + 50px)'}; // 50px to adjust for header pushing content down
+ flex-grow: 1;
+ flex-basis: 50%;
+ overflow: hidden;
`,
};
};