Skip to content

Commit

Permalink
added constant VIZ_CONTAIN_XY_AXIS for x, y value axis
Browse files Browse the repository at this point in the history
Signed-off-by: rinku-kumar-psl <rinku_kumar@persistent.com>
  • Loading branch information
rinku-kumar-psl committed May 17, 2022
1 parent 9891cb3 commit f8114e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions dashboards-observability/common/constants/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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];
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `
{
Expand Down Expand Up @@ -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 } = {
Expand Down

0 comments on commit f8114e4

Please sign in to comment.