Skip to content

Commit

Permalink
[BUG]: Revert code for treemap and histogram. (opensearch-project#1037)
Browse files Browse the repository at this point in the history
* Revert code for histogram and treemap after antlr merge because of crashes in app

Signed-off-by: ruchika-narang <ruchika_narang@persistent.com>

* Fixes after rebasing with main and test cases failing

Signed-off-by: ruchika-narang <ruchika_narang@persistent.com>

* Removed commented code

Signed-off-by: ruchika-narang <ruchika_narang@persistent.com>

* Working on review comments, renaming metrics to series

Signed-off-by: ruchika-narang <ruchika_narang@persistent.com>

* Removing extra import after rebasing main

Signed-off-by: ruchika-narang <ruchika_narang@persistent.com>

* Working on review comments

Signed-off-by: ruchika-narang <ruchika_narang@persistent.com>

* Replacing series and dimension with dynamic naming

Signed-off-by: ruchika-narang <ruchika_narang@persistent.com>

* Updated snapshots

Signed-off-by: ruchika-narang <ruchika_narang@persistent.com>

* Fixed failing test case issue

Signed-off-by: ruchika-narang <ruchika_narang@persistent.com>

* Resolving review comment

Signed-off-by: ruchika-narang <ruchika_narang@persistent.com>

Signed-off-by: ruchika-narang <ruchika_narang@persistent.com>
  • Loading branch information
ruchika-narang authored Sep 26, 2022
1 parent 18c642f commit 3ce8d87
Show file tree
Hide file tree
Showing 34 changed files with 595 additions and 494 deletions.
20 changes: 11 additions & 9 deletions dashboards-observability/common/constants/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { visChartTypes } from './shared';
import { VIS_CHART_TYPES } 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 @@ -81,11 +81,11 @@ export const DEFAULT_AVAILABILITY_QUERY = 'stats count() by span( timestamp, 1h
export const ADD_BUTTON_TEXT = '+ Add color theme';

export const VIZ_CONTAIN_XY_AXIS = [
visChartTypes.Bar,
visChartTypes.Histogram,
visChartTypes.Line,
visChartTypes.Pie,
visChartTypes.Scatter,
VIS_CHART_TYPES.Bar,
VIS_CHART_TYPES.Histogram,
VIS_CHART_TYPES.Line,
VIS_CHART_TYPES.Pie,
VIS_CHART_TYPES.Scatter,
];

// default ppl aggregation method options
Expand Down Expand Up @@ -153,7 +153,7 @@ export interface DefaultGaugeChartParametersProps {
ThresholdsMaxLimit: number;
}

export const DefaultGaugeChartParameters: DefaultGaugeChartParametersProps = {
export const DEFAULT_GAUGE_CHART_PARAMETERS: DefaultGaugeChartParametersProps = {
GaugeTitleSize: 14,
DisplayDefaultGauges: 1,
OrientationDefault: 'h',
Expand All @@ -166,10 +166,12 @@ export const DefaultGaugeChartParameters: DefaultGaugeChartParametersProps = {
export const PLOTLY_PIE_COLUMN_NUMBER = 2;
export const PIE_XAXIS_GAP = 0.2;
export const PIE_YAXIS_GAP = 0.1;
export interface DefaultPieChartParametersProps {
export interface DefaultPieChartParameterProps {
DefaultMode: string;
}

export const DefaultPieChartParameters: DefaultPieChartParametersProps = {
export const DEFAULT_PIE_CHART_PARAMETERS: DefaultPieChartParameterProps = {
DefaultMode: 'pie',
};
export const GROUPBY = 'dimensions';
export const AGGREGATIONS = 'series';
38 changes: 13 additions & 25 deletions dashboards-observability/common/constants/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { IField } from '../../common/types/explorer';
import CSS from 'csstype';

// Client route
Expand Down Expand Up @@ -72,7 +70,7 @@ export const pageStyles: CSS.Properties = {
maxWidth: '1130px',
};

export enum visChartTypes {
export enum VIS_CHART_TYPES {
Bar = 'bar',
HorizontalBar = 'horizontal_bar',
Line = 'line',
Expand All @@ -86,30 +84,20 @@ export enum visChartTypes {
LogsView = 'logs_view',
}

export interface ValueOptionsAxes {
xaxis?: IField[];
yaxis?: IField[];
zaxis?: IField[];
childField?: IField[];
valueField?: IField[];
series?: IField[];
value?: IField[];
}

export const NUMERICAL_FIELDS = ['short', 'integer', 'long', 'float', 'double'];

export const ENABLED_VIS_TYPES = [
visChartTypes.Bar,
visChartTypes.HorizontalBar,
visChartTypes.Line,
visChartTypes.Pie,
visChartTypes.HeatMap,
visChartTypes.Text,
visChartTypes.TreeMap,
visChartTypes.Gauge,
visChartTypes.Histogram,
visChartTypes.Scatter,
visChartTypes.LogsView,
VIS_CHART_TYPES.Bar,
VIS_CHART_TYPES.HorizontalBar,
VIS_CHART_TYPES.Line,
VIS_CHART_TYPES.Pie,
VIS_CHART_TYPES.HeatMap,
VIS_CHART_TYPES.Text,
VIS_CHART_TYPES.TreeMap,
VIS_CHART_TYPES.Gauge,
VIS_CHART_TYPES.Histogram,
VIS_CHART_TYPES.Scatter,
VIS_CHART_TYPES.LogsView,
];

//Live tail constants
Expand Down Expand Up @@ -175,7 +163,7 @@ export interface DefaultChartStylesProps {
DefaultModeScatter: string;
}

export const DefaultChartStyles: DefaultChartStylesProps = {
export const DEFAULT_CHART_STYLES: DefaultChartStylesProps = {
DefaultModeLine: 'lines',
Interpolation: 'spline',
LineWidth: 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ export interface ExpressionChunk {
value: string | number;
}

export interface DataConfigMetric {
export interface DataConfigSeries {
alias: string;
label: string;
name: string;
aggregation: string;
}

export interface AggregationConfigurations {
metrics: Array<DataConfigMetric>;
series: Array<DataConfigSeries>;
dimensions: Array<GroupField>;
span: SpanChunk;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const composeAggregations = (
staleStats: PreviouslyParsedStaleStats
) => {
return {
aggregations: aggConfig.metrics.map((metric) => ({
aggregations: aggConfig.series.map((metric) => ({
function_alias: metric.alias,
function: {
name: metric.aggregation,
Expand Down
6 changes: 4 additions & 2 deletions dashboards-observability/common/types/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import {
FINAL_QUERY,
SELECTED_TIMESTAMP,
SELECTED_DATE_RANGE,
GROUPBY,
AGGREGATIONS,
} from '../constants/explorer';
import {
CoreStart,
Expand Down Expand Up @@ -294,8 +296,8 @@ export interface DimensionSpan {
}

export interface ConfigList {
dimensions?: ConfigListEntry[] | HistogramConfigList[];
metrics?: ConfigListEntry[];
[GROUPBY]?: ConfigListEntry[] | HistogramConfigList[];
[AGGREGATIONS]?: ConfigListEntry[];
breakdowns?: ConfigListEntry[] | HistogramConfigList[];
span?: DimensionSpan;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,9 @@ exports[`Utils helper functions renders displayVisualization function 1`] = `
}
}
>
<EmptyPlaceholder>
<EmptyPlaceholder
icon="visBarVerticalStacked"
>
<EuiText
className="lnsChart__empty"
color="subdued"
Expand Down Expand Up @@ -1448,17 +1450,18 @@ exports[`Utils helper functions renders displayVisualization function 1`] = `
<EuiIcon
color="subdued"
size="xxl"
type="visBarVerticalStacked"
>
<EuiIconEmpty
aria-hidden={true}
className="euiIcon euiIcon--xxLarge euiIcon--subdued"
className="euiIcon euiIcon--xxLarge euiIcon--subdued euiIcon-isLoading"
focusable="false"
role="img"
style={null}
>
<svg
aria-hidden={true}
className="euiIcon euiIcon--xxLarge euiIcon--subdued"
className="euiIcon euiIcon--xxLarge euiIcon--subdued euiIcon-isLoading"
focusable="false"
height={16}
role="img"
Expand Down Expand Up @@ -3992,7 +3995,9 @@ exports[`Utils helper functions renders displayVisualization function 3`] = `
}
}
>
<EmptyPlaceholder>
<EmptyPlaceholder
icon="visBarVerticalStacked"
>
<EuiText
className="lnsChart__empty"
color="subdued"
Expand Down Expand Up @@ -4020,17 +4025,18 @@ exports[`Utils helper functions renders displayVisualization function 3`] = `
<EuiIcon
color="subdued"
size="xxl"
type="visBarVerticalStacked"
>
<EuiIconEmpty
aria-hidden={true}
className="euiIcon euiIcon--xxLarge euiIcon--subdued"
className="euiIcon euiIcon--xxLarge euiIcon--subdued euiIcon-isLoading"
focusable="false"
role="img"
style={null}
>
<svg
aria-hidden={true}
className="euiIcon euiIcon--xxLarge euiIcon--subdued"
className="euiIcon euiIcon--xxLarge euiIcon--subdued euiIcon-isLoading"
focusable="false"
height={16}
role="img"
Expand Down Expand Up @@ -4745,7 +4751,9 @@ exports[`Utils helper functions renders displayVisualization function 4`] = `
}
}
>
<EmptyPlaceholder>
<EmptyPlaceholder
icon="visBarVerticalStacked"
>
<EuiText
className="lnsChart__empty"
color="subdued"
Expand Down Expand Up @@ -4773,17 +4781,18 @@ exports[`Utils helper functions renders displayVisualization function 4`] = `
<EuiIcon
color="subdued"
size="xxl"
type="visBarVerticalStacked"
>
<EuiIconEmpty
aria-hidden={true}
className="euiIcon euiIcon--xxLarge euiIcon--subdued"
className="euiIcon euiIcon--xxLarge euiIcon--subdued euiIcon-isLoading"
focusable="false"
role="img"
style={null}
>
<svg
aria-hidden={true}
className="euiIcon euiIcon--xxLarge euiIcon--subdued"
className="euiIcon euiIcon--xxLarge euiIcon--subdued euiIcon-isLoading"
focusable="false"
height={16}
role="img"
Expand Down
Loading

0 comments on commit 3ce8d87

Please sign in to comment.