Skip to content

Commit

Permalink
merged main and resloved conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Wei <[email protected]>
  • Loading branch information
mengweieric committed Sep 26, 2022
2 parents 764a718 + 3ce8d87 commit 0c3b35b
Show file tree
Hide file tree
Showing 41 changed files with 944 additions and 798 deletions.
55 changes: 39 additions & 16 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 @@ -120,7 +120,16 @@ export const AGGREGATION_OPTIONS = [
];

// numeric fields type for metrics
export const numericalTypes = ['float', 'double', 'bigint', 'long', 'octet', 'short', 'byte', 'integer'];
export const numericalTypes = [
'float',
'double',
'bigint',
'long',
'octet',
'short',
'byte',
'integer',
];
// Data table constants
export const GRID_HEADER_COLUMN_MAX_WIDTH = '150px';
export const GRID_PAGE_RANGE_DISPLAY = 5;
Expand All @@ -136,19 +145,33 @@ export const HEADER_HEIGHT = 35;

// gauge chart default parameters
export interface DefaultGaugeChartParametersProps {
GaugeTitleSize: number,
DisplayDefaultGauges: number,
OrientationDefault: string,
TickLength: number,
LegendPlacement: string,
ThresholdsMaxLimit: number
};
GaugeTitleSize: number;
DisplayDefaultGauges: number;
OrientationDefault: string;
TickLength: number;
LegendPlacement: string;
ThresholdsMaxLimit: number;
}

export const DefaultGaugeChartParameters: DefaultGaugeChartParametersProps = {
export const DEFAULT_GAUGE_CHART_PARAMETERS: DefaultGaugeChartParametersProps = {
GaugeTitleSize: 14,
DisplayDefaultGauges: 1,
OrientationDefault: 'h',
TickLength: 5,
LegendPlacement: 'center',
ThresholdsMaxLimit: 1
ThresholdsMaxLimit: 1,
};

// pie chart default parameters
export const PLOTLY_PIE_COLUMN_NUMBER = 2;
export const PIE_XAXIS_GAP = 0.2;
export const PIE_YAXIS_GAP = 0.1;
export interface DefaultPieChartParameterProps {
DefaultMode: string;
}

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
53 changes: 49 additions & 4 deletions dashboards-observability/common/types/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import { History } from 'history';
import Plotly from 'plotly.js-dist';
import { QueryManager } from 'common/query_manager';
import {
RAW_QUERY,
SELECTED_FIELDS,
Expand All @@ -15,13 +16,21 @@ import {
FINAL_QUERY,
SELECTED_TIMESTAMP,
SELECTED_DATE_RANGE,
GROUPBY,
AGGREGATIONS,
} from '../constants/explorer';
import { CoreStart, HttpSetup, HttpStart, NotificationsStart } from '../../../../src/core/public';
import {
CoreStart,
CoreSetup,
HttpSetup,
HttpStart,
NotificationsStart,
} from '../../../../src/core/public';
import SavedObjects from '../../public/services/saved_objects/event_analytics/saved_objects';
import TimestampUtils from '../../public/services/timestamp/timestamp';
import PPLService from '../../public/services/requests/ppl';
import DSLService from '../../public/services/requests/dsl';

import { SavedObjectsStart } from '../../../../src/core/public/saved_objects';
export interface IQueryTab {
id: string;
name: React.ReactNode | string;
Expand All @@ -34,6 +43,13 @@ export interface IField {
label?: string;
}

export interface ExplorerFields {
availableFields: IField[];
queriedFields: IField[];
selectedFields: IField[];
unselectedFields: IField[];
}

export interface ITabQueryResults {
[tabId: string]: any;
}
Expand Down Expand Up @@ -83,6 +99,7 @@ export interface ILogExplorerProps {
) => void;
savedObjectId: string;
getExistingEmptyTab: (params: EmptyTabParams) => string;
qm: QueryManager;
}

export interface IExplorerProps {
Expand Down Expand Up @@ -113,6 +130,7 @@ export interface IExplorerProps {
appBaseQuery?: string;
callback?: any;
callbackInApp?: any;
qm: QueryManager;
}

export interface SavedQuery {
Expand Down Expand Up @@ -278,8 +296,35 @@ export interface DimensionSpan {
}

export interface ConfigList {
dimensions?: ConfigListEntry[] | HistogramConfigList[];
metrics?: ConfigListEntry[];
[GROUPBY]?: ConfigListEntry[] | HistogramConfigList[];
[AGGREGATIONS]?: ConfigListEntry[];
breakdowns?: ConfigListEntry[] | HistogramConfigList[];
span?: DimensionSpan;
}

export interface Breadcrumbs {
text: string;
href: string;
}

export interface EventAnalyticsProps {
chrome: CoreSetup;
parentBreadcrumbs: Breadcrumbs[];
pplService: any;
dslService: any;
savedObjects: SavedObjectsStart;
timestampUtils: TimestampUtils;
http: HttpStart;
notifications: NotificationsStart;
qm: QueryManager;
}

export interface DataConfigPanelProps {
fieldOptionList: IField[];
visualizations: IVisualizationContainerProps;
qm?: QueryManager;
}
export interface GetTooltipHoverInfoType {
tooltipMode: string;
tooltipText: string;
}
4 changes: 4 additions & 0 deletions dashboards-observability/public/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { I18nProvider } from '@osd/i18n/react';
import React from 'react';
import { Provider } from 'react-redux';
import { HashRouter, Route, Switch } from 'react-router-dom';
import { QueryManager } from 'common/query_manager';
import { CoreStart } from '../../../../src/core/public';
import { observabilityID, observabilityTitle } from '../../common/constants/shared';
import store from '../framework/redux/store';
Expand All @@ -24,6 +25,7 @@ interface ObservabilityAppDeps {
dslService: any;
savedObjects: any;
timestampUtils: any;
qm: QueryManager;
}

// for cypress to test redux store
Expand All @@ -38,6 +40,7 @@ export const App = ({
dslService,
savedObjects,
timestampUtils,
qm,
}: ObservabilityAppDeps) => {
const { chrome, http, notifications } = CoreStartProp;
const parentBreadcrumb = {
Expand Down Expand Up @@ -130,6 +133,7 @@ export const App = ({
timestampUtils={timestampUtils}
http={http}
notifications={notifications}
qm={qm}
{...props}
/>
);
Expand Down
Loading

0 comments on commit 0c3b35b

Please sign in to comment.