{
@@ -314,7 +333,7 @@ const getContentStyle = (
innerHeight = height - headerHeight - panelPadding - panelBorder;
}
- if (!isOpen) {
+ if (collapsed) {
innerHeight = headerHeight;
}
diff --git a/public/app/features/explore/NodeGraph/NodeGraphContainer.test.tsx b/public/app/features/explore/NodeGraph/NodeGraphContainer.test.tsx
index 7fdc2ce78b2..bc1f3f2ae1f 100644
--- a/public/app/features/explore/NodeGraph/NodeGraphContainer.test.tsx
+++ b/public/app/features/explore/NodeGraph/NodeGraphContainer.test.tsx
@@ -18,8 +18,8 @@ describe('NodeGraphContainer', () => {
/>
);
- // Make sure we only show header in the collapsible
- expect(container.firstChild?.childNodes.length).toBe(1);
+ // Make sure we only show header and loading bar container from PanelChrome in the collapsible
+ expect(container.firstChild?.childNodes.length).toBe(2);
});
it('shows the graph if not with trace view', async () => {
@@ -33,7 +33,7 @@ describe('NodeGraphContainer', () => {
/>
);
- expect(container.firstChild?.childNodes.length).toBe(2);
+ expect(container.firstChild?.childNodes.length).toBe(3);
expect(container.querySelector('svg')).toBeInTheDocument();
await screen.findByLabelText(/Node: tempo-querier/);
});
diff --git a/public/app/features/explore/NodeGraph/NodeGraphContainer.tsx b/public/app/features/explore/NodeGraph/NodeGraphContainer.tsx
index 4f31a960219..d47dbd7aa21 100644
--- a/public/app/features/explore/NodeGraph/NodeGraphContainer.tsx
+++ b/public/app/features/explore/NodeGraph/NodeGraphContainer.tsx
@@ -5,7 +5,7 @@ import { useToggle, useWindowSize } from 'react-use';
import { applyFieldOverrides, DataFrame, GrafanaTheme2, SplitOpen } from '@grafana/data';
import { config, reportInteraction } from '@grafana/runtime';
-import { Collapse, useStyles2, useTheme2 } from '@grafana/ui';
+import { useStyles2, useTheme2, PanelChrome } from '@grafana/ui';
import { NodeGraph } from '../../../plugins/panel/nodeGraph';
import { useCategorizeFrames } from '../../../plugins/panel/nodeGraph/useCategorizeFrames';
@@ -15,6 +15,8 @@ import { useLinks } from '../utils/links';
const getStyles = (theme: GrafanaTheme2) => ({
warningText: css`
label: warningText;
+ display: flex;
+ align-items: center;
font-size: ${theme.typography.bodySmall.fontSize};
color: ${theme.colors.text.secondary};
`,
@@ -53,9 +55,10 @@ export function UnconnectedNodeGraphContainer(props: Props) {
});
const { nodes } = useCategorizeFrames(frames);
- const [open, toggleOpen] = useToggle(false);
+ const [collapsed, toggleCollapsed] = useToggle(true);
+
const toggled = () => {
- toggleOpen();
+ toggleCollapsed();
reportInteraction('grafana_traces_node_graph_panel_clicked', {
datasourceType: datasourceType,
grafana_version: config.buildInfo.version,
@@ -81,12 +84,13 @@ export function UnconnectedNodeGraphContainer(props: Props) {
) : null;
return (
-
Node graph{countWarning} }
- collapsible={withTraceView}
+ toggled() : undefined}
+ collapsible={!!withTraceView}
+ collapsed={withTraceView ? collapsed : false}
+ onToggleCollapse={withTraceView ? toggled : undefined}
>
-
+
);
}