diff --git a/.github/workflows/dashboards-observability-test-and-build-workflow.yml b/.github/workflows/dashboards-observability-test-and-build-workflow.yml index e052febae..7f09b560f 100644 --- a/.github/workflows/dashboards-observability-test-and-build-workflow.yml +++ b/.github/workflows/dashboards-observability-test-and-build-workflow.yml @@ -6,7 +6,7 @@ on: [pull_request, push] env: PLUGIN_NAME: dashboards-observability OPENSEARCH_VERSION: 'main' - OPENSEARCH_PLUGIN_VERSION: 2.1.0.0 + OPENSEARCH_PLUGIN_VERSION: 2.2.0.0 jobs: diff --git a/dashboards-observability/common/constants/shared.ts b/dashboards-observability/common/constants/shared.ts index 75dbbe98c..e61909789 100644 --- a/dashboards-observability/common/constants/shared.ts +++ b/dashboards-observability/common/constants/shared.ts @@ -72,7 +72,6 @@ export const pageStyles: CSS.Properties = { maxWidth: '1130px', }; - export enum visChartTypes { Bar = 'bar', HorizontalBar = 'horizontal_bar', @@ -88,9 +87,9 @@ export enum visChartTypes { } export interface ValueOptionsAxes { - xaxis ?: IField[]; - yaxis ?: IField[]; - zaxis ?: IField[]; + xaxis?: IField[]; + yaxis?: IField[]; + zaxis?: IField[]; childField?: IField[]; valueField?: IField[]; series?: IField[]; @@ -99,70 +98,82 @@ export interface ValueOptionsAxes { 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]; +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, +]; //Live tail constants export const LIVE_OPTIONS = [ { - label:'5s', + label: '5s', startTime: 'now-5s', delayTime: 5000, }, { - label:'10s', + label: '10s', startTime: 'now-10s', delayTime: 10000, }, { - label:'30s', + label: '30s', startTime: 'now-30s', delayTime: 30000, }, { - label:'1m', + label: '1m', startTime: 'now-1m', delayTime: 60000, }, { - label:'5m', + label: '5m', startTime: 'now-5m', delayTime: 60000 * 5, }, { - label:'15m', + label: '15m', startTime: 'now-15m', delayTime: 60000 * 15, }, { - label:'30m', + label: '30m', startTime: 'now-30m', delayTime: 60000 * 30, }, { - label:'1h', + label: '1h', startTime: 'now-1h', delayTime: 60000 * 60, }, { - label:'2h', + label: '2h', startTime: 'now-2h', delayTime: 60000 * 120, }, ]; -export const LIVE_END_TIME ='now'; +export const LIVE_END_TIME = 'now'; export interface DefaultChartStylesProps { - DefaultModeLine: string, - Interpolation: string, - LineWidth: number, - FillOpacity: number, - MarkerSize: number, - ShowLegend: string, - LegendPosition: string, - LabelAngle: number, - DefaultSortSectors: string, - DefaultModeScatter: string, -}; + DefaultModeLine: string; + Interpolation: string; + LineWidth: number; + FillOpacity: number; + MarkerSize: number; + ShowLegend: string; + LegendPosition: string; + LabelAngle: number; + DefaultSortSectors: string; + DefaultModeScatter: string; +} export const DefaultChartStyles: DefaultChartStylesProps = { DefaultModeLine: 'lines', @@ -174,8 +185,7 @@ export const DefaultChartStyles: DefaultChartStylesProps = { LegendPosition: 'v', LabelAngle: 0, DefaultSortSectors: 'largest_to_smallest', - DefaultModeScatter: 'markers' -} - -export const FILLOPACITY_DIV_FACTOR = 200; + DefaultModeScatter: 'markers', +}; +export const FILLOPACITY_DIV_FACTOR = 200; diff --git a/dashboards-observability/opensearch_dashboards.json b/dashboards-observability/opensearch_dashboards.json index b8d9645c6..75b51d910 100644 --- a/dashboards-observability/opensearch_dashboards.json +++ b/dashboards-observability/opensearch_dashboards.json @@ -1,7 +1,7 @@ { "id": "observabilityDashboards", - "version": "2.1.0.0", - "opensearchDashboardsVersion": "2.1.0", + "version": "2.2.0.0", + "opensearchDashboardsVersion": "2.2.0", "server": true, "ui": true, "requiredPlugins": [ diff --git a/dashboards-observability/package.json b/dashboards-observability/package.json index d068e60c4..2bae5dc13 100644 --- a/dashboards-observability/package.json +++ b/dashboards-observability/package.json @@ -1,6 +1,6 @@ { "name": "observability-dashboards", - "version": "2.1.0.0", + "version": "2.2.0.0", "main": "index.ts", "license": "Apache-2.0", "scripts": { diff --git a/dashboards-observability/public/components/custom_panels/helpers/__tests__/__snapshots__/utils.test.tsx.snap b/dashboards-observability/public/components/custom_panels/helpers/__tests__/__snapshots__/utils.test.tsx.snap index 0a003aefa..ad5343037 100644 --- a/dashboards-observability/public/components/custom_panels/helpers/__tests__/__snapshots__/utils.test.tsx.snap +++ b/dashboards-observability/public/components/custom_panels/helpers/__tests__/__snapshots__/utils.test.tsx.snap @@ -2433,12 +2433,132 @@ exports[`Utils helper functions renders displayVisualization function 2`] = ` "id": "lines", "name": "Lines", }, + Object { + "id": "markers", + "name": "Marker", + }, + Object { + "id": "lines+markers", + "name": "Lines + Markers", + }, + ], + }, + }, + Object { + "component": [Function], + "eleType": "buttons", + "mapTo": "interpolation", + "name": "Interpolation", + "props": Object { + "defaultSelections": Array [ + Object { + "id": "spline", + "name": "Smooth", + }, + ], + "options": Array [ + Object { + "id": "linear", + "name": "Linear", + }, + Object { + "id": "spline", + "name": "Smooth", + }, + Object { + "id": "hv", + "name": "Step before", + }, + Object { + "id": "vh", + "name": "Step after", + }, + ], + }, + }, + Object { + "component": [Function], + "defaultState": 2, + "eleType": "slider", + "mapTo": "lineWidth", + "name": "Line width", + "props": Object { + "max": 10, + }, + }, + Object { + "component": [Function], + "defaultState": 40, + "eleType": "slider", + "mapTo": "fillOpacity", + "name": "Fill opacity", + "props": Object { + "max": 100, + }, + }, + Object { + "component": [Function], + "defaultState": 5, + "eleType": "slider", + "mapTo": "pointSize", + "name": "Point size", + "props": Object { + "max": 40, + }, + }, + Object { + "component": [Function], + "eleType": "input", + "mapTo": "labelSize", + "name": "Label size", + "title": "Label size", + }, + Object { + "component": [Function], + "defaultState": 0, + "eleType": "slider", + "mapTo": "rotateLabels", + "name": "Rotate labels", +======= + }, + Object { + "component": null, + "mapTo": "position", + "name": "Position", + "props": Object { + "defaultSelections": Array [ + Object { + "id": "v", + "name": "Right", + }, + ], + "options": Array [ + Object { + "id": "v", + "name": "Right", + }, + Object { + "id": "h", + "name": "Bottom", + }, + ], + }, + }, + Object { + "component": [Function], + "eleType": "input", + "mapTo": "legendSize", + "name": "Legend Size", + "title": "Legend Size", + }, ], "options": Array [ Object { "id": "lines", "name": "Lines", }, + ], + "options": Array [ Object { "id": "markers", "name": "Marker", @@ -2446,6 +2566,110 @@ exports[`Utils helper functions renders displayVisualization function 2`] = ` Object { "id": "lines+markers", "name": "Lines + Markers", +>>>>>>> 5a182978b1731b84de6af34643f38b4114cf2a45 + }, + ], + }, + }, + Object { + "component": [Function], + "eleType": "buttons", + "mapTo": "interpolation", + "name": "Interpolation", + "props": Object { + "defaultSelections": Array [ + Object { + "id": "spline", + "name": "Smooth", + }, + ], + "options": Array [ + Object { + "id": "linear", + "name": "Linear", + }, + Object { + "id": "spline", + "name": "Smooth", + }, + Object { + "id": "hv", + "name": "Step before", + }, + Object { + "id": "vh", + "name": "Step after", + }, + ], + }, + }, + Object { + "component": [Function], + "defaultState": 2, + "eleType": "slider", + "mapTo": "lineWidth", + "name": "Line width", + "props": Object { + "max": 10, + }, + }, + Object { + "component": [Function], + "defaultState": 40, + "eleType": "slider", + "mapTo": "fillOpacity", + "name": "Fill Opacity", + "props": Object { + "max": 100, + }, + }, + Object { + "component": [Function], + "defaultState": 5, + "eleType": "slider", + "mapTo": "pointSize", + "name": "Point Size", + "props": Object { + "max": 40, + }, + }, + Object { + "component": [Function], + "eleType": "input", + "mapTo": "labelSize", + "name": "Label Size", + "title": "Label Size", + }, + Object { + "component": [Function], + "defaultState": 0, + "eleType": "slider", + "mapTo": "rotateLabels", + "name": "Rotate labels", + "props": Object { + "max": 90, + "min": -90, + "showTicks": true, + "ticks": Array [ + Object { + "label": "-90°", + "value": -90, + }, + Object { + "label": "-45°", + "value": -45, + }, + Object { + "label": "0°", + "value": 0, + }, + Object { + "label": "45°", + "value": 45, + }, + Object { + "label": "90°", + "value": 90, }, ], }, @@ -2562,6 +2786,13 @@ exports[`Utils helper functions renders displayVisualization function 2`] = ` "name": "Color theme", "schemas": Array [], }, + Object { + "editor": [Function], + "id": "color-theme", + "mapTo": "colorTheme", + "name": "Color theme", + "schemas": Array [], + }, Object { "defaultState": Array [], "editor": [Function], diff --git a/dashboards-observability/public/components/custom_panels/panel_modules/visualization_flyout/__tests__/__snapshots__/visualization_flyout.test.tsx.snap b/dashboards-observability/public/components/custom_panels/panel_modules/visualization_flyout/__tests__/__snapshots__/visualization_flyout.test.tsx.snap index 9dda6a3ab..3c4bda7a0 100644 --- a/dashboards-observability/public/components/custom_panels/panel_modules/visualization_flyout/__tests__/__snapshots__/visualization_flyout.test.tsx.snap +++ b/dashboards-observability/public/components/custom_panels/panel_modules/visualization_flyout/__tests__/__snapshots__/visualization_flyout.test.tsx.snap @@ -92,7 +92,7 @@ exports[`Visualization Flyout Component renders add visualization Flyout 1`] = ` ownFocus={false} size="m" > - @@ -1319,7 +1319,7 @@ exports[`Visualization Flyout Component renders replace visualization Flyout 1`] ownFocus={false} size="m" > - diff --git a/dashboards-observability/public/components/event_analytics/explorer/visualizations/config_panel/__tests__/__snapshots__/config_panel.test.tsx.snap b/dashboards-observability/public/components/event_analytics/explorer/visualizations/config_panel/__tests__/__snapshots__/config_panel.test.tsx.snap index 55a5c4d51..26317c44e 100644 --- a/dashboards-observability/public/components/event_analytics/explorer/visualizations/config_panel/__tests__/__snapshots__/config_panel.test.tsx.snap +++ b/dashboards-observability/public/components/event_analytics/explorer/visualizations/config_panel/__tests__/__snapshots__/config_panel.test.tsx.snap @@ -1850,6 +1850,30 @@ exports[`Config panel component Renders config panel with visualization data 1`] ], }, }, + Object { + "component": [Function], + "eleType": "buttons", + "mapTo": "sort_sectors", + "name": "Sort Sectors", + "props": Object { + "defaultSelections": Array [ + Object { + "id": undefined, + "name": "Largest to Smallest", + }, + ], + "options": Array [ + Object { + "id": "largest_to_smallest", + "name": "Largest to Smallest", + }, + Object { + "id": "random", + "name": "Random", + }, + ], + }, + }, ], }, Object { diff --git a/dashboards-observability/public/components/event_analytics/explorer/visualizations/config_panel/config_panes/config_controls/data_config_panel_item.tsx b/dashboards-observability/public/components/event_analytics/explorer/visualizations/config_panel/config_panes/config_controls/data_config_panel_item.tsx index 8cfbeccae..838df9287 100644 --- a/dashboards-observability/public/components/event_analytics/explorer/visualizations/config_panel/config_panes/config_controls/data_config_panel_item.tsx +++ b/dashboards-observability/public/components/event_analytics/explorer/visualizations/config_panel/config_panes/config_controls/data_config_panel_item.tsx @@ -156,7 +156,7 @@ export const DataConfigPanelItem = ({ fieldOptionList, visualizations }: any) => setConfigList(updatedList); }; - const updateChart = () => { + const updateChart = (updatedConfigList = configList) => { dispatch( renderExplorerVis({ tabId, @@ -347,8 +347,9 @@ export const DataConfigPanelItem = ({ fieldOptionList, visualizations }: any) => updateChart()} size="s" + disabled > Update chart diff --git a/dashboards-observability/public/components/trace_analytics/components/traces/__tests__/__snapshots__/span_detail_flyout.test.tsx.snap b/dashboards-observability/public/components/trace_analytics/components/traces/__tests__/__snapshots__/span_detail_flyout.test.tsx.snap index e3c372ee1..cb4564c2e 100644 --- a/dashboards-observability/public/components/trace_analytics/components/traces/__tests__/__snapshots__/span_detail_flyout.test.tsx.snap +++ b/dashboards-observability/public/components/trace_analytics/components/traces/__tests__/__snapshots__/span_detail_flyout.test.tsx.snap @@ -15,7 +15,7 @@ exports[` spec renders the empty component 1`] = ` onClose={[MockFunction]} size="s" > - diff --git a/dashboards-observability/public/components/visualizations/charts/__tests__/__snapshots__/heatmap.test.tsx.snap b/dashboards-observability/public/components/visualizations/charts/__tests__/__snapshots__/heatmap.test.tsx.snap index cf25ddc8c..bacc09c3f 100644 --- a/dashboards-observability/public/components/visualizations/charts/__tests__/__snapshots__/heatmap.test.tsx.snap +++ b/dashboards-observability/public/components/visualizations/charts/__tests__/__snapshots__/heatmap.test.tsx.snap @@ -504,7 +504,7 @@ exports[`Heatmap component Renders heatmap component 1`] = ` > { - const { DefaultModeLine, Interpolation, LineWidth, FillOpacity, MarkerSize, LegendPosition, ShowLegend, DefaultModeScatter, LabelAngle } = DefaultChartStyles; + const { + DefaultModeLine, + Interpolation, + LineWidth, + FillOpacity, + MarkerSize, + LegendPosition, + ShowLegend, + DefaultModeScatter, + LabelAngle, + } = DefaultChartStyles; const { data = {}, metadata: { fields }, @@ -26,13 +41,19 @@ export const Line = ({ visualizations, layout, config }: any) => { } = visualizations?.data?.userConfigs; let visType: string = visualizations.vis.name; - const dataConfigTab = visualizations.data?.rawVizData?.[visType]?.dataConfig && visualizations.data.rawVizData[visType].dataConfig; - const xaxis = dataConfigTab?.dimensions ? dataConfigTab?.dimensions.filter((item) => item.label) : []; + const dataConfigTab = + visualizations.data?.rawVizData?.[visType]?.dataConfig && + visualizations.data.rawVizData[visType].dataConfig; + const xaxis = dataConfigTab?.dimensions + ? dataConfigTab?.dimensions.filter((item) => item.label) + : []; const yaxis = dataConfigTab?.metrics ? dataConfigTab?.metrics.filter((item) => item.label) : []; const lastIndex = fields.length - 1; - const mode = dataConfig?.chartStyles?.style || (visType === visChartTypes.Line ? DefaultModeLine : DefaultModeScatter); + const mode = + dataConfig?.chartStyles?.style || + (visType === visChartTypes.Line ? DefaultModeLine : DefaultModeScatter); const lineShape = dataConfig?.chartStyles?.interpolation || Interpolation; const lineWidth = dataConfig?.chartStyles?.lineWidth || LineWidth; const showLegend = !( @@ -61,8 +82,9 @@ export const Line = ({ visualizations, layout, config }: any) => { if (!isEmpty(xaxis) && !isEmpty(yaxis)) { valueSeries = [...yaxis]; } else { - valueSeries = (defaultAxes.yaxis || take(fields, lastIndex > 0 ? lastIndex : 1)) - .map((item, i) => ({ ...item, side: i === 0 ? 'left' : 'right' })); + valueSeries = ( + defaultAxes.yaxis || take(fields, lastIndex > 0 ? lastIndex : 1) + ).map((item, i) => ({ ...item, side: i === 0 ? 'left' : 'right' })); } const isDimensionTimestamp = isEmpty(xaxis) @@ -197,10 +219,13 @@ export const Line = ({ visualizations, layout, config }: any) => { return [mergedLayout, calculatedLineValues]; }, [data, fields, lastIndex, layout, layoutConfig, xaxis, yaxis, mode, valueSeries]); - const mergedConfigs = useMemo(() => ({ - ...config, - ...(layoutConfig.config && layoutConfig.config), - }), [config, layoutConfig.config]); + const mergedConfigs = useMemo( + () => ({ + ...config, + ...(layoutConfig.config && layoutConfig.config), + }), + [config, layoutConfig.config] + ); return isDimensionTimestamp ? ( diff --git a/dashboards-observability/public/components/visualizations/charts/lines/line_type.ts b/dashboards-observability/public/components/visualizations/charts/lines/line_type.ts index ca0e3819f..ec612c2c1 100644 --- a/dashboards-observability/public/components/visualizations/charts/lines/line_type.ts +++ b/dashboards-observability/public/components/visualizations/charts/lines/line_type.ts @@ -21,7 +21,16 @@ import { ButtonGroupItem } from '../../../../../public/components/event_analytic import { SliderConfig } from '../../../../../public/components/event_analytics/explorer/visualizations/config_panel/config_panes/config_controls/config_style_slider'; const sharedConfigs = getPlotlySharedConfigs(); const VIS_CATEGORY = getPlotlyCategory(); -const { DefaultModeLine, Interpolation, LineWidth, FillOpacity, MarkerSize, LegendPosition, ShowLegend, DefaultModeScatter, LabelAngle } = DefaultChartStyles; +const { + DefaultMode, + Interpolation, + LineWidth, + FillOpacity, + MarkerSize, + LegendPosition, + ShowLegend, + LabelAngle +} = DefaultChartStyles; export const createLineTypeDefinition = (params: any = {}) => ({ name: params.type, diff --git a/opensearch-observability/build.gradle b/opensearch-observability/build.gradle index 944f05ba8..4152a9054 100644 --- a/opensearch-observability/build.gradle +++ b/opensearch-observability/build.gradle @@ -10,7 +10,7 @@ import org.opensearch.gradle.testclusters.StandaloneRestIntegTestTask buildscript { ext { isSnapshot = "true" == System.getProperty("build.snapshot", "true") - opensearch_version = System.getProperty("opensearch.version", "2.1.0-SNAPSHOT") + opensearch_version = System.getProperty("opensearch.version", "2.2.0-SNAPSHOT") buildVersionQualifier = System.getProperty("build.version_qualifier", "") version_tokens = opensearch_version.tokenize('-') opensearch_build = version_tokens[0] + '.0' @@ -115,6 +115,7 @@ configurations.all { force "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}" force "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}" force "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.11.4" + force "org.mockito:mockito-core:4.6.1" } }