From b34509215e1a45b64e672f0e39838c8856bd8f6d Mon Sep 17 00:00:00 2001 From: Vikrant Gupta Date: Fri, 28 Jun 2024 12:10:57 +0530 Subject: [PATCH] fix: pie chart panels not rendering (#5376) * fix: pie chart panels not rendering * fix: restructure code --- .../container/GridCardLayout/GridCard/FullView/index.tsx | 2 +- frontend/src/container/GridCardLayout/GridCard/index.tsx | 2 +- frontend/src/container/NewWidget/LeftContainer/index.tsx | 6 +++--- frontend/src/utils/getGraphType.ts | 3 +++ 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/frontend/src/container/GridCardLayout/GridCard/FullView/index.tsx b/frontend/src/container/GridCardLayout/GridCard/FullView/index.tsx index 83ba3b7d4b..7511a4d445 100644 --- a/frontend/src/container/GridCardLayout/GridCard/FullView/index.tsx +++ b/frontend/src/container/GridCardLayout/GridCard/FullView/index.tsx @@ -81,7 +81,7 @@ function FullView({ globalSelectedInterval: globalSelectedTime, variables: getDashboardVariables(selectedDashboard?.data.variables), fillGaps: widget.fillSpans, - formatForWeb: getGraphType(widget.panelTypes) === PANEL_TYPES.TABLE, + formatForWeb: widget.panelTypes === PANEL_TYPES.TABLE, }; } updatedQuery.builder.queryData[0].pageSize = 10; diff --git a/frontend/src/container/GridCardLayout/GridCard/index.tsx b/frontend/src/container/GridCardLayout/GridCard/index.tsx index 2daac8c9b4..976f58b8f0 100644 --- a/frontend/src/container/GridCardLayout/GridCard/index.tsx +++ b/frontend/src/container/GridCardLayout/GridCard/index.tsx @@ -109,7 +109,7 @@ function GridCardGraph({ globalSelectedInterval, variables: getDashboardVariables(variables), fillGaps: widget.fillSpans, - formatForWeb: getGraphType(widget.panelTypes) === PANEL_TYPES.TABLE, + formatForWeb: widget.panelTypes === PANEL_TYPES.TABLE, }; } updatedQuery.builder.queryData[0].pageSize = 10; diff --git a/frontend/src/container/NewWidget/LeftContainer/index.tsx b/frontend/src/container/NewWidget/LeftContainer/index.tsx index 658fb564b4..80e893759e 100644 --- a/frontend/src/container/NewWidget/LeftContainer/index.tsx +++ b/frontend/src/container/NewWidget/LeftContainer/index.tsx @@ -12,7 +12,7 @@ import { memo, useEffect, useState } from 'react'; import { useSelector } from 'react-redux'; import { AppState } from 'store/reducers'; import { GlobalReducer } from 'types/reducer/globalTime'; -import { getGraphType } from 'utils/getGraphType'; +import { getGraphType, getGraphTypeForFormat } from 'utils/getGraphType'; import { WidgetGraphProps } from '../types'; import ExplorerColumnsRenderer from './ExplorerColumnsRenderer'; @@ -45,7 +45,7 @@ function LeftContainer({ query: stagedQuery || initialQueriesMap.metrics, globalSelectedInterval, formatForWeb: - getGraphType(selectedGraph || selectedWidget.panelTypes) === + getGraphTypeForFormat(selectedGraph || selectedWidget.panelTypes) === PANEL_TYPES.TABLE, variables: getDashboardVariables(selectedDashboard?.data.variables), }; @@ -77,7 +77,7 @@ function LeftContainer({ query: stagedQuery, fillGaps: selectedWidget.fillSpans || false, formatForWeb: - getGraphType(selectedGraph || selectedWidget.panelTypes) === + getGraphTypeForFormat(selectedGraph || selectedWidget.panelTypes) === PANEL_TYPES.TABLE, })); } diff --git a/frontend/src/utils/getGraphType.ts b/frontend/src/utils/getGraphType.ts index 9c3ded97e8..cbb6e6c216 100644 --- a/frontend/src/utils/getGraphType.ts +++ b/frontend/src/utils/getGraphType.ts @@ -10,3 +10,6 @@ export const getGraphType = (panelType: PANEL_TYPES): PANEL_TYPES => { } return panelType; }; + +export const getGraphTypeForFormat = (panelType: PANEL_TYPES): PANEL_TYPES => + panelType;