From f8114e424b9c680494260e9cad5ed2368b5ed85c Mon Sep 17 00:00:00 2001 From: rinku-kumar-psl Date: Tue, 17 May 2022 19:03:49 +0530 Subject: [PATCH] added constant VIZ_CONTAIN_XY_AXIS for x, y value axis Signed-off-by: rinku-kumar-psl --- dashboards-observability/common/constants/explorer.ts | 3 +++ .../explorer/visualizations/config_panel/config_panel.tsx | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dashboards-observability/common/constants/explorer.ts b/dashboards-observability/common/constants/explorer.ts index fbe09f13b..2aac321d4 100644 --- a/dashboards-observability/common/constants/explorer.ts +++ b/dashboards-observability/common/constants/explorer.ts @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import { visChartTypes } from "./shared"; export const EVENT_ANALYTICS_DOCUMENTATION_URL = 'https://opensearch.org/docs/latest/observability-plugin/event-analytics/'; export const OPEN_TELEMETRY_LOG_CORRELATION_LINK = @@ -77,3 +78,5 @@ export const REDUX_EXPL_SLICE_COUNT_DISTRIBUTION = 'countDistributionVisualizati export const PLOTLY_GAUGE_COLUMN_NUMBER = 5; export const APP_ANALYTICS_TAB_ID_REGEX = /application-analytics-tab.+/; export const DEFAULT_AVAILABILITY_QUERY = 'stats count() by span( timestamp, 1h )'; + +export const VIZ_CONTAIN_XY_AXIS = [visChartTypes.Bar, visChartTypes.Histogram, visChartTypes.Line, visChartTypes.Pie]; \ No newline at end of file diff --git a/dashboards-observability/public/components/event_analytics/explorer/visualizations/config_panel/config_panel.tsx b/dashboards-observability/public/components/event_analytics/explorer/visualizations/config_panel/config_panel.tsx index 1e8eadd35..d1e8d25a8 100644 --- a/dashboards-observability/public/components/event_analytics/explorer/visualizations/config_panel/config_panel.tsx +++ b/dashboards-observability/public/components/event_analytics/explorer/visualizations/config_panel/config_panel.tsx @@ -26,6 +26,7 @@ import { TabContext } from '../../../hooks'; import { DefaultEditorControls } from './config_panel_footer'; import { getVisType } from '../../../../visualizations/charts/vis_types'; import { ENABLED_VIS_TYPES, ValueOptionsAxes, visChartTypes } from '../../../../../../common/constants/shared'; +import { VIZ_CONTAIN_XY_AXIS } from '../../../../../../common/constants/explorer'; const CONFIG_LAYOUT_TEMPLATE = ` { @@ -112,8 +113,8 @@ export const ConfigPanel = ({ visualizations, setCurVisId, callback, changeIsVal // To check, If user empty any of the value options const isValidValueOptionConfigSelected = useMemo(() => { const valueOptions = vizConfigs.dataConfig?.valueOptions; - const { Bar, Line, Histogram, Pie, TreeMap, Gauge, HeatMap } = visChartTypes; - const isValidValueOptionsXYAxes = [Bar, Line, Histogram, Pie].includes(curVisId) && + const { TreeMap, Gauge, HeatMap } = visChartTypes; + const isValidValueOptionsXYAxes = VIZ_CONTAIN_XY_AXIS.includes(curVisId) && valueOptions?.xaxis?.length !== 0 && valueOptions?.yaxis?.length !== 0; const isValid_valueOptions: { [key: string]: boolean } = {