From 0762566ec143fe9a8c1d2b61d4d4c33d64f825d3 Mon Sep 17 00:00:00 2001 From: Miki Date: Mon, 17 Apr 2023 15:23:52 -0700 Subject: [PATCH 01/38] Omit adding the `osd-version` header when the Fetch request is to an external origin (#3643) * Making `fetch` requests using core/public/http/fetch, an `osd-version` header is forcefully added, even to external requests. This change examines the destination and only adds the header to relative URLs and those that are to OSD itself. * This change also adds `osd-xsrf` to calls that use `osd-version` incorrectly to satisfy XSRF protection Fixes #3277 Signed-off-by: Miki --- CHANGELOG.md | 2 ++ src/core/public/http/fetch.ts | 14 +++++++++++++- .../__snapshots__/ui_settings_api.test.ts.snap | 7 +++++++ .../integration_tests/lifecycle_handlers.test.ts | 5 ++++- src/core/server/http/lifecycle_handlers.test.ts | 9 +++++---- src/core/server/http/lifecycle_handlers.ts | 3 ++- src/plugins/bfetch/public/plugin.ts | 1 + .../public/angular/angular_config.tsx | 4 ++++ 8 files changed, 38 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad516b6c049..c29de254733 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Vis Builder] Add metric to metric, bucket to bucket aggregation persistence ([#3495](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3495)) - Use mirrors to download Node.js binaries to escape sporadic 404 errors ([#3619](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3619)) - [Multiple DataSource] Refactor dev tool console to use opensearch-js client to send requests ([#3544](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3544)) +- Add `osd-xsrf` header to all requests that incorrectly used `node-version` to satisfy XSRF protection ([#3643](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3643)) - [Data] Add geo shape filter field ([#3605](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3605)) - [VisBuilder] Add UI actions handler ([#3732](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3732)) - [Dashboard] Indicate that IE is no longer supported ([#3641](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3641)) @@ -117,6 +118,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Region Maps] Add ui setting to configure custom vector map's size parameter([#3399](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3399)) - [Search Telemetry] Fixes search telemetry's observable object that won't be GC-ed([#3390](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3390)) - Clean up and rebuild `@osd/pm` ([#3570](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3570)) +- Omit adding the `osd-version` header when the Fetch request is to an external origin ([#3643](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3643)) - [Vega] Add Filter custom label for opensearchDashboardsAddFilter ([#3640](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3640)) - [Timeline] Fix y-axis label color in dark mode ([#3698](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3698)) - [VisBuilder] Fix multiple warnings thrown on page load ([#3732](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3732)) diff --git a/src/core/public/http/fetch.ts b/src/core/public/http/fetch.ts index cefaa353f7f..694372c46d9 100644 --- a/src/core/public/http/fetch.ts +++ b/src/core/public/http/fetch.ts @@ -31,6 +31,7 @@ import { omitBy } from 'lodash'; import { format } from 'url'; import { BehaviorSubject } from 'rxjs'; +import { isRelativeUrl } from '@osd/std'; import { IBasePath, @@ -144,7 +145,6 @@ export class Fetch { headers: removedUndefined({ 'Content-Type': 'application/json', ...options.headers, - 'osd-version': this.params.opensearchDashboardsVersion, }), }; @@ -158,6 +158,18 @@ export class Fetch { fetchOptions.headers['osd-system-request'] = 'true'; } + /* `osd-version` is used on the server-side to make sure that an incoming request originated from a front-end + * of the same version; see core/server/http/lifecycle_handlers.ts + * `osd-xsrf` is to satisfy XSRF protection but is only meaningful to OpenSearch Dashboards. + * + * If the `url` equals `basePath`, starts with `basePath` + '/', or is relative, add `osd-version` and `osd-xsrf` headers. + */ + const basePath = this.params.basePath.get(); + if (isRelativeUrl(url) || url === basePath || url.startsWith(`${basePath}/`)) { + fetchOptions.headers['osd-version'] = this.params.opensearchDashboardsVersion; + fetchOptions.headers['osd-xsrf'] = 'osd-fetch'; + } + return new Request(url, fetchOptions as RequestInit); } diff --git a/src/core/public/ui_settings/__snapshots__/ui_settings_api.test.ts.snap b/src/core/public/ui_settings/__snapshots__/ui_settings_api.test.ts.snap index f80d88dd91f..52d04f52ff8 100644 --- a/src/core/public/ui_settings/__snapshots__/ui_settings_api.test.ts.snap +++ b/src/core/public/ui_settings/__snapshots__/ui_settings_api.test.ts.snap @@ -9,6 +9,7 @@ Array [ "accept": "application/json", "content-type": "application/json", "osd-version": "opensearchDashboardsVersion", + "osd-xsrf": "osd-fetch", }, "method": "POST", }, @@ -20,6 +21,7 @@ Array [ "accept": "application/json", "content-type": "application/json", "osd-version": "opensearchDashboardsVersion", + "osd-xsrf": "osd-fetch", }, "method": "POST", }, @@ -36,6 +38,7 @@ Array [ "accept": "application/json", "content-type": "application/json", "osd-version": "opensearchDashboardsVersion", + "osd-xsrf": "osd-fetch", }, "method": "POST", }, @@ -47,6 +50,7 @@ Array [ "accept": "application/json", "content-type": "application/json", "osd-version": "opensearchDashboardsVersion", + "osd-xsrf": "osd-fetch", }, "method": "POST", }, @@ -63,6 +67,7 @@ Array [ "accept": "application/json", "content-type": "application/json", "osd-version": "opensearchDashboardsVersion", + "osd-xsrf": "osd-fetch", }, "method": "POST", }, @@ -74,6 +79,7 @@ Array [ "accept": "application/json", "content-type": "application/json", "osd-version": "opensearchDashboardsVersion", + "osd-xsrf": "osd-fetch", }, "method": "POST", }, @@ -113,6 +119,7 @@ Array [ "accept": "application/json", "content-type": "application/json", "osd-version": "opensearchDashboardsVersion", + "osd-xsrf": "osd-fetch", }, "method": "POST", }, diff --git a/src/core/server/http/integration_tests/lifecycle_handlers.test.ts b/src/core/server/http/integration_tests/lifecycle_handlers.test.ts index fc13c1ae3fb..0742e8c08d6 100644 --- a/src/core/server/http/integration_tests/lifecycle_handlers.test.ts +++ b/src/core/server/http/integration_tests/lifecycle_handlers.test.ts @@ -231,20 +231,23 @@ describe('core lifecycle handlers', () => { .expect(200, 'ok'); }); + // ToDo: Remove next; `osd-version` incorrectly used for satisfying XSRF protection it('accepts requests with the version header', async () => { await getSupertest(method.toLowerCase(), testPath) .set(versionHeader, actualVersion) .expect(200, 'ok'); }); + // ToDo: Rename next; `osd-version` incorrectly used for satisfying XSRF protection it('rejects requests without either an xsrf or version header', async () => { await getSupertest(method.toLowerCase(), testPath).expect(400, { statusCode: 400, error: 'Bad Request', - message: 'Request must contain a osd-xsrf header.', + message: 'Request must contain the osd-xsrf header.', }); }); + // ToDo: Rename next; `osd-version` incorrectly used for satisfying XSRF protection it('accepts whitelisted requests without either an xsrf or version header', async () => { await getSupertest(method.toLowerCase(), whitelistedTestPath).expect(200, 'ok'); }); diff --git a/src/core/server/http/lifecycle_handlers.test.ts b/src/core/server/http/lifecycle_handlers.test.ts index 6a49bbfa14f..cd96f0ea776 100644 --- a/src/core/server/http/lifecycle_handlers.test.ts +++ b/src/core/server/http/lifecycle_handlers.test.ts @@ -102,6 +102,7 @@ describe('xsrf post-auth handler', () => { expect(result).toEqual('next'); }); + // ToDo: Remove; `osd-version` incorrectly used for satisfying XSRF protection it('accepts requests with version header', () => { const config = createConfig({ xsrf: { whitelist: [], disableProtection: false } }); const handler = createXsrfPostAuthHandler(config); @@ -129,7 +130,7 @@ describe('xsrf post-auth handler', () => { expect(responseFactory.badRequest).toHaveBeenCalledTimes(1); expect(responseFactory.badRequest.mock.calls[0][0]).toMatchInlineSnapshot(` Object { - "body": "Request must contain a osd-xsrf header.", + "body": "Request must contain the osd-xsrf header.", } `); expect(result).toEqual('badRequest'); @@ -199,7 +200,7 @@ describe('versionCheck post-auth handler', () => { responseFactory = httpServerMock.createLifecycleResponseFactory(); }); - it('forward the request to the next interceptor if header matches', () => { + it('forward the request to the next interceptor if osd-version header matches the actual version', () => { const handler = createVersionCheckPostAuthHandler('actual-version'); const request = forgeRequest({ headers: { 'osd-version': 'actual-version' } }); @@ -212,7 +213,7 @@ describe('versionCheck post-auth handler', () => { expect(result).toBe('next'); }); - it('returns a badRequest error if header does not match', () => { + it('returns a badRequest error if osd-version header exists but does not match the actual version', () => { const handler = createVersionCheckPostAuthHandler('actual-version'); const request = forgeRequest({ headers: { 'osd-version': 'another-version' } }); @@ -236,7 +237,7 @@ describe('versionCheck post-auth handler', () => { expect(result).toBe('badRequest'); }); - it('forward the request to the next interceptor if header is not present', () => { + it('forward the request to the next interceptor if osd-version header is not present', () => { const handler = createVersionCheckPostAuthHandler('actual-version'); const request = forgeRequest({ headers: {} }); diff --git a/src/core/server/http/lifecycle_handlers.ts b/src/core/server/http/lifecycle_handlers.ts index 636bb8af452..f17b07942e6 100644 --- a/src/core/server/http/lifecycle_handlers.ts +++ b/src/core/server/http/lifecycle_handlers.ts @@ -54,8 +54,9 @@ export const createXsrfPostAuthHandler = (config: HttpConfig): OnPostAuthHandler const hasVersionHeader = VERSION_HEADER in request.headers; const hasXsrfHeader = XSRF_HEADER in request.headers; + // ToDo: Remove !hasVersionHeader; `osd-version` incorrectly used for satisfying XSRF protection if (!isSafeMethod(request.route.method) && !hasVersionHeader && !hasXsrfHeader) { - return response.badRequest({ body: `Request must contain a ${XSRF_HEADER} header.` }); + return response.badRequest({ body: `Request must contain the ${XSRF_HEADER} header.` }); } return toolkit.next(); diff --git a/src/plugins/bfetch/public/plugin.ts b/src/plugins/bfetch/public/plugin.ts index 1a3a0bffc82..e115b35a44e 100644 --- a/src/plugins/bfetch/public/plugin.ts +++ b/src/plugins/bfetch/public/plugin.ts @@ -95,6 +95,7 @@ export class BfetchPublicPlugin url: `${basePath}/${removeLeadingSlash(params.url)}`, headers: { 'Content-Type': 'application/json', + 'osd-xsrf': 'osd-bfetch', 'osd-version': version, ...(params.headers || {}), }, diff --git a/src/plugins/opensearch_dashboards_legacy/public/angular/angular_config.tsx b/src/plugins/opensearch_dashboards_legacy/public/angular/angular_config.tsx index ef01d29e4b1..fbe36a289d7 100644 --- a/src/plugins/opensearch_dashboards_legacy/public/angular/angular_config.tsx +++ b/src/plugins/opensearch_dashboards_legacy/public/angular/angular_config.tsx @@ -159,6 +159,8 @@ export const $setupXsrfRequestInterceptor = (version: string) => { // Configure jQuery prefilter $.ajaxPrefilter(({ osdXsrfToken = true }: any, originalOptions, jqXHR) => { if (osdXsrfToken) { + jqXHR.setRequestHeader('osd-xsrf', 'osd-legacy'); + // ToDo: Remove next; `osd-version` incorrectly used for satisfying XSRF protection jqXHR.setRequestHeader('osd-version', version); } }); @@ -170,6 +172,8 @@ export const $setupXsrfRequestInterceptor = (version: string) => { request(opts) { const { osdXsrfToken = true } = opts as any; if (osdXsrfToken) { + set(opts, ['headers', 'osd-xsrf'], 'osd-legacy'); + // ToDo: Remove next; `osd-version` incorrectly used for satisfying XSRF protection set(opts, ['headers', 'osd-version'], version); } return opts; From fc195ea580844dea47e21c4854ac7767f2513531 Mon Sep 17 00:00:00 2001 From: Anan Zhuang Date: Mon, 17 Apr 2023 15:54:52 -0700 Subject: [PATCH 02/38] [Table Vis] move format table, consolidate types and add unit tests (#3397) Currently, table data is formatted by a until function convertToFormattedData in TableVisComponent. In this PR, we moved the formatting data process to table_vis_response_handler.ts to combine with other data process logics. In this way, component render and data handling logics are completely isolated. This PR also solidate some types. Issue Resolved: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3395 https://github.com/opensearch-project/OpenSearch-Dashboards/issues/2856 Signed-off-by: Anan Zhuang --- CHANGELOG.md | 1 + .../public/components/table_vis_app.scss | 16 +- .../public/components/table_vis_app.test.tsx | 98 ++++++++ .../public/components/table_vis_app.tsx | 17 +- .../public/components/table_vis_cell.test.tsx | 65 +++++ .../public/components/table_vis_cell.tsx | 38 +++ .../components/table_vis_component.test.tsx | 234 ++++++++++++++++++ .../public/components/table_vis_component.tsx | 117 ++++----- .../table_vis_component_group.test.tsx | 67 +++++ .../components/table_vis_component_group.tsx | 7 +- .../components/table_vis_grid_columns.tsx | 21 +- .../vis_type_table/public/table_vis_fn.ts | 4 +- .../public/table_vis_renderer.test.tsx | 78 ++++++ .../public/table_vis_response_handler.test.ts | 157 ++++++++++++ .../public/table_vis_response_handler.ts | 60 ++--- src/plugins/vis_type_table/public/types.ts | 7 - .../add_percentage_col.test.ts.snap | 170 +++++++++++++ .../public/utils/add_percentage_col.test.ts | 76 ++++++ .../public/utils/add_percentage_col.ts | 76 ++++++ .../public/utils/convert_to_csv_data.test.ts | 76 ++++++ .../public/utils/convert_to_csv_data.ts | 2 +- .../utils/convert_to_formatted_data.test.ts | 136 ++++++++++ .../public/utils/convert_to_formatted_data.ts | 69 ++---- .../public/utils/get_table_ui_state.test.ts | 66 +++++ .../public/utils/get_table_ui_state.ts | 40 +++ .../vis_type_table/public/utils/index.ts | 2 + .../public/utils/use_pagination.test.ts | 101 ++++++++ .../public/utils/use_pagination.ts | 23 +- 28 files changed, 1627 insertions(+), 197 deletions(-) create mode 100644 src/plugins/vis_type_table/public/components/table_vis_app.test.tsx create mode 100644 src/plugins/vis_type_table/public/components/table_vis_cell.test.tsx create mode 100644 src/plugins/vis_type_table/public/components/table_vis_cell.tsx create mode 100644 src/plugins/vis_type_table/public/components/table_vis_component.test.tsx create mode 100644 src/plugins/vis_type_table/public/components/table_vis_component_group.test.tsx create mode 100644 src/plugins/vis_type_table/public/table_vis_renderer.test.tsx create mode 100644 src/plugins/vis_type_table/public/table_vis_response_handler.test.ts create mode 100644 src/plugins/vis_type_table/public/utils/__snapshots__/add_percentage_col.test.ts.snap create mode 100644 src/plugins/vis_type_table/public/utils/add_percentage_col.test.ts create mode 100644 src/plugins/vis_type_table/public/utils/add_percentage_col.ts create mode 100644 src/plugins/vis_type_table/public/utils/convert_to_csv_data.test.ts create mode 100644 src/plugins/vis_type_table/public/utils/convert_to_formatted_data.test.ts create mode 100644 src/plugins/vis_type_table/public/utils/get_table_ui_state.test.ts create mode 100644 src/plugins/vis_type_table/public/utils/get_table_ui_state.ts create mode 100644 src/plugins/vis_type_table/public/utils/use_pagination.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index c29de254733..001f9248f2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Multiple DataSource] Allow create and distinguish index pattern with same name but from different datasources ([#3571](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3571)) - [Multiple DataSource] Integrate multiple datasource with dev tool console ([#3754](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3754)) - Add satisfaction survey link to help menu ([#3676] (https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3676)) +- [Table Visualization] Move format table, consolidate types and add unit tests ([#3397](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3397)) ### ๐Ÿ› Bug Fixes diff --git a/src/plugins/vis_type_table/public/components/table_vis_app.scss b/src/plugins/vis_type_table/public/components/table_vis_app.scss index 87684766741..aafcd40e738 100644 --- a/src/plugins/vis_type_table/public/components/table_vis_app.scss +++ b/src/plugins/vis_type_table/public/components/table_vis_app.scss @@ -1,21 +1,29 @@ +// Container for the Table Visualization component .visTable { display: flex; flex-direction: column; flex: 1 0 0; overflow: auto; + + @include euiScrollBar; } +// Group container for table visualization components .visTable__group { padding: $euiSizeS; margin-bottom: $euiSizeL; + display: flex; + flex-direction: column; + flex: 0 0 auto; +} - > h3 { - text-align: center; - } +// Style for table component title +.visTable__component__title { + text-align: center; } +// Modifier for visTables__group when displayed in columns .visTable__groupInColumns { - display: flex; flex-direction: row; align-items: flex-start; } diff --git a/src/plugins/vis_type_table/public/components/table_vis_app.test.tsx b/src/plugins/vis_type_table/public/components/table_vis_app.test.tsx new file mode 100644 index 00000000000..37cb753765f --- /dev/null +++ b/src/plugins/vis_type_table/public/components/table_vis_app.test.tsx @@ -0,0 +1,98 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import React from 'react'; +import { render } from '@testing-library/react'; +import { coreMock } from '../../../../core/public/mocks'; +import { IInterpreterRenderHandlers } from 'src/plugins/expressions'; +import { TableVisApp } from './table_vis_app'; +import { TableVisConfig } from '../types'; +import { TableVisData } from '../table_vis_response_handler'; + +jest.mock('./table_vis_component_group', () => ({ + TableVisComponentGroup: () => ( +
TableVisComponentGroup
+ ), +})); + +jest.mock('./table_vis_component', () => ({ + TableVisComponent: () =>
TableVisComponent
, +})); + +describe('TableVisApp', () => { + const serviceMock = coreMock.createStart(); + const handlersMock = ({ + done: jest.fn(), + uiState: { + get: jest.fn((key) => { + switch (key) { + case 'vis.sortColumn': + return {}; + case 'vis.columnsWidth': + return []; + default: + return undefined; + } + }), + set: jest.fn(), + }, + event: 'event', + } as unknown) as IInterpreterRenderHandlers; + const visConfigMock = ({} as unknown) as TableVisConfig; + + it('should render TableVisComponent if no split table', () => { + const visDataMock = { + table: { + columns: [], + rows: [], + formattedColumns: [], + }, + tableGroups: [], + } as TableVisData; + const { getByTestId } = render( + + ); + expect(getByTestId('TableVisComponent')).toBeInTheDocument(); + }); + + it('should render TableVisComponentGroup component if split direction is column', () => { + const visDataMock = { + tableGroups: [], + direction: 'column', + } as TableVisData; + const { container, getByTestId } = render( + + ); + expect(container.outerHTML.includes('visTable visTable__groupInColumns')).toBe(true); + expect(getByTestId('TableVisComponentGroup')).toBeInTheDocument(); + }); + + it('should render TableVisComponentGroup component if split direction is row', () => { + const visDataMock = { + tableGroups: [], + direction: 'row', + } as TableVisData; + const { container, getByTestId } = render( + + ); + expect(container.outerHTML.includes('visTable')).toBe(true); + expect(getByTestId('TableVisComponentGroup')).toBeInTheDocument(); + }); +}); diff --git a/src/plugins/vis_type_table/public/components/table_vis_app.tsx b/src/plugins/vis_type_table/public/components/table_vis_app.tsx index af10500a1a9..81f4d775f1e 100644 --- a/src/plugins/vis_type_table/public/components/table_vis_app.tsx +++ b/src/plugins/vis_type_table/public/components/table_vis_app.tsx @@ -4,20 +4,22 @@ */ import './table_vis_app.scss'; -import React, { useEffect, useState } from 'react'; +import React, { useEffect } from 'react'; import classNames from 'classnames'; import { CoreStart } from 'opensearch-dashboards/public'; import { I18nProvider } from '@osd/i18n/react'; import { IInterpreterRenderHandlers } from 'src/plugins/expressions'; +import { PersistedState } from '../../../visualizations/public'; import { OpenSearchDashboardsContextProvider } from '../../../opensearch_dashboards_react/public'; -import { TableContext } from '../table_vis_response_handler'; -import { TableVisConfig, ColumnSort, ColumnWidth, TableUiState } from '../types'; +import { TableVisData } from '../table_vis_response_handler'; +import { TableVisConfig } from '../types'; import { TableVisComponent } from './table_vis_component'; import { TableVisComponentGroup } from './table_vis_component_group'; +import { getTableUIState, TableUiState } from '../utils'; interface TableVisAppProps { services: CoreStart; - visData: TableContext; + visData: TableVisData; visConfig: TableVisConfig; handlers: IInterpreterRenderHandlers; } @@ -38,12 +40,7 @@ export const TableVisApp = ({ visTable__groupInColumns: direction === 'column', }); - // TODO: remove duplicate sort and width state - // Issue: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/2704#issuecomment-1299380818 - const [sort, setSort] = useState({ colIndex: null, direction: null }); - const [width, setWidth] = useState([]); - - const tableUiState: TableUiState = { sort, setSort, width, setWidth }; + const tableUiState: TableUiState = getTableUIState(handlers.uiState as PersistedState); return ( diff --git a/src/plugins/vis_type_table/public/components/table_vis_cell.test.tsx b/src/plugins/vis_type_table/public/components/table_vis_cell.test.tsx new file mode 100644 index 00000000000..9b1b1c02ac4 --- /dev/null +++ b/src/plugins/vis_type_table/public/components/table_vis_cell.test.tsx @@ -0,0 +1,65 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import React from 'react'; +import { render } from '@testing-library/react'; + +import { OpenSearchDashboardsDatatableRow } from 'src/plugins/expressions'; +import { FormattedColumn } from '../types'; +import { getTableVisCellValue } from './table_vis_cell'; +import { FieldFormat } from 'src/plugins/data/public'; + +class MockFieldFormat extends FieldFormat { + convert = jest.fn(); +} + +describe('getTableVisCellValue', () => { + const mockFormatter = new MockFieldFormat(); + + const columns: FormattedColumn[] = [ + { + id: 'testId', + title: 'Test Column', + formatter: mockFormatter, + filterable: true, + }, + ]; + + const sortedRows: OpenSearchDashboardsDatatableRow[] = [ + { + testId: 'Test Value 1', + }, + { + testId: 'Test Value 2', + }, + ]; + + const TableCell = ({ rowIndex, columnId }: { rowIndex: number; columnId: string }) => { + const getCellValue = getTableVisCellValue(sortedRows, columns); + return getCellValue({ rowIndex, columnId }); + }; + + beforeEach(() => { + mockFormatter.convert.mockClear(); + }); + + test('should render cell value with correct formatting', () => { + mockFormatter.convert.mockReturnValueOnce('Test Value 1'); + const { getByText } = render(); + expect(mockFormatter.convert).toHaveBeenCalledWith('Test Value 1', 'html'); + expect(getByText('Test Value 1')).toBeInTheDocument(); + expect(getByText('Test Value 1').closest('strong')).toBeInTheDocument(); + }); + + test('should return null when rowIndex is out of bounds', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); + + test('should return null when no matching columnId is found', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); +}); diff --git a/src/plugins/vis_type_table/public/components/table_vis_cell.tsx b/src/plugins/vis_type_table/public/components/table_vis_cell.tsx new file mode 100644 index 00000000000..30c0877df70 --- /dev/null +++ b/src/plugins/vis_type_table/public/components/table_vis_cell.tsx @@ -0,0 +1,38 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import React from 'react'; +import dompurify from 'dompurify'; + +import { OpenSearchDashboardsDatatableRow } from 'src/plugins/expressions'; +import { FormattedColumn } from '../types'; + +export const getTableVisCellValue = ( + sortedRows: OpenSearchDashboardsDatatableRow[], + columns: FormattedColumn[] +) => ({ rowIndex, columnId }: { rowIndex: number; columnId: string }) => { + if (rowIndex < 0 || rowIndex >= sortedRows.length) { + return null; + } + const row = sortedRows[rowIndex]; + if (!row || !row.hasOwnProperty(columnId)) { + return null; + } + const rawContent = row[columnId]; + const colIndex = columns.findIndex((col) => col.id === columnId); + const htmlContent = columns[colIndex].formatter.convert(rawContent, 'html'); + const formattedContent = ( + /* + * Justification for dangerouslySetInnerHTML: + * This is one of the visualizations which makes use of the HTML field formatters. + * Since these formatters produce raw HTML, this visualization needs to be able to render them as-is, relying + * on the field formatter to only produce safe HTML. + * `htmlContent` is created by converting raw data via HTML field formatter, so we need to make sure this value never contains + * any unsafe HTML (e.g. by bypassing the field formatter). + */ +
// eslint-disable-line react/no-danger + ); + return formattedContent || null; +}; diff --git a/src/plugins/vis_type_table/public/components/table_vis_component.test.tsx b/src/plugins/vis_type_table/public/components/table_vis_component.test.tsx new file mode 100644 index 00000000000..6e2d0090aa3 --- /dev/null +++ b/src/plugins/vis_type_table/public/components/table_vis_component.test.tsx @@ -0,0 +1,234 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import React from 'react'; +import { shallow } from 'enzyme'; +import { TableVisConfig, ColumnSort } from '../types'; +import { TableVisComponent } from './table_vis_component'; +import { FormattedColumn } from '../types'; +import { FormattedTableContext } from '../table_vis_response_handler'; +import { getTableVisCellValue } from './table_vis_cell'; +import { getDataGridColumns } from './table_vis_grid_columns'; +import { EuiDataGridColumn } from '@elastic/eui'; + +jest.mock('./table_vis_cell', () => ({ + getTableVisCellValue: jest.fn(() => () => {}), +})); + +const mockGetDataGridColumns = jest.fn(() => []); +jest.mock('./table_vis_grid_columns', () => ({ + getDataGridColumns: jest.fn(() => mockGetDataGridColumns()), +})); + +const table = { + formattedColumns: [ + { + id: 'col-0-2', + title: 'name.keyword: Descending', + formatter: {}, + filterable: true, + }, + { + id: 'col-1-1', + title: 'Count', + formatter: {}, + filterable: false, + sumTotal: 5, + formattedTotal: 5, + total: 5, + }, + ] as FormattedColumn[], + rows: [ + { 'col-0-2': 'Alice', 'col-1-1': 3 }, + { 'col-0-2': 'Anthony', 'col-1-1': 1 }, + { 'col-0-2': 'Timmy', 'col-1-1': 1 }, + ], + columns: [ + { id: 'col-0-2', name: 'Name' }, + { id: 'col-1-1', name: 'Count' }, + ], +} as FormattedTableContext; + +const visConfig = { + buckets: [ + { + accessor: 0, + aggType: 'terms', + format: { + id: 'terms', + params: { + id: 'number', + missingBucketLabel: 'Missing', + otherBucketLabel: 'Other', + parsedUrl: { + basePath: '/arf', + origin: '', + pathname: '/arf/app/home', + }, + }, + }, + label: 'age: Descending', + params: {}, + }, + ], + metrics: [ + { + accessor: 1, + aggType: 'count', + format: { + id: 'number', + }, + label: 'Count', + params: {}, + }, + ], + perPage: 10, + percentageCol: '', + showMetricsAtAllLevels: false, + showPartialRows: false, + showTotal: false, + title: '', + totalFunc: 'sum', +} as TableVisConfig; + +const uiState = { + sort: {} as ColumnSort, + setSort: jest.fn(), + colWidth: [], + setWidth: jest.fn(), +}; + +describe('TableVisComponent', function () { + const props = { + title: '', + table, + visConfig, + event: jest.fn(), + uiState, + }; + + const dataGridColumnsValue = [ + { + id: 'col-0-2', + display: 'name.keyword: Descending', + displayAsText: 'name.keyword: Descending', + actions: { + showHide: false, + showMoveLeft: false, + showMoveRight: false, + showSortAsc: {}, + showSortDesc: {}, + }, + cellActions: expect.any(Function), + }, + { + id: 'col-1-1', + display: 'Count', + displayAsText: 'Count', + actions: { + showHide: false, + showMoveLeft: false, + showMoveRight: false, + showSortAsc: {}, + showSortDesc: {}, + }, + cellActions: undefined, + }, + ] as EuiDataGridColumn[]; + + it('should render data grid', () => { + const comp = shallow(); + expect(comp.find('EuiDataGrid')).toHaveLength(1); + }); + + it('should render title when provided', () => { + const compWithTitle = shallow(); + const titleElement = compWithTitle.find('EuiTitle'); + expect(titleElement).toHaveLength(1); + expect(titleElement.find('h3').text()).toEqual('Test Title'); + }); + + it('should not render title when not provided', () => { + const compWithoutTitle = shallow(); + const titleElement = compWithoutTitle.find('EuiTitle'); + expect(titleElement).toHaveLength(0); + }); + + it('should set sort if sort column', () => { + mockGetDataGridColumns.mockReturnValueOnce(dataGridColumnsValue); + const comp = shallow(); + const { onSort } = comp.find('EuiDataGrid').prop('sorting') as any; + onSort([]); + expect(props.uiState.setSort).toHaveBeenCalledWith([]); + onSort([{ id: 'col-0-2', direction: 'asc' }]); + expect(props.uiState.setSort).toHaveBeenCalledWith({ colIndex: 0, direction: 'asc' }); + onSort([ + { id: 'col-0-2', direction: 'asc' }, + { id: 'col-1-1', direction: 'desc' }, + ]); + expect(props.uiState.setSort).toHaveBeenCalledWith({ colIndex: 1, direction: 'desc' }); + }); + + it('should set width if adjust column width', () => { + const uiStateProps = { + ...props.uiState, + width: [ + { colIndex: 0, width: 12 }, + { colIndex: 1, width: 8 }, + ], + }; + const comp = shallow(); + const onColumnResize = comp.find('EuiDataGrid').prop('onColumnResize') as any; + onColumnResize({ columnId: 'col-0-2', width: 18 }); + expect(props.uiState.setWidth).toHaveBeenCalledWith({ colIndex: 0, width: 18 }); + const updatedComp = shallow(); + const onColumnResizeUpdate = updatedComp.find('EuiDataGrid').prop('onColumnResize') as any; + onColumnResizeUpdate({ columnId: 'col-0-2', width: 18 }); + expect(props.uiState.setWidth).toHaveBeenCalledWith({ colIndex: 0, width: 18 }); + }); + + it('should create sortedRows and pass to getTableVisCellValue', () => { + const uiStateProps = { + ...props.uiState, + sort: { colIndex: 1, direction: 'asc' } as ColumnSort, + }; + const sortedRows = [ + { 'col-0-2': 'Anthony', 'col-1-1': 1 }, + { 'col-0-2': 'Timmy', 'col-1-1': 1 }, + { 'col-0-2': 'Alice', 'col-1-1': 3 }, + ]; + mockGetDataGridColumns.mockReturnValueOnce(dataGridColumnsValue); + shallow(); + expect(getTableVisCellValue).toHaveBeenCalledWith(sortedRows, table.formattedColumns); + expect(getDataGridColumns).toHaveBeenCalledWith(table, props.event, props.uiState.colWidth); + }); + + it('should return formattedTotal from footerCellValue', () => { + let comp = shallow(); + let renderFooterCellValue = comp.find('EuiDataGrid').prop('renderFooterCellValue') as any; + expect(renderFooterCellValue).toEqual(undefined); + comp = shallow(); + renderFooterCellValue = comp.find('EuiDataGrid').prop('renderFooterCellValue'); + expect(renderFooterCellValue({ columnId: 'col-1-1' })).toEqual(5); + expect(renderFooterCellValue({ columnId: 'col-0-2' })).toEqual(null); + }); + + it('should apply pagination correctly', () => { + const comp = shallow(); + const paginationProps = comp.find('EuiDataGrid').prop('pagination'); + expect(paginationProps).toMatchObject({ + pageIndex: 0, + pageSize: 3, + onChangeItemsPerPage: expect.any(Function), + onChangePage: expect.any(Function), + }); + }); + + it('should not call renderFooterCellValue when showTotal is false', () => { + const comp = shallow(); + const renderFooterCellValue = comp.find('EuiDataGrid').prop('renderFooterCellValue'); + expect(renderFooterCellValue).toBeUndefined(); + }); +}); diff --git a/src/plugins/vis_type_table/public/components/table_vis_component.tsx b/src/plugins/vis_type_table/public/components/table_vis_component.tsx index 4576e3420e2..1b16ec170a8 100644 --- a/src/plugins/vis_type_table/public/components/table_vis_component.tsx +++ b/src/plugins/vis_type_table/public/components/table_vis_component.tsx @@ -5,20 +5,20 @@ import React, { useCallback, useMemo } from 'react'; import { orderBy } from 'lodash'; -import dompurify from 'dompurify'; import { EuiDataGridProps, EuiDataGrid, EuiDataGridSorting, EuiTitle } from '@elastic/eui'; import { IInterpreterRenderHandlers } from 'src/plugins/expressions'; -import { Table } from '../table_vis_response_handler'; -import { TableVisConfig, ColumnWidth, ColumnSort, TableUiState } from '../types'; +import { FormattedTableContext } from '../table_vis_response_handler'; +import { TableVisConfig, ColumnSort } from '../types'; import { getDataGridColumns } from './table_vis_grid_columns'; +import { getTableVisCellValue } from './table_vis_cell'; import { usePagination } from '../utils'; -import { convertToFormattedData } from '../utils/convert_to_formatted_data'; import { TableVisControl } from './table_vis_control'; +import { TableUiState } from '../utils'; interface TableVisComponentProps { title?: string; - table: Table; + table: FormattedTableContext; visConfig: TableVisConfig; event: IInterpreterRenderHandlers['event']; uiState: TableUiState; @@ -29,52 +29,44 @@ export const TableVisComponent = ({ table, visConfig, event, - uiState, + uiState: { sort, setSort, colWidth, setWidth }, }: TableVisComponentProps) => { - const { formattedRows: rows, formattedColumns: columns } = convertToFormattedData( - table, - visConfig - ); + const { rows, formattedColumns } = table; const pagination = usePagination(visConfig, rows.length); const sortedRows = useMemo(() => { - return uiState.sort.colIndex !== null && - columns[uiState.sort.colIndex].id && - uiState.sort.direction - ? orderBy(rows, columns[uiState.sort.colIndex].id, uiState.sort.direction) - : rows; - }, [columns, rows, uiState]); + const sortColumnId = + sort.colIndex !== null && sort.colIndex !== undefined + ? formattedColumns[sort.colIndex]?.id + : undefined; + + if (sortColumnId && sort.direction) { + return orderBy(rows, sortColumnId, sort.direction); + } else { + return rows; + } + }, [formattedColumns, rows, sort]); - const renderCellValue = useMemo(() => { - return (({ rowIndex, columnId }) => { - const rawContent = sortedRows[rowIndex][columnId]; - const colIndex = columns.findIndex((col) => col.id === columnId); - const htmlContent = columns[colIndex].formatter.convert(rawContent, 'html'); - const formattedContent = ( - /* - * Justification for dangerouslySetInnerHTML: - * This is one of the visualizations which makes use of the HTML field formatters. - * Since these formatters produce raw HTML, this visualization needs to be able to render them as-is, relying - * on the field formatter to only produce safe HTML. - * `htmlContent` is created by converting raw data via HTML field formatter, so we need to make sure this value never contains - * any unsafe HTML (e.g. by bypassing the field formatter). - */ -
// eslint-disable-line react/no-danger - ); - return sortedRows.hasOwnProperty(rowIndex) ? formattedContent || null : null; - }) as EuiDataGridProps['renderCellValue']; - }, [sortedRows, columns]); + const renderCellValue = useMemo(() => getTableVisCellValue(sortedRows, formattedColumns), [ + sortedRows, + formattedColumns, + ]); - const dataGridColumns = getDataGridColumns(sortedRows, columns, table, event, uiState.width); + const dataGridColumns = getDataGridColumns(table, event, colWidth); const sortedColumns = useMemo(() => { - return uiState.sort.colIndex !== null && - dataGridColumns[uiState.sort.colIndex].id && - uiState.sort.direction - ? [{ id: dataGridColumns[uiState.sort.colIndex].id, direction: uiState.sort.direction }] - : []; - }, [dataGridColumns, uiState]); + if ( + sort.colIndex !== null && + sort.colIndex !== undefined && + dataGridColumns[sort.colIndex].id && + sort.direction + ) { + return [{ id: dataGridColumns[sort.colIndex].id, direction: sort.direction }]; + } else { + return []; + } + }, [dataGridColumns, sort]); const onSort = useCallback( (sortingCols: EuiDataGridSorting['columns'] | []) => { @@ -85,47 +77,34 @@ export const TableVisComponent = ({ colIndex: dataGridColumns.findIndex((col) => col.id === nextSortValue?.id), direction: nextSortValue.direction, } - : { - colIndex: null, - direction: null, - }; - uiState.setSort(nextSort); + : []; + setSort(nextSort); return nextSort; }, - [dataGridColumns, uiState] + [dataGridColumns, setSort] ); const onColumnResize: EuiDataGridProps['onColumnResize'] = useCallback( - ({ columnId, width }) => { - const curWidth: ColumnWidth[] = uiState.width; - const nextWidth = [...curWidth]; - const nextColIndex = columns.findIndex((col) => col.id === columnId); - const curColIndex = curWidth.findIndex((col) => col.colIndex === nextColIndex); - const nextColWidth = { colIndex: nextColIndex, width }; - - // if updated column index is not found, then add it to nextWidth - // else reset it in nextWidth - if (curColIndex < 0) nextWidth.push(nextColWidth); - else nextWidth[curColIndex] = nextColWidth; - - // update uiState.width - uiState.setWidth(nextWidth); + ({ columnId, width }: { columnId: string; width: number }) => { + const colIndex = formattedColumns.findIndex((col) => col.id === columnId); + // update width in uiState + setWidth({ colIndex, width }); }, - [columns, uiState] + [formattedColumns, setWidth] ); const ariaLabel = title || visConfig.title || 'tableVis'; const footerCellValue = visConfig.showTotal ? ({ columnId }: { columnId: any }) => { - return columns.find((col) => col.id === columnId)?.formattedTotal || null; + return formattedColumns.find((col) => col.id === columnId)?.formattedTotal || null; } : undefined; return ( <> {title && ( - +

{title}

)} @@ -133,7 +112,7 @@ export const TableVisComponent = ({ aria-label={ariaLabel} columns={dataGridColumns} columnVisibility={{ - visibleColumns: columns.map(({ id }) => id), + visibleColumns: formattedColumns.map(({ id }) => id), setVisibleColumns: () => {}, }} rowCount={rows.length} @@ -153,7 +132,11 @@ export const TableVisComponent = ({ showFullScreenSelector: false, showStyleSelector: false, additionalControls: ( - + ), }} /> diff --git a/src/plugins/vis_type_table/public/components/table_vis_component_group.test.tsx b/src/plugins/vis_type_table/public/components/table_vis_component_group.test.tsx new file mode 100644 index 00000000000..570c8c0b853 --- /dev/null +++ b/src/plugins/vis_type_table/public/components/table_vis_component_group.test.tsx @@ -0,0 +1,67 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import React from 'react'; +import { render } from '@testing-library/react'; +import { TableVisComponentGroup } from './table_vis_component_group'; +import { TableVisConfig, ColumnSort } from '../types'; +import { Table, TableGroup } from '../table_vis_response_handler'; + +jest.mock('./table_vis_component', () => ({ + TableVisComponent: () =>
TableVisComponent
, +})); + +const table1 = { + table: { + columns: [], + rows: [], + formattedColumns: [], + } as Table, + title: '', +} as TableGroup; + +const table2 = { + table: { + columns: [], + rows: [], + formattedColumns: [], + } as Table, + title: '', +} as TableGroup; + +const tableUiStateMock = { + sort: { colIndex: undefined, direction: undefined } as ColumnSort, + setSort: jest.fn(), + width: [], + setWidth: jest.fn(), +}; + +describe('TableVisApp', () => { + it('should not render table or table group components if no table', () => { + const { container, queryAllByText } = render( + + ); + expect(queryAllByText('TableVisComponent')).toHaveLength(0); + expect(container.outerHTML.includes('visTable__group')).toBe(false); + }); + + it('should render table component 2 times', () => { + const { container, queryAllByText } = render( + + ); + expect(queryAllByText('TableVisComponent')).toHaveLength(2); + expect(container.outerHTML.includes('visTable__group')).toBe(true); + }); +}); diff --git a/src/plugins/vis_type_table/public/components/table_vis_component_group.tsx b/src/plugins/vis_type_table/public/components/table_vis_component_group.tsx index 633b9d2230b..af8fd8048cb 100644 --- a/src/plugins/vis_type_table/public/components/table_vis_component_group.tsx +++ b/src/plugins/vis_type_table/public/components/table_vis_component_group.tsx @@ -7,8 +7,9 @@ import React, { memo } from 'react'; import { IInterpreterRenderHandlers } from 'src/plugins/expressions'; import { TableGroup } from '../table_vis_response_handler'; -import { TableVisConfig, TableUiState } from '../types'; +import { TableVisConfig } from '../types'; import { TableVisComponent } from './table_vis_component'; +import { TableUiState } from '../utils'; interface TableVisGroupComponentProps { tableGroups: TableGroup[]; @@ -21,11 +22,11 @@ export const TableVisComponentGroup = memo( ({ tableGroups, visConfig, event, uiState }: TableVisGroupComponentProps) => { return ( <> - {tableGroups.map(({ tables, title }) => ( + {tableGroups.map(({ table, title }) => (
{ const filterBucket = (rowIndex: number, columnIndex: number, negate: boolean) => { - const foramttedColumnId = cols[columnIndex].id; - const rawColumnIndex = table.columns.findIndex((col) => col.id === foramttedColumnId); event({ name: 'filterBucket', data: { @@ -28,10 +23,10 @@ export const getDataGridColumns = ( { table: { columns: table.columns, - rows, + rows: table.rows, }, row: rowIndex, - column: rawColumnIndex, + column: columnIndex, }, ], negate, @@ -39,11 +34,11 @@ export const getDataGridColumns = ( }); }; - return cols.map((col, colIndex) => { + return table.formattedColumns.map((col, colIndex) => { const cellActions = col.filterable ? [ ({ rowIndex, columnId, Component, closePopover }: EuiDataGridColumnCellActionProps) => { - const filterValue = rows[rowIndex][columnId]; + const filterValue = table.rows[rowIndex][columnId]; const filterContent = col.formatter?.convert(filterValue); const filterForValueText = i18n.translate( @@ -79,7 +74,7 @@ export const getDataGridColumns = ( ); }, ({ rowIndex, columnId, Component, closePopover }: EuiDataGridColumnCellActionProps) => { - const filterValue = rows[rowIndex][columnId]; + const filterValue = table.rows[rowIndex][columnId]; const filterContent = col.formatter?.convert(filterValue); const filterOutValueText = i18n.translate( diff --git a/src/plugins/vis_type_table/public/table_vis_fn.ts b/src/plugins/vis_type_table/public/table_vis_fn.ts index 4f0fb2c0ba1..556cfaf24e0 100644 --- a/src/plugins/vis_type_table/public/table_vis_fn.ts +++ b/src/plugins/vis_type_table/public/table_vis_fn.ts @@ -4,7 +4,7 @@ */ import { i18n } from '@osd/i18n'; -import { tableVisResponseHandler, TableContext } from './table_vis_response_handler'; +import { tableVisResponseHandler, TableVisData } from './table_vis_response_handler'; import { ExpressionFunctionDefinition, OpenSearchDashboardsDatatable, @@ -19,7 +19,7 @@ interface Arguments { } export interface TableVisRenderValue { - visData: TableContext; + visData: TableVisData; visType: 'table'; visConfig: TableVisConfig; } diff --git a/src/plugins/vis_type_table/public/table_vis_renderer.test.tsx b/src/plugins/vis_type_table/public/table_vis_renderer.test.tsx new file mode 100644 index 00000000000..ee18bcfaf73 --- /dev/null +++ b/src/plugins/vis_type_table/public/table_vis_renderer.test.tsx @@ -0,0 +1,78 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { unmountComponentAtNode } from 'react-dom'; +import { act } from '@testing-library/react'; + +import { CoreStart } from 'opensearch-dashboards/public'; +import { getTableVisRenderer } from './table_vis_renderer'; +import { TableVisData } from './table_vis_response_handler'; +import { TableVisConfig } from './types'; +import { TableVisRenderValue } from './table_vis_fn'; + +const mockVisData = { + tableGroups: [], + direction: 'row', +} as TableVisData; + +const mockVisConfig = { + title: 'My Table', + metrics: [] as any, + buckets: [] as any, +} as TableVisConfig; + +const mockHandlers = { + done: jest.fn(), + reload: jest.fn(), + update: jest.fn(), + event: jest.fn(), + onDestroy: jest.fn(), +}; + +const mockCoreStart = {} as CoreStart; + +describe('getTableVisRenderer', () => { + let container: any = null; + + beforeEach(() => { + container = document.createElement('div'); + document.body.appendChild(container); + }); + + afterEach(() => { + unmountComponentAtNode(container); + container.remove(); + container = null; + }); + + it('should render table visualization', async () => { + const renderer = getTableVisRenderer(mockCoreStart); + const mockTableVisRenderValue = { + visData: mockVisData, + visType: 'table', + visConfig: mockVisConfig, + } as TableVisRenderValue; + await act(async () => { + renderer.render(container, mockTableVisRenderValue, mockHandlers); + }); + expect(container.querySelector('.tableVis')).toBeTruthy(); + }); + + it('should destroy table on unmount', async () => { + const renderer = getTableVisRenderer(mockCoreStart); + const mockTableVisRenderValue = { + visData: mockVisData, + visType: 'table', + visConfig: mockVisConfig, + } as TableVisRenderValue; + await act(async () => { + renderer.render(container, mockTableVisRenderValue, mockHandlers); + }); + await act(async () => { + unmountComponentAtNode(container); + }); + expect(mockHandlers.onDestroy).toHaveBeenCalled(); + }); +}); diff --git a/src/plugins/vis_type_table/public/table_vis_response_handler.test.ts b/src/plugins/vis_type_table/public/table_vis_response_handler.test.ts new file mode 100644 index 00000000000..89627854b44 --- /dev/null +++ b/src/plugins/vis_type_table/public/table_vis_response_handler.test.ts @@ -0,0 +1,157 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { tableVisResponseHandler } from './table_vis_response_handler'; + +jest.mock('./services', () => { + const formatService = { + deserialize: jest.fn(() => ({ + convert: jest.fn((value) => value), + })), + }; + + return { + getFormatService: () => formatService, + }; +}); + +const createTableGroup = (title, rows) => ({ + title, + table: { + columns: [ + { id: 'col-0', meta: { type: 'string' }, name: 'Column 1' }, + { id: 'col-1', meta: { type: 'number' }, name: 'Column 2' }, + ], + formattedColumns: [ + { + id: 'col-0', + title: 'Column 1', + formatter: { convert: expect.any(Function) }, + filterable: true, + }, + { + id: 'col-1', + title: 'Column 2', + formatter: { convert: expect.any(Function) }, + filterable: false, + }, + ], + rows, + }, +}); + +describe('tableVisResponseHandler', () => { + const input = { + type: 'datatable', + columns: [ + { id: 'col-0', name: 'Column 1', meta: { type: 'string' } }, + { id: 'col-1', name: 'Column 2', meta: { type: 'number' } }, + ], + rows: [ + { 'col-0': 'Group 1', 'col-1': 100 }, + { 'col-0': 'Group 2', 'col-1': 200 }, + ], + }; + + const baseVisConfig = { + title: 'My Table', + buckets: [ + { + accessor: 0, + label: 'Column 1', + format: { + id: 'string', + params: {}, + }, + params: {}, + aggType: 'terms', + }, + ], + metrics: [ + { + accessor: 1, + label: 'Count', + format: { + id: 'number', + }, + params: {}, + aggType: 'count', + }, + ], + }; + + const splitConfig = { + accessor: 0, + label: 'Column 1', + format: { + id: 'string', + params: {}, + }, + params: {}, + aggType: 'terms', + }; + + it('should correctly format data with splitRow', () => { + const visConfig = { ...baseVisConfig, splitRow: [splitConfig] }; + + const expected = { + table: undefined, + tableGroups: [ + createTableGroup('Group 1: Column 1', [{ 'col-0': 'Group 1', 'col-1': 100 }]), + createTableGroup('Group 2: Column 1', [{ 'col-0': 'Group 2', 'col-1': 200 }]), + ], + direction: 'row', + }; + + const result = tableVisResponseHandler(input, visConfig); + expect(result).toEqual(expected); + }); + + it('should correctly format data with splitColumn', () => { + const visConfig = { ...baseVisConfig, splitColumn: [splitConfig] }; + + const expected = { + table: undefined, + tableGroups: [ + createTableGroup('Group 1: Column 1', [{ 'col-0': 'Group 1', 'col-1': 100 }]), + createTableGroup('Group 2: Column 1', [{ 'col-0': 'Group 2', 'col-1': 200 }]), + ], + direction: 'column', + }; + + const result = tableVisResponseHandler(input, visConfig); + expect(result).toEqual(expected); + }); + + it('should correctly format data with no split', () => { + const visConfig = baseVisConfig; + + const expected = { + table: { + columns: input.columns, + formattedColumns: [ + { + id: 'col-0', + title: 'Column 1', + formatter: { convert: expect.any(Function) }, + filterable: true, + }, + { + id: 'col-1', + title: 'Column 2', + formatter: { convert: expect.any(Function) }, + filterable: false, + }, + ], + rows: input.rows, + }, + tableGroups: [], + direction: undefined, + }; + + const result = tableVisResponseHandler(input, visConfig); + expect(result).toEqual(expected); + }); +}); diff --git a/src/plugins/vis_type_table/public/table_vis_response_handler.ts b/src/plugins/vis_type_table/public/table_vis_response_handler.ts index b1d41edfff8..975038c4c11 100644 --- a/src/plugins/vis_type_table/public/table_vis_response_handler.ts +++ b/src/plugins/vis_type_table/public/table_vis_response_handler.ts @@ -30,25 +30,25 @@ import { getFormatService } from './services'; import { OpenSearchDashboardsDatatable } from '../../expressions/public'; -import { TableVisConfig } from './types'; +import { FormattedColumn, TableVisConfig } from './types'; +import { convertToFormattedData } from './utils/convert_to_formatted_data'; export interface Table { columns: OpenSearchDashboardsDatatable['columns']; rows: OpenSearchDashboardsDatatable['rows']; } +export interface FormattedTableContext extends Table { + formattedColumns: FormattedColumn[]; +} + export interface TableGroup { - table: OpenSearchDashboardsDatatable; - tables: Table[]; + table: FormattedTableContext; title: string; - name: string; - key: any; - column: number; - row: number; } -export interface TableContext { - table?: Table; +export interface TableVisData { + table?: FormattedTableContext; tableGroups: TableGroup[]; direction?: 'row' | 'column'; } @@ -56,10 +56,10 @@ export interface TableContext { export function tableVisResponseHandler( input: OpenSearchDashboardsDatatable, config: TableVisConfig -): TableContext { - let table: Table | undefined; +): TableVisData { + let table: FormattedTableContext | undefined; const tableGroups: TableGroup[] = []; - let direction: TableContext['direction']; + let direction: TableVisData['direction']; const split = config.splitColumn || config.splitRow; @@ -78,30 +78,32 @@ export function tableVisResponseHandler( (splitMap as any)[splitValue] = splitIndex++; const tableGroup: TableGroup = { title: `${splitColumnFormatter.convert(splitValue)}: ${splitColumn.name}`, - name: splitColumn.name, - key: splitValue, - column: splitColumnIndex, - row: rowIndex, - table: input, - tables: [], + table: { + formattedColumns: [], + rows: [], + columns: input.columns, + }, }; - tableGroup.tables.push({ - columns: input.columns, - rows: [], - }); - tableGroups.push(tableGroup); } - const tableIndex = (splitMap as any)[splitValue]; - (tableGroups[tableIndex] as any).tables[0].rows.push(row); + const tableIndex = splitMap[splitValue]; + tableGroups[tableIndex].table.rows.push(row); + }); + + // format tables + tableGroups.forEach((tableGroup) => { + tableGroup.table = convertToFormattedData(tableGroup.table, config); }); } else { - table = { - columns: input.columns, - rows: input.rows, - }; + table = convertToFormattedData( + { + columns: input.columns, + rows: input.rows, + }, + config + ); } return { diff --git a/src/plugins/vis_type_table/public/types.ts b/src/plugins/vis_type_table/public/types.ts index 814a86f5ac6..a14767f9630 100644 --- a/src/plugins/vis_type_table/public/types.ts +++ b/src/plugins/vis_type_table/public/types.ts @@ -75,10 +75,3 @@ export interface ColumnSort { colIndex?: number; direction?: 'asc' | 'desc'; } - -export interface TableUiState { - sort: ColumnSort; - setSort: (sort: ColumnSort) => void; - width: ColumnWidth[]; - setWidth: (columnWidths: ColumnWidth[]) => void; -} diff --git a/src/plugins/vis_type_table/public/utils/__snapshots__/add_percentage_col.test.ts.snap b/src/plugins/vis_type_table/public/utils/__snapshots__/add_percentage_col.test.ts.snap new file mode 100644 index 00000000000..41f4f24ecff --- /dev/null +++ b/src/plugins/vis_type_table/public/utils/__snapshots__/add_percentage_col.test.ts.snap @@ -0,0 +1,170 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`addPercentageCol should add new percentage column 1`] = ` +Object { + "cols": Array [ + Object { + "filterable": true, + "formatter": Object {}, + "id": "col-0-2", + "title": "name.keyword: Descending", + }, + Object { + "filterable": false, + "formatter": Object {}, + "id": "col-1-1", + "sumTotal": 5, + "title": "Count", + }, + Object { + "filterable": false, + "formatter": Object {}, + "id": "col-1-1-percents", + "title": "count percentages", + }, + ], + "rows": Array [ + Object { + "col-0-2": "Alice", + "col-1-1": 3, + "col-1-1-percents": 0.6, + }, + Object { + "col-0-2": "Anthony", + "col-1-1": 1, + "col-1-1-percents": 0.2, + }, + Object { + "col-0-2": "Timmy", + "col-1-1": 1, + "col-1-1-percents": 0.2, + }, + ], +} +`; + +exports[`addPercentageCol should handle empty input data 1`] = ` +Object { + "cols": Array [], + "rows": Array [], +} +`; + +exports[`addPercentageCol should handle input data with null values 1`] = ` +Object { + "cols": Array [ + Object { + "filterable": true, + "formatter": Object {}, + "id": "col-0-2", + "title": "name.keyword: Descending", + }, + Object { + "filterable": false, + "formatter": Object {}, + "id": "col-1-1", + "sumTotal": 5, + "title": "Count", + }, + Object { + "filterable": false, + "formatter": Object {}, + "id": "col-1-1-percents", + "title": "count percentages", + }, + ], + "rows": Array [ + Object { + "col-0-2": "Alice", + "col-1-1": null, + "col-1-1-percents": 0, + }, + Object { + "col-0-2": "Anthony", + "col-1-1": null, + "col-1-1-percents": 0, + }, + Object { + "col-0-2": "Timmy", + "col-1-1": null, + "col-1-1-percents": 0, + }, + ], +} +`; + +exports[`addPercentageCol should handle input data with one row 1`] = ` +Object { + "cols": Array [ + Object { + "filterable": true, + "formatter": Object {}, + "id": "col-0-2", + "title": "name.keyword: Descending", + }, + Object { + "filterable": false, + "formatter": Object {}, + "id": "col-1-1", + "sumTotal": 5, + "title": "Count", + }, + Object { + "filterable": false, + "formatter": Object {}, + "id": "col-1-1-percents", + "title": "count percentages", + }, + ], + "rows": Array [ + Object { + "col-0-2": "Alice", + "col-1-1": 3, + "col-1-1-percents": 0.6, + }, + ], +} +`; + +exports[`addPercentageCol should handle sumTotal being 0 1`] = ` +Object { + "cols": Array [ + Object { + "filterable": true, + "formatter": Object {}, + "id": "col-0-2", + "title": "name.keyword: Descending", + }, + Object { + "filterable": false, + "formatter": Object {}, + "id": "col-1-1", + "sumTotal": 0, + "title": "Count", + }, + Object { + "filterable": false, + "formatter": Object {}, + "id": "col-1-1-percents", + "title": "count percentages", + }, + ], + "rows": Array [ + Object { + "col-0-2": "Alice", + "col-1-1": 3, + "col-1-1-percents": 0, + }, + Object { + "col-0-2": "Anthony", + "col-1-1": 1, + "col-1-1-percents": 0, + }, + Object { + "col-0-2": "Timmy", + "col-1-1": 1, + "col-1-1-percents": 0, + }, + ], +} +`; diff --git a/src/plugins/vis_type_table/public/utils/add_percentage_col.test.ts b/src/plugins/vis_type_table/public/utils/add_percentage_col.test.ts new file mode 100644 index 00000000000..5f27cb5e49e --- /dev/null +++ b/src/plugins/vis_type_table/public/utils/add_percentage_col.test.ts @@ -0,0 +1,76 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { addPercentageCol } from './add_percentage_col'; +import { FormattedColumn } from '../types'; +import { Table } from '../table_vis_response_handler'; + +const mockDeserialize = jest.fn(() => ({})); +jest.mock('../services', () => ({ + getFormatService: jest.fn(() => ({ + deserialize: mockDeserialize, + })), +})); + +let formattedColumns: FormattedColumn[]; +const rows = [ + { 'col-0-2': 'Alice', 'col-1-1': 3 }, + { 'col-0-2': 'Anthony', 'col-1-1': 1 }, + { 'col-0-2': 'Timmy', 'col-1-1': 1 }, +] as Table['rows']; + +beforeEach(() => { + formattedColumns = [ + { + id: 'col-0-2', + title: 'name.keyword: Descending', + formatter: {}, + filterable: true, + }, + { + id: 'col-1-1', + title: 'Count', + formatter: {}, + filterable: false, + sumTotal: 5, + }, + ] as FormattedColumn[]; +}); + +describe('addPercentageCol', () => { + it('should add new percentage column', () => { + const result = addPercentageCol(formattedColumns, 'count', rows, 1); + expect(result).toMatchSnapshot(); + }); + + it('should handle sumTotal being 0', () => { + formattedColumns[1].sumTotal = 0; + const result = addPercentageCol(formattedColumns, 'count', rows, 1); + expect(result).toMatchSnapshot(); + }); + + it('should handle empty input data', () => { + const emptyFormattedColumns: FormattedColumn[] = []; + const emptyRows: Table['rows'] = []; + const result = addPercentageCol(emptyFormattedColumns, 'count', emptyRows, 1); + expect(result).toMatchSnapshot(); + }); + + it('should handle input data with one row', () => { + const oneRow = [{ 'col-0-2': 'Alice', 'col-1-1': 3 }] as Table['rows']; + const result = addPercentageCol(formattedColumns, 'count', oneRow, 1); + expect(result).toMatchSnapshot(); + }); + + it('should handle input data with null values', () => { + const nullValueRows = [ + { 'col-0-2': 'Alice', 'col-1-1': null }, + { 'col-0-2': 'Anthony', 'col-1-1': null }, + { 'col-0-2': 'Timmy', 'col-1-1': null }, + ] as Table['rows']; + const result = addPercentageCol(formattedColumns, 'count', nullValueRows, 1); + expect(result).toMatchSnapshot(); + }); +}); diff --git a/src/plugins/vis_type_table/public/utils/add_percentage_col.ts b/src/plugins/vis_type_table/public/utils/add_percentage_col.ts new file mode 100644 index 00000000000..8c300f29d06 --- /dev/null +++ b/src/plugins/vis_type_table/public/utils/add_percentage_col.ts @@ -0,0 +1,76 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { i18n } from '@osd/i18n'; +import { Table } from '../table_vis_response_handler'; +import { getFormatService } from '../services'; +import { FormattedColumn } from '../types'; + +function insert(arr: FormattedColumn[], index: number, col: FormattedColumn) { + const newArray = [...arr]; + newArray.splice(index + 1, 0, col); + return newArray; +} +/** + * @param columns - the formatted columns that will be displayed + * @param title - the title of the column to add to + * @param rows - the row data for the columns + * @param insertAtIndex - the index to insert the percentage column at + * @returns cols and rows for the table to render now included percentage column(s) + */ +export function addPercentageCol( + columns: FormattedColumn[], + title: string, + rows: Table['rows'], + insertAtIndex: number +) { + if (columns.length === 0) { + return { cols: columns, rows }; + } + const { id, sumTotal } = columns[insertAtIndex]; + const newId = `${id}-percents`; + const formatter = getFormatService().deserialize({ id: 'percent' }); + const i18nTitle = i18n.translate('visTypeTable.params.percentageTableColumnName', { + defaultMessage: '{title} percentages', + values: { title }, + }); + const newCols = insert(columns, insertAtIndex, { + title: i18nTitle, + id: newId, + formatter, + filterable: false, + }); + const newRows = rows.map((row) => ({ + [newId]: sumTotal === 0 ? 0 : (row[id] as number) / (sumTotal as number), + ...row, + })); + + return { cols: newCols, rows: newRows }; +} diff --git a/src/plugins/vis_type_table/public/utils/convert_to_csv_data.test.ts b/src/plugins/vis_type_table/public/utils/convert_to_csv_data.test.ts new file mode 100644 index 00000000000..591dbe5454c --- /dev/null +++ b/src/plugins/vis_type_table/public/utils/convert_to_csv_data.test.ts @@ -0,0 +1,76 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { IUiSettingsClient } from 'opensearch-dashboards/public'; +import { FormattedColumn } from '../types'; +import { toCsv } from './convert_to_csv_data'; +import { IFieldFormat } from 'src/plugins/data/common'; + +const mockConvert = jest.fn((x) => x); +const defaultFormatter = { convert: (x) => mockConvert(x) } as IFieldFormat; + +function implementConvert(nRow: number) { + for (let i = 0; i < nRow; i++) { + mockConvert.mockImplementationOnce((x) => x); + mockConvert.mockImplementationOnce((x) => x); + mockConvert.mockImplementationOnce((x) => { + return parseFloat(x) * 100 + '%'; + }); + } +} + +const columns = [ + { + id: 'col-0-2', + title: 'name.keyword: Descending', + formatter: defaultFormatter, + filterable: true, + }, + { + id: 'col-1-1', + title: 'Count', + formatter: defaultFormatter, + filterable: false, + sumTotal: 5, + formattedTotal: 5, + total: 5, + }, + { + id: 'col-1-1-percents', + title: 'Count percentages', + formatter: defaultFormatter, + filterable: false, + }, +] as FormattedColumn[]; + +const rows = [ + { 'col-1-1-percents': 0.6, 'col-0-2': 'Alice', 'col-1-1': 3 }, + { 'col-1-1-percents': 0.2, 'col-0-2': 'Anthony', 'col-1-1': 1 }, + { 'col-1-1-percents': 0.2, 'col-0-2': 'Timmy', 'col-1-1': 1 }, +]; + +const uiSettings = { + get: (key: string) => { + if (key === 'csv:separator') return ','; + else if (key === 'csv:quoteValues') return true; + }, +} as IUiSettingsClient; + +describe('toCsv', () => { + it('should create csv rows if not formatted', () => { + const result = toCsv(false, { rows, columns, uiSettings }); + expect(result).toEqual( + '"name.keyword: Descending",Count,"Count percentages"\r\nAlice,3,"0.6"\r\nAnthony,1,"0.2"\r\nTimmy,1,"0.2"\r\n' + ); + }); + + it('should create csv rows if formatted', () => { + implementConvert(3); + const result = toCsv(true, { rows, columns, uiSettings }); + expect(result).toEqual( + '"name.keyword: Descending",Count,"Count percentages"\r\nAlice,3,"60%"\r\nAnthony,1,"20%"\r\nTimmy,1,"20%"\r\n' + ); + }); +}); diff --git a/src/plugins/vis_type_table/public/utils/convert_to_csv_data.ts b/src/plugins/vis_type_table/public/utils/convert_to_csv_data.ts index 2c37df1aa3d..3d478173668 100644 --- a/src/plugins/vis_type_table/public/utils/convert_to_csv_data.ts +++ b/src/plugins/vis_type_table/public/utils/convert_to_csv_data.ts @@ -46,7 +46,7 @@ interface CSVDataProps { uiSettings: CoreStart['uiSettings']; } -const toCsv = function (formatted: boolean, { rows, columns, uiSettings }: CSVDataProps) { +export const toCsv = function (formatted: boolean, { rows, columns, uiSettings }: CSVDataProps) { const separator = uiSettings.get(CSV_SEPARATOR_SETTING); const quoteValues = uiSettings.get(CSV_QUOTE_VALUES_SETTING); diff --git a/src/plugins/vis_type_table/public/utils/convert_to_formatted_data.test.ts b/src/plugins/vis_type_table/public/utils/convert_to_formatted_data.test.ts new file mode 100644 index 00000000000..34085b70a27 --- /dev/null +++ b/src/plugins/vis_type_table/public/utils/convert_to_formatted_data.test.ts @@ -0,0 +1,136 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { convertToFormattedData } from './convert_to_formatted_data'; +import { TableVisConfig } from '../types'; +import { Table } from '../table_vis_response_handler'; +import { AggTypes } from '../types'; + +const mockDeserialize = jest.fn(() => ({})); +jest.mock('../services', () => ({ + getFormatService: jest.fn(() => ({ + deserialize: mockDeserialize, + })), +})); + +const table = { + type: 'opensearch_dashboards_datatable', + columns: [ + { id: 'col-0-2', name: 'name.keyword: Descending', meta: { type: 'terms' } }, + { id: 'col-1-1', name: 'Count', meta: { type: 'count' } }, + ], + rows: [ + { 'col-0-2': 'Alice', 'col-1-1': 3 }, + { 'col-0-2': 'Anthony', 'col-1-1': 1 }, + { 'col-0-2': 'Timmy', 'col-1-1': 1 }, + ], +} as Table; + +let visConfig = {} as TableVisConfig; + +function implementDeserialize() { + mockDeserialize.mockImplementationOnce(() => ({})); + mockDeserialize.mockImplementationOnce(() => ({ + allowsNumericalAggregations: true, + convert: jest.fn((x: number) => x), + })); +} + +describe('convertToFormattedData', () => { + beforeEach(() => { + visConfig = { + buckets: [ + { + accessor: 0, + aggType: 'terms', + format: { + id: 'terms', + params: { + id: 'string', + missingBucketLabel: 'Missing', + otherBucketLabel: 'Other', + parsedUrl: { + basePath: '/arf', + origin: '', + pathname: '/arf/app/home', + }, + }, + }, + label: 'name.keyword: Descending', + params: {}, + }, + ], + metrics: [ + { + accessor: 1, + aggType: 'count', + format: { + id: 'number', + }, + label: 'Count', + params: {}, + }, + ], + perPage: 10, + percentageCol: '', + showMetricsAtAllLevels: false, + showPartialRows: false, + showTotal: false, + title: '', + totalFunc: 'sum', + } as TableVisConfig; + }); + + it('should create formatted data', () => { + const result = convertToFormattedData(table, visConfig); + expect(result.rows).toEqual(table.rows); + expect(result.formattedColumns).toEqual([ + { + id: 'col-0-2', + title: 'name.keyword: Descending', + formatter: {}, + filterable: true, + }, + { id: 'col-1-1', title: 'Count', formatter: {}, filterable: false }, + ]); + }); + + describe.each([ + [AggTypes.SUM, 5], + [AggTypes.AVG, 1.6666666666666667], + [AggTypes.MIN, 1], + [AggTypes.MAX, 3], + [AggTypes.COUNT, 3], + ])('with totalFunc as %s', (totalFunc, expectedTotal) => { + beforeEach(() => { + implementDeserialize(); + visConfig.showTotal = true; + visConfig.totalFunc = totalFunc; + }); + + it(`should add ${totalFunc} total`, () => { + const result = convertToFormattedData(table, visConfig); + const expectedFormattedColumns = [ + { + id: 'col-0-2', + title: 'name.keyword: Descending', + formatter: {}, + filterable: true, + ...(totalFunc === AggTypes.COUNT ? { sumTotal: 0, formattedTotal: 3, total: 3 } : {}), + }, + { + id: 'col-1-1', + title: 'Count', + formatter: { allowsNumericalAggregations: true, convert: expect.any(Function) }, + filterable: false, + sumTotal: 5, + formattedTotal: expectedTotal, + total: expectedTotal, + }, + ]; + expect(result.formattedColumns).toEqual(expectedFormattedColumns); + }); + }); +}); diff --git a/src/plugins/vis_type_table/public/utils/convert_to_formatted_data.ts b/src/plugins/vis_type_table/public/utils/convert_to_formatted_data.ts index 2ab67e3b0a6..afb2906af8a 100644 --- a/src/plugins/vis_type_table/public/utils/convert_to_formatted_data.ts +++ b/src/plugins/vis_type_table/public/utils/convert_to_formatted_data.ts @@ -28,56 +28,20 @@ * under the License. */ -import { i18n } from '@osd/i18n'; import { chain } from 'lodash'; -import { OpenSearchDashboardsDatatableRow } from 'src/plugins/expressions'; +import { + OpenSearchDashboardsDatatableRow, + OpenSearchDashboardsDatatableColumn, +} from 'src/plugins/expressions'; import { Table } from '../table_vis_response_handler'; import { AggTypes, TableVisConfig } from '../types'; import { getFormatService } from '../services'; import { FormattedColumn } from '../types'; - -function insert(arr: FormattedColumn[], index: number, col: FormattedColumn) { - const newArray = [...arr]; - newArray.splice(index + 1, 0, col); - return newArray; -} - -/** - * @param columns - the formatted columns that will be displayed - * @param title - the title of the column to add to - * @param rows - the row data for the columns - * @param insertAtIndex - the index to insert the percentage column at - * @returns cols and rows for the table to render now included percentage column(s) - */ -function addPercentageCol( - columns: FormattedColumn[], - title: string, - rows: Table['rows'], - insertAtIndex: number -) { - const { id, sumTotal } = columns[insertAtIndex]; - const newId = `${id}-percents`; - const formatter = getFormatService().deserialize({ id: 'percent' }); - const i18nTitle = i18n.translate('visTypeTable.params.percentageTableColumnName', { - defaultMessage: '{title} percentages', - values: { title }, - }); - const newCols = insert(columns, insertAtIndex, { - title: i18nTitle, - id: newId, - formatter, - filterable: false, - }); - const newRows = rows.map((row) => ({ - [newId]: (row[id] as number) / (sumTotal as number), - ...row, - })); - - return { cols: newCols, rows: newRows }; -} +import { addPercentageCol } from './add_percentage_col'; export interface FormattedDataProps { - formattedRows: OpenSearchDashboardsDatatableRow[]; + rows: OpenSearchDashboardsDatatableRow[]; + columns: OpenSearchDashboardsDatatableColumn[]; formattedColumns: FormattedColumn[]; } @@ -107,12 +71,15 @@ export const convertToFormattedData = ( const allowsNumericalAggregations = formatter?.allowsNumericalAggregations; if (allowsNumericalAggregations || isDate || visConfig.totalFunc === AggTypes.COUNT) { - const sum = table.rows.reduce((prev, curr) => { - // some metrics return undefined for some of the values - // derivative is an example of this as it returns undefined in the first row - if (curr[col.id] === undefined) return prev; - return prev + (curr[col.id] as number); - }, 0); + // only calculate the sumTotal for numerical columns + const sum = isBucket + ? 0 + : table.rows.reduce((prev, curr) => { + // some metrics return undefined for some of the values + // derivative is an example of this as it returns undefined in the first row + if (curr[col.id] === undefined) return prev; + return prev + (curr[col.id] as number); + }, 0); formattedColumn.sumTotal = sum; switch (visConfig.totalFunc) { @@ -164,7 +131,7 @@ export const convertToFormattedData = ( ); // column to show percentage was removed - if (insertAtIndex < 0) return { formattedRows, formattedColumns }; + if (insertAtIndex < 0) return { rows: table.rows, columns: table.columns, formattedColumns }; const { cols, rows } = addPercentageCol( formattedColumns, @@ -175,5 +142,5 @@ export const convertToFormattedData = ( formattedRows = rows; formattedColumns = cols; } - return { formattedRows, formattedColumns }; + return { rows: formattedRows, columns: table.columns, formattedColumns }; }; diff --git a/src/plugins/vis_type_table/public/utils/get_table_ui_state.test.ts b/src/plugins/vis_type_table/public/utils/get_table_ui_state.test.ts new file mode 100644 index 00000000000..64488d9275e --- /dev/null +++ b/src/plugins/vis_type_table/public/utils/get_table_ui_state.test.ts @@ -0,0 +1,66 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { PersistedState } from '../../../visualizations/public'; +import { TableUiState, getTableUIState } from './get_table_ui_state'; +import { ColumnWidth, ColumnSort } from '../types'; + +describe('getTableUIState', () => { + let uiState: PersistedState; + let tableUiState: TableUiState; + + beforeEach(() => { + uiState = ({ + get: jest.fn(), + set: jest.fn(), + emit: jest.fn(), + } as unknown) as PersistedState; + tableUiState = getTableUIState(uiState); + }); + + it('should get initial sort and width values from uiState', () => { + const initialSort: ColumnSort = { colIndex: 1, direction: 'asc' }; + const initialWidth: ColumnWidth[] = [{ colIndex: 0, width: 100 }]; + + (uiState.get as jest.Mock).mockImplementation((key: string) => { + if (key === 'vis.sortColumn') return initialSort; + if (key === 'vis.columnsWidth') return initialWidth; + }); + + const newTableUiState = getTableUIState(uiState); + expect(newTableUiState.sort).toEqual(initialSort); + expect(newTableUiState.colWidth).toEqual(initialWidth); + }); + + it('should set and emit sort values', () => { + const newSort: ColumnSort = { colIndex: 2, direction: 'desc' }; + tableUiState.setSort(newSort); + + expect(uiState.set).toHaveBeenCalledWith('vis.sortColumn', newSort); + expect(uiState.emit).toHaveBeenCalledWith('reload'); + }); + + it('should set and emit width values for a new column', () => { + const newWidth: ColumnWidth = { colIndex: 1, width: 150 }; + tableUiState.setWidth(newWidth); + + expect(uiState.set).toHaveBeenCalledWith('vis.columnsWidth', [newWidth]); + expect(uiState.emit).toHaveBeenCalledWith('reload'); + }); + + it('should update and emit width values for an existing column', () => { + const initialWidth: ColumnWidth[] = [{ colIndex: 0, width: 100 }]; + (uiState.get as jest.Mock).mockReturnValue(initialWidth); + + const updatedTableUiState = getTableUIState(uiState); + + const updatedWidth: ColumnWidth = { colIndex: 0, width: 150 }; + updatedTableUiState.setWidth(updatedWidth); + + const expectedWidths = [{ colIndex: 0, width: 150 }]; + expect(uiState.set).toHaveBeenCalledWith('vis.columnsWidth', expectedWidths); + expect(uiState.emit).toHaveBeenCalledWith('reload'); + }); +}); diff --git a/src/plugins/vis_type_table/public/utils/get_table_ui_state.ts b/src/plugins/vis_type_table/public/utils/get_table_ui_state.ts new file mode 100644 index 00000000000..58fc6b472a4 --- /dev/null +++ b/src/plugins/vis_type_table/public/utils/get_table_ui_state.ts @@ -0,0 +1,40 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { PersistedState } from '../../../visualizations/public'; +import { ColumnSort, ColumnWidth } from '../types'; + +export interface TableUiState { + sort: ColumnSort; + setSort: (sort: ColumnSort) => void; + colWidth: ColumnWidth[]; + setWidth: (columnWidths: ColumnWidth) => void; +} + +export function getTableUIState(uiState: PersistedState): TableUiState { + const sort: ColumnSort = uiState.get('vis.sortColumn') || {}; + const colWidth: ColumnWidth[] = uiState.get('vis.columnsWidth') || []; + + const setSort = (newSort: ColumnSort) => { + uiState.set('vis.sortColumn', newSort); + uiState.emit('reload'); + }; + + const setWidth = (columnWidth: ColumnWidth) => { + const nextState = [...colWidth]; + const curColIndex = colWidth.findIndex((col) => col.colIndex === columnWidth.colIndex); + + if (curColIndex < 0) { + nextState.push(columnWidth); + } else { + nextState[curColIndex] = columnWidth; + } + + uiState.set('vis.columnsWidth', nextState); + uiState.emit('reload'); + }; + + return { sort, setSort, colWidth, setWidth }; +} diff --git a/src/plugins/vis_type_table/public/utils/index.ts b/src/plugins/vis_type_table/public/utils/index.ts index 1fd0e3f1e0f..3277d92efc7 100644 --- a/src/plugins/vis_type_table/public/utils/index.ts +++ b/src/plugins/vis_type_table/public/utils/index.ts @@ -6,3 +6,5 @@ export * from './convert_to_csv_data'; export * from './convert_to_formatted_data'; export * from './use_pagination'; +export * from './add_percentage_col'; +export * from './get_table_ui_state'; diff --git a/src/plugins/vis_type_table/public/utils/use_pagination.test.ts b/src/plugins/vis_type_table/public/utils/use_pagination.test.ts new file mode 100644 index 00000000000..d8e7a02a079 --- /dev/null +++ b/src/plugins/vis_type_table/public/utils/use_pagination.test.ts @@ -0,0 +1,101 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { act, renderHook } from '@testing-library/react-hooks'; +import { AggTypes, TableVisParams } from '../types'; +import { usePagination } from './use_pagination'; + +describe('usePagination', () => { + const visParams = { + perPage: 10, + showPartialRows: false, + showMetricsAtAllLevels: false, + showTotal: false, + totalFunc: AggTypes.SUM, + percentageCol: '', + } as TableVisParams; + + it('should not set pagination if perPage is empty string', () => { + const params = { + ...visParams, + perPage: '', + }; + const { result } = renderHook(() => usePagination(params, 20)); + expect(result.current).toEqual(undefined); + }); + + it('should init pagination', () => { + const { result } = renderHook(() => usePagination(visParams, 20)); + expect(result.current).toEqual({ + pageIndex: 0, + pageSize: 10, + onChangeItemsPerPage: expect.any(Function), + onChangePage: expect.any(Function), + }); + }); + + it('should init pagination with pageSize as the minimum of perPage and nRow', () => { + const { result } = renderHook(() => usePagination(visParams, 8)); + expect(result.current).toEqual({ + pageIndex: 0, + pageSize: 8, + onChangeItemsPerPage: expect.any(Function), + onChangePage: expect.any(Function), + }); + }); + + it('should set pageSize to the lesser of perPage and nRow when nRow is less than perPage', () => { + const { result } = renderHook(() => usePagination(visParams, 5)); + expect(result.current).toEqual({ + pageIndex: 0, + pageSize: 5, + onChangeItemsPerPage: expect.any(Function), + onChangePage: expect.any(Function), + }); + }); + + it('should set page index via onChangePage', () => { + const { result } = renderHook(() => usePagination(visParams, 50)); + act(() => { + // set page index to 3 + result.current?.onChangePage(3); + }); + expect(result.current?.pageIndex).toEqual(3); + }); + + it('should set to max page index via onChangePage if exceed maxiPageIndex', () => { + const { result, rerender } = renderHook((props) => usePagination(props.visParams, props.nRow), { + initialProps: { + visParams, + nRow: 55, + }, + }); + + act(() => { + // set page index to the last page + result.current?.onChangePage(5); + }); + + rerender({ visParams, nRow: 15 }); + // when the number of rows decreases, page index should + // be set to maxiPageIndex + expect(result.current).toEqual({ + pageIndex: 1, + pageSize: 10, + onChangeItemsPerPage: expect.any(Function), + onChangePage: expect.any(Function), + }); + }); + + it('should pagination via onChangeItemsPerPage', () => { + const { result } = renderHook(() => usePagination(visParams, 20)); + act(() => { + // set page size to 5 + result.current?.onChangeItemsPerPage(5); + }); + + expect(result.current?.pageSize).toEqual(5); + }); +}); diff --git a/src/plugins/vis_type_table/public/utils/use_pagination.ts b/src/plugins/vis_type_table/public/utils/use_pagination.ts index e3993f1c086..97ecfd6b85e 100644 --- a/src/plugins/vis_type_table/public/utils/use_pagination.ts +++ b/src/plugins/vis_type_table/public/utils/use_pagination.ts @@ -4,12 +4,12 @@ */ import { useCallback, useEffect, useMemo, useState } from 'react'; -import { TableVisConfig } from '../types'; +import { TableVisParams } from '../types'; -export const usePagination = (visConfig: TableVisConfig, nRow: number) => { +export const usePagination = (visParams: TableVisParams, nRow: number) => { const [pagination, setPagination] = useState({ pageIndex: 0, - pageSize: Math.min(visConfig.perPage || 10, nRow), + pageSize: Math.min(visParams.perPage || 0, nRow), }); const onChangeItemsPerPage = useCallback( (pageSize) => setPagination((p) => ({ ...p, pageSize, pageIndex: 0 })), @@ -20,20 +20,23 @@ export const usePagination = (visConfig: TableVisConfig, nRow: number) => { ]); useEffect(() => { - const perPage = Math.min(visConfig.perPage || 10, nRow); + const perPage = Math.min(visParams.perPage || 0, nRow); const maxiPageIndex = Math.ceil(nRow / perPage) - 1; setPagination((p) => ({ pageIndex: p.pageIndex > maxiPageIndex ? maxiPageIndex : p.pageIndex, pageSize: perPage, })); - }, [nRow, visConfig.perPage]); + }, [nRow, visParams.perPage]); return useMemo( - () => ({ - ...pagination, - onChangeItemsPerPage, - onChangePage, - }), + () => + pagination.pageSize + ? { + ...pagination, + onChangeItemsPerPage, + onChangePage, + } + : undefined, [pagination, onChangeItemsPerPage, onChangePage] ); }; From 14bde2bba9b338183f117a8e852cbd4ce02c0694 Mon Sep 17 00:00:00 2001 From: Ashwin P Chandran Date: Mon, 17 Apr 2023 16:00:28 -0700 Subject: [PATCH 03/38] Adds toast ID to toast api (#3752) * Currently sending the same toast multiple times results in multiple toasts being rendered on the screen. This change allows the toast api to additionally accept an id parameter that * Update changelog * Update src/core/public/notifications/toasts/toasts_api.tsx Issue Resolved: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/2643 Signed-off-by: Ashwin P Chandran Co-authored-by: Josh Romero --------- Signed-off-by: Ashwin P Chandran Co-authored-by: Sean Neumann <1413295+seanneumann@users.noreply.github.com> Co-authored-by: Josh Romero --- CHANGELOG.md | 1 + .../notifications/toasts/toasts_api.test.ts | 23 +++++++++++++++++++ .../notifications/toasts/toasts_api.tsx | 14 ++++++++--- .../application/components/workspace.tsx | 6 ++++- .../utils/state_management/store.ts | 4 ++-- src/plugins/vis_builder/public/plugin.ts | 3 ++- 6 files changed, 44 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 001f9248f2b..92adeabb33a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,6 +73,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Multiple DataSource] Refactor dev tool console to use opensearch-js client to send requests ([#3544](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3544)) - Add `osd-xsrf` header to all requests that incorrectly used `node-version` to satisfy XSRF protection ([#3643](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3643)) - [Data] Add geo shape filter field ([#3605](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3605)) +- [Notifications] Adds id to toast api for deduplication ([#3752](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3752)) - [VisBuilder] Add UI actions handler ([#3732](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3732)) - [Dashboard] Indicate that IE is no longer supported ([#3641](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3641)) - [UI] Add support for comma delimiters in the global filter bar ([#3686](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3686)) diff --git a/src/core/public/notifications/toasts/toasts_api.test.ts b/src/core/public/notifications/toasts/toasts_api.test.ts index ef4f469194d..dacfa98b623 100644 --- a/src/core/public/notifications/toasts/toasts_api.test.ts +++ b/src/core/public/notifications/toasts/toasts_api.test.ts @@ -105,6 +105,24 @@ describe('#get$()', () => { toasts.remove('bar'); expect(onToasts).not.toHaveBeenCalled(); }); + + it('does not emit a new toast list when a toast with the same id is passed to add()', () => { + const toasts = new ToastsApi(toastDeps()); + const onToasts = jest.fn(); + + toasts.get$().subscribe(onToasts); + toasts.add({ + id: 'foo', + title: 'foo', + }); + onToasts.mockClear(); + + toasts.add({ + id: 'foo', + title: 'bar', + }); + expect(onToasts).not.toHaveBeenCalled(); + }); }); describe('#add()', () => { @@ -135,6 +153,11 @@ describe('#add()', () => { const toasts = new ToastsApi(toastDeps()); expect(toasts.add('foo')).toHaveProperty('title', 'foo'); }); + + it('accepts an id and does not auto increment', async () => { + const toasts = new ToastsApi(toastDeps()); + expect(toasts.add({ id: 'foo', title: 'not foo' })).toHaveProperty('id', 'foo'); + }); }); describe('#remove()', () => { diff --git a/src/core/public/notifications/toasts/toasts_api.tsx b/src/core/public/notifications/toasts/toasts_api.tsx index 008c4fb3c50..76d0bf9cf9b 100644 --- a/src/core/public/notifications/toasts/toasts_api.tsx +++ b/src/core/public/notifications/toasts/toasts_api.tsx @@ -42,12 +42,10 @@ import { I18nStart } from '../../i18n'; /** * Allowed fields for {@link ToastInput}. * - * @remarks - * `id` cannot be specified. - * * @public */ export type ToastInputFields = Pick> & { + id?: string; title?: string | MountPoint; text?: string | MountPoint; }; @@ -143,6 +141,16 @@ export class ToastsApi implements IToasts { * @returns a {@link Toast} */ public add(toastOrTitle: ToastInput) { + if (typeof toastOrTitle !== 'string') { + const toastObject = toastOrTitle; + const list = this.toasts$.getValue(); + const existingToast = list.find((toast) => toast.id === toastObject.id); + + if (existingToast) { + return existingToast; + } + } + const toast: Toast = { id: String(this.idCounter++), toastLifeTimeMs: this.uiSettings.get('notifications:lifetime:info'), diff --git a/src/plugins/vis_builder/public/application/components/workspace.tsx b/src/plugins/vis_builder/public/application/components/workspace.tsx index 214a735f6ba..baccd4faf34 100644 --- a/src/plugins/vis_builder/public/application/components/workspace.tsx +++ b/src/plugins/vis_builder/public/application/components/workspace.tsx @@ -56,7 +56,11 @@ export const WorkspaceUI = () => { const err = schemaValidation.errorMsg || aggValidation.errorMsg; - if (err) toasts.addWarning(err); + if (err) + toasts.addWarning({ + id: 'vb_expression_validation', + title: err, + }); return; } diff --git a/src/plugins/vis_builder/public/application/utils/state_management/store.ts b/src/plugins/vis_builder/public/application/utils/state_management/store.ts index f1b1c0eeae2..588c221a50f 100644 --- a/src/plugins/vis_builder/public/application/utils/state_management/store.ts +++ b/src/plugins/vis_builder/public/application/utils/state_management/store.ts @@ -47,9 +47,9 @@ export const getPreloadedStore = async (services: VisBuilderServices) => { }; // the store subscriber will automatically detect changes and call handleChange function - store.subscribe(handleChange); + const unsubscribe = store.subscribe(handleChange); - return store; + return { store, unsubscribe }; }; // Infer the `RootState` and `AppDispatch` types from the store itself diff --git a/src/plugins/vis_builder/public/plugin.ts b/src/plugins/vis_builder/public/plugin.ts index 0c1d569f6be..5744341ab3c 100644 --- a/src/plugins/vis_builder/public/plugin.ts +++ b/src/plugins/vis_builder/public/plugin.ts @@ -163,7 +163,7 @@ export class VisBuilderPlugin }; // Instantiate the store - const store = await getPreloadedStore(services); + const { store, unsubscribe: unsubscribeStore } = await getPreloadedStore(services); const unmount = renderApp(params, services, store); // Render the application @@ -171,6 +171,7 @@ export class VisBuilderPlugin unlistenParentHistory(); unmount(); appUnMounted(); + unsubscribeStore(); }; }, }); From 8b0587e7aa683ebe9a25c4a454ddb117c68d7335 Mon Sep 17 00:00:00 2001 From: sayuree <52072402+sayuree@users.noreply.github.com> Date: Tue, 18 Apr 2023 05:11:43 +0600 Subject: [PATCH 04/38] Add tooltip to help icon (#3626) * Add tooltip to help icon Signed-off-by: sabina.zaripova Add tooltip to menu icon Signed-off-by: sabina.zaripova --- CHANGELOG.md | 1 + .../header/__snapshots__/header.test.tsx.snap | 46 +++++++++++++++++++ .../header_help_menu.test.tsx.snap | 40 ++++++++++++++++ src/core/public/chrome/ui/header/header.tsx | 8 +++- .../chrome/ui/header/header_help_menu.tsx | 8 ++++ 5 files changed, 102 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92adeabb33a..f2c52847d8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -245,6 +245,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [TSVB] Fixes undefined serial diff aggregation documentation link ([#3503](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3503)) - [Console] Fix dev tool console autocomplete not loading issue ([#3775](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3775)) - [Console] Fix dev tool console run command with query parameter error ([#3813](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3813)) +- Add clarifying tooltips to header navigation ([#3573](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3573)) ### ๐Ÿšž Infrastructure diff --git a/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap index c7e883d9b00..6486e207ed3 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap @@ -2798,6 +2798,7 @@ exports[`Header handles visibility and lock changes 1`] = ` > @@ -2842,11 +2843,13 @@ exports[`Header handles visibility and lock changes 1`] = ` > @@ -5416,6 +5419,11 @@ exports[`Header handles visibility and lock changes 1`] = ` size="m" type="questionInCircle" /> + } closePopover={[Function]} @@ -5467,6 +5475,10 @@ exports[`Header handles visibility and lock changes 1`] = ` + @@ -5514,6 +5526,17 @@ exports[`Header handles visibility and lock changes 1`] = ` size="m" /> + + + @@ -8117,6 +8140,7 @@ exports[`Header renders condensed header 1`] = ` > @@ -8161,11 +8185,13 @@ exports[`Header renders condensed header 1`] = ` > @@ -10652,6 +10678,11 @@ exports[`Header renders condensed header 1`] = ` size="m" type="questionInCircle" /> + } closePopover={[Function]} @@ -10703,6 +10734,10 @@ exports[`Header renders condensed header 1`] = ` + @@ -10750,6 +10785,17 @@ exports[`Header renders condensed header 1`] = ` size="m" /> + + + diff --git a/src/core/public/chrome/ui/header/__snapshots__/header_help_menu.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/header_help_menu.test.tsx.snap index 835c2d8d4a4..5406fbf6aba 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/header_help_menu.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/header_help_menu.test.tsx.snap @@ -1626,6 +1626,11 @@ exports[`Header help menu hides survey link 1`] = ` size="m" type="questionInCircle" /> + } closePopover={[Function]} @@ -1677,6 +1682,10 @@ exports[`Header help menu hides survey link 1`] = ` + @@ -1724,6 +1733,17 @@ exports[`Header help menu hides survey link 1`] = ` size="m" /> + + + @@ -3782,6 +3802,11 @@ exports[`Header help menu renders survey link 1`] = ` size="m" type="questionInCircle" /> + } closePopover={[Function]} @@ -3833,6 +3858,10 @@ exports[`Header help menu renders survey link 1`] = ` + @@ -3880,6 +3909,17 @@ exports[`Header help menu renders survey link 1`] = ` size="m" /> + + + diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index 917d1ebd4c4..a78371f4f26 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -173,7 +173,13 @@ export function Header({ aria-controls={navId} ref={toggleCollapsibleNavRef} > - + diff --git a/src/core/public/chrome/ui/header/header_help_menu.tsx b/src/core/public/chrome/ui/header/header_help_menu.tsx index 6f536184edc..f0be769937f 100644 --- a/src/core/public/chrome/ui/header/header_help_menu.tsx +++ b/src/core/public/chrome/ui/header/header_help_menu.tsx @@ -331,6 +331,14 @@ class HeaderHelpMenuUI extends Component { onClick={this.onMenuButtonClick} > + ); From d110fc69f4e431c6b3f4adda7e3578acd6a64080 Mon Sep 17 00:00:00 2001 From: Kawika Avilla Date: Mon, 17 Apr 2023 17:08:36 -0700 Subject: [PATCH 05/38] [Dashboards Listing] Fix edit button (#3862) Fixes the edit button by not adding the base path to the URL when the route continues from the dashboards path. Also re-add `addBasePath` to the interface defined by RenderDeps as before it was removed since we navigated away from using it but was missed in reverting back to the original implementation. Issue Resolved: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3861 Signed-off-by: Kawika Avilla --- src/plugins/dashboard/public/application/application.ts | 1 + src/plugins/dashboard/public/application/legacy_app.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/dashboard/public/application/application.ts b/src/plugins/dashboard/public/application/application.ts index e527565b3c4..f29b1bd9180 100644 --- a/src/plugins/dashboard/public/application/application.ts +++ b/src/plugins/dashboard/public/application/application.ts @@ -81,6 +81,7 @@ export interface RenderDeps { }; uiSettings: IUiSettingsClient; chrome: ChromeStart; + addBasePath: (path: string) => string; savedQueryService: DataPublicPluginStart['query']['savedQueries']; embeddable: EmbeddableStart; localStorage: Storage; diff --git a/src/plugins/dashboard/public/application/legacy_app.js b/src/plugins/dashboard/public/application/legacy_app.js index b6895814327..027f65591bd 100644 --- a/src/plugins/dashboard/public/application/legacy_app.js +++ b/src/plugins/dashboard/public/application/legacy_app.js @@ -165,7 +165,7 @@ export function initDashboardApp(app, deps) { }; $scope.editItem = ({ editUrl }) => { - history.push(deps.addBasePath(editUrl)); + history.push(editUrl); }; $scope.viewItem = ({ viewUrl }) => { history.push(deps.addBasePath(viewUrl)); From ee32d201d48595efefc922384a8f1f7aee5609fa Mon Sep 17 00:00:00 2001 From: Ashwin P Chandran Date: Mon, 17 Apr 2023 17:48:40 -0700 Subject: [PATCH 06/38] [VisBuilder] Adds UIState to vis, adds index patterns to embeddable, bug fixes (#3751) * adds uiActions to visBuilder * prevents multiple errors on load * fixes visbuilder type errors * fixes save * adds ui state to vis builder * fixes tests * Adds support in embeddables for multiple indices * Moves ui state to separate slice * Adds changelog Signed-off-by: Ashwin P Chandran --------- Signed-off-by: Ashwin P Chandran Co-authored-by: Josh Romero --- CHANGELOG.md | 2 + .../vis_builder_saved_object_attributes.ts | 1 + .../application/components/right_nav.tsx | 2 +- .../application/components/workspace.tsx | 25 ++++++-- .../public/application/utils/schema.json | 63 ++++++++++++------- .../utils/state_management/metadata_slice.ts | 2 +- .../utils/state_management/preload.ts | 3 + .../redux_persistence.test.tsx | 2 + .../state_management/redux_persistence.ts | 7 +-- .../utils/state_management/store.ts | 4 ++ .../utils/state_management/ui_state_slice.ts | 42 +++++++++++++ .../utils/use/use_saved_vis_builder_vis.ts | 10 ++- .../embeddable/vis_builder_embeddable.tsx | 45 ++++++++++--- .../vis_builder_embeddable_factory.tsx | 28 +++++---- src/plugins/vis_builder/public/plugin.ts | 9 ++- .../public/saved_visualizations/_saved_vis.ts | 4 +- .../saved_visualizations/transforms.test.ts | 6 +- .../public/saved_visualizations/transforms.ts | 7 ++- src/plugins/vis_builder/public/types.ts | 1 + .../server/saved_objects/vis_builder_app.ts | 4 ++ 20 files changed, 207 insertions(+), 60 deletions(-) create mode 100644 src/plugins/vis_builder/public/application/utils/state_management/ui_state_slice.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index f2c52847d8b..2f49d62513d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Multiple DataSource] Allow create and distinguish index pattern with same name but from different datasources ([#3571](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3571)) - [Multiple DataSource] Integrate multiple datasource with dev tool console ([#3754](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3754)) - Add satisfaction survey link to help menu ([#3676] (https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3676)) +- [Vis Builder] Add persistence to visualizations inner state ([#3751](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3751)) - [Table Visualization] Move format table, consolidate types and add unit tests ([#3397](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3397)) ### ๐Ÿ› Bug Fixes @@ -126,6 +127,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [VisBuilder] Fix multiple warnings thrown on page load ([#3732](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3732)) - [VisBuilder] Fix Firefox legend selection issue ([#3732](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3732)) - [VisBuilder] Fix type errors ([#3732](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3732)) +- [VisBuilder] Fix indexpattern selection in filter bar ([#3751](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3751)) - [Table Visualization] Fix table rendering empty unused space ([#3797](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3797)) - [Table Visualization] Fix data table not adjusting height on the initial load ([#3816](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3816)) - Cleanup unused url ([#3847](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3847)) diff --git a/src/plugins/vis_builder/common/vis_builder_saved_object_attributes.ts b/src/plugins/vis_builder/common/vis_builder_saved_object_attributes.ts index 243e455d715..3e157f9bf6d 100644 --- a/src/plugins/vis_builder/common/vis_builder_saved_object_attributes.ts +++ b/src/plugins/vis_builder/common/vis_builder_saved_object_attributes.ts @@ -13,6 +13,7 @@ export interface VisBuilderSavedObjectAttributes extends SavedObjectAttributes { visualizationState?: string; updated_at?: string; styleState?: string; + uiState?: string; version: number; searchSourceFields?: { index?: string; diff --git a/src/plugins/vis_builder/public/application/components/right_nav.tsx b/src/plugins/vis_builder/public/application/components/right_nav.tsx index 5d3f298c6bf..fde4f3110d1 100644 --- a/src/plugins/vis_builder/public/application/components/right_nav.tsx +++ b/src/plugins/vis_builder/public/application/components/right_nav.tsx @@ -122,6 +122,6 @@ const OptionItem = ({ icon, title }: { icon: IconType; title: string }) => ( ); -// The app uses EuiResizableContainer that triggers a rerender for ever mouseover action. +// The app uses EuiResizableContainer that triggers a rerender for every mouseover action. // To prevent this child component from unnecessarily rerendering in that instance, it needs to be memoized export const RightNav = React.memo(RightNavUI); diff --git a/src/plugins/vis_builder/public/application/components/workspace.tsx b/src/plugins/vis_builder/public/application/components/workspace.tsx index baccd4faf34..31880e93bb7 100644 --- a/src/plugins/vis_builder/public/application/components/workspace.tsx +++ b/src/plugins/vis_builder/public/application/components/workspace.tsx @@ -10,7 +10,7 @@ import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react import { IExpressionLoaderParams } from '../../../../expressions/public'; import { VisBuilderServices } from '../../types'; import { validateSchemaState, validateAggregations } from '../utils/validations'; -import { useTypedSelector } from '../utils/state_management'; +import { useTypedDispatch, useTypedSelector, setUIStateState } from '../utils/state_management'; import { useAggs, useVisualizationType } from '../utils/use'; import { PersistedState } from '../../../../visualizations/public'; @@ -39,8 +39,25 @@ export const WorkspaceUI = () => { timeRange: data.query.timefilter.timefilter.getTime(), }); const rootState = useTypedSelector((state) => state); - // Visualizations require the uiState to persist even when the expression changes - const uiState = useMemo(() => new PersistedState(), []); + const dispatch = useTypedDispatch(); + // Visualizations require the uiState object to persist even when the expression changes + // eslint-disable-next-line react-hooks/exhaustive-deps + const uiState = useMemo(() => new PersistedState(rootState.ui), []); + + useEffect(() => { + if (rootState.metadata.editor.state === 'loaded') { + uiState.setSilent(rootState.ui); + } + // To update uiState once saved object data is loaded + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [rootState.metadata.editor.state, uiState]); + + useEffect(() => { + uiState.on('change', (args) => { + // Store changes to UI state + dispatch(setUIStateState(uiState.toJSON())); + }); + }, [dispatch, uiState]); useEffect(() => { async function loadExpression() { @@ -137,6 +154,6 @@ export const WorkspaceUI = () => { ); }; -// The app uses EuiResizableContainer that triggers a rerender for ever mouseover action. +// The app uses EuiResizableContainer that triggers a rerender for every mouseover action. // To prevent this child component from unnecessarily rerendering in that instance, it needs to be memoized export const Workspace = React.memo(WorkspaceUI); diff --git a/src/plugins/vis_builder/public/application/utils/schema.json b/src/plugins/vis_builder/public/application/utils/schema.json index 9effed97b2b..7cf8bbc2534 100644 --- a/src/plugins/vis_builder/public/application/utils/schema.json +++ b/src/plugins/vis_builder/public/application/utils/schema.json @@ -1,28 +1,47 @@ { - "type": "object", - "properties": { - "styleState": { - "type": "object" - }, - "visualizationState": { - "type": "object", - "properties": { - "activeVisualization": { - "type": "object", - "properties": { - "name": { "type": "string" }, - "aggConfigParams": { "type": "array" } + "type": "object", + "properties": { + "styleState": { + "type": "object" + }, + "visualizationState": { + "type": "object", + "properties": { + "activeVisualization": { + "type": "object", + "properties": { + "name": { + "type": "string" }, - "required": ["name", "aggConfigParams"], - "additionalProperties": false + "aggConfigParams": { + "type": "array" + } }, - "indexPattern": { "type": "string" }, - "searchField": { "type": "string" } + "required": [ + "name", + "aggConfigParams" + ], + "additionalProperties": false }, - "required": ["searchField"], - "additionalProperties": false - } + "indexPattern": { + "type": "string" + }, + "searchField": { + "type": "string" + } + }, + "required": [ + "searchField" + ], + "additionalProperties": false }, - "required": ["styleState", "visualizationState"], - "additionalProperties": false + "uiState": { + "type": "object" + } + }, + "required": [ + "styleState", + "visualizationState" + ], + "additionalProperties": false } \ No newline at end of file diff --git a/src/plugins/vis_builder/public/application/utils/state_management/metadata_slice.ts b/src/plugins/vis_builder/public/application/utils/state_management/metadata_slice.ts index 05ceb324aaa..880c15f3e44 100644 --- a/src/plugins/vis_builder/public/application/utils/state_management/metadata_slice.ts +++ b/src/plugins/vis_builder/public/application/utils/state_management/metadata_slice.ts @@ -11,7 +11,7 @@ import { VisBuilderServices } from '../../../types'; * Clean state: when viz finished loading and ready to be edited * Dirty state: when there are changes applied to the viz after it finished loading */ -type EditorState = 'loading' | 'clean' | 'dirty'; +type EditorState = 'loading' | 'loaded' | 'clean' | 'dirty'; export interface MetadataState { editor: { diff --git a/src/plugins/vis_builder/public/application/utils/state_management/preload.ts b/src/plugins/vis_builder/public/application/utils/state_management/preload.ts index 43aa2e7b8ed..f7a0f6bd7ad 100644 --- a/src/plugins/vis_builder/public/application/utils/state_management/preload.ts +++ b/src/plugins/vis_builder/public/application/utils/state_management/preload.ts @@ -8,6 +8,7 @@ import { VisBuilderServices } from '../../..'; import { getPreloadedState as getPreloadedStyleState } from './style_slice'; import { getPreloadedState as getPreloadedVisualizationState } from './visualization_slice'; import { getPreloadedState as getPreloadedMetadataState } from './metadata_slice'; +import { getPreloadedState as getPreloadedUIState } from './ui_state_slice'; import { RootState } from './store'; export const getPreloadedState = async ( @@ -16,10 +17,12 @@ export const getPreloadedState = async ( const styleState = await getPreloadedStyleState(services); const visualizationState = await getPreloadedVisualizationState(services); const metadataState = await getPreloadedMetadataState(services); + const uiState = await getPreloadedUIState(services); return { style: styleState, visualization: visualizationState, metadata: metadataState, + ui: uiState, }; }; diff --git a/src/plugins/vis_builder/public/application/utils/state_management/redux_persistence.test.tsx b/src/plugins/vis_builder/public/application/utils/state_management/redux_persistence.test.tsx index 91f760bbf23..a46d5c02765 100644 --- a/src/plugins/vis_builder/public/application/utils/state_management/redux_persistence.test.tsx +++ b/src/plugins/vis_builder/public/application/utils/state_management/redux_persistence.test.tsx @@ -18,6 +18,7 @@ describe('test redux state persistence', () => { style: 'style', visualization: 'visualization', metadata: 'metadata', + ui: 'ui', }; }); @@ -33,6 +34,7 @@ describe('test redux state persistence', () => { editor: { errors: {}, state: 'loading' }, originatingApp: undefined, }, + ui: {}, }; const returnStates = await loadReduxState(mockServices); diff --git a/src/plugins/vis_builder/public/application/utils/state_management/redux_persistence.ts b/src/plugins/vis_builder/public/application/utils/state_management/redux_persistence.ts index a531986a9ac..3ebfa47268e 100644 --- a/src/plugins/vis_builder/public/application/utils/state_management/redux_persistence.ts +++ b/src/plugins/vis_builder/public/application/utils/state_management/redux_persistence.ts @@ -12,22 +12,21 @@ export const loadReduxState = async (services: VisBuilderServices) => { const serializedState = services.osdUrlStateStorage.get('_a'); if (serializedState !== null) return serializedState; } catch (err) { - /* eslint-disable no-console */ + // eslint-disable-next-line no-console console.error(err); - /* eslint-enable no-console */ } return await getPreloadedState(services); }; export const persistReduxState = ( - { style, visualization, metadata }, + { style, visualization, metadata, ui }: RootState, services: VisBuilderServices ) => { try { services.osdUrlStateStorage.set( '_a', - { style, visualization, metadata }, + { style, visualization, metadata, ui }, { replace: true, } diff --git a/src/plugins/vis_builder/public/application/utils/state_management/store.ts b/src/plugins/vis_builder/public/application/utils/state_management/store.ts index 588c221a50f..8fe5c23fd65 100644 --- a/src/plugins/vis_builder/public/application/utils/state_management/store.ts +++ b/src/plugins/vis_builder/public/application/utils/state_management/store.ts @@ -8,12 +8,14 @@ import { isEqual } from 'lodash'; import { reducer as styleReducer } from './style_slice'; import { reducer as visualizationReducer } from './visualization_slice'; import { reducer as metadataReducer } from './metadata_slice'; +import { reducer as uiStateReducer } from './ui_state_slice'; import { VisBuilderServices } from '../../..'; import { loadReduxState, persistReduxState } from './redux_persistence'; import { handlerEditorState } from './handlers/editor_state'; import { handlerParentAggs } from './handlers/parent_aggs'; const rootReducer = combineReducers({ + ui: uiStateReducer, style: styleReducer, visualization: visualizationReducer, metadata: metadataReducer, @@ -60,3 +62,5 @@ export type AppDispatch = Store['dispatch']; export { setState as setStyleState, StyleState } from './style_slice'; export { setState as setVisualizationState, VisualizationState } from './visualization_slice'; +export { MetadataState } from './metadata_slice'; +export { setState as setUIStateState, UIStateState } from './ui_state_slice'; diff --git a/src/plugins/vis_builder/public/application/utils/state_management/ui_state_slice.ts b/src/plugins/vis_builder/public/application/utils/state_management/ui_state_slice.ts new file mode 100644 index 00000000000..826fe9d9873 --- /dev/null +++ b/src/plugins/vis_builder/public/application/utils/state_management/ui_state_slice.ts @@ -0,0 +1,42 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import { VisBuilderServices } from '../../../types'; + +export type UIStateState = T; + +const initialState = {} as UIStateState; + +export const getPreloadedState = async ({ + types, + data, +}: VisBuilderServices): Promise => { + return initialState; +}; + +export const uiStateSlice = createSlice({ + name: 'ui', + initialState, + reducers: { + setState(state: T, action: PayloadAction>) { + return action.payload; + }, + updateState(state: T, action: PayloadAction>>) { + state = { + ...state, + ...action.payload, + }; + }, + }, +}); + +// Exposing the state functions as generics +export const setState = uiStateSlice.actions.setState as (payload: T) => PayloadAction; +export const updateState = uiStateSlice.actions.updateState as ( + payload: Partial +) => PayloadAction>; + +export const { reducer } = uiStateSlice; diff --git a/src/plugins/vis_builder/public/application/utils/use/use_saved_vis_builder_vis.ts b/src/plugins/vis_builder/public/application/utils/use/use_saved_vis_builder_vis.ts index 604c90a25cc..44ffbaf7595 100644 --- a/src/plugins/vis_builder/public/application/utils/use/use_saved_vis_builder_vis.ts +++ b/src/plugins/vis_builder/public/application/utils/use/use_saved_vis_builder_vis.ts @@ -14,7 +14,12 @@ import { import { EDIT_PATH, PLUGIN_ID } from '../../../../common'; import { VisBuilderServices } from '../../../types'; import { getCreateBreadcrumbs, getEditBreadcrumbs } from '../breadcrumbs'; -import { useTypedDispatch, setStyleState, setVisualizationState } from '../state_management'; +import { + useTypedDispatch, + setStyleState, + setVisualizationState, + setUIStateState, +} from '../state_management'; import { useOpenSearchDashboards } from '../../../../../opensearch_dashboards_react/public'; import { setEditorState } from '../state_management/metadata_slice'; import { getStateFromSavedObject } from '../../../saved_visualizations/transforms'; @@ -46,6 +51,7 @@ export const useSavedVisBuilderVis = (visualizationIdFromUrl: string | undefined const loadSavedVisBuilderVis = async () => { try { + dispatch(setEditorState({ state: 'loading' })); const savedVisBuilderVis = await getSavedVisBuilderVis( savedVisBuilderLoader, visualizationIdFromUrl @@ -56,8 +62,10 @@ export const useSavedVisBuilderVis = (visualizationIdFromUrl: string | undefined chrome.setBreadcrumbs(getEditBreadcrumbs(title, navigateToApp)); chrome.docTitle.change(title); + dispatch(setUIStateState(state.ui)); dispatch(setStyleState(state.style)); dispatch(setVisualizationState(state.visualization)); + dispatch(setEditorState({ state: 'loaded' })); } else { chrome.setBreadcrumbs(getCreateBreadcrumbs(navigateToApp)); } diff --git a/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable.tsx b/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable.tsx index 7142c9c3c0c..a931877ffe6 100644 --- a/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable.tsx +++ b/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable.tsx @@ -22,6 +22,7 @@ import { } from '../../../expressions/public'; import { Filter, + IIndexPattern, opensearchFilters, Query, TimefilterContract, @@ -37,20 +38,23 @@ import { import { PersistedState } from '../../../visualizations/public'; import { VisBuilderSavedVis } from '../saved_visualizations/transforms'; import { handleVisEvent } from '../application/utils/handle_vis_event'; +import { VisBuilderEmbeddableFactoryDeps } from './vis_builder_embeddable_factory'; // Apparently this needs to match the saved object type for the clone and replace panel actions to work export const VISBUILDER_EMBEDDABLE = VISBUILDER_SAVED_OBJECT; export interface VisBuilderEmbeddableConfiguration { savedVis: VisBuilderSavedVis; - // TODO: add indexPatterns as part of configuration - // indexPatterns?: IIndexPattern[]; + indexPatterns?: IIndexPattern[]; editPath: string; editUrl: string; editable: boolean; + deps: VisBuilderEmbeddableFactoryDeps; } -export type VisBuilderInput = SavedObjectEmbeddableInput; +export interface VisBuilderInput extends SavedObjectEmbeddableInput { + uiState?: any; +} export interface VisBuilderOutput extends EmbeddableOutput { /** @@ -58,11 +62,12 @@ export interface VisBuilderOutput extends EmbeddableOutput { * `input.savedObjectId`. If the id is invalid, this may be undefined. */ savedVis?: VisBuilderSavedVis; + indexPatterns?: IIndexPattern[]; } type ExpressionLoader = InstanceType; -export class VisBuilderEmbeddable extends Embeddable { +export class VisBuilderEmbeddable extends Embeddable { public readonly type = VISBUILDER_EMBEDDABLE; private handler?: ExpressionLoader; private timeRange?: TimeRange; @@ -75,11 +80,19 @@ export class VisBuilderEmbeddable extends Embeddable s.unsubscribe()); + this.uiState.off('change', this.uiStateChangeHandler); + this.uiState.off('reload', this.reload); if (this.node) { ReactDOM.unmountComponentAtNode(this.node); } @@ -249,6 +268,7 @@ export class VisBuilderEmbeddable extends Embeddable { + this.updateInput({ + uiState: this.uiState.toJSON(), + }); + }; + + private transferInputToUiState = () => { + if (JSON.stringify(this.input.uiState) !== this.uiState.toString()) + this.uiState.set(this.input.uiState); + }; + // TODO: we may eventually need to add support for visualizations that use triggers like filter or brush, but current VisBuilder vis types don't support triggers // public supportedTriggers(): TriggerId[] { // return this.visType.getSupportedTriggers?.() ?? []; diff --git a/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable_factory.tsx b/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable_factory.tsx index f80ad18ee36..90048ba9132 100644 --- a/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable_factory.tsx +++ b/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable_factory.tsx @@ -5,7 +5,6 @@ import { i18n } from '@osd/i18n'; import { - EmbeddableFactory, EmbeddableFactoryDefinition, EmbeddableOutput, ErrorEmbeddable, @@ -35,16 +34,14 @@ import { getTimeFilter, getUISettings, } from '../plugin_services'; +import { StartServicesGetter } from '../../../opensearch_dashboards_utils/public'; +import { VisBuilderPluginStartDependencies } from '../types'; -// TODO: use or remove? -export type VisBuilderEmbeddableFactory = EmbeddableFactory< - SavedObjectEmbeddableInput, - VisBuilderOutput | EmbeddableOutput, - VisBuilderEmbeddable | DisabledEmbeddable, - VisBuilderSavedObjectAttributes ->; +export interface VisBuilderEmbeddableFactoryDeps { + start: StartServicesGetter; +} -export class VisBuilderEmbeddableFactoryDefinition +export class VisBuilderEmbeddableFactory implements EmbeddableFactoryDefinition< SavedObjectEmbeddableInput, @@ -62,7 +59,7 @@ export class VisBuilderEmbeddableFactoryDefinition }; // TODO: Would it be better to explicitly declare start service dependencies? - constructor() {} + constructor(private readonly deps: VisBuilderEmbeddableFactoryDeps) {} public canCreateNew() { // Because VisBuilder creation starts with the visualization modal, no need to have a separate entry for VisBuilder until it's separate @@ -90,13 +87,22 @@ export class VisBuilderEmbeddableFactoryDefinition return new DisabledEmbeddable(PLUGIN_NAME, input); } + const savedVis = getStateFromSavedObject(savedObject); + const indexPatternService = this.deps.start().plugins.data.indexPatterns; + const indexPattern = await indexPatternService.get( + savedVis.state.visualization.indexPattern || '' + ); + const indexPatterns = indexPattern ? [indexPattern] : []; + return new VisBuilderEmbeddable( getTimeFilter(), { - savedVis: getStateFromSavedObject(savedObject), + savedVis, editUrl, editPath, editable: true, + deps: this.deps, + indexPatterns, }, { ...input, diff --git a/src/plugins/vis_builder/public/plugin.ts b/src/plugins/vis_builder/public/plugin.ts index 5744341ab3c..1445de92301 100644 --- a/src/plugins/vis_builder/public/plugin.ts +++ b/src/plugins/vis_builder/public/plugin.ts @@ -23,7 +23,7 @@ import { VisBuilderSetup, VisBuilderStart, } from './types'; -import { VisBuilderEmbeddableFactoryDefinition, VISBUILDER_EMBEDDABLE } from './embeddable'; +import { VisBuilderEmbeddableFactory, VISBUILDER_EMBEDDABLE } from './embeddable'; import visBuilderIconSecondaryFill from './assets/vis_builder_icon_secondary_fill.svg'; import visBuilderIcon from './assets/vis_builder_icon.svg'; import { @@ -54,6 +54,7 @@ import { ConfigSchema } from '../config'; import { createOsdUrlStateStorage, createOsdUrlTracker, + createStartServicesGetter, withNotifyOnErrors, } from '../../opensearch_dashboards_utils/public'; import { opensearchFilters } from '../../data/public'; @@ -177,10 +178,8 @@ export class VisBuilderPlugin }); // Register embeddable - // TODO: investigate simplification via getter a la visualizations: - // const start = createStartServicesGetter(core.getStartServices)); - // const embeddableFactory = new VisBuilderEmbeddableFactoryDefinition({ start }); - const embeddableFactory = new VisBuilderEmbeddableFactoryDefinition(); + const start = createStartServicesGetter(core.getStartServices); + const embeddableFactory = new VisBuilderEmbeddableFactory({ start }); embeddable.registerEmbeddableFactory(VISBUILDER_EMBEDDABLE, embeddableFactory); // Register the plugin as an alias to create visualization diff --git a/src/plugins/vis_builder/public/saved_visualizations/_saved_vis.ts b/src/plugins/vis_builder/public/saved_visualizations/_saved_vis.ts index 53ccc7a9d7d..021af777df1 100644 --- a/src/plugins/vis_builder/public/saved_visualizations/_saved_vis.ts +++ b/src/plugins/vis_builder/public/saved_visualizations/_saved_vis.ts @@ -22,6 +22,7 @@ export function createSavedVisBuilderVisClass(services: SavedObjectOpenSearchDas description: 'text', visualizationState: 'text', styleState: 'text', + uiState: 'text', version: 'integer', }; @@ -44,7 +45,8 @@ export function createSavedVisBuilderVisClass(services: SavedObjectOpenSearchDas description: '', visualizationState: '{}', styleState: '{}', - version: 2, + uiState: '{}', + version: 3, }, }); this.showInRecentlyAccessed = true; diff --git a/src/plugins/vis_builder/public/saved_visualizations/transforms.test.ts b/src/plugins/vis_builder/public/saved_visualizations/transforms.test.ts index efbcfd23f79..68c24dfe4af 100644 --- a/src/plugins/vis_builder/public/saved_visualizations/transforms.test.ts +++ b/src/plugins/vis_builder/public/saved_visualizations/transforms.test.ts @@ -25,7 +25,7 @@ describe('transforms', () => { savedObject = {} as VisBuilderSavedObject; rootState = { metadata: { editor: { state: 'loading', errors: {} } }, - style: '', + style: {}, visualization: { searchField: '', indexPattern: TEST_INDEX_PATTERN_ID, @@ -34,6 +34,7 @@ describe('transforms', () => { aggConfigParams: [], }, }, + ui: {}, }; indexPattern = getStubIndexPattern( TEST_INDEX_PATTERN_ID, @@ -49,6 +50,7 @@ describe('transforms', () => { expect(savedObject.visualizationState).not.toContain(TEST_INDEX_PATTERN_ID); expect(savedObject.styleState).toEqual(JSON.stringify(rootState.style)); + expect(savedObject.uiState).toEqual(JSON.stringify(rootState.ui)); expect(savedObject.searchSourceFields?.index?.id).toEqual(TEST_INDEX_PATTERN_ID); }); @@ -69,6 +71,7 @@ describe('transforms', () => { visualizationState: JSON.stringify({ searchField: '', }), + uiState: '{}', searchSourceFields: { index: 'test-index', }, @@ -80,6 +83,7 @@ describe('transforms', () => { expect(state).toMatchInlineSnapshot(` Object { "style": Object {}, + "ui": Object {}, "visualization": Object { "indexPattern": "test-index", "searchField": "", diff --git a/src/plugins/vis_builder/public/saved_visualizations/transforms.ts b/src/plugins/vis_builder/public/saved_visualizations/transforms.ts index 0a7a6e529a6..9f8dd705e3e 100644 --- a/src/plugins/vis_builder/public/saved_visualizations/transforms.ts +++ b/src/plugins/vis_builder/public/saved_visualizations/transforms.ts @@ -27,6 +27,7 @@ export const saveStateToSavedObject = ( ); obj.styleState = JSON.stringify(state.style); obj.searchSourceFields = { index: indexPattern }; + obj.uiState = JSON.stringify(state.ui); return obj; }; @@ -40,7 +41,8 @@ export const getStateFromSavedObject = ( obj: VisBuilderSavedObjectAttributes ): VisBuilderSavedVis => { const { id, title, description } = obj; - const styleState = JSON.parse(obj.styleState || ''); + const styleState = JSON.parse(obj.styleState || '{}'); + const uiState = JSON.parse(obj.uiState || '{}'); const vizStateWithoutIndex = JSON.parse(obj.visualizationState || ''); const visualizationState: VisualizationState = { searchField: '', @@ -48,7 +50,7 @@ export const getStateFromSavedObject = ( indexPattern: obj.searchSourceFields?.index, }; - const validateResult = validateVisBuilderState({ styleState, visualizationState }); + const validateResult = validateVisBuilderState({ styleState, visualizationState, uiState }); if (!validateResult.valid) { throw new InvalidJSONProperty( @@ -75,6 +77,7 @@ export const getStateFromSavedObject = ( state: { visualization: visualizationState, style: styleState, + ui: uiState, }, }; }; diff --git a/src/plugins/vis_builder/public/types.ts b/src/plugins/vis_builder/public/types.ts index 5221a1c513e..1ba8843e016 100644 --- a/src/plugins/vis_builder/public/types.ts +++ b/src/plugins/vis_builder/public/types.ts @@ -62,6 +62,7 @@ export interface ISavedVis { description?: string; visualizationState?: string; styleState?: string; + uiState?: string; version?: number; } diff --git a/src/plugins/vis_builder/server/saved_objects/vis_builder_app.ts b/src/plugins/vis_builder/server/saved_objects/vis_builder_app.ts index 15d785b3b45..029557010be 100644 --- a/src/plugins/vis_builder/server/saved_objects/vis_builder_app.ts +++ b/src/plugins/vis_builder/server/saved_objects/vis_builder_app.ts @@ -46,6 +46,10 @@ export const visBuilderSavedObjectType: SavedObjectsType = { type: 'text', index: false, }, + uiState: { + type: 'text', + index: false, + }, version: { type: 'integer' }, // Need to add a kibanaSavedObjectMeta attribute here to follow the current saved object flow // When we save a saved object, the saved object plugin will extract the search source into two parts From 9d270234378dc06c51939b8d115beb6082c46e3b Mon Sep 17 00:00:00 2001 From: Peter Fitzgibbons Date: Tue, 18 Apr 2023 03:06:59 -0700 Subject: [PATCH 07/38] [FIX] Dashboard list integrated delete (#3796) * [FIx] Dashboard-List Integrated Delete Signed-off-by: Peter Fitzgibbons * Add toast notification on deletion error Signed-off-by: Josh Romero * add toast notification dependency Signed-off-by: Josh Romero --------- Signed-off-by: Peter Fitzgibbons Signed-off-by: Josh Romero Co-authored-by: Peter Fitzgibbons Co-authored-by: Josh Romero --- .../dashboard/public/application/application.ts | 2 ++ .../dashboard/public/application/legacy_app.js | 14 ++++++++++++-- src/plugins/dashboard/public/plugin.tsx | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/plugins/dashboard/public/application/application.ts b/src/plugins/dashboard/public/application/application.ts index f29b1bd9180..35899cddf69 100644 --- a/src/plugins/dashboard/public/application/application.ts +++ b/src/plugins/dashboard/public/application/application.ts @@ -37,6 +37,7 @@ import 'angular-sanitize'; import { i18nDirective, i18nFilter, I18nProvider } from '@osd/i18n/angular'; import { ChromeStart, + ToastsStart, IUiSettingsClient, CoreStart, SavedObjectsClientContract, @@ -93,6 +94,7 @@ export interface RenderDeps { setHeaderActionMenu: AppMountParameters['setHeaderActionMenu']; savedObjects: SavedObjectsStart; restorePreviousUrl: () => void; + toastNotifications: ToastsStart; } let angularModuleInstance: IModule | null = null; diff --git a/src/plugins/dashboard/public/application/legacy_app.js b/src/plugins/dashboard/public/application/legacy_app.js index 027f65591bd..3ed961e5404 100644 --- a/src/plugins/dashboard/public/application/legacy_app.js +++ b/src/plugins/dashboard/public/application/legacy_app.js @@ -114,7 +114,6 @@ export function initDashboardApp(app, deps) { deps.core.chrome.docTitle.change( i18n.translate('dashboard.dashboardPageTitle', { defaultMessage: 'Dashboards' }) ); - const service = deps.savedDashboards; const dashboardConfig = deps.dashboardConfig; // syncs `_g` portion of url with query services @@ -171,7 +170,18 @@ export function initDashboardApp(app, deps) { history.push(deps.addBasePath(viewUrl)); }; $scope.delete = (dashboards) => { - return service.delete(dashboards.map((d) => d.id)); + const ids = dashboards.map((d) => ({ id: d.id, appId: d.appId })); + return Promise.all( + ids.map(({ id, appId }) => { + return deps.savedObjectsClient.delete(appId, id); + }) + ).catch((error) => { + deps.toastNotifications.addError(error, { + title: i18n.translate('dashboard.dashboardListingDeleteErrorTitle', { + defaultMessage: 'Error deleting dashboard', + }), + }); + }); }; $scope.hideWriteControls = dashboardConfig.getHideWriteControls(); $scope.initialFilter = parse(history.location.search).filter || EMPTY_FILTER; diff --git a/src/plugins/dashboard/public/plugin.tsx b/src/plugins/dashboard/public/plugin.tsx index 56388cfc64e..87f93492589 100644 --- a/src/plugins/dashboard/public/plugin.tsx +++ b/src/plugins/dashboard/public/plugin.tsx @@ -344,7 +344,7 @@ export class DashboardPlugin registerDashboardProvider({ savedObjectsType: 'dashboard', savedObjectsName: 'Dashboard', - appId: 'dashboards', + appId: 'dashboard', viewUrlPathFn: (obj) => `#/view/${obj.id}`, editUrlPathFn: (obj) => `/view/${obj.id}?_a=(viewMode:edit)`, createUrl: core.http.basePath.prepend('/app/dashboards#/create'), From 712a42fee9f8606b5e3b4fceb3164f948a87dce0 Mon Sep 17 00:00:00 2001 From: Ashwin P Chandran Date: Wed, 19 Apr 2023 00:40:41 -0700 Subject: [PATCH 08/38] Bump OUI to 1.1.1 (#3884) * chore(OUI): bump OUI to 1.1.0 Signed-off-by: Josh Romero * bootstrap and update yarn.lock Signed-off-by: Josh Romero * add changelog Signed-off-by: Josh Romero * update snapshot Signed-off-by: Josh Romero * updates to OUI to 1.1.1 Signed-off-by: Ashwin P Chandran * Update CHANGELOG.md Signed-off-by: Ashwin P Chandran * test cache fixes Signed-off-by: Ashwin P Chandran * test cache fixes Signed-off-by: Ashwin P Chandran * reenable ci tests Signed-off-by: Ashwin P Chandran --------- Signed-off-by: Josh Romero Signed-off-by: Ashwin P Chandran Co-authored-by: Josh Romero --- .github/workflows/build_and_test_workflow.yml | 11 ----------- CHANGELOG.md | 1 + package.json | 2 +- packages/osd-ui-framework/package.json | 2 +- packages/osd-ui-shared-deps/package.json | 2 +- .../__snapshots__/update_password_modal.test.tsx.snap | 4 ++-- .../plugins/osd_tp_run_pipeline/package.json | 2 +- .../plugins/osd_sample_panel_action/package.json | 2 +- .../plugins/osd_tp_custom_visualizations/package.json | 2 +- yarn.lock | 8 ++++---- 10 files changed, 13 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build_and_test_workflow.yml b/.github/workflows/build_and_test_workflow.yml index 5daef79cc8b..fd4cdbbefa7 100644 --- a/.github/workflows/build_and_test_workflow.yml +++ b/.github/workflows/build_and_test_workflow.yml @@ -343,17 +343,6 @@ jobs: npm i -g yarn@1.22.10 yarn config set network-timeout 1000000 -g - - name: Configure Yarn Cache - run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV - - - name: Initialize Yarn Cache - uses: actions/cache@v3 - with: - path: ${{ env.YARN_CACHE_LOCATION }} - key: yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - yarn- - - name: Get package version run: | echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f49d62513d..fb7c3fd8732 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -181,6 +181,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Remove the unused `renovate.json5` file ([3489](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3489)) - Allow selecting the Node.js binary using `NODE_HOME` and `OSD_NODE_HOME` ([3508](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3508)) - Bump `styled-components` from 5.3.5 to 5.3.9 ([#3678](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3678)) +- Bump `oui` from `1.0.0` to `1.1.1` ([#3884](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3884)) ### ๐Ÿช› Refactoring diff --git a/package.json b/package.json index 998a5335fb4..b9eb244f775 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "dependencies": { "@aws-crypto/client-node": "^3.1.1", "@elastic/datemath": "5.0.3", - "@elastic/eui": "npm:@opensearch-project/oui@1.0.0", + "@elastic/eui": "npm:@opensearch-project/oui@1.1.1", "@elastic/good": "^9.0.1-kibana3", "@elastic/numeral": "^2.5.0", "@elastic/request-crypto": "2.0.0", diff --git a/packages/osd-ui-framework/package.json b/packages/osd-ui-framework/package.json index a89cc82a9d4..3ebc09f4a8a 100644 --- a/packages/osd-ui-framework/package.json +++ b/packages/osd-ui-framework/package.json @@ -23,7 +23,7 @@ "enzyme-adapter-react-16": "^1.9.1" }, "devDependencies": { - "@elastic/eui": "npm:@opensearch-project/oui@1.0.0", + "@elastic/eui": "npm:@opensearch-project/oui@1.1.1", "@osd/babel-preset": "1.0.0", "@osd/optimizer": "1.0.0", "grunt": "^1.5.2", diff --git a/packages/osd-ui-shared-deps/package.json b/packages/osd-ui-shared-deps/package.json index c4d8103ecc0..61f7008fbc0 100644 --- a/packages/osd-ui-shared-deps/package.json +++ b/packages/osd-ui-shared-deps/package.json @@ -10,7 +10,7 @@ }, "dependencies": { "@elastic/charts": "31.1.0", - "@elastic/eui": "npm:@opensearch-project/oui@1.0.0", + "@elastic/eui": "npm:@opensearch-project/oui@1.1.1", "@elastic/numeral": "^2.5.0", "@osd/i18n": "1.0.0", "@osd/monaco": "1.0.0", diff --git a/src/plugins/data_source_management/public/components/edit_data_source/components/update_password_modal/__snapshots__/update_password_modal.test.tsx.snap b/src/plugins/data_source_management/public/components/edit_data_source/components/update_password_modal/__snapshots__/update_password_modal.test.tsx.snap index 7c5de9b6ba2..21ec04bd300 100644 --- a/src/plugins/data_source_management/public/components/edit_data_source/components/update_password_modal/__snapshots__/update_password_modal.test.tsx.snap +++ b/src/plugins/data_source_management/public/components/edit_data_source/components/update_password_modal/__snapshots__/update_password_modal.test.tsx.snap @@ -569,7 +569,7 @@ exports[`Datasource Management: Update Stored Password Modal should render norma onChange={[Function]} onFocus={[Function]} placeholder="Updated password" - spellCheck={false} + spellCheck="false" type="password" value="" /> @@ -733,7 +733,7 @@ exports[`Datasource Management: Update Stored Password Modal should render norma onChange={[Function]} onFocus={[Function]} placeholder="Confirm Updated password" - spellCheck={false} + spellCheck="false" type="password" value="" /> diff --git a/test/interpreter_functional/plugins/osd_tp_run_pipeline/package.json b/test/interpreter_functional/plugins/osd_tp_run_pipeline/package.json index a0ff828390c..5f308268566 100644 --- a/test/interpreter_functional/plugins/osd_tp_run_pipeline/package.json +++ b/test/interpreter_functional/plugins/osd_tp_run_pipeline/package.json @@ -12,7 +12,7 @@ "build": "../../../../scripts/use_node ../../../../scripts/remove.js './target' && tsc" }, "devDependencies": { - "@elastic/eui": "npm:@opensearch-project/oui@1.0.0", + "@elastic/eui": "npm:@opensearch-project/oui@1.1.1", "@osd/plugin-helpers": "1.0.0", "react": "^16.14.0", "react-dom": "^16.12.0", diff --git a/test/plugin_functional/plugins/osd_sample_panel_action/package.json b/test/plugin_functional/plugins/osd_sample_panel_action/package.json index 5c5237717ac..35f7e84ae0e 100644 --- a/test/plugin_functional/plugins/osd_sample_panel_action/package.json +++ b/test/plugin_functional/plugins/osd_sample_panel_action/package.json @@ -12,7 +12,7 @@ "build": "../../../../scripts/use_node ../../../../scripts/remove.js './target' && tsc" }, "devDependencies": { - "@elastic/eui": "npm:@opensearch-project/oui@1.0.0", + "@elastic/eui": "npm:@opensearch-project/oui@1.1.1", "react": "^16.14.0", "typescript": "4.0.2" } diff --git a/test/plugin_functional/plugins/osd_tp_custom_visualizations/package.json b/test/plugin_functional/plugins/osd_tp_custom_visualizations/package.json index 23be4ebf14d..13f7b1695a0 100644 --- a/test/plugin_functional/plugins/osd_tp_custom_visualizations/package.json +++ b/test/plugin_functional/plugins/osd_tp_custom_visualizations/package.json @@ -12,7 +12,7 @@ "build": "../../../../scripts/use_node ../../../../scripts/remove.js './target' && tsc" }, "devDependencies": { - "@elastic/eui": "npm:@opensearch-project/oui@1.0.0", + "@elastic/eui": "npm:@opensearch-project/oui@1.1.1", "@osd/plugin-helpers": "1.0.0", "react": "^16.14.0", "typescript": "4.0.2" diff --git a/yarn.lock b/yarn.lock index 455b3475298..33ca05a2f2c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1273,10 +1273,10 @@ resolved "https://registry.yarnpkg.com/@elastic/eslint-plugin-eui/-/eslint-plugin-eui-0.0.2.tgz#56b9ef03984a05cc213772ae3713ea8ef47b0314" integrity sha512-IoxURM5zraoQ7C8f+mJb9HYSENiZGgRVcG4tLQxE61yHNNRDXtGDWTZh8N1KIHcsqN1CEPETjuzBXkJYF/fDiQ== -"@elastic/eui@npm:@opensearch-project/oui@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@opensearch-project/oui/-/oui-1.0.0.tgz#bf5e115c8d0f230415b07cc6acfb149ab081c5de" - integrity sha512-J709UQc7+il4y3aiqpHzeLOJAQhN6xEGLLHq4sUL3WHTsP37acONINXCpRNMa3FxZ+ChOd2ABmY+Ajs+fIgmug== +"@elastic/eui@npm:@opensearch-project/oui@1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@opensearch-project/oui/-/oui-1.1.1.tgz#4a9318c2954659cdd8d83263ff2dc22a77cbd779" + integrity sha512-RBXbsZh6mjJKJqB/hSI2loenyM2rvdq9id29P/ZYlZGKKy0/tSreIOGcegSYMtNFmG029D20xVkhRmdn7cxK1A== dependencies: "@types/chroma-js" "^2.0.0" "@types/lodash" "^4.14.160" From e9dc8902c1bef80690a3d7a1ef3bbeaa861f5b3a Mon Sep 17 00:00:00 2001 From: Josh Romero Date: Wed, 19 Apr 2023 11:54:57 -0700 Subject: [PATCH 09/38] Add 2.7.0 release notes (#3889) Signed-off-by: Josh Romero --- ...ensearch-dashboards.release-notes-2.7.0.md | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 release-notes/opensearch-dashboards.release-notes-2.7.0.md diff --git a/release-notes/opensearch-dashboards.release-notes-2.7.0.md b/release-notes/opensearch-dashboards.release-notes-2.7.0.md new file mode 100644 index 00000000000..6f4c4fb73df --- /dev/null +++ b/release-notes/opensearch-dashboards.release-notes-2.7.0.md @@ -0,0 +1,88 @@ +## Version 2.7.0 Release Notes + +### Deprecations + +### ๐Ÿ›ก Security + +- [CVE-2023-26486] Bump vega from `5.22.1` to `5.23.0` ([#3533](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3533)) +- [CVE-2023-26487] Bump vega from `5.22.1` to `5.23.0` ([#3533](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3533)) +- [CVE-2023-0842] Bump xml2js from `0.4.23` to `0.5.0` ([#3842](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3842)) + +### ๐Ÿ“ˆ Features/Enhancements + +- Add satisfaction survey link to help menu ([#3676](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3676)) +- Add `osd-xsrf` header to all requests that incorrectly used `node-version` to satisfy XSRF protection ([#3643](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3643)) +- [Dashboard] Add Dashboards-list integrations for Plugins ([#3090](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3090) ) +- [Data] Add geo shape filter field ([#3605](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3605)) +- [Doc Links] Add downgrade logic for branch in DocLinkService ([#3483](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3483)) +- [Monaco editor] Add json worker support ([#3424](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3424)) +- [Multiple DataSource] Allow create and distinguish index pattern with same name but from different datasources ([#3604](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3604)) +- [Multiple DataSource] Integrate multiple datasource with dev tool console ([#3754](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3754)) +- [Notifications] Add id to toast api for deduplication ([#3752](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3752)) +- [UI] Add support for comma delimiters in the global filter bar ([#3686](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3686)) +- [UI] Indicate that IE is no longer supported ([#3641](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3641)) +- [Vega] Add Filter custom label for opensearchDashboardsAddFilter ([#3640](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3640)) +- [VisBuilder] Add metric to metric, bucket to bucket aggregation persistence ([#3495](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3495)) +- [VisBuilder] Add UI actions handler ([#3732](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3732)) +- [VisBuilder] Add persistence to visualizations inner state ([#3751](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3751)) + +### ๐Ÿ› Bug Fixes + +- Clean up and rebuild `@osd/pm` ([#3570](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3570)) +- Omit adding the `osd-version` header when the Fetch request is to an external origin ([#3643](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3643)) +- [Console] Fix/update documentation links in Dev Tools console ([#3724](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3724)) +- [Console] Fix dev tool console autocomplete not loading issue ([#3775](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3775)) +- [Console] Fix dev tool console run command with query parameter error ([#3813](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3813)) +- [Table Visualization] Fix table rendering empty unused space ([#3797](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3797)) +- [Table Visualization] Fix data table not adjusting height on the initial load ([#3816](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3816)) +- [Timeline] Fix y-axis label color in dark mode ([#3698](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3698)) +- [TSVB] Fix undefined serial diff aggregation documentation link ([#3503](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3503)) +- [UI] Add clarifying tooltips to header navigation icons ([#3573](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3573)) +- [VisBuilder] Fix multiple warnings thrown on page load ([#3732](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3732)) +- [VisBuilder] Fix Firefox legend selection issue ([#3732](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3732)) +- [VisBuilder] Fix type errors ([#3732](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3732)) +- [VisBuilder] Fix indexpattern selection in filter bar ([#3751](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3751)) + +### ๐Ÿšž Infrastructure + +- Use mirrors to download Node.js binaries to escape sporadic 404 errors ([#3619](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3619)) +- [CI] Update NOTICE file, add validation to GitHub CI ([#3051](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3051)) +- [CI] Reduce redundancy by using matrix strategy on Windows and Linux workflows ([#3514](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3514)) +- [Darwin] Add support for Darwin for running OpenSearch snapshots with `yarn opensearch snapshot` ([#3537](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3537)) + +### ๐Ÿ“ Documentation + +- Correct copyright date range of NOTICE file and notice generator ([#3308](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3308)) +- Simplify the in-code instructions for upgrading `re2` ([#3328](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3328)) +- [Doc] Improve DEVELOPER_GUIDE to make first time setup quicker and easier ([#3421](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3421)) +- [Doc] Update DEVELOPER_GUIDE with added manual bootstrap timeout solution and max virtual memory error solution with docker ([#3764](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3764)) +- [Doc] Add second command to install yarn step in DEVELOPER_GUIDE ([#3633](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3633)) +- [Doc] Add docker dev set up instruction ([#3444](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3444)) +- [Doc] Add docker files and instructions for debugging Selenium functional tests ([#3747](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3747)) +- [Doc] Update SECURITY with instructions for nested dependencies and backporting ([#3497](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3497)) +- [TSVB] Fix typo in TSVB README ([#3518](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3518)) +- [UI Actions] Improve UI actions explorer ([#3614](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3614)) + +### ๐Ÿ›  Maintenance + +- Relax the Node.js requirement to `^14.20.1` ([#3463](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3463)) +- Bump the version of Node.js installed by `nvm` to `14.21.3` ([#3463](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3463)) +- Allow selecting the Node.js binary using `NODE_HOME` and `OSD_NODE_HOME` ([#3508](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3508)) +- Remove the unused `renovate.json5` file ([#3489](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3489)) +- Bump `styled-components` from `5.3.5` to `5.3.9` ([#3678](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3678)) +- [Timeline] Update default expressions from `.es(*)` to `.opensearch(*)`. ([#2720](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2720)) + +### ๐Ÿช› Refactoring + +- Remove automatic addition of `osd-version` header to requests outside of OpenSearch Dashboards ([#3643](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3643)) +- [Console] Replace jQuery usage in console plugin with native methods ([#3733](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3733)) +- [Doc Links] Clean up docs_link_service organization so that strings are in the right categories. ([#3685](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3685)) +- [I18n] Fix Listr type errors and error handlers ([#3629](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3629)) +- [Multiple DataSource] Refactor dev tool console to use opensearch-js client to send requests ([#3544](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3544)) +- [Multiple DataSource] Present the authentication type choices in a drop-down ([#3693](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3693)) +- [Table Visualization] Move format table, consolidate types and add unit tests ([#3397](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3397)) + +### ๐Ÿ”ฉ Tests + +- Update caniuse to `1.0.30001460` to fix failed integration tests ([#3538](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3538)) +- [Tests] Fix unit tests for `get_keystore` ([#3854](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3854)) From 86d42bc1cd68120fd389d7c39b705fcde4d09770 Mon Sep 17 00:00:00 2001 From: Josh Romero Date: Thu, 20 Apr 2023 11:06:50 -0700 Subject: [PATCH 10/38] Chore (release notes): polish 2.7.0 notes (#3896) Add welcome/thank you section for first-time contributors Fix link that pointed to issue instead of PR Add entry for OUI bump Signed-off-by: Josh Romero --- release-notes/opensearch-dashboards.release-notes-2.7.0.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/release-notes/opensearch-dashboards.release-notes-2.7.0.md b/release-notes/opensearch-dashboards.release-notes-2.7.0.md index 6f4c4fb73df..3ad55fe4d80 100644 --- a/release-notes/opensearch-dashboards.release-notes-2.7.0.md +++ b/release-notes/opensearch-dashboards.release-notes-2.7.0.md @@ -37,7 +37,7 @@ - [Table Visualization] Fix data table not adjusting height on the initial load ([#3816](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3816)) - [Timeline] Fix y-axis label color in dark mode ([#3698](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3698)) - [TSVB] Fix undefined serial diff aggregation documentation link ([#3503](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3503)) -- [UI] Add clarifying tooltips to header navigation icons ([#3573](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3573)) +- [UI] Add clarifying tooltips to header navigation icons ([#3626](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3626)) - [VisBuilder] Fix multiple warnings thrown on page load ([#3732](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3732)) - [VisBuilder] Fix Firefox legend selection issue ([#3732](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3732)) - [VisBuilder] Fix type errors ([#3732](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3732)) @@ -70,6 +70,7 @@ - Allow selecting the Node.js binary using `NODE_HOME` and `OSD_NODE_HOME` ([#3508](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3508)) - Remove the unused `renovate.json5` file ([#3489](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3489)) - Bump `styled-components` from `5.3.5` to `5.3.9` ([#3678](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3678)) +- Bump `oui` from `1.0.0` to `1.1.1` ([3884](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3884)) - [Timeline] Update default expressions from `.es(*)` to `.opensearch(*)`. ([#2720](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2720)) ### ๐Ÿช› Refactoring @@ -86,3 +87,7 @@ - Update caniuse to `1.0.30001460` to fix failed integration tests ([#3538](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3538)) - [Tests] Fix unit tests for `get_keystore` ([#3854](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3854)) + +## ๐ŸŽ‰ Welcome + +Thank you to all the first-time contributors who made this release possible: @pjfitzgibbons, @djindjic, @jlabatut, @sayuree, @Nicksqain, @kappassov, @aswath86, @frost017, @curq, @Aigerim-ai, @andreymyssak, @Hailong-am! From e74ab2d4f5f5bcee4aebb5d04899aaa48b565513 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Sat, 22 Apr 2023 04:35:06 -0700 Subject: [PATCH 11/38] Fix header icon (#3910) (#3915) * fixes header change * Update src/core/public/chrome/ui/header/header_help_menu.tsx * fixes snapshots --------- (cherry picked from commit 3cca08851cb1527705c60bbb4202d50174f034af) Signed-off-by: Ashwin P Chandran Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] Co-authored-by: Josh Romero --- .../header/__snapshots__/header.test.tsx.snap | 40 ++----------------- .../header_help_menu.test.tsx.snap | 40 ++----------------- .../chrome/ui/header/header_help_menu.tsx | 3 +- 3 files changed, 9 insertions(+), 74 deletions(-) diff --git a/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap index 6486e207ed3..4c2beb329a9 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap @@ -5415,14 +5415,10 @@ exports[`Header handles visibility and lock changes 1`] = ` aria-label="Help menu" onClick={[Function]} > - } @@ -5474,9 +5470,6 @@ exports[`Header handles visibility and lock changes 1`] = ` > - @@ -5519,21 +5512,12 @@ exports[`Header handles visibility and lock changes 1`] = ` > - - - @@ -10674,14 +10658,10 @@ exports[`Header renders condensed header 1`] = ` aria-label="Help menu" onClick={[Function]} > - } @@ -10733,9 +10713,6 @@ exports[`Header renders condensed header 1`] = ` > - @@ -10778,21 +10755,12 @@ exports[`Header renders condensed header 1`] = ` > - - - diff --git a/src/core/public/chrome/ui/header/__snapshots__/header_help_menu.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/header_help_menu.test.tsx.snap index 5406fbf6aba..036e2b4ee0c 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/header_help_menu.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/header_help_menu.test.tsx.snap @@ -1622,14 +1622,10 @@ exports[`Header help menu hides survey link 1`] = ` aria-label="Help menu" onClick={[Function]} > - } @@ -1681,9 +1677,6 @@ exports[`Header help menu hides survey link 1`] = ` > - @@ -1726,21 +1719,12 @@ exports[`Header help menu hides survey link 1`] = ` > - - - @@ -3798,14 +3782,10 @@ exports[`Header help menu renders survey link 1`] = ` aria-label="Help menu" onClick={[Function]} > - } @@ -3857,9 +3837,6 @@ exports[`Header help menu renders survey link 1`] = ` > - @@ -3902,21 +3879,12 @@ exports[`Header help menu renders survey link 1`] = ` > - - - diff --git a/src/core/public/chrome/ui/header/header_help_menu.tsx b/src/core/public/chrome/ui/header/header_help_menu.tsx index f0be769937f..0eba4c0c267 100644 --- a/src/core/public/chrome/ui/header/header_help_menu.tsx +++ b/src/core/public/chrome/ui/header/header_help_menu.tsx @@ -330,9 +330,8 @@ class HeaderHelpMenuUI extends Component { })} onClick={this.onMenuButtonClick} > - Date: Mon, 24 Apr 2023 14:35:01 -0700 Subject: [PATCH 12/38] Add server side private IP blocking for data source endpoints validation (#3912) Signed-off-by: Kristen Tian --- .lycheeexclude | 3 + CHANGELOG.md | 1 + config/opensearch_dashboards.yml | 27 ++++++++- src/plugins/data_source/config.ts | 1 + src/plugins/data_source/server/plugin.ts | 3 +- ...ata_source_saved_objects_client_wrapper.ts | 22 ++++--- .../server/util/endpoint_validator.test.js | 34 +++++++++++ .../server/util/endpoint_validator.ts | 59 +++++++++++++++++++ 8 files changed, 136 insertions(+), 14 deletions(-) create mode 100644 src/plugins/data_source/server/util/endpoint_validator.test.js create mode 100644 src/plugins/data_source/server/util/endpoint_validator.ts diff --git a/.lycheeexclude b/.lycheeexclude index 07317835aab..252db4e8278 100644 --- a/.lycheeexclude +++ b/.lycheeexclude @@ -88,6 +88,7 @@ https://opensearch.org/redirect http://www.opensearch.org/painlessDocs https://www.hostedgraphite.com/ https://connectionurl.com +http://169.254.169.254/latest/meta-data/ # External urls https://www.zeek.org/ @@ -117,3 +118,5 @@ http://www.creedthoughts.gov https://media-for-the-masses.theacademyofperformingartsandscience.org/ https://yarnpkg.com/latest.msi https://forum.opensearch.org/ +https://facebook.github.io/jest/ +https://facebook.github.io/jest/docs/cli.html diff --git a/CHANGELOG.md b/CHANGELOG.md index fb7c3fd8732..c3402ef49b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [CVE-2023-25653] Bump node-jose to 2.2.0 ([#3445](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3445)) - [CVE-2023-26486][cve-2023-26487] Bump vega from 5.22.1 to 5.23.0 ([#3533](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3533)) - [CVE-2023-0842] Bump xml2js from 0.4.23 to 0.5.0 ([#3842](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3842)) +- [Multi DataSource] Add private IP blocking validation on server side([#3912](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3912)) ### ๐Ÿ“ˆ Features/Enhancements diff --git a/config/opensearch_dashboards.yml b/config/opensearch_dashboards.yml index 38377296bd2..1d751769f70 100644 --- a/config/opensearch_dashboards.yml +++ b/config/opensearch_dashboards.yml @@ -238,5 +238,30 @@ #data_source.encryption.wrappingKeyNamespace: 'changeme' #data_source.encryption.wrappingKey: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] +#data_source.endpointDeniedIPs: [ +# '127.0.0.0/8', +# '::1/128', +# '169.254.0.0/16', +# 'fe80::/10', +# '10.0.0.0/8', +# '172.16.0.0/12', +# '192.168.0.0/16', +# 'fc00::/7', +# '0.0.0.0/8', +# '100.64.0.0/10', +# '192.0.0.0/24', +# '192.0.2.0/24', +# '198.18.0.0/15', +# '192.88.99.0/24', +# '198.51.100.0/24', +# '203.0.113.0/24', +# '224.0.0.0/4', +# '240.0.0.0/4', +# '255.255.255.255/32', +# '::/128', +# '2001:db8::/32', +# 'ff00::/8', +# ] + # Set the value of this setting to false to hide the help menu link to the OpenSearch Dashboards user survey -# opensearchDashboards.survey.url: "https://survey.opensearch.org" \ No newline at end of file +# opensearchDashboards.survey.url: "https://survey.opensearch.org" diff --git a/src/plugins/data_source/config.ts b/src/plugins/data_source/config.ts index 1fc4e00c3e2..09ce3597892 100644 --- a/src/plugins/data_source/config.ts +++ b/src/plugins/data_source/config.ts @@ -37,6 +37,7 @@ export const configSchema = schema.object({ enabled: schema.boolean({ defaultValue: false }), appender: fileAppenderSchema, }), + endpointDeniedIPs: schema.maybe(schema.arrayOf(schema.string())), }); export type DataSourcePluginConfigType = TypeOf; diff --git a/src/plugins/data_source/server/plugin.ts b/src/plugins/data_source/server/plugin.ts index e038a0f7685..0f3c47be4b4 100644 --- a/src/plugins/data_source/server/plugin.ts +++ b/src/plugins/data_source/server/plugin.ts @@ -58,7 +58,8 @@ export class DataSourcePlugin implements Plugin(attributes: T) { this.validateAttributes(attributes); @@ -254,8 +250,10 @@ export class DataSourceSavedObjectsClientWrapper { ); } - if (!this.isValidUrl(endpoint)) { - throw SavedObjectsErrorHelpers.createBadRequestError('"endpoint" attribute is not valid'); + if (!isValidURL(endpoint, this.endpointBlockedIps)) { + throw SavedObjectsErrorHelpers.createBadRequestError( + '"endpoint" attribute is not valid or allowed' + ); } if (!auth) { diff --git a/src/plugins/data_source/server/util/endpoint_validator.test.js b/src/plugins/data_source/server/util/endpoint_validator.test.js new file mode 100644 index 00000000000..618bf52d4d9 --- /dev/null +++ b/src/plugins/data_source/server/util/endpoint_validator.test.js @@ -0,0 +1,34 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import * as validator from './endpoint_validator'; + +describe('endpoint_validator', function () { + it('Url1 that should be blocked should return false', function () { + expect(validator.isValidURL('http://127.0.0.1', ['127.0.0.0/8'])).toEqual(false); + }); + + it('Url2 that is invalid should return false', function () { + expect(validator.isValidURL('www.test.com', [])).toEqual(false); + }); + + it('Url3 that is invalid should return false', function () { + expect(validator.isValidURL('ftp://www.test.com', [])).toEqual(false); + }); + + it('Url4 that should be blocked should return false', function () { + expect( + validator.isValidURL('http://169.254.169.254/latest/meta-data/', ['169.254.0.0/16']) + ).toEqual(false); + }); + + it('Url5 that should not be blocked should return true', function () { + expect(validator.isValidURL('https://www.opensearch.org', ['127.0.0.0/8'])).toEqual(true); + }); + + it('Url6 that should not be blocked should return true when null IPs', function () { + expect(validator.isValidURL('https://www.opensearch.org')).toEqual(true); + }); +}); diff --git a/src/plugins/data_source/server/util/endpoint_validator.ts b/src/plugins/data_source/server/util/endpoint_validator.ts new file mode 100644 index 00000000000..1c032037d2f --- /dev/null +++ b/src/plugins/data_source/server/util/endpoint_validator.ts @@ -0,0 +1,59 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import dns from 'dns-sync'; +import IPCIDR from 'ip-cidr'; + +export function isValidURL(endpoint: string, deniedIPs?: string[]) { + // Check the format of URL, URL has be in the format as + // scheme://server/path/resource otherwise an TypeError + // would be thrown. + let url; + try { + url = new URL(endpoint); + } catch (err) { + return false; + } + + if (!(Boolean(url) && (url.protocol === 'http:' || url.protocol === 'https:'))) { + return false; + } + + const ip = getIpAddress(url); + if (!ip) { + return false; + } + + // IP CIDR check if a specific IP address fall in the + // range of an IP address block + for (const deniedIP of deniedIPs ?? []) { + const cidr = new IPCIDR(deniedIP); + if (cidr.contains(ip)) { + return false; + } + } + return true; +} + +/** + * Resolve hostname to IP address + * @param {object} urlObject + * @returns {string} configuredIP + * or null if it cannot be resolve + * According to RFC, all IPv6 IP address needs to be in [] + * such as [::1]. + * So if we detect a IPv6 address, we remove brackets. + */ +function getIpAddress(urlObject: URL) { + const hostname = urlObject.hostname; + const configuredIP = dns.resolve(hostname); + if (configuredIP) { + return configuredIP; + } + if (hostname.startsWith('[') && hostname.endsWith(']')) { + return hostname.substr(1).slice(0, -1); + } + return null; +} From a947240ea2bc28341c4d950e6c2badfc7ca365f9 Mon Sep 17 00:00:00 2001 From: Josh Romero Date: Mon, 24 Apr 2023 15:46:54 -0700 Subject: [PATCH 13/38] Docs (Jest): Update jest documentation links (#3931) Signed-off-by: Josh Romero --- .../README.md | 6 +++--- scripts/jest.js | 2 +- scripts/jest_integration.js | 2 +- src/dev/jest/junit_reporter.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/opensearch-eslint-config-opensearch-dashboards/README.md b/packages/opensearch-eslint-config-opensearch-dashboards/README.md index 4fb3f13c8f2..a2f60c437e5 100644 --- a/packages/opensearch-eslint-config-opensearch-dashboards/README.md +++ b/packages/opensearch-eslint-config-opensearch-dashboards/README.md @@ -4,7 +4,7 @@ The eslint config used by the opensearch dashboards team ## Usage -To use this eslint config, just install the peer dependencies and reference it +To use this eslint config, just install the peer dependencies and reference it in your `.eslintrc`: ```javascript @@ -17,8 +17,8 @@ in your `.eslintrc`: ## Optional jest config -If the project uses the [jest test runner](https://facebook.github.io/jest/), -the `@elastic/eslint-config-kibana/jest` config can be extended as well to use +If the project uses the [jest test runner](https://jestjs.io), +the `@elastic/eslint-config-kibana/jest` config can be extended as well to use `eslint-plugin-jest` and add settings specific to it: ```javascript diff --git a/scripts/jest.js b/scripts/jest.js index 53c687e51a8..80f269c7249 100755 --- a/scripts/jest.js +++ b/scripts/jest.js @@ -38,7 +38,7 @@ // // node scripts/jest --coverage // -// See all cli options in https://facebook.github.io/jest/docs/cli.html +// See all cli options in https://jestjs.io/docs/cli var resolve = require('path').resolve; process.argv.push('--config', resolve(__dirname, '../src/dev/jest/config.js')); diff --git a/scripts/jest_integration.js b/scripts/jest_integration.js index f5bc937c4d7..265919f2070 100755 --- a/scripts/jest_integration.js +++ b/scripts/jest_integration.js @@ -38,7 +38,7 @@ // // node scripts/jest_integration --coverage // -// See all cli options in https://facebook.github.io/jest/docs/cli.html +// See all cli options in https://jestjs.io/docs/cli var resolve = require('path').resolve; process.argv.push('--config', resolve(__dirname, '../src/dev/jest/config.integration.js')); diff --git a/src/dev/jest/junit_reporter.js b/src/dev/jest/junit_reporter.js index 65f244042a1..1add8e722a5 100644 --- a/src/dev/jest/junit_reporter.js +++ b/src/dev/jest/junit_reporter.js @@ -53,7 +53,7 @@ export default class JestJUnitReporter { /** * Called by jest when all tests complete * @param {Object} contexts - * @param {JestResults} results see https://facebook.github.io/jest/docs/en/configuration.html#testresultsprocessor-string + * @param {JestResults} results see https://jestjs.io/docs/configuration/#testresultsprocessor-string * @return {undefined} */ onRunComplete(contexts, results) { From b97a4b5e8ea87db33d3946b9530dc00cf9e7540a Mon Sep 17 00:00:00 2001 From: Josh Romero Date: Mon, 24 Apr 2023 15:48:12 -0700 Subject: [PATCH 14/38] Revert "[CCI] Replace jquery usage in console plugin with native methods (#3733)" (#3929) This reverts commit ffe455615eef10d1719884fd131f6953976583ff. --- CHANGELOG.md | 1 - .../__tests__/input.test.js | 5 +-- .../__tests__/output_tokenization.test.js | 5 +-- .../legacy_core_editor/legacy_core_editor.ts | 31 +++++++++++-------- .../__tests__/integration.test.js | 4 +-- .../__tests__/sense_editor.test.js | 5 +-- .../sense_editor/sense_editor.test.mocks.ts | 8 +++++ .../ace_token_provider/token_provider.test.ts | 6 ++-- src/plugins/console/public/lib/osd/osd.js | 20 ++++++------ 9 files changed, 52 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3402ef49b7..92f117e3a59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -192,7 +192,6 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Console] Replace jQuery.ajax with core.http when calling OSD APIs in console ([#3080](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3080)) - [I18n] Fix Listr type errors and error handlers ([#3629](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3629)) - [Multiple DataSource] Present the authentication type choices in a drop-down ([#3693](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3693)) -- [Console] Replace jQuery usage in console plugin with native methods ([#3733](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3733)) ### ๐Ÿ”ฉ Tests diff --git a/src/plugins/console/public/application/models/legacy_core_editor/__tests__/input.test.js b/src/plugins/console/public/application/models/legacy_core_editor/__tests__/input.test.js index 653e34aa007..7accc948e6c 100644 --- a/src/plugins/console/public/application/models/legacy_core_editor/__tests__/input.test.js +++ b/src/plugins/console/public/application/models/legacy_core_editor/__tests__/input.test.js @@ -31,6 +31,7 @@ import '../legacy_core_editor.test.mocks'; import RowParser from '../../../../lib/row_parser'; import { createTokenIterator } from '../../../factories'; +import $ from 'jquery'; import { create } from '../create'; describe('Input', () => { @@ -45,10 +46,10 @@ describe('Input', () => { coreEditor = create(document.querySelector('#ConAppEditor')); - coreEditor.getContainer().style.display = ''; + $(coreEditor.getContainer()).show(); }); afterEach(() => { - coreEditor.getContainer().style.display = 'none'; + $(coreEditor.getContainer()).hide(); }); describe('.getLineCount', () => { diff --git a/src/plugins/console/public/application/models/legacy_core_editor/__tests__/output_tokenization.test.js b/src/plugins/console/public/application/models/legacy_core_editor/__tests__/output_tokenization.test.js index d143d72e15c..4973011a2aa 100644 --- a/src/plugins/console/public/application/models/legacy_core_editor/__tests__/output_tokenization.test.js +++ b/src/plugins/console/public/application/models/legacy_core_editor/__tests__/output_tokenization.test.js @@ -29,6 +29,7 @@ */ import '../legacy_core_editor.test.mocks'; +import $ from 'jquery'; import RowParser from '../../../../lib/row_parser'; import ace from 'brace'; import { createReadOnlyAceEditor } from '../create_readonly'; @@ -38,11 +39,11 @@ const tokenIterator = ace.acequire('ace/token_iterator'); describe('Output Tokenization', () => { beforeEach(() => { output = createReadOnlyAceEditor(document.querySelector('#ConAppOutput')); - output.container.style.display = ''; + $(output.container).show(); }); afterEach(() => { - output.container.style.display = 'none'; + $(output.container).hide(); }); function tokensAsList() { diff --git a/src/plugins/console/public/application/models/legacy_core_editor/legacy_core_editor.ts b/src/plugins/console/public/application/models/legacy_core_editor/legacy_core_editor.ts index 5fe93ca4e09..55ee5fe2a34 100644 --- a/src/plugins/console/public/application/models/legacy_core_editor/legacy_core_editor.ts +++ b/src/plugins/console/public/application/models/legacy_core_editor/legacy_core_editor.ts @@ -30,6 +30,7 @@ import ace from 'brace'; import { Editor as IAceEditor, IEditSession as IAceEditSession } from 'brace'; +import $ from 'jquery'; import { CoreEditor, Position, @@ -53,11 +54,11 @@ const rangeToAceRange = ({ start, end }: Range) => export class LegacyCoreEditor implements CoreEditor { private _aceOnPaste: any; - actions: any; + $actions: any; resize: () => void; constructor(private readonly editor: IAceEditor, actions: HTMLElement) { - this.actions = actions; + this.$actions = $(actions); this.editor.setShowPrintMargin(false); const session = this.editor.getSession(); @@ -273,16 +274,20 @@ export class LegacyCoreEditor implements CoreEditor { private setActionsBar = (value?: any, topOrBottom: 'top' | 'bottom' = 'top') => { if (value === null) { - this.actions.style.visibility = 'hidden'; + this.$actions.css('visibility', 'hidden'); } else { if (topOrBottom === 'top') { - this.actions.style.bottom = 'auto'; - this.actions.style.top = value; - this.actions.style.visibility = 'visible'; + this.$actions.css({ + bottom: 'auto', + top: value, + visibility: 'visible', + }); } else { - this.actions.style.top = 'auto'; - this.actions.style.bottom = value; - this.actions.style.visibility = 'visible'; + this.$actions.css({ + top: 'auto', + bottom: value, + visibility: 'visible', + }); } } }; @@ -313,14 +318,14 @@ export class LegacyCoreEditor implements CoreEditor { } legacyUpdateUI(range: any) { - if (!this.actions) { + if (!this.$actions) { return; } if (range) { // elements are positioned relative to the editor's container // pageY is relative to page, so subtract the offset // from pageY to get the new top value - const offsetFromPage = this.editor.container.offsetTop; + const offsetFromPage = $(this.editor.container).offset()!.top; const startLine = range.start.lineNumber; const startColumn = range.start.column; const firstLine = this.getLineValue(startLine); @@ -340,11 +345,11 @@ export class LegacyCoreEditor implements CoreEditor { let offset = 0; if (isWrapping) { // Try get the line height of the text area in pixels. - const textArea = this.editor.container.querySelector('textArea'); + const textArea = $(this.editor.container.querySelector('textArea')!); const hasRoomOnNextLine = this.getLineValue(startLine).length < maxLineLength; if (textArea && hasRoomOnNextLine) { // Line height + the number of wraps we have on a line. - offset += this.getLineValue(startLine).length * textArea.getBoundingClientRect().height; + offset += this.getLineValue(startLine).length * textArea.height()!; } else { if (startLine > 1) { this.setActionsBar(getScreenCoords(startLine - 1)); diff --git a/src/plugins/console/public/application/models/sense_editor/__tests__/integration.test.js b/src/plugins/console/public/application/models/sense_editor/__tests__/integration.test.js index 88f9acc27e7..cf6df4d31b0 100644 --- a/src/plugins/console/public/application/models/sense_editor/__tests__/integration.test.js +++ b/src/plugins/console/public/application/models/sense_editor/__tests__/integration.test.js @@ -44,11 +44,11 @@ describe('Integration', () => { '
'; senseEditor = create(document.querySelector('#ConAppEditor')); - senseEditor.getCoreEditor().getContainer().style.display = ''; + $(senseEditor.getCoreEditor().getContainer()).show(); senseEditor.autocomplete._test.removeChangeListener(); }); afterEach(() => { - senseEditor.getCoreEditor().getContainer().style.display = 'none'; + $(senseEditor.getCoreEditor().getContainer()).hide(); senseEditor.autocomplete._test.addChangeListener(); }); diff --git a/src/plugins/console/public/application/models/sense_editor/__tests__/sense_editor.test.js b/src/plugins/console/public/application/models/sense_editor/__tests__/sense_editor.test.js index de67ae1a890..18d798c28c9 100644 --- a/src/plugins/console/public/application/models/sense_editor/__tests__/sense_editor.test.js +++ b/src/plugins/console/public/application/models/sense_editor/__tests__/sense_editor.test.js @@ -30,6 +30,7 @@ import '../sense_editor.test.mocks'; +import $ from 'jquery'; import _ from 'lodash'; import { create } from '../create'; @@ -50,11 +51,11 @@ describe('Editor', () => {
`; input = create(document.querySelector('#ConAppEditor')); - input.getCoreEditor().getContainer().style.display = ''; + $(input.getCoreEditor().getContainer()).show(); input.autocomplete._test.removeChangeListener(); }); afterEach(function () { - input.getCoreEditor().getContainer().style.display = 'none'; + $(input.getCoreEditor().getContainer()).hide(); input.autocomplete._test.addChangeListener(); }); diff --git a/src/plugins/console/public/application/models/sense_editor/sense_editor.test.mocks.ts b/src/plugins/console/public/application/models/sense_editor/sense_editor.test.mocks.ts index 92e86d60104..6474fcb0ec9 100644 --- a/src/plugins/console/public/application/models/sense_editor/sense_editor.test.mocks.ts +++ b/src/plugins/console/public/application/models/sense_editor/sense_editor.test.mocks.ts @@ -31,3 +31,11 @@ /* eslint no-undef: 0 */ import '../legacy_core_editor/legacy_core_editor.test.mocks'; + +import jQuery from 'jquery'; +jest.spyOn(jQuery, 'ajax').mockImplementation( + () => + new Promise(() => { + // never resolve + }) as any +); diff --git a/src/plugins/console/public/lib/ace_token_provider/token_provider.test.ts b/src/plugins/console/public/lib/ace_token_provider/token_provider.test.ts index a933fdeb801..55c18381cb9 100644 --- a/src/plugins/console/public/lib/ace_token_provider/token_provider.test.ts +++ b/src/plugins/console/public/lib/ace_token_provider/token_provider.test.ts @@ -30,6 +30,8 @@ import '../../application/models/sense_editor/sense_editor.test.mocks'; +import $ from 'jquery'; + // TODO: // We import from application models as a convenient way to bootstrap loading up of an editor using // this lib. We also need to import application specific mocks which is not ideal. @@ -57,14 +59,14 @@ describe('Ace (legacy) token provider', () => { senseEditor = create(document.querySelector('#ConAppEditor')!); - senseEditor.getCoreEditor().getContainer().style.display = ''; + $(senseEditor.getCoreEditor().getContainer())!.show(); (senseEditor as any).autocomplete._test.removeChangeListener(); tokenProvider = senseEditor.getCoreEditor().getTokenProvider(); }); afterEach(async () => { - senseEditor.getCoreEditor().getContainer().style.display = 'none'; + $(senseEditor.getCoreEditor().getContainer())!.hide(); (senseEditor as any).autocomplete._test.addChangeListener(); await senseEditor.update('', true); }); diff --git a/src/plugins/console/public/lib/osd/osd.js b/src/plugins/console/public/lib/osd/osd.js index cf812627107..529fba754a9 100644 --- a/src/plugins/console/public/lib/osd/osd.js +++ b/src/plugins/console/public/lib/osd/osd.js @@ -38,6 +38,7 @@ import { UsernameAutocompleteComponent, } from '../autocomplete/components'; +import $ from 'jquery'; import _ from 'lodash'; import Api from './api'; @@ -173,19 +174,20 @@ function loadApisFromJson( // like this, it looks like a minor security issue. export function setActiveApi(api) { if (!api) { - fetch('../api/console/api_server', { - method: 'GET', + $.ajax({ + url: '../api/console/api_server', + dataType: 'json', // disable automatic guessing headers: { 'osd-xsrf': 'opensearch-dashboards', }, - }) - .then(function (response) { - response.json(); - }) - .then(function (data) { + }).then( + function (data) { setActiveApi(loadApisFromJson(data)); - }) - .catch((error) => console.log(`failed to load API '${api}': ${error}`)); + }, + function (jqXHR) { + console.log("failed to load API '" + api + "': " + jqXHR.responseText); + } + ); return; } From 0e34c3ccbc7de911862694c98f910dd223d5c27a Mon Sep 17 00:00:00 2001 From: Kawika Avilla Date: Mon, 24 Apr 2023 19:51:54 -0700 Subject: [PATCH 15/38] [BUG][Dashboard listing] push to history if dashboard otherwise nav (#3922) History push will just to the current route. However, dashboardsProvider was implemented with the expectation that it was a different app. So when a plugin registered it was attempting to navigate to `app/dashboard#/app/{url}` Add tests and extra data test subject. Signed-off-by: Kawika Avilla --- .../public/application/legacy_app.js | 16 +++-- .../listing/create_button.test.tsx | 2 +- .../application/listing/create_button.tsx | 2 +- test/plugin_functional/config.ts | 1 + .../opensearch_dashboards.json | 9 +++ .../package.json | 17 +++++ .../public/index.ts | 22 ++++++ .../public/plugin.tsx | 53 ++++++++++++++ .../tsconfig.json | 17 +++++ .../dashboard_listing_plugin.ts | 71 +++++++++++++++++++ .../dashboard_listing_plugin/index.ts | 35 +++++++++ 11 files changed, 239 insertions(+), 6 deletions(-) create mode 100644 test/plugin_functional/plugins/dashboard_listing_test_plugin/opensearch_dashboards.json create mode 100644 test/plugin_functional/plugins/dashboard_listing_test_plugin/package.json create mode 100644 test/plugin_functional/plugins/dashboard_listing_test_plugin/public/index.ts create mode 100644 test/plugin_functional/plugins/dashboard_listing_test_plugin/public/plugin.tsx create mode 100644 test/plugin_functional/plugins/dashboard_listing_test_plugin/tsconfig.json create mode 100644 test/plugin_functional/test_suites/dashboard_listing_plugin/dashboard_listing_plugin.ts create mode 100644 test/plugin_functional/test_suites/dashboard_listing_plugin/index.ts diff --git a/src/plugins/dashboard/public/application/legacy_app.js b/src/plugins/dashboard/public/application/legacy_app.js index 3ed961e5404..baacc69f780 100644 --- a/src/plugins/dashboard/public/application/legacy_app.js +++ b/src/plugins/dashboard/public/application/legacy_app.js @@ -163,11 +163,19 @@ export function initDashboardApp(app, deps) { }; }; - $scope.editItem = ({ editUrl }) => { - history.push(editUrl); + $scope.editItem = ({ appId, editUrl }) => { + if (appId === 'dashboard') { + history.push(editUrl); + } else { + deps.core.application.navigateToUrl(editUrl); + } }; - $scope.viewItem = ({ viewUrl }) => { - history.push(deps.addBasePath(viewUrl)); + $scope.viewItem = ({ appId, viewUrl }) => { + if (appId === 'dashboard') { + history.push(viewUrl); + } else { + deps.core.application.navigateToUrl(viewUrl); + } }; $scope.delete = (dashboards) => { const ids = dashboards.map((d) => ({ id: d.id, appId: d.appId })); diff --git a/src/plugins/dashboard/public/application/listing/create_button.test.tsx b/src/plugins/dashboard/public/application/listing/create_button.test.tsx index 5d2a200f55d..9521df8590e 100644 --- a/src/plugins/dashboard/public/application/listing/create_button.test.tsx +++ b/src/plugins/dashboard/public/application/listing/create_button.test.tsx @@ -57,7 +57,7 @@ describe('create button with props', () => { expect(createButtons.length).toBe(0); const createDropdown = findTestSubject(component, 'createMenuDropdown'); createDropdown.simulate('click'); - const contextMenus = findTestSubject(component, 'contextMenuItem'); + const contextMenus = findTestSubject(component, 'contextMenuItem-test'); expect(contextMenus.length).toBe(2); expect(contextMenus.at(0).prop('href')).toBe('test1'); }); diff --git a/src/plugins/dashboard/public/application/listing/create_button.tsx b/src/plugins/dashboard/public/application/listing/create_button.tsx index 04e6df88377..4959603fa27 100644 --- a/src/plugins/dashboard/public/application/listing/create_button.tsx +++ b/src/plugins/dashboard/public/application/listing/create_button.tsx @@ -38,7 +38,7 @@ const CreateButton = (props: CreateButtonProps) => { {provider.createLinkText} diff --git a/test/plugin_functional/config.ts b/test/plugin_functional/config.ts index e733a4e3636..ce027815a57 100644 --- a/test/plugin_functional/config.ts +++ b/test/plugin_functional/config.ts @@ -52,6 +52,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { require.resolve('./test_suites/doc_views_links'), require.resolve('./test_suites/application_links'), require.resolve('./test_suites/data_plugin'), + require.resolve('./test_suites/dashboard_listing_plugin'), ], services: { ...functionalConfig.get('services'), diff --git a/test/plugin_functional/plugins/dashboard_listing_test_plugin/opensearch_dashboards.json b/test/plugin_functional/plugins/dashboard_listing_test_plugin/opensearch_dashboards.json new file mode 100644 index 00000000000..454d9ea5847 --- /dev/null +++ b/test/plugin_functional/plugins/dashboard_listing_test_plugin/opensearch_dashboards.json @@ -0,0 +1,9 @@ +{ + "id": "dashboard_listing_test_plugin", + "version": "0.0.1", + "opensearchDashboardsVersion": "opensearchDashboards", + "configPath": ["dashboard_listing_test_plugin"], + "server": false, + "ui": true, + "requiredPlugins": ["dashboard"] +} diff --git a/test/plugin_functional/plugins/dashboard_listing_test_plugin/package.json b/test/plugin_functional/plugins/dashboard_listing_test_plugin/package.json new file mode 100644 index 00000000000..0b593604a2a --- /dev/null +++ b/test/plugin_functional/plugins/dashboard_listing_test_plugin/package.json @@ -0,0 +1,17 @@ +{ + "name": "dashboard_listing_test_plugin", + "version": "1.0.0", + "main": "target/test/plugin_functional/plugins/dashboard_listing_test_plugin", + "opensearchDashboards": { + "version": "opensearchDashboards", + "templateVersion": "1.0.0" + }, + "license": "Apache-2.0", + "scripts": { + "osd": "../../../../scripts/use_node ../../../../scripts/osd.js", + "build": "../../../../scripts/use_node ../../../../scripts/remove.js './target' && tsc" + }, + "devDependencies": { + "typescript": "4.0.2" + } +} diff --git a/test/plugin_functional/plugins/dashboard_listing_test_plugin/public/index.ts b/test/plugin_functional/plugins/dashboard_listing_test_plugin/public/index.ts new file mode 100644 index 00000000000..80ddbf8a338 --- /dev/null +++ b/test/plugin_functional/plugins/dashboard_listing_test_plugin/public/index.ts @@ -0,0 +1,22 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +import { PluginInitializer } from 'opensearch-dashboards/public'; +import { + DashboardListingTestPlugin, + DashboardListingTestPluginSetup, + DashboardListingTestPluginStart, +} from './plugin'; + +export const plugin: PluginInitializer< + DashboardListingTestPluginSetup, + DashboardListingTestPluginStart +> = () => new DashboardListingTestPlugin(); diff --git a/test/plugin_functional/plugins/dashboard_listing_test_plugin/public/plugin.tsx b/test/plugin_functional/plugins/dashboard_listing_test_plugin/public/plugin.tsx new file mode 100644 index 00000000000..76a407f7c0d --- /dev/null +++ b/test/plugin_functional/plugins/dashboard_listing_test_plugin/public/plugin.tsx @@ -0,0 +1,53 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +import * as React from 'react'; +import { render, unmountComponentAtNode } from 'react-dom'; +import { Router, Switch, Route, Link } from 'react-router-dom'; +import { CoreSetup, Plugin } from 'opensearch-dashboards/public'; + +export class DashboardListingTestPlugin + implements Plugin { + public setup(core: CoreSetup, setupDeps: SetupDependencies) { + const ID = 'dashboard_listing_test_plugin'; + const BASE_URL = core.http.basePath.prepend(`/app/${ID}#`); + setupDeps.dashboard.registerDashboardProvider({ + appId: ID, + savedObjectsType: 'dashboardTest', + savedObjectsName: 'Dashboard Test', + editUrlPathFn: (obj: SavedObject) => `${BASE_URL}/${obj.id}/edit`, + viewUrlPathFn: (obj: SavedObject) => `${BASE_URL}/${obj.id}`, + createLinkText: 'Test Dashboard', + createSortText: 'Test Dashboard', + createUrl: `${BASE_URL}/create`, + }); + + core.application.register({ + id: ID, + title: 'Dashboard Listing Test Plugin', + appRoute: `app/${ID}`, + async mount(context, { element }) { + render( +

Dashboard Listing Test Header

, + element + ); + + return () => unmountComponentAtNode(element); + }, + }); + } + + public start() {} + public stop() {} +} + +export type DashboardListingTestPluginSetup = ReturnType; +export type DashboardListingTestPluginStart = ReturnType; diff --git a/test/plugin_functional/plugins/dashboard_listing_test_plugin/tsconfig.json b/test/plugin_functional/plugins/dashboard_listing_test_plugin/tsconfig.json new file mode 100644 index 00000000000..f77a5eaffc3 --- /dev/null +++ b/test/plugin_functional/plugins/dashboard_listing_test_plugin/tsconfig.json @@ -0,0 +1,17 @@ +{ + "extends": "../../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./target", + "skipLibCheck": true + }, + "include": [ + "index.ts", + "public/**/*.ts", + "public/**/*.tsx", + "../../../../typings/**/*", + ], + "exclude": [], + "references": [ + { "path": "../../../../src/core/tsconfig.json" } + ] +} diff --git a/test/plugin_functional/test_suites/dashboard_listing_plugin/dashboard_listing_plugin.ts b/test/plugin_functional/test_suites/dashboard_listing_plugin/dashboard_listing_plugin.ts new file mode 100644 index 00000000000..354cfac4fa8 --- /dev/null +++ b/test/plugin_functional/test_suites/dashboard_listing_plugin/dashboard_listing_plugin.ts @@ -0,0 +1,71 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +import url from 'url'; +import expect from '@osd/expect'; + +const getPathWithHash = (absoluteUrl: string) => { + const parsed = url.parse(absoluteUrl); + return `${parsed.path}${parsed.hash ?? ''}`; +}; + +export default function ({ getService, getPageObjects }) { + const testSubjects = getService('testSubjects'); + const PageObjects = getPageObjects(['common', 'dashboard', 'header']); + const browser = getService('browser'); + const listingTable = getService('listingTable'); + const find = getService('find'); + + describe('dashboard listing plugin', function describeIndexTests() { + const dashboardName = 'Dashboard Test'; + + before(async () => { + await PageObjects.dashboard.initTests({ + opensearchDashboardsIndex: '../functional/fixtures/opensearch_archiver/dashboard/legacy', + }); + await PageObjects.dashboard.clickCreateDashboardPrompt(); + await PageObjects.dashboard.saveDashboard('default'); + await PageObjects.dashboard.gotoDashboardLandingPage(); + }); + + it('should be able to navigate to create a dashboard', async () => { + await testSubjects.click('createMenuDropdown'); + await testSubjects.click('contextMenuItem-dashboard'); + await PageObjects.dashboard.saveDashboard(dashboardName); + + await PageObjects.dashboard.gotoDashboardLandingPage(); + await listingTable.searchAndExpectItemsCount('dashboard', dashboardName, 1); + }); + + it('should be able to navigate to view dashboard', async () => { + await listingTable.clickItemLink('dashboard', dashboardName); + await PageObjects.header.awaitGlobalLoadingIndicatorHidden(); + await PageObjects.dashboard.getIsInViewMode(); + await PageObjects.dashboard.gotoDashboardLandingPage(); + }); + + it('should be able to navigate to edit dashboard', async () => { + await listingTable.searchForItemWithName(dashboardName); + const editBttn = await find.allByCssSelector('.euiToolTipAnchor'); + await editBttn[0].click(); + await PageObjects.dashboard.clickCancelOutOfEditMode(); + await PageObjects.dashboard.gotoDashboardLandingPage(); + }); + + it('should be able to navigate to create a test dashboard', async () => { + await testSubjects.click('createMenuDropdown'); + await testSubjects.click('contextMenuItem-dashboard_listing_test_plugin'); + expect(getPathWithHash(await browser.getCurrentUrl())).to.eql( + '/app/dashboard_listing_test_plugin#/create' + ); + }); + }); +} diff --git a/test/plugin_functional/test_suites/dashboard_listing_plugin/index.ts b/test/plugin_functional/test_suites/dashboard_listing_plugin/index.ts new file mode 100644 index 00000000000..a84790824f6 --- /dev/null +++ b/test/plugin_functional/test_suites/dashboard_listing_plugin/index.ts @@ -0,0 +1,35 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +export default function ({ getService, loadTestFile }) { + const browser = getService('browser'); + const opensearchArchiver = getService('opensearchArchiver'); + + async function loadLogstash() { + await browser.setWindowSize(1200, 900); + await opensearchArchiver.loadIfNeeded( + '../functional/fixtures/opensearch_archiver/logstash_functional' + ); + } + + async function unloadLogstash() { + await opensearchArchiver.unload( + '../functional/fixtures/opensearch_archiver/logstash_functional' + ); + } + + describe('dashboard listing plugin', () => { + before(loadLogstash); + after(unloadLogstash); + + loadTestFile(require.resolve('./dashboard_listing_plugin')); + }); +} From 66aa1228504dc32b5d9aee1e2a93f48a52c3a1f5 Mon Sep 17 00:00:00 2001 From: Josh Romero Date: Mon, 24 Apr 2023 20:04:59 -0700 Subject: [PATCH 16/38] remove jquery console release note for https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3929 revert (#3930) Signed-off-by: Josh Romero Co-authored-by: Ashwin P Chandran --- release-notes/opensearch-dashboards.release-notes-2.7.0.md | 1 - 1 file changed, 1 deletion(-) diff --git a/release-notes/opensearch-dashboards.release-notes-2.7.0.md b/release-notes/opensearch-dashboards.release-notes-2.7.0.md index 3ad55fe4d80..60eda383243 100644 --- a/release-notes/opensearch-dashboards.release-notes-2.7.0.md +++ b/release-notes/opensearch-dashboards.release-notes-2.7.0.md @@ -76,7 +76,6 @@ ### ๐Ÿช› Refactoring - Remove automatic addition of `osd-version` header to requests outside of OpenSearch Dashboards ([#3643](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3643)) -- [Console] Replace jQuery usage in console plugin with native methods ([#3733](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3733)) - [Doc Links] Clean up docs_link_service organization so that strings are in the right categories. ([#3685](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3685)) - [I18n] Fix Listr type errors and error handlers ([#3629](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3629)) - [Multiple DataSource] Refactor dev tool console to use opensearch-js client to send requests ([#3544](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3544)) From 755f16bb33a06436b24ebe790e21c9f320afdefa Mon Sep 17 00:00:00 2001 From: Andrey Myssak <40265277+andreymyssak@users.noreply.github.com> Date: Wed, 26 Apr 2023 05:07:43 +0600 Subject: [PATCH 17/38] [CCI] Update js-yaml to v4.0.5 (#3770) * Update js-yaml to 4.0.5 (#3659) * Update CHANGELOG.md (#3659) Co-authored-by: Sergey Myssak Signed-off-by: Andrey Myssak --------- Signed-off-by: Andrey Myssak Signed-off-by: Josh Romero Co-authored-by: Sergey Myssak Co-authored-by: Josh Romero --- CHANGELOG.md | 1 + package.json | 4 ++-- packages/osd-apm-config-loader/package.json | 2 +- .../osd-apm-config-loader/src/utils/read_config.ts | 4 ++-- packages/osd-config/package.json | 2 +- packages/osd-config/src/raw/read_config.ts | 4 ++-- packages/osd-optimizer/package.json | 2 +- packages/osd-optimizer/src/limits.ts | 4 ++-- .../integration_tests/reload_logging_config.test.ts | 4 ++-- src/dev/stylelint/lint_files.js | 4 ++-- .../collectors/usage/telemetry_usage_collector.ts | 4 ++-- tasks/function_test_groups.js | 4 ++-- yarn.lock | 12 ++++++------ 13 files changed, 26 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92f117e3a59..09445595256 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -182,6 +182,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Remove the unused `renovate.json5` file ([3489](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3489)) - Allow selecting the Node.js binary using `NODE_HOME` and `OSD_NODE_HOME` ([3508](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3508)) - Bump `styled-components` from 5.3.5 to 5.3.9 ([#3678](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3678)) +- Bump `js-yaml` from 3.14.0 to 4.1.0 ([#3770](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3770)) - Bump `oui` from `1.0.0` to `1.1.1` ([#3884](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3884)) ### ๐Ÿช› Refactoring diff --git a/package.json b/package.json index b9eb244f775..4bd9cd10f49 100644 --- a/package.json +++ b/package.json @@ -184,7 +184,7 @@ "inline-style": "^2.0.0", "ip-cidr": "^2.1.0", "joi": "^13.5.2", - "js-yaml": "^3.14.0", + "js-yaml": "^4.1.0", "json-stable-stringify": "^1.0.1", "json-stringify-safe": "5.0.1", "lodash": "^4.17.21", @@ -288,7 +288,7 @@ "@types/jest": "^27.4.0", "@types/joi": "^13.4.2", "@types/jquery": "^3.3.31", - "@types/js-yaml": "^3.11.1", + "@types/js-yaml": "^4.0.5", "@types/json-stable-stringify": "^1.0.32", "@types/json5": "^0.0.30", "@types/license-checker": "15.0.0", diff --git a/packages/osd-apm-config-loader/package.json b/packages/osd-apm-config-loader/package.json index c3c0249bd73..fc06ff025e8 100644 --- a/packages/osd-apm-config-loader/package.json +++ b/packages/osd-apm-config-loader/package.json @@ -13,7 +13,7 @@ "dependencies": { "@elastic/safer-lodash-set": "0.0.0", "@osd/utils": "1.0.0", - "js-yaml": "^3.14.0", + "js-yaml": "^4.1.0", "lodash": "^4.17.21" }, "devDependencies": { diff --git a/packages/osd-apm-config-loader/src/utils/read_config.ts b/packages/osd-apm-config-loader/src/utils/read_config.ts index 806a1ad2e92..7076060cb04 100644 --- a/packages/osd-apm-config-loader/src/utils/read_config.ts +++ b/packages/osd-apm-config-loader/src/utils/read_config.ts @@ -29,13 +29,13 @@ */ import { readFileSync } from 'fs'; -import { safeLoad } from 'js-yaml'; +import { load } from 'js-yaml'; import { set } from '@elastic/safer-lodash-set'; import { isPlainObject } from 'lodash'; import { ensureDeepObject } from './ensure_deep_object'; -const readYaml = (path: string) => safeLoad(readFileSync(path, 'utf8')); +const readYaml = (path: string) => load(readFileSync(path, 'utf8')); function replaceEnvVarRefs(val: string) { return val.replace(/\$\{(\w+)\}/g, (match, envVarName) => { diff --git a/packages/osd-config/package.json b/packages/osd-config/package.json index 7d2f68abc8d..f6d363c9c38 100644 --- a/packages/osd-config/package.json +++ b/packages/osd-config/package.json @@ -14,7 +14,7 @@ "@osd/config-schema": "1.0.0", "@osd/logging": "1.0.0", "@osd/std": "1.0.0", - "js-yaml": "^3.14.0", + "js-yaml": "^4.1.0", "load-json-file": "^6.2.0", "lodash": "^4.17.21", "moment": "^2.24.0", diff --git a/packages/osd-config/src/raw/read_config.ts b/packages/osd-config/src/raw/read_config.ts index 0c4a7c2330d..ad7820381ee 100644 --- a/packages/osd-config/src/raw/read_config.ts +++ b/packages/osd-config/src/raw/read_config.ts @@ -29,13 +29,13 @@ */ import { readFileSync } from 'fs'; -import { safeLoad } from 'js-yaml'; +import { load } from 'js-yaml'; import { set } from '@elastic/safer-lodash-set'; import { isPlainObject } from 'lodash'; import { ensureDeepObject } from './ensure_deep_object'; -const readYaml = (path: string) => safeLoad(readFileSync(path, 'utf8')); +const readYaml = (path: string) => load(readFileSync(path, 'utf8')); function replaceEnvVarRefs(val: string) { return val.replace(/\$\{(\w+)\}/g, (match, envVarName) => { diff --git a/packages/osd-optimizer/package.json b/packages/osd-optimizer/package.json index 2aec5681ba9..5e82a7004ff 100644 --- a/packages/osd-optimizer/package.json +++ b/packages/osd-optimizer/package.json @@ -27,7 +27,7 @@ "execa": "^4.0.2", "fibers": "^5.0.3", "jest-diff": "^27.5.1", - "js-yaml": "^3.14.0", + "js-yaml": "^4.1.0", "json-stable-stringify": "^1.0.1", "lmdb-store": "^1.6.11", "normalize-path": "^3.0.0", diff --git a/packages/osd-optimizer/src/limits.ts b/packages/osd-optimizer/src/limits.ts index 86b18693027..d81137c3a9a 100644 --- a/packages/osd-optimizer/src/limits.ts +++ b/packages/osd-optimizer/src/limits.ts @@ -51,7 +51,7 @@ export function readLimits(): Limits { } } - return yaml ? (Yaml.safeLoad(yaml) as any) : {}; + return yaml ? (Yaml.load(yaml) as any) : {}; } export function validateLimitsForAllBundles(log: ToolingLog, config: OptimizerConfig) { @@ -109,6 +109,6 @@ export function updateBundleLimits(log: ToolingLog, config: OptimizerConfig) { pageLoadAssetSize, }; - Fs.writeFileSync(LIMITS_PATH, Yaml.safeDump(newLimits)); + Fs.writeFileSync(LIMITS_PATH, Yaml.dump(newLimits)); log.success(`wrote updated limits to ${LIMITS_PATH}`); } diff --git a/src/cli/serve/integration_tests/reload_logging_config.test.ts b/src/cli/serve/integration_tests/reload_logging_config.test.ts index fb3c63ffc71..5950cb1fdfb 100644 --- a/src/cli/serve/integration_tests/reload_logging_config.test.ts +++ b/src/cli/serve/integration_tests/reload_logging_config.test.ts @@ -36,7 +36,7 @@ import Del from 'del'; import * as Rx from 'rxjs'; import { map, filter, take } from 'rxjs/operators'; -import { safeDump } from 'js-yaml'; +import { dump } from 'js-yaml'; import { getConfigFromFiles } from '@osd/config'; const legacyConfig = follow('__fixtures__/reload_logging_config/opensearch_dashboards.test.yml'); @@ -89,7 +89,7 @@ function createConfigManager(configPath: string) { return { modify(fn: (input: Record) => Record) { const oldContent = getConfigFromFiles([configPath]); - const yaml = safeDump(fn(oldContent)); + const yaml = dump(fn(oldContent)); Fs.writeFileSync(configPath, yaml); }, }; diff --git a/src/dev/stylelint/lint_files.js b/src/dev/stylelint/lint_files.js index ead1fde5bb2..2d94f98b396 100644 --- a/src/dev/stylelint/lint_files.js +++ b/src/dev/stylelint/lint_files.js @@ -30,13 +30,13 @@ import stylelint from 'stylelint'; import path from 'path'; -import { safeLoad } from 'js-yaml'; +import { load } from 'js-yaml'; import fs from 'fs'; import { createFailError } from '@osd/dev-utils'; // load the include globs from .stylelintrc.yml and convert them to regular expressions for filtering files const stylelintPath = path.resolve(__dirname, '..', '..', '..', '.stylelintrc.yml'); -const styleLintConfig = safeLoad(fs.readFileSync(stylelintPath)); +const styleLintConfig = load(fs.readFileSync(stylelintPath)); /** * Lints a list of files with eslint. eslint reports are written to the log diff --git a/src/plugins/telemetry/server/collectors/usage/telemetry_usage_collector.ts b/src/plugins/telemetry/server/collectors/usage/telemetry_usage_collector.ts index 7347975dbc4..e15a1921b73 100644 --- a/src/plugins/telemetry/server/collectors/usage/telemetry_usage_collector.ts +++ b/src/plugins/telemetry/server/collectors/usage/telemetry_usage_collector.ts @@ -29,7 +29,7 @@ */ import { accessSync, constants, readFileSync, statSync } from 'fs'; -import { safeLoad } from 'js-yaml'; +import { load } from 'js-yaml'; import { dirname, join } from 'path'; import { Observable } from 'rxjs'; @@ -78,7 +78,7 @@ export async function readTelemetryFile( try { if (isFileReadable(configPath)) { const yaml = readFileSync(configPath); - const data = safeLoad(yaml.toString()); + const data = load(yaml.toString()); // don't bother returning empty objects if (Object.keys(data).length) { diff --git a/tasks/function_test_groups.js b/tasks/function_test_groups.js index 91f017a437c..d6df1573a66 100644 --- a/tasks/function_test_groups.js +++ b/tasks/function_test_groups.js @@ -33,10 +33,10 @@ import { resolve } from 'path'; import execa from 'execa'; import grunt from 'grunt'; -import { safeLoad } from 'js-yaml'; +import { load } from 'js-yaml'; const JOBS_YAML = readFileSync(resolve(__dirname, '../.ci/jobs.yml'), 'utf8'); -const TEST_TAGS = safeLoad(JOBS_YAML) +const TEST_TAGS = load(JOBS_YAML) .JOB.filter((id) => id.startsWith('opensearch-dashboards-ciGroup')) .map((id) => id.replace(/^opensearch-dashboards-/, '')); diff --git a/yarn.lock b/yarn.lock index 33ca05a2f2c..7817a668b03 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3126,10 +3126,10 @@ resolved "https://registry.yarnpkg.com/@types/js-cookie/-/js-cookie-2.2.5.tgz#38dfaacae8623b37cc0b0d27398e574e3fc28b1e" integrity sha512-cpmwBRcHJmmZx0OGU7aPVwGWGbs4iKwVYchk9iuMtxNCA2zorwdaTz4GkLgs2WGxiRZRFKnV1k6tRUHX7tBMxg== -"@types/js-yaml@^3.11.1": - version "3.12.7" - resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-3.12.7.tgz#330c5d97a3500e9c903210d6e49f02964af04a0e" - integrity sha512-S6+8JAYTE1qdsc9HMVsfY7+SgSuUU/Tp6TYTmITW0PZxiyIMvol3Gy//y69Wkhs0ti4py5qgR3uZH6uz/DNzJQ== +"@types/js-yaml@^4.0.5": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.5.tgz#738dd390a6ecc5442f35e7f03fa1431353f7e138" + integrity sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA== "@types/json-schema@*", "@types/json-schema@^7.0.3", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.11" @@ -11234,14 +11234,14 @@ js-yaml-js-types@1.0.0: dependencies: esprima "^4.0.1" -js-yaml@4.1.0: +js-yaml@4.1.0, js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== dependencies: argparse "^2.0.1" -js-yaml@^3.13.1, js-yaml@^3.14.0, js-yaml@~3.14.0: +js-yaml@^3.13.1, js-yaml@~3.14.0: version "3.14.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== From ac2ee3a3ee5c0d56243c7a2d731b8743bbd77ab8 Mon Sep 17 00:00:00 2001 From: Melissa Vagi Date: Wed, 26 Apr 2023 16:26:36 -0600 Subject: [PATCH 18/38] Update README.md (#3788) * Update README.md Signed-off-by: Melissa Vagi * Update README.md Co-authored-by: Miki --------- Signed-off-by: Melissa Vagi Co-authored-by: Miki Co-authored-by: Miki --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d1b8fc9ed9d..e073be79e20 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,13 @@ ## Welcome -OpenSearch Dashboards is an open source search and analytics visualization. We aim to be the best community-driven platform and provide all the contributors a great open source experience. +OpenSearch Dashboards is an open-source data visualization tool designed to work with OpenSearch. OpenSearch Dashboards gives you data visualization tools to improve and automate business intelligence and support data-driven decision-making and strategic planning. -Feel free to take a look at what the community has been up to, and then head over to the [Project Board](https://github.com/opensearch-project/OpenSearch-Dashboards/projects) to track release targets, or jump in and [start opening issues](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/new/choose), [set up your development environment](DEVELOPER_GUIDE.md#getting-started), or [start contributing](CONTRIBUTING.md). +We aim to be an exceptional community-driven platform and to foster open participation and collective contribution with all contributors. Stay up to date on what's happening with the OpenSearch Project by tracking GitHub [issues](https://github.com/opensearch-project/OpenSearch-Dashboards/issues) and [pull requests](https://github.com/opensearch-project/OpenSearch-Dashboards/pulls). + +You can [contribute to this project](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/CONTRIBUTING.md) by [opening issues](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/new/choose) to give feedback, share ideas, identify bugs, and contribute code. + +Set up your [OpenSearch Dashboards development environment](ttps://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/DEVELOPER_GUIDE.md#getting-started-guide) today! The project team looks forward to your contributions. ## Code Summary From a8ace28a97f5b178e5e767db03dc8d38046ce14e Mon Sep 17 00:00:00 2001 From: Manasvini B Suryanarayana Date: Thu, 27 Apr 2023 13:20:11 -0700 Subject: [PATCH 19/38] Bump yaml to 2.2.2 (#3947) Signed-off-by: Manasvini B Suryanarayana Co-authored-by: Sean Neumann <1413295+seanneumann@users.noreply.github.com> --- CHANGELOG.md | 3 ++- package.json | 3 ++- yarn.lock | 13 ++++--------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09445595256..6f969dec126 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Eliminate dependency on `got` versions older than 11.8.5 ([#2801](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2801)) - [Multi DataSource] Add explicit no spellcheck on password fields ([#2818](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2818)) - [CVE-2022-25912] Bumps simple-git from 3.4.0 to 3.15.0 ([#3036](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3036)) -- [CVE-2022-35256] Bumps node version from 14.20.0 to 14.20.1 [#3166](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3166)) +- [CVE-2022-35256] Bumps node version from 14.20.0 to 14.20.1 ([#3166](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3166)) - [CVE-2022-46175] Bumps json5 version from 1.0.1 and 2.2.1 to 1.0.2 and 2.2.3 ([#3201](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3201)) - [CVE-2022-25860] Bumps simple-git from 3.15.1 to 3.16.0 ([#3345](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3345)) - [Security] Bumps hapi/statehood to 7.0.4 ([#3411](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3411)) @@ -23,6 +23,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [CVE-2023-26486][cve-2023-26487] Bump vega from 5.22.1 to 5.23.0 ([#3533](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3533)) - [CVE-2023-0842] Bump xml2js from 0.4.23 to 0.5.0 ([#3842](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3842)) - [Multi DataSource] Add private IP blocking validation on server side([#3912](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3912)) +- [CVE-2023-2251] Bump yaml to 2.2.2 ([#3947](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3947)) ### ๐Ÿ“ˆ Features/Enhancements diff --git a/package.json b/package.json index 4bd9cd10f49..04856baeb20 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,8 @@ "**/unset-value": "^2.0.1", "**/jest-config": "npm:@amoo-miki/jest-config@27.5.1", "**/jest-jasmine2": "npm:@amoo-miki/jest-jasmine2@27.5.1", - "**/xml2js": "^0.5.0" + "**/xml2js": "^0.5.0", + "**/yaml": "^2.2.2" }, "workspaces": { "packages": [ diff --git a/yarn.lock b/yarn.lock index 7817a668b03..64c5873a2e3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18478,15 +18478,10 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yaml@^1.10.0: - version "1.10.2" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" - integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== - -yaml@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.1.1.tgz#1e06fb4ca46e60d9da07e4f786ea370ed3c3cfec" - integrity sha512-o96x3OPo8GjWeSLF+wOAbrPfhFOGY0W00GNaxCDv+9hkcDJEnev1yh8S7pgHF0ik6zc8sQLuL8hjHjJULZp8bw== +yaml@^1.10.0, yaml@^2.0.0, yaml@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.2.2.tgz#ec551ef37326e6d42872dad1970300f8eb83a073" + integrity sha512-CBKFWExMn46Foo4cldiChEzn7S7SRV+wqiluAb6xmueD/fGyRHIhX8m14vVGgeFWjN540nKCNVj6P21eQjgTuA== yargs-parser@20.2.4: version "20.2.4" From ca0bb8f63f5db103c4ea2ca21fd41dc66310d957 Mon Sep 17 00:00:00 2001 From: Miki Date: Tue, 2 May 2023 11:40:56 -0700 Subject: [PATCH 20/38] Bump `joi` to v14 to avoid the possibility of prototype poisoning in a nested dependency (#3952) Signed-off-by: Miki --- CHANGELOG.md | 3 ++- package.json | 2 +- packages/osd-config-schema/package.json | 2 +- packages/osd-test/package.json | 2 +- yarn.lock | 15 +++++---------- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f969dec126..f2924cdc1c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [CVE-2023-25653] Bump node-jose to 2.2.0 ([#3445](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3445)) - [CVE-2023-26486][cve-2023-26487] Bump vega from 5.22.1 to 5.23.0 ([#3533](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3533)) - [CVE-2023-0842] Bump xml2js from 0.4.23 to 0.5.0 ([#3842](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3842)) -- [Multi DataSource] Add private IP blocking validation on server side([#3912](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3912)) +- [Multi DataSource] Add private IP blocking validation on server side ([#3912](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3912)) +- Bump `joi` to v14 to avoid the possibility of prototype poisoning in a nested dependency ([#3952](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3952)) - [CVE-2023-2251] Bump yaml to 2.2.2 ([#3947](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3947)) ### ๐Ÿ“ˆ Features/Enhancements diff --git a/package.json b/package.json index 04856baeb20..2b894a95897 100644 --- a/package.json +++ b/package.json @@ -184,7 +184,7 @@ "https-proxy-agent": "^5.0.0", "inline-style": "^2.0.0", "ip-cidr": "^2.1.0", - "joi": "^13.5.2", + "joi": "^14.3.1", "js-yaml": "^4.1.0", "json-stable-stringify": "^1.0.1", "json-stringify-safe": "5.0.1", diff --git a/packages/osd-config-schema/package.json b/packages/osd-config-schema/package.json index 52471e29527..c88afe609e1 100644 --- a/packages/osd-config-schema/package.json +++ b/packages/osd-config-schema/package.json @@ -16,7 +16,7 @@ }, "peerDependencies": { "lodash": "^4.17.21", - "joi": "^13.5.2", + "joi": "^14.3.1", "moment": "^2.24.0", "type-detect": "^4.0.8" } diff --git a/packages/osd-test/package.json b/packages/osd-test/package.json index 69fa50828fc..c1ee4f1687c 100644 --- a/packages/osd-test/package.json +++ b/packages/osd-test/package.json @@ -31,7 +31,7 @@ "exit-hook": "^2.2.0", "getopts": "^2.2.5", "glob": "^7.1.7", - "joi": "^13.5.2", + "joi": "^14.3.1", "lodash": "^4.17.21", "parse-link-header": "^2.0.0", "rxjs": "^6.5.5", diff --git a/yarn.lock b/yarn.lock index 64c5873a2e3..c424c6592eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9589,11 +9589,6 @@ hmac-drbg@^1.0.1: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" -hoek@5.x.x: - version "5.0.4" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-5.0.4.tgz#0f7fa270a1cafeb364a4b2ddfaa33f864e4157da" - integrity sha512-Alr4ZQgoMlnere5FZJsIyfIjORBqZll5POhDsF4q64dPuJR6rNxXdDxtHSQq8OXRurhmx+PWYEE8bXRROY8h0w== - hoek@6.x.x: version "6.1.3" resolved "https://registry.yarnpkg.com/hoek/-/hoek-6.1.3.tgz#73b7d33952e01fe27a38b0457294b79dd8da242c" @@ -11187,12 +11182,12 @@ jmespath@0.16.0: resolved "https://registry.yarnpkg.com/jmespath/-/jmespath-0.16.0.tgz#b15b0a85dfd4d930d43e69ed605943c802785076" integrity sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw== -joi@^13.5.2: - version "13.7.0" - resolved "https://registry.yarnpkg.com/joi/-/joi-13.7.0.tgz#cfd85ebfe67e8a1900432400b4d03bbd93fb879f" - integrity sha512-xuY5VkHfeOYK3Hdi91ulocfuFopwgbSORmIwzcwHKESQhC7w1kD5jaVSPnqDxS2I8t3RZ9omCKAxNwXN5zG1/Q== +joi@^14.3.1: + version "14.3.1" + resolved "https://registry.yarnpkg.com/joi/-/joi-14.3.1.tgz#164a262ec0b855466e0c35eea2a885ae8b6c703c" + integrity sha512-LQDdM+pkOrpAn4Lp+neNIFV3axv1Vna3j38bisbQhETPMANYRbFJFUyOZcOClYvM/hppMhGWuKSFEK9vjrB+bQ== dependencies: - hoek "5.x.x" + hoek "6.x.x" isemail "3.x.x" topo "3.x.x" From f5a978dfb510ef777b13eec8589b3134c693b2b7 Mon Sep 17 00:00:00 2001 From: Josh Romero Date: Wed, 3 May 2023 11:16:38 -0700 Subject: [PATCH 21/38] [Doc] Add communication guide (#3837) * docs(COMMUNICATION): Add communication guide with info on slack, forum, and developer office hours link from README, CONTRIBUTING, DEVELOPER_GUIDE Signed-off-by: Josh Romero --------- Signed-off-by: Josh Romero --- CHANGELOG.md | 1 + COMMUNICATIONS.md | 83 ++++++++++++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 6 ++++ DEVELOPER_GUIDE.md | 4 +++ README.md | 2 +- 5 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 COMMUNICATIONS.md diff --git a/CHANGELOG.md b/CHANGELOG.md index f2924cdc1c1..37813fee68c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -167,6 +167,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Doc] Update SECURITY.md with instructions for nested dependencies and backporting ([#3497](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3497)) - [Doc] [Console] Fix/update documentation links in Dev Tools console ([#3724](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3724)) - [Doc] Update DEVELOPER_GUIDE.md with added manual bootstrap timeout solution and max virtual memory error solution with docker ([#3764](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3764)) +- [Doc] Add COMMUNICATIONS.md with info about Slack, forum, office hours ([#3837](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3837)) - [Doc] Add docker files and instructions for debugging Selenium functional tests ([#3747](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3747)) ### ๐Ÿ›  Maintenance diff --git a/COMMUNICATIONS.md b/COMMUNICATIONS.md new file mode 100644 index 00000000000..c1dbfc114ce --- /dev/null +++ b/COMMUNICATIONS.md @@ -0,0 +1,83 @@ +# OpenSearch Dashboards Communication + +- [Overview](#overview) +- [Slack](#slack) +- [Forum](#forum) +- [Developer Office Hours](#developer-office-hours) + - [What it is](#what-it-is) + - [When](#when) + - [How to sign up](#how-to-sign-up) + - [FAQ](#faq) + +## Overview + +The purpose of this document is to provide information regarding the communication channels for OpenSearch Dashboards. All communication is subject to the [OpenSearch Code of Conduct](CODE_OF_CONDUCT.md). Please see [CONTRIBUTING](CONTRIBUTING.md) if you're interested in contributing to the project. + +## Slack + +The OpenSearch project has a public workspace on [Slack](https://opensearch.slack.com). See the [Getting Started guide]() for steps to register and setup the workspace. + +Once registered, check out these channels for discussion of OpenSearch Dashboards topics: + +- [#dashboards](https://opensearch.slack.com/archives/C01QENNTGUD) +- [#dashboards-ux](https://opensearch.slack.com/archives/C05389T9LJC) + +## Forum + +Slack conversations are not searchable outside the workspace. For this reason we encourage using the [OpenSearch Dashboards category](https://forum.opensearch.org/c/opensearch-dashboards/57) of the forum for technical support discussions or summarizing findings for the rest of the community. + +## Developer Office Hours + +### What it is + +A recurring 1-hour virtual meeting for community developers to chat with [OpenSearch Dashboards project maintainers](MAINTAINERS.md). Priority will be given to topics that are signed-up in advance, but ad-hoc discussions are welcome in any remaining time. + +While we'll always prioritize asynchronous communication, sometimes a community call is the most effective and efficient venue to share information and knowledge. Some reasons to sign up: + +1. Review a proposal or technical design for a new feature in OpenSearch Dashboards or an OpenSearch Dashboards plugin +2. Learn more about how to build and extend OpenSearch Dashboards - which APIs, plugins, resources, and services are available to speed development +3. Discuss OpenSearch Dashboard roadmap and technical initiatives + +Signing up isn't required to attend - all OpenSearch Dashboards contributors or interested developers are welcome as participants. + +Bring your ideas and projects early, while you still have time and flexibility to make significant changes. + +### When + +Every other Thursday, 10AM-11AM PT. + +### How to sign up + +There will be a forum post for each iteration of the meeting, with pre-defined slots. To sign-up, simply reply in the forum thread with the following template: + +* Topic: [a brief description of what you'd like to discuss] +* Requested by: [provide GitHub aliases of attendees] +* GitHub issues or PRs: [before signing up, make sure to create an issue, whether in the OpenSearch Dashboards repository or your own plugin repository] +* Time required [choose 15, 30, 45, or 60 minutes] +* Requested maintainer: [optional; provide GitHub alias of any particular maintainer youโ€™d like to attend] + +### FAQ + +#### Will the meetings be recorded? + +Yes, we plan to record each office hours session and post to our YouTube channel so the information can be more easily shared and referenced. + +#### Will all maintainers attend? + +Generally no, but there will always be at least one maintainer. We'll review the sign-ups ahead of time to make sure the right subject-matter experts will attend, depending on the topics. + +#### What happens if there are no sign-ups for a particular session? + +The session will still occur, and the maintainers will present a brief knowledge-sharing session or demo. We'll also hold ad-hoc discussions, but the session may end early. + +#### Is it first come first serve or do we get to decide which topics we discuss in a session? + +For sign-ups, itโ€™s first-come first served, until we decide we need another method. + +#### Will there also be meeting notes? or is the recording the only available transcript? + +No. But weโ€™ll also post the chat transcript and any slides shared (see https://forum.opensearch.org/t/opensearch-community-meeting-2023-0131/11892/5 as example) + +#### How can I cancel or reschedule? + +Just leave another forum reply, as early as possible so other folks have the opportunity to sign-up for the same spot. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 045b17019b7..4a605d04c05 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,7 @@ - [Contributing to OpenSearch](#contributing-to-opensearch-dashboards) - [First Things First](#first-things-first) - [Ways to Contribute](#ways-to-contribute) + - [Join the Discussion](#join-the-discussion) - [Bug Reports](#bug-reports) - [Feature Requests](#feature-requests) - [Documentation Changes](#documentation-changes) @@ -19,6 +20,11 @@ OpenSearch is a community project that is built and maintained by people just li **Only submit your own work** (or work you have sufficient rights to submit) - Please make sure that any code or documentation you submit is your work or you have the rights to submit. We respect the intellectual property rights of others, and as part of contributing, we'll ask you to sign your contribution with a "Developer Certificate of Origin" (DCO) that states you have the rights to submit this work and you understand we'll use your contribution. There's more information about this topic in the [DCO section](#developer-certificate-of-origin). ## Ways to Contribute + +### Join the Discussion + +See the [communication guide](COMMUNICATION.md)for information on how to join our slack workspace, forum, or developer office hours. + ### Bug Reports A bug is when software behaves in a way that you didn't expect and the developer didn't intend. To help us understand what's going on, we first want to make sure you're working from the latest version. Please make sure you're testing against the [latest version](https://github.com/opensearch-project/OpenSearch-Dashboards). diff --git a/DEVELOPER_GUIDE.md b/DEVELOPER_GUIDE.md index d3c8b269c4c..3df2106e967 100644 --- a/DEVELOPER_GUIDE.md +++ b/DEVELOPER_GUIDE.md @@ -209,6 +209,10 @@ $ yarn start --run-examples - [Project testing guidelines](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/TESTING.md) - [Plugin conventions](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/core/CONVENTIONS.md#technical-conventions) +#### Join the discussion + +See the [communication guide](COMMUNICATION.md)for information on how to join our slack workspace, forum, or developer office hours. + ## Alternative development installations Although the [getting started guide](#getting-started-guide) covers the recommended development environment setup, there are several alternatives worth being aware of. diff --git a/README.md b/README.md index e073be79e20..5c6c764f87f 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Set up your [OpenSearch Dashboards development environment](ttps://github.com/op * [Project Website](https://opensearch.org/) * [Downloads](https://opensearch.org/downloads.html) * [Documentation](https://opensearch.org/docs/) -* Need help? Try [Forums](https://discuss.opendistrocommunity.dev/) +* Need help? See the [communication guide](COMMUNICATION.md) for various options * [Project Principles](https://opensearch.org/#principles) * [Developer Guide](DEVELOPER_GUIDE.md) * [Contributing to OpenSearch](CONTRIBUTING.md) From 5ea0cbe25223e24badfe27f79813ee313c9af0b0 Mon Sep 17 00:00:00 2001 From: Anan Zhuang Date: Fri, 5 May 2023 10:01:35 -0700 Subject: [PATCH 22/38] Temporarily hardcode chromedriver to 112.0.0 to enable all ftr tests (#3976) The latest version of chromedriver is 112.0.1 which does not support node 14. This PR hardcodes chromedriver to 112.0.0 temporarily. Pls revert it once we bump to node 18. Issue Resolved https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3975 Signed-off-by: ananzh --- CHANGELOG.md | 1 + scripts/upgrade_chromedriver.js | 27 +++++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37813fee68c..9bd5689a8e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -211,6 +211,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Prevent primitive linting limitations from being applied to unit tests found under `src/setup_node_env` ([#3403](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3403)) - [Tests] Fix unit tests for `get_keystore` ([#3854](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3854)) - [Tests] Use `scripts/use_node` instead of `node` in functional test plugins ([#3783](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3783)) +- Temporarily hardcode the largest support `chromedriver` version to `112.0.0` to enable all ftr tests ([#3976](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3976)) ## [2.x] diff --git a/scripts/upgrade_chromedriver.js b/scripts/upgrade_chromedriver.js index 3aa896fd1fa..224486bb986 100644 --- a/scripts/upgrade_chromedriver.js +++ b/scripts/upgrade_chromedriver.js @@ -71,16 +71,31 @@ versionCheckCommands.some((cmd) => { const majorVersion = versionCheckOutput?.match?.(/(?:^|\s)(9\d|\d{3})\./)?.[1]; if (majorVersion) { + let targetVersion = `^${majorVersion}`; + + // TODO: Temporary fix to install chromedriver 112.0.0 if major version is 112. + // Exit if major version is greater than 112. + // Revert this once node is bumped to 16+. + // https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3975 + if (parseInt(majorVersion) === 112) { + targetVersion = '112.0.0'; + } else if (parseInt(majorVersion) > 112) { + console.error( + `::error::Chrome version (${majorVersion}) is not supported by this script. The largest chrome version we support is 112.` + ); + process.exit(1); + } + if (process.argv.includes('--install')) { - console.log(`Installing chromedriver@^${majorVersion}`); + console.log(`Installing chromedriver@${targetVersion}`); - spawnSync(`yarn add --dev chromedriver@^${majorVersion}`, { + spawnSync(`yarn add --dev chromedriver@${targetVersion}`, { stdio: 'inherit', cwd: process.cwd(), shell: true, }); } else { - console.log(`Upgrading to chromedriver@^${majorVersion}`); + console.log(`Upgrading to chromedriver@${targetVersion}`); let upgraded = false; const writeStream = createWriteStream('package.json.upgrading-chromedriver', { flags: 'w' }); @@ -92,7 +107,7 @@ if (majorVersion) { if (line.includes('"chromedriver": "')) { line = line.replace( /"chromedriver":\s*"[~^]?\d[\d.]*\d"/, - `"chromedriver": "^${majorVersion}"` + `"chromedriver": "${targetVersion}"` ); upgraded = true; } @@ -107,11 +122,11 @@ if (majorVersion) { renameSync('package.json', 'package.json.bak'); renameSync('package.json.upgrading-chromedriver', 'package.json'); - console.log(`Backed up package.json and updated chromedriver to ${majorVersion}`); + console.log(`Backed up package.json and updated chromedriver to ${targetVersion}`); } else { unlinkSync('package.json.upgrading-chromedriver'); console.error( - `Failed to update chromedriver to ${majorVersion}. Try adding the \`--install\` switch.` + `Failed to update chromedriver to ${targetVersion}. Try adding the \`--install\` switch.` ); } }); From 6e352ff5c0d029abbb7e3f7c3e69be897a95114b Mon Sep 17 00:00:00 2001 From: "Qingyang(Abby) Hu" Date: Fri, 5 May 2023 10:46:13 -0700 Subject: [PATCH 23/38] Fix wording and duplicate code in embeddable example plugin (#3911) * Fix wording and duplicate code in embeddable example plugin Signed-off-by: abbyhu2000 * Fix some wording in the embeddable readme Signed-off-by: abbyhu2000 --------- Signed-off-by: abbyhu2000 --- .../searchable_list_container_component.tsx | 1 - .../public/list_container_example.tsx | 9 +++++++++ src/plugins/embeddable/docs/input_and_output_state.md | 5 +---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/examples/embeddable_examples/public/searchable_list_container/searchable_list_container_component.tsx b/examples/embeddable_examples/public/searchable_list_container/searchable_list_container_component.tsx index c24d258fd7d..7e742aba7cc 100644 --- a/examples/embeddable_examples/public/searchable_list_container/searchable_list_container_component.tsx +++ b/examples/embeddable_examples/public/searchable_list_container/searchable_list_container_component.tsx @@ -82,7 +82,6 @@ export class SearchableListContainerComponentInner extends Component (checked[id] = false)); this.state = { checked, hasMatch, diff --git a/examples/embeddable_explorer/public/list_container_example.tsx b/examples/embeddable_explorer/public/list_container_example.tsx index 797b8751303..f466d120e21 100644 --- a/examples/embeddable_explorer/public/list_container_example.tsx +++ b/examples/embeddable_explorer/public/list_container_example.tsx @@ -164,6 +164,15 @@ export function ListContainerExample({ The first HelloWorldEmbeddable does not emit the hasMatch output variable, so the container chooses to hide it.

+

+ Type some strings in the search bar, and press Check matching button. If the search + string matches with any strings from the title or the description of the children + embeddables, the child embeddable's check box will be checked. Noted that the + search filter is case sensitive. However, even if the search string matches with the + strings in the HelloWorldEmbeddable, its check box will not be checked because of the + reason explained above. If we click Delete checked, all the selected child embeddables + will be deleted from the container. +

Check out the "Dynamically adding children" section, to see how to add diff --git a/src/plugins/embeddable/docs/input_and_output_state.md b/src/plugins/embeddable/docs/input_and_output_state.md index 2fd8799099b..a0cd4cc5c0e 100644 --- a/src/plugins/embeddable/docs/input_and_output_state.md +++ b/src/plugins/embeddable/docs/input_and_output_state.md @@ -274,9 +274,6 @@ There are no real life examples showcasing this, it may not even be really neede the thinking being that it would support any type of rendering of child embeddables - whether in a "snap to grid" style like dashboard, or in a free form layout like canvas. -The only real implementation of a container in production code at the time this is written is Dashboard however, with no plans to migrate -Canvas over to use it (this was the original impetus for an abstraction). The container code is quite complicated with child management, -so it makes creating a new container very easy, as you can see in the developer examples of containers. But, it's possible this layer was - an over abstraction without a real prod use case (I can say that because I wrote it, I'm only insulting myself!) :). +The only real implementation of a container in production code at the time is written in the Dashboard plugin, however, with no plans to migrate over to Canvas (this was the original impetus for an abstraction). The container code is quite complicated with child management, so it makes creating a new container very easy, as you can see in the developer examples of containers. But, it's possible this layer was an over abstraction without a real prod use case (I can say that because I wrote it, I'm only insulting myself!) :). Be sure to read [Common mistakes with embeddable containers and inherited input state](./containers_and_inherited_state.md) next! \ No newline at end of file From 0188d05234f3fc510202b27ae1a122a1d1606686 Mon Sep 17 00:00:00 2001 From: Kawika Avilla Date: Thu, 11 May 2023 15:43:10 -0700 Subject: [PATCH 24/38] [CI] setup Chrome and utilize binary path (#3997) Within the CI, the virtual runner that we are utilizing has Chrome installed already. The version of Chrome is installed periodically. The most recent version of Chrome requires updates to dependencies that drop support for Node 14. This downloads chrome in the CI and then checks the chromedriver from the environment variable `TEST_BROWSER_BINARY_PATH`. Signed-off-by: Kawika Avilla --- .github/workflows/build_and_test_workflow.yml | 19 +++++++++++++++++ CHANGELOG.md | 1 + scripts/upgrade_chromedriver.js | 21 +++++++++++++++++-- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test_workflow.yml b/.github/workflows/build_and_test_workflow.yml index fd4cdbbefa7..7568b065321 100644 --- a/.github/workflows/build_and_test_workflow.yml +++ b/.github/workflows/build_and_test_workflow.yml @@ -25,6 +25,8 @@ env: TEST_OPENSEARCH_TRANSPORT_PORT: 9403 TEST_OPENSEARCH_PORT: 9400 OSD_SNAPSHOT_SKIP_VERIFY_CHECKSUM: true + # Version 112.0.5615.0 + CHROME_VERSION: 1109208 jobs: build-lint-test: @@ -122,6 +124,7 @@ jobs: functional-tests: name: Run functional tests on ${{ matrix.name }} (ciGroup${{ matrix.group }}) strategy: + fail-fast: false matrix: os: [ubuntu-latest, windows-latest] group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] @@ -134,6 +137,22 @@ jobs: steps: - run: echo Running functional tests for ciGroup${{ matrix.group }} + - name: Setup Chrome + id: setup-chrome + uses: browser-actions/setup-chrome@v1 + with: + chrome-version: ${{ env.CHROME_VERSION }} + + - name: Set Chrome Path + if: matrix.os != 'windows-latest' + run: | + echo "TEST_BROWSER_BINARY_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV + + - name: Set Chrome Path (Windows) + if: matrix.os == 'windows-latest' + run: | + echo "TEST_BROWSER_BINARY_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $env:GITHUB_ENV + - name: Configure git's autocrlf (Windows only) if: matrix.os == 'windows-latest' run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bd5689a8e7..ef17eb77691 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -148,6 +148,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Upgrade yarn version to be compatible with @openearch-project/opensearch ([#3443](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3443)) - [CI] Reduce redundancy by using matrix strategy on Windows and Linux workflows ([#3514](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3514)) - Add an achievement badger to the PR ([#3721](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3721)) +- Install chrome driver for functional tests from path set by environment variable `TEST_BROWSER_BINARY_PATH`([#3997](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3997)) ### ๐Ÿ“ Documentation diff --git a/scripts/upgrade_chromedriver.js b/scripts/upgrade_chromedriver.js index 224486bb986..ee992706a1f 100644 --- a/scripts/upgrade_chromedriver.js +++ b/scripts/upgrade_chromedriver.js @@ -25,17 +25,34 @@ const versionCheckCommands = []; switch (process.platform) { case 'win32': versionCheckCommands.push( - 'powershell "(Get-Item \\"$Env:Programfiles/Google/Chrome/Application/chrome.exe\\").VersionInfo.FileVersion"' + ...[ + ...(process.env.TEST_BROWSER_BINARY_PATH + ? [ + `powershell "(Get-Item \\"${process.env.TEST_BROWSER_BINARY_PATH}\\").VersionInfo.FileVersion"`, + ] + : []), + 'powershell "(Get-Item \\"$Env:Programfiles/Google/Chrome/Application/chrome.exe\\").VersionInfo.FileVersion"', + ] ); break; case 'darwin': versionCheckCommands.push( - '/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --version' + ...[ + ...(process.env.TEST_BROWSER_BINARY_PATH + ? [`${process.env.TEST_BROWSER_BINARY_PATH} --version`] + : []), + '/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --version', + ] ); break; default: + versionCheckCommands.push( + ...(process.env.TEST_BROWSER_BINARY_PATH + ? [`${process.env.TEST_BROWSER_BINARY_PATH} --version`] + : []) + ); versionCheckCommands.push( ...[ '/usr/bin', From 8121c9df29db8e04d2b188ec29408c0e0ce02a6d Mon Sep 17 00:00:00 2001 From: Kawika Avilla Date: Mon, 15 May 2023 11:21:18 -0700 Subject: [PATCH 25/38] [Dashboards listing] fix listing limit (#4021) Initial page size was passed to the search function instead of the listing limit causing the max amount received to be significantly less than the previously implementation. Saved objects per page is `20` by default and the listing limit per page is `1000` by default. Issue: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/4017 Signed-off-by: Kawika Avilla --- CHANGELOG.md | 1 + src/plugins/dashboard/public/application/legacy_app.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef17eb77691..bf7df824e53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -255,6 +255,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Console] Fix dev tool console autocomplete not loading issue ([#3775](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3775)) - [Console] Fix dev tool console run command with query parameter error ([#3813](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3813)) - Add clarifying tooltips to header navigation ([#3573](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3573)) +- [Dashboards Listing] Fix listing limit to utilize `savedObjects:listingLimit` instead of `savedObjects:perPage` ([#4021](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4021)) ### ๐Ÿšž Infrastructure diff --git a/src/plugins/dashboard/public/application/legacy_app.js b/src/plugins/dashboard/public/application/legacy_app.js index baacc69f780..0c10653d7f4 100644 --- a/src/plugins/dashboard/public/application/legacy_app.js +++ b/src/plugins/dashboard/public/application/legacy_app.js @@ -150,7 +150,7 @@ export function initDashboardApp(app, deps) { type: $scope.dashboardListTypes, search: search ? `${search}*` : undefined, fields: ['title', 'type', 'description', 'updated_at'], - perPage: $scope.initialPageSize, + perPage: $scope.listingLimit, page: 1, searchFields: ['title^3', 'type', 'description'], defaultSearchOperator: 'AND', From 0e25f2e6e0e906e2474e513a6784be9ac63b26da Mon Sep 17 00:00:00 2001 From: Alexei Karikov Date: Tue, 16 May 2023 05:45:57 +0600 Subject: [PATCH 26/38] [CCI] Fix EUI/OUI type errors (#3798) * Update find_test_subject imports for tests Signed-off-by: Alexei Karikov * Update to available imports for findTestSubject Signed-off-by: Alexei Karikov * Fix available import for Query and custom icon Signed-off-by: Alexei Karikov * Add changelog entry Signed-off-by: Alexei Karikov * Add ts-ignore Signed-off-by: Alexei Karikov --------- Signed-off-by: Alexei Karikov Co-authored-by: Qingyang(Abby) Hu --- CHANGELOG.md | 1 + .../public/management_app/components/field/field.test.tsx | 2 +- .../public/management_app/components/form/form.test.tsx | 2 +- .../public/management_app/components/search/search.test.tsx | 2 +- .../public/management_app/components/search/search.tsx | 2 +- .../public/application/dashboard_empty_screen.test.tsx | 2 +- .../public/application/tests/dashboard_container.test.tsx | 2 +- .../shard_failure_open_modal_button.test.tsx | 2 +- src/plugins/dev_tools/public/plugin.ts | 2 +- .../angular/context/components/action_bar/action_bar.test.tsx | 2 +- .../doc_table/components/pager/tool_bar_pager_buttons.test.tsx | 2 +- .../doc_table/components/table_header/table_header.test.tsx | 2 +- .../context_error_message/context_error_message.test.tsx | 2 +- .../discover/public/application/components/doc/doc.test.tsx | 2 +- .../application/components/doc_viewer/doc_viewer.test.tsx | 2 +- .../application/components/hits_counter/hits_counter.test.tsx | 2 +- .../components/loading_spinner/loading_spinner.test.tsx | 2 +- .../components/sidebar/discover_field_search.test.tsx | 2 +- .../application/components/sidebar/discover_sidebar.test.tsx | 2 +- .../discover/public/application/components/table/table.test.tsx | 2 +- .../components/timechart_header/timechart_header.test.tsx | 2 +- .../embeddable/public/lib/embeddables/embeddable_root.test.tsx | 2 +- .../embeddable/public/lib/panel/embeddable_panel.test.tsx | 2 +- .../panel_actions/add_panel/add_panel_flyout.test.tsx | 2 +- .../public/components/editor/controls_tab.test.tsx | 2 +- .../public/components/editor/list_control_editor.test.tsx | 2 +- .../public/components/editor/range_control_editor.test.tsx | 2 +- .../public/components/vis/input_control_vis.test.tsx | 2 +- 28 files changed, 28 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf7df824e53..f49fa05b2c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -197,6 +197,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Console] Replace jQuery.ajax with core.http when calling OSD APIs in console ([#3080](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3080)) - [I18n] Fix Listr type errors and error handlers ([#3629](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3629)) - [Multiple DataSource] Present the authentication type choices in a drop-down ([#3693](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3693)) +- Fix EUI/OUI type errors ([#3798](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3798)) ### ๐Ÿ”ฉ Tests diff --git a/src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx b/src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx index c5a8a89157f..4f17ab378d3 100644 --- a/src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx +++ b/src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx @@ -36,7 +36,7 @@ import { FieldSetting } from '../../types'; import { UiSettingsType, StringValidation } from '../../../../../../core/public'; import { notificationServiceMock, docLinksServiceMock } from '../../../../../../core/public/mocks'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import { Field, getEditableValue } from './field'; jest.mock('brace/theme/textmate', () => 'brace/theme/textmate'); diff --git a/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx b/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx index 650d8b259f0..7f22894fb8a 100644 --- a/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx +++ b/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers'; import { UiSettingsType } from '../../../../../../core/public'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import { notificationServiceMock } from '../../../../../../core/public/mocks'; import { SettingsChanges } from '../../types'; diff --git a/src/plugins/advanced_settings/public/management_app/components/search/search.test.tsx b/src/plugins/advanced_settings/public/management_app/components/search/search.test.tsx index 34b69888b3b..f362af408e0 100644 --- a/src/plugins/advanced_settings/public/management_app/components/search/search.test.tsx +++ b/src/plugins/advanced_settings/public/management_app/components/search/search.test.tsx @@ -31,7 +31,7 @@ import React from 'react'; import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import { Query } from '@elastic/eui'; import { Search } from './search'; diff --git a/src/plugins/advanced_settings/public/management_app/components/search/search.tsx b/src/plugins/advanced_settings/public/management_app/components/search/search.tsx index a957fa793f8..0b1de3bbfb2 100644 --- a/src/plugins/advanced_settings/public/management_app/components/search/search.tsx +++ b/src/plugins/advanced_settings/public/management_app/components/search/search.tsx @@ -31,7 +31,6 @@ import React, { Fragment, PureComponent } from 'react'; import { i18n } from '@osd/i18n'; import { EuiSearchBar, EuiFormErrorText, Query } from '@elastic/eui'; - import { getCategoryName } from '../../lib'; interface SearchProps { @@ -111,6 +110,7 @@ export class Search extends PureComponent { return ( + {/* @ts-ignore The Query types that typescript complains about here are identical and is a false flag. Once OUI migration is complete, this ignore can be removed */} {queryParseError} diff --git a/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx b/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx index fd4291b2945..ac22b069135 100644 --- a/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx +++ b/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx @@ -31,7 +31,7 @@ import React from 'react'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; import { DashboardEmptyScreen, DashboardEmptyScreenProps } from './dashboard_empty_screen'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import { coreMock } from '../../../../core/public/mocks'; describe('DashboardEmptyScreen', () => { diff --git a/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx b/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx index d3198f6e1e3..2746997947c 100644 --- a/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx +++ b/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx @@ -28,7 +28,7 @@ * under the License. */ -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import React from 'react'; import { mount } from 'enzyme'; import { nextTick } from 'test_utils/enzyme_helpers'; diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx index 1ff83cf474c..9a6b71ae645 100644 --- a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx +++ b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx @@ -34,7 +34,7 @@ import { mountWithIntl } from 'test_utils/enzyme_helpers'; import ShardFailureOpenModalButton from './shard_failure_open_modal_button'; import { shardFailureRequest } from './__mocks__/shard_failure_request'; import { shardFailureResponse } from './__mocks__/shard_failure_response'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; describe('ShardFailureOpenModalButton', () => { it('triggers the openModal function when "Show details" button is clicked', () => { diff --git a/src/plugins/dev_tools/public/plugin.ts b/src/plugins/dev_tools/public/plugin.ts index 0c0b3b07f5c..02663da5768 100644 --- a/src/plugins/dev_tools/public/plugin.ts +++ b/src/plugins/dev_tools/public/plugin.ts @@ -78,7 +78,7 @@ export class DevToolsPlugin implements Plugin { defaultMessage: 'Dev Tools', }), updater$: this.appStateUpdater, - euiIconType: '/plugins/home/assets/logos/opensearch_mark_default.svg', + icon: '/plugins/home/public/assets/logos/opensearch_mark_default.svg', order: 9010, category: DEFAULT_APP_CATEGORIES.management, mount: async (params: AppMountParameters) => { diff --git a/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.test.tsx b/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.test.tsx index db5abf3dbed..2f7cc40b7d9 100644 --- a/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.test.tsx +++ b/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.test.tsx @@ -31,7 +31,7 @@ import React from 'react'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; import { ActionBar, ActionBarProps } from './action_bar'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import { MAX_CONTEXT_SIZE, MIN_CONTEXT_SIZE } from '../../query_parameters/constants'; describe('Test Discover Context ActionBar for successor | predecessor records', () => { diff --git a/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx b/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx index 204d0b161c6..2ac06b2b6eb 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx +++ b/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx @@ -31,7 +31,7 @@ import React from 'react'; import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; import { ToolBarPagerButtons } from './tool_bar_pager_buttons'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; test('it renders ToolBarPagerButtons', () => { const props = { diff --git a/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx b/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx index 2e486976bbd..0e8efc18efd 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx +++ b/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx @@ -31,7 +31,7 @@ import React from 'react'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; import { TableHeader } from './table_header'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import { SortOrder } from './helpers'; import { IndexPattern, IFieldType } from '../../../../../opensearch_dashboards_services'; diff --git a/src/plugins/discover/public/application/components/context_error_message/context_error_message.test.tsx b/src/plugins/discover/public/application/components/context_error_message/context_error_message.test.tsx index 30b57eaf0dc..a1ef06b81cf 100644 --- a/src/plugins/discover/public/application/components/context_error_message/context_error_message.test.tsx +++ b/src/plugins/discover/public/application/components/context_error_message/context_error_message.test.tsx @@ -34,7 +34,7 @@ import { ReactWrapper } from 'enzyme'; import { ContextErrorMessage } from './context_error_message'; // @ts-ignore import { FAILURE_REASONS, LOADING_STATUS } from '../../angular/context/query'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; describe('loading spinner', function () { let component: ReactWrapper; diff --git a/src/plugins/discover/public/application/components/doc/doc.test.tsx b/src/plugins/discover/public/application/components/doc/doc.test.tsx index 7385f0d360a..4a3fb740492 100644 --- a/src/plugins/discover/public/application/components/doc/doc.test.tsx +++ b/src/plugins/discover/public/application/components/doc/doc.test.tsx @@ -33,7 +33,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; import { ReactWrapper } from 'enzyme'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import { Doc, DocProps } from './doc'; const mockSearchApi = jest.fn(); diff --git a/src/plugins/discover/public/application/components/doc_viewer/doc_viewer.test.tsx b/src/plugins/discover/public/application/components/doc_viewer/doc_viewer.test.tsx index 843ad578825..ccab0be41ed 100644 --- a/src/plugins/discover/public/application/components/doc_viewer/doc_viewer.test.tsx +++ b/src/plugins/discover/public/application/components/doc_viewer/doc_viewer.test.tsx @@ -31,7 +31,7 @@ import React from 'react'; import { mount, shallow } from 'enzyme'; import { DocViewer } from './doc_viewer'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import { getDocViewsRegistry } from '../../../opensearch_dashboards_services'; import { DocViewRenderProps } from '../../doc_views/doc_views_types'; diff --git a/src/plugins/discover/public/application/components/hits_counter/hits_counter.test.tsx b/src/plugins/discover/public/application/components/hits_counter/hits_counter.test.tsx index 05435ccae99..998ababbc47 100644 --- a/src/plugins/discover/public/application/components/hits_counter/hits_counter.test.tsx +++ b/src/plugins/discover/public/application/components/hits_counter/hits_counter.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; import { ReactWrapper } from 'enzyme'; import { HitsCounter, HitsCounterProps } from './hits_counter'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; describe('hits counter', function () { let props: HitsCounterProps; diff --git a/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.test.tsx b/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.test.tsx index 5bc6aa29136..fbc98e2550e 100644 --- a/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.test.tsx +++ b/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; import { ReactWrapper } from 'enzyme'; import { LoadingSpinner } from './loading_spinner'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; describe('loading spinner', function () { let component: ReactWrapper; diff --git a/src/plugins/discover/public/application/components/sidebar/discover_field_search.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_field_search.test.tsx index 9170adccc7e..f78505e11f1 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_field_search.test.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_field_search.test.tsx @@ -31,7 +31,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import { DiscoverFieldSearch, Props } from './discover_field_search'; import { EuiButtonGroupProps, EuiPopover } from '@elastic/eui'; import { ReactWrapper } from 'enzyme'; diff --git a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx index dbc8c896246..fa692ca22b5 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx @@ -30,7 +30,7 @@ import _ from 'lodash'; import { ReactWrapper } from 'enzyme'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; // @ts-ignore import realHits from 'fixtures/real_hits.js'; // @ts-ignore diff --git a/src/plugins/discover/public/application/components/table/table.test.tsx b/src/plugins/discover/public/application/components/table/table.test.tsx index bb10fc137bc..220ac57feae 100644 --- a/src/plugins/discover/public/application/components/table/table.test.tsx +++ b/src/plugins/discover/public/application/components/table/table.test.tsx @@ -30,7 +30,7 @@ import React from 'react'; import { mount } from 'enzyme'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import { DocViewTable } from './table'; import { indexPatterns, IndexPattern } from '../../../../../data/public'; diff --git a/src/plugins/discover/public/application/components/timechart_header/timechart_header.test.tsx b/src/plugins/discover/public/application/components/timechart_header/timechart_header.test.tsx index 4a88e469a08..9011c38a6ac 100644 --- a/src/plugins/discover/public/application/components/timechart_header/timechart_header.test.tsx +++ b/src/plugins/discover/public/application/components/timechart_header/timechart_header.test.tsx @@ -33,7 +33,7 @@ import { mountWithIntl } from 'test_utils/enzyme_helpers'; import { ReactWrapper } from 'enzyme'; import { TimechartHeader, TimechartHeaderProps } from './timechart_header'; import { EuiIconTip } from '@elastic/eui'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; describe('timechart header', function () { let props: TimechartHeaderProps; diff --git a/src/plugins/embeddable/public/lib/embeddables/embeddable_root.test.tsx b/src/plugins/embeddable/public/lib/embeddables/embeddable_root.test.tsx index badeda5d4ae..486e99b1c28 100644 --- a/src/plugins/embeddable/public/lib/embeddables/embeddable_root.test.tsx +++ b/src/plugins/embeddable/public/lib/embeddables/embeddable_root.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { HelloWorldEmbeddable } from '../../../../../../examples/embeddable_examples/public'; import { EmbeddableRoot } from './embeddable_root'; import { mount } from 'enzyme'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; test('EmbeddableRoot renders an embeddable', async () => { const embeddable = new HelloWorldEmbeddable({ id: 'hello' }); diff --git a/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx index 072bcd93d32..4db6b30c9b5 100644 --- a/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { mount } from 'enzyme'; import { nextTick } from 'test_utils/enzyme_helpers'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import { I18nProvider } from '@osd/i18n/react'; import { CONTEXT_MENU_TRIGGER } from '../triggers'; import { Action, UiActionsStart, ActionType } from '../../../../ui_actions/public'; diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx index 232c2ca82d1..ac7d6e7aa08 100644 --- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx @@ -41,7 +41,7 @@ import { ContainerInput } from '../../../../containers'; import { mountWithIntl as mount } from 'test_utils/enzyme_helpers'; import { ReactWrapper } from 'enzyme'; import { coreMock } from '../../../../../../../../core/public/mocks'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import { embeddablePluginMock } from '../../../../../mocks'; function DummySavedObjectFinder(props: { children: React.ReactNode }) { diff --git a/src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx b/src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx index e2355799d72..06ed4a66606 100644 --- a/src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx +++ b/src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx @@ -30,7 +30,7 @@ import React from 'react'; import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import { getDepsMock, getIndexPatternMock } from '../../test_utils'; import { ControlsTab, ControlsTabUiProps } from './controls_tab'; import { Vis } from '../../../../visualizations/public'; diff --git a/src/plugins/input_control_vis/public/components/editor/list_control_editor.test.tsx b/src/plugins/input_control_vis/public/components/editor/list_control_editor.test.tsx index d8a36ac9b6c..6837c14fafd 100644 --- a/src/plugins/input_control_vis/public/components/editor/list_control_editor.test.tsx +++ b/src/plugins/input_control_vis/public/components/editor/list_control_editor.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import sinon from 'sinon'; import { shallow } from 'enzyme'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; import { getIndexPatternMock } from '../../test_utils/get_index_pattern_mock'; diff --git a/src/plugins/input_control_vis/public/components/editor/range_control_editor.test.tsx b/src/plugins/input_control_vis/public/components/editor/range_control_editor.test.tsx index a8dcc0761f2..76b1e15a9df 100644 --- a/src/plugins/input_control_vis/public/components/editor/range_control_editor.test.tsx +++ b/src/plugins/input_control_vis/public/components/editor/range_control_editor.test.tsx @@ -33,7 +33,7 @@ import { shallow } from 'enzyme'; import { SinonSpy, spy, assert } from 'sinon'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import { RangeControlEditor } from './range_control_editor'; import { ControlParams } from '../../editor_utils'; diff --git a/src/plugins/input_control_vis/public/components/vis/input_control_vis.test.tsx b/src/plugins/input_control_vis/public/components/vis/input_control_vis.test.tsx index 1e931c084a5..ea1ef17d79f 100644 --- a/src/plugins/input_control_vis/public/components/vis/input_control_vis.test.tsx +++ b/src/plugins/input_control_vis/public/components/vis/input_control_vis.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import sinon from 'sinon'; import { shallow } from 'enzyme'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; -import { findTestSubject } from '@elastic/eui/lib/test'; +import { findTestSubject } from 'test_utils/helpers'; import { InputControlVis } from './input_control_vis'; import { ListControl } from '../../control/list_control_factory'; From 87e795123a36958e7c2596a12f58d775bba2beff Mon Sep 17 00:00:00 2001 From: Sergey Myssak Date: Tue, 16 May 2023 06:18:59 +0600 Subject: [PATCH 27/38] Fix bottom bar visibility using create portal (#3336) (#3978) Signed-off-by: Sergey Myssak Co-authored-by: Andrey Myssak --- CHANGELOG.md | 1 + src/core/public/rendering/_base.scss | 1 - .../public/rendering/app_containers.test.tsx | 3 + src/core/public/rendering/app_containers.tsx | 6 +- .../management_app/_advanced_settings.scss | 4 - .../components/form/form.test.tsx | 9 ++ .../management_app/components/form/form.tsx | 121 +++++++++--------- 7 files changed, 79 insertions(+), 66 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f49fa05b2c6..0e7670ad7a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -134,6 +134,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Table Visualization] Fix table rendering empty unused space ([#3797](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3797)) - [Table Visualization] Fix data table not adjusting height on the initial load ([#3816](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3816)) - Cleanup unused url ([#3847](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3847)) +- [BUG] Docked navigation impacts visibility of bottom bar component ([#3978](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3978)) ### ๐Ÿšž Infrastructure diff --git a/src/core/public/rendering/_base.scss b/src/core/public/rendering/_base.scss index e59008f0825..1333e48f6ca 100644 --- a/src/core/public/rendering/_base.scss +++ b/src/core/public/rendering/_base.scss @@ -5,7 +5,6 @@ */ // SASSTODO: Naming here is too embedded and high up that changing them could cause major breaks #opensearch-dashboards-body { - overflow-x: hidden; min-height: 100%; } diff --git a/src/core/public/rendering/app_containers.test.tsx b/src/core/public/rendering/app_containers.test.tsx index fd43c79514c..157253f5f75 100644 --- a/src/core/public/rendering/app_containers.test.tsx +++ b/src/core/public/rendering/app_containers.test.tsx @@ -43,6 +43,7 @@ describe('AppWrapper', () => { expect(component.getDOMNode()).toMatchInlineSnapshot(`

app-content
@@ -53,6 +54,7 @@ describe('AppWrapper', () => { expect(component.getDOMNode()).toMatchInlineSnapshot(`
app-content
@@ -63,6 +65,7 @@ describe('AppWrapper', () => { expect(component.getDOMNode()).toMatchInlineSnapshot(`
app-content
diff --git a/src/core/public/rendering/app_containers.tsx b/src/core/public/rendering/app_containers.tsx index dab85769bd0..8ccf795f8dc 100644 --- a/src/core/public/rendering/app_containers.tsx +++ b/src/core/public/rendering/app_containers.tsx @@ -37,7 +37,11 @@ export const AppWrapper: React.FunctionComponent<{ chromeVisible$: Observable; }> = ({ chromeVisible$, children }) => { const visible = useObservable(chromeVisible$); - return
{children}
; + return ( +
+ {children} +
+ ); }; export const AppContainer: React.FunctionComponent<{ diff --git a/src/plugins/advanced_settings/public/management_app/_advanced_settings.scss b/src/plugins/advanced_settings/public/management_app/_advanced_settings.scss index 82704fc9306..a33082c3ef6 100644 --- a/src/plugins/advanced_settings/public/management_app/_advanced_settings.scss +++ b/src/plugins/advanced_settings/public/management_app/_advanced_settings.scss @@ -76,7 +76,3 @@ .mgtAdvancedSettingsForm__button { width: 100%; } - -.osdBody--mgtAdvancedSettingsHasBottomBar .mgtPage__body { - padding-bottom: $euiSizeXL * 2; -} diff --git a/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx b/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx index 7f22894fb8a..a0edaa5ab60 100644 --- a/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx +++ b/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx @@ -29,6 +29,7 @@ */ import React from 'react'; +import ReactDOM from 'react-dom'; import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers'; import { UiSettingsType } from '../../../../../../core/public'; @@ -38,6 +39,11 @@ import { notificationServiceMock } from '../../../../../../core/public/mocks'; import { SettingsChanges } from '../../types'; import { Form } from './form'; +jest.mock('react-dom', () => ({ + ...jest.requireActual('react-dom'), + createPortal: jest.fn((element) => element), +})); + jest.mock('../field', () => ({ Field: () => { return 'field'; @@ -45,6 +51,8 @@ jest.mock('../field', () => ({ })); beforeAll(() => { + ReactDOM.createPortal = jest.fn((children: any) => children); + const localStorage: Record = { 'core.chrome.isLocked': true, }; @@ -60,6 +68,7 @@ beforeAll(() => { }); afterAll(() => { + (ReactDOM.createPortal as jest.Mock).mockClear(); delete (window as any).localStorage; }); diff --git a/src/plugins/advanced_settings/public/management_app/components/form/form.tsx b/src/plugins/advanced_settings/public/management_app/components/form/form.tsx index 92b7a792d2d..a74199771d2 100644 --- a/src/plugins/advanced_settings/public/management_app/components/form/form.tsx +++ b/src/plugins/advanced_settings/public/management_app/components/form/form.tsx @@ -47,8 +47,9 @@ import { import { FormattedMessage } from '@osd/i18n/react'; import { isEmpty } from 'lodash'; import { i18n } from '@osd/i18n'; +import { DocLinksStart, ToastsStart } from 'opensearch-dashboards/public'; +import { createPortal } from 'react-dom'; import { toMountPoint } from '../../../../../opensearch_dashboards_react/public'; -import { DocLinksStart, ToastsStart } from '../../../../../../core/public'; import { getCategoryName } from '../../lib'; import { Field, getEditableValue } from '../field'; @@ -336,63 +337,69 @@ export class Form extends PureComponent { }; renderBottomBar = () => { - const areChangesInvalid = this.areChangesInvalid(); - return ( - - - -

{this.renderCountOfUnsaved()}

-
- - - - {i18n.translate('advancedSettings.form.cancelButtonLabel', { - defaultMessage: 'Cancel changes', - })} - - - - - + + +

{this.renderCountOfUnsaved()}

+
+ + + - {i18n.translate('advancedSettings.form.saveButtonLabel', { - defaultMessage: 'Save changes', + {i18n.translate('advancedSettings.form.cancelButtonLabel', { + defaultMessage: 'Cancel changes', })} -
-
-
-
-
- ); + + + + + + {i18n.translate('advancedSettings.form.saveButtonLabel', { + defaultMessage: 'Save changes', + })} + + + + + + ); + + return createPortal(bottomBar, document.getElementById('app-wrapper')!); + } catch (e) { + return null; + } }; render() { @@ -401,12 +408,6 @@ export class Form extends PureComponent { const currentCategories: Category[] = []; const hasUnsavedChanges = !isEmpty(unsavedChanges); - if (hasUnsavedChanges) { - document.body.classList.add('osdBody--mgtAdvancedSettingsHasBottomBar'); - } else { - document.body.classList.remove('osdBody--mgtAdvancedSettingsHasBottomBar'); - } - categories.forEach((category) => { if (visibleSettings[category] && visibleSettings[category].length) { currentCategories.push(category); From 69b185461d64ce9172cd145d607b731b35079060 Mon Sep 17 00:00:00 2001 From: Ashwin P Chandran Date: Tue, 16 May 2023 09:29:50 -0700 Subject: [PATCH 28/38] Adds threshold to code coverage changes for project (#4040) * Fixes code coverage workflow failures for the project test due to inderect flakey changes Signed-off-by: Ashwin P Chandran * Adds changelog Signed-off-by: Ashwin P Chandran --------- Signed-off-by: Ashwin P Chandran --- .github/.codecov.yml | 8 ++++++-- CHANGELOG.md | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/.codecov.yml b/.github/.codecov.yml index 1ce321b650d..ba7dd34e747 100644 --- a/.github/.codecov.yml +++ b/.github/.codecov.yml @@ -1,7 +1,11 @@ # https://docs.codecov.com/docs/codecov-yaml +codecov: + require_ci_to_pass: yes + coverage: status: project: default: - # https://docs.codecov.com/docs/commit-status#target - target: auto # coverage must be equal or above the previous commit + target: auto + threshold: 2% # the leniency in hitting the target + diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e7670ad7a1..3ae939521a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -150,6 +150,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [CI] Reduce redundancy by using matrix strategy on Windows and Linux workflows ([#3514](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3514)) - Add an achievement badger to the PR ([#3721](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3721)) - Install chrome driver for functional tests from path set by environment variable `TEST_BROWSER_BINARY_PATH`([#3997](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3997)) +- Adds threshold to code coverage config to prevent workflow failures ([#4040](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4040)) ### ๐Ÿ“ Documentation From 873b7f3c7c946972c7529c21159881b45b2b4fc3 Mon Sep 17 00:00:00 2001 From: Ashwin P Chandran Date: Tue, 16 May 2023 09:38:46 -0700 Subject: [PATCH 29/38] Updates PR template for screenshots and test instructions (#4042) Signed-off-by: Ashwin P Chandran --- .github/pull_request_template.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 9bd61e660b6..2a9e814b5fe 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -4,8 +4,20 @@ ### Issues Resolved - - + + + +## Screenshot + + + +## Testing the changes + + ### Check List From 2c33d574672d26c898d4c5d6759ace168111c9a7 Mon Sep 17 00:00:00 2001 From: Anan Zhuang Date: Tue, 16 May 2023 14:55:07 -0700 Subject: [PATCH 30/38] Replace re2 with RegExp in timeline and add unit tests (#3908) Remove re2 usage and replace it with JavaScript built-in RegExp object. Also add more unit tests to make sure that using RegExp has same expressions as using re2 library. Issue Resolve https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3901 Signed-off-by: Anan Zhuang --- CHANGELOG.md | 1 + package.json | 1 - .../tasks/patch_native_modules_task.test.ts | 116 +++++--- .../build/tasks/patch_native_modules_task.ts | 69 ++--- .../server/series_functions/label.js | 6 +- .../server/series_functions/label.test.js | 20 ++ yarn.lock | 258 ++---------------- 7 files changed, 138 insertions(+), 333 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ae939521a3..17c86ec89bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -247,6 +247,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Multi DataSource] UX enhancement on Data source management stack ([#2521](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2521)) - [Multi DataSource] UX enhancement on Update stored password modal for Data source management stack ([#2532](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2532)) - [Monaco editor] Add json worker support ([#3424](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3424)) +- Replace re2 with RegExp in timeline and add unit tests ([#3908](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3908)) ### ๐Ÿ› Bug Fixes diff --git a/package.json b/package.json index 2b894a95897..676bd6cb653 100644 --- a/package.json +++ b/package.json @@ -200,7 +200,6 @@ "pegjs": "0.10.0", "proxy-from-env": "1.0.0", "query-string": "^6.13.2", - "re2": "1.17.4", "react": "^16.14.0", "react-dom": "^16.12.0", "react-input-range": "^1.3.0", diff --git a/src/dev/build/tasks/patch_native_modules_task.test.ts b/src/dev/build/tasks/patch_native_modules_task.test.ts index f3a3daa432c..71553d39cd9 100644 --- a/src/dev/build/tasks/patch_native_modules_task.test.ts +++ b/src/dev/build/tasks/patch_native_modules_task.test.ts @@ -9,8 +9,8 @@ import { createAnyInstanceSerializer, createAbsolutePathSerializer, } from '@osd/dev-utils'; -import { Build, Config } from '../lib'; -import { PatchNativeModules } from './patch_native_modules_task'; +import { Build, Config, read, download, untar, gunzip } from '../lib'; +import { createPatchNativeModulesTask } from './patch_native_modules_task'; const log = new ToolingLog(); const testWriter = new ToolingLogCollectingWriter(); @@ -19,16 +19,16 @@ expect.addSnapshotSerializer(createAnyInstanceSerializer(Config)); expect.addSnapshotSerializer(createAnyInstanceSerializer(ToolingLog)); expect.addSnapshotSerializer(createAbsolutePathSerializer()); -jest.mock('../lib/download'); -jest.mock('../lib/fs', () => ({ - ...jest.requireActual('../lib/fs'), - untar: jest.fn(), - gunzip: jest.fn(), -})); - -const { untar } = jest.requireMock('../lib/fs'); -const { gunzip } = jest.requireMock('../lib/fs'); -const { download } = jest.requireMock('../lib/download'); +jest.mock('../lib', () => { + const originalModule = jest.requireActual('../lib'); + return { + ...originalModule, + download: jest.fn(), + gunzip: jest.fn(), + untar: jest.fn(), + read: jest.fn(), + }; +}); async function setup() { const config = await Config.create({ @@ -38,14 +38,15 @@ async function setup() { linux: false, linuxArm: false, darwin: false, + windows: false, }, }); const build = new Build(config); - download.mockImplementation(() => {}); - untar.mockImplementation(() => {}); - gunzip.mockImplementation(() => {}); + (read as jest.MockedFunction).mockImplementation(async () => { + return JSON.stringify({ version: mockPackage.version }); + }); return { config, build }; } @@ -55,38 +56,77 @@ beforeEach(() => { jest.clearAllMocks(); }); -it('patch native modules task downloads the correct platform package', async () => { - const { config, build } = await setup(); - config.targetPlatforms.linuxArm = true; - await PatchNativeModules.run(config, log, build); - expect(download.mock.calls.length).toBe(1); - expect(download.mock.calls).toMatchInlineSnapshot(` +const mockPackage = { + name: 'mock-native-module', + version: '1.0.0', + destinationPath: 'path/to/destination', + extractMethod: 'untar', + archives: { + 'linux-arm64': { + url: 'https://example.com/mock-native-module/linux-arm64.tar.gz', + sha256: 'mock-sha256', + }, + 'linux-x64': { + url: 'https://example.com/mock-native-module/linux-x64.gz', + sha256: 'mock-sha256', + }, + }, +}; + +describe('patch native modules task', () => { + it('patch native modules task downloads the correct platform package', async () => { + const { config, build } = await setup(); + config.targetPlatforms.linuxArm = true; + const PatchNativeModulesWithMock = createPatchNativeModulesTask([mockPackage]); + await PatchNativeModulesWithMock.run(config, log, build); + expect((download as jest.MockedFunction).mock.calls.length).toBe(1); + expect((download as jest.MockedFunction).mock.calls).toMatchInlineSnapshot(` Array [ Array [ Object { - "destination": /.native_modules/re2/linux-arm64-83.tar.gz, + "destination": /.native_modules/mock-native-module/linux-arm64.tar.gz, "log": , "retries": 3, - "sha256": "d86ced75b794fbf518b90908847b3c09a50f3ff5a2815aa30f53080f926a2873", - "url": "https://d1v1sj258etie.cloudfront.net/node-re2/releases/download/1.17.4/linux-arm64-83.tar.gz", + "sha256": "mock-sha256", + "url": "https://example.com/mock-native-module/linux-arm64.tar.gz", }, ], ] `); -}); + }); -it('for .tar.gz artifact, patch native modules task unzip it via untar', async () => { - const { config, build } = await setup(); - config.targetPlatforms.linuxArm = true; - await PatchNativeModules.run(config, log, build); - expect(untar.mock.calls.length).toBe(1); - expect(gunzip.mock.calls.length).toBe(0); -}); + it('for .tar.gz artifact, patch native modules task unzip it via untar', async () => { + const { config, build } = await setup(); + config.targetPlatforms.linuxArm = true; + const PatchNativeModulesWithMock = createPatchNativeModulesTask([mockPackage]); + await PatchNativeModulesWithMock.run(config, log, build); + expect(untar).toHaveBeenCalled(); + expect(gunzip).not.toHaveBeenCalled(); + }); -it('for .gz artifact, patch native modules task unzip it via gunzip', async () => { - const { config, build } = await setup(); - config.targetPlatforms.linux = true; - await PatchNativeModules.run(config, log, build); - expect(untar.mock.calls.length).toBe(0); - expect(gunzip.mock.calls.length).toBe(1); + it('for .gz artifact, patch native modules task unzip it via gunzip', async () => { + const mockPackageGZ = { + ...mockPackage, + extractMethod: 'gunzip', + }; + const { config, build } = await setup(); + config.targetPlatforms.linux = true; + const PatchNativeModulesWithMock = createPatchNativeModulesTask([mockPackageGZ]); + await PatchNativeModulesWithMock.run(config, log, build); + expect(gunzip).toHaveBeenCalled(); + expect(untar).not.toHaveBeenCalled(); + }); + + it('throws error for unsupported extract methods', async () => { + const mockPackageUnsupported = { + ...mockPackage, + extractMethod: 'unsupported', + }; + const { config, build } = await setup(); + config.targetPlatforms.linux = true; + const PatchNativeModulesWithMock = createPatchNativeModulesTask([mockPackageUnsupported]); + await expect(PatchNativeModulesWithMock.run(config, log, build)).rejects.toThrow( + 'Extract method of unsupported is not supported' + ); + }); }); diff --git a/src/dev/build/tasks/patch_native_modules_task.ts b/src/dev/build/tasks/patch_native_modules_task.ts index 3bd9fa63c35..b8c8d8a5b9f 100644 --- a/src/dev/build/tasks/patch_native_modules_task.ts +++ b/src/dev/build/tasks/patch_native_modules_task.ts @@ -52,45 +52,7 @@ interface Package { >; } -/* Process for updating URLs and checksums after bumping the version of `re2` or NodeJS: - * 1. Match the `version` with the version in the yarn.lock file. - * 2. Match the module version, the digits at the end of the filename, with the output of - * `node -p process.versions.modules`. - * 3. Confirm that the URLs exist for each platform-architecture combo on - * https://github.com/uhop/node-re2/releases/tag/[VERSION]; reach out to maintainers for ARM - * releases of `re2` as they currently don't have an official ARM release. - * 4. Generate new checksums for each artifact by downloading each one and calling - * `shasum -a 256` or `sha256sum` on the downloaded file. - */ -const packages: Package[] = [ - { - name: 're2', - version: '1.17.4', - destinationPath: 'node_modules/re2/build/Release/re2.node', - extractMethod: 'gunzip', - archives: { - 'darwin-x64': { - url: 'https://github.com/uhop/node-re2/releases/download/1.17.4/darwin-x64-83.gz', - sha256: '9112ed93c1544ecc6397f7ff20bd2b28f3b04c7fbb54024e10f9a376a132a87d', - }, - 'linux-x64': { - url: 'https://github.com/uhop/node-re2/releases/download/1.17.4/linux-x64-83.gz', - sha256: '86e03540783a18c41f81df0aec320b1f64aca6cbd3a87fc1b7a9b4109c5f5986', - }, - 'linux-arm64': { - url: - 'https://d1v1sj258etie.cloudfront.net/node-re2/releases/download/1.17.4/linux-arm64-83.tar.gz', - sha256: 'd86ced75b794fbf518b90908847b3c09a50f3ff5a2815aa30f53080f926a2873', - overriddenExtractMethod: 'untar', - overriddenDestinationPath: 'node_modules/re2/build/Release', - }, - 'win32-x64': { - url: 'https://github.com/uhop/node-re2/releases/download/1.17.4/win32-x64-83.gz', - sha256: '2f842d9757288afd4bd5dec0e7b370a4c3e89ac98050598b17abb9e8e00e3294', - }, - }, - }, -]; +export const packages: Package[] = []; async function getInstalledVersion(config: Config, packageName: string) { const packageJSONPath = config.resolveFromRepo( @@ -145,15 +107,20 @@ async function patchModule( } } -export const PatchNativeModules: Task = { - description: 'Patching platform-specific native modules', - async run(config, log, build) { - for (const pkg of packages) { - await Promise.all( - config.getTargetPlatforms().map(async (platform) => { - await patchModule(config, log, build, platform, pkg); - }) - ); - } - }, -}; +export function createPatchNativeModulesTask(customPackages?: Package[]): Task { + return { + description: 'Patching platform-specific native modules', + async run(config, log, build) { + const targetPackages = customPackages || packages; + for (const pkg of targetPackages) { + await Promise.all( + config.getTargetPlatforms().map(async (platform) => { + await patchModule(config, log, build, platform, pkg); + }) + ); + } + }, + }; +} + +export const PatchNativeModules = createPatchNativeModulesTask(); diff --git a/src/plugins/vis_type_timeline/server/series_functions/label.js b/src/plugins/vis_type_timeline/server/series_functions/label.js index c935d537081..4649ee6cf53 100644 --- a/src/plugins/vis_type_timeline/server/series_functions/label.js +++ b/src/plugins/vis_type_timeline/server/series_functions/label.js @@ -62,10 +62,8 @@ export default new Chainable('label', { const config = args.byName; return alter(args, function (eachSeries) { if (config.regex) { - // not using a standard `import` so that if there's an issue with the re2 native module - // that it doesn't prevent OpenSearch Dashboards from starting up and we only have an issue using Timeline labels - const RE2 = require('re2'); - eachSeries.label = eachSeries.label.replace(new RE2(config.regex), config.label); + const regex = new RegExp(config.regex); + eachSeries.label = eachSeries.label.replace(regex, config.label); } else { eachSeries.label = config.label; } diff --git a/src/plugins/vis_type_timeline/server/series_functions/label.test.js b/src/plugins/vis_type_timeline/server/series_functions/label.test.js index c6dc832914a..69268b385b0 100644 --- a/src/plugins/vis_type_timeline/server/series_functions/label.test.js +++ b/src/plugins/vis_type_timeline/server/series_functions/label.test.js @@ -51,4 +51,24 @@ describe('label.js', () => { expect(r.output.list[0].label).to.equal('beerative'); }); }); + + it('can use a regex to capture groups to modify series label', () => { + return invoke(fn, [seriesList, 'beer$2', '(N)(egative)']).then((r) => { + expect(r.output.list[0].label).to.equal('beeregative'); + }); + }); + + it('can handle different regex patterns', () => { + const seriesListCopy1 = JSON.parse(JSON.stringify(seriesList)); + const seriesListCopy2 = JSON.parse(JSON.stringify(seriesList)); + + return Promise.all([ + invoke(fn, [seriesListCopy1, 'beer$1 - $2', '(N)(egative)']).then((r) => { + expect(r.output.list[0].label).to.equal('beerN - egative'); + }), + invoke(fn, [seriesListCopy2, 'beer$1_$2', '(N)(eg.*)']).then((r) => { + expect(r.output.list[0].label).to.equal('beerN_egative'); + }), + ]); + }); }); diff --git a/yarn.lock b/yarn.lock index c424c6592eb..3f8d40708ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4141,7 +4141,7 @@ agent-base@4: dependencies: es6-promisify "^5.0.0" -agent-base@6, agent-base@^6.0.2: +agent-base@6: version "6.0.2" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== @@ -4155,7 +4155,7 @@ agentkeepalive@^3.4.1: dependencies: humanize-ms "^1.2.1" -agentkeepalive@^4.1.3, agentkeepalive@^4.2.1: +agentkeepalive@^4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.2.1.tgz#a7975cbb9f83b367f06c90cc51ff28fe7d499717" integrity sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA== @@ -4369,11 +4369,6 @@ append-transform@^2.0.0: dependencies: default-require-extensions "^3.0.0" -"aproba@^1.0.3 || ^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/aproba/-/aproba-2.0.0.tgz#52520b8ae5b569215b354efc0caa3fe1e45a8adc" - integrity sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ== - aproba@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" @@ -4413,14 +4408,6 @@ archy@^1.0.0: resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" integrity sha1-+cjBN1fMHde8N5rHeyxipcKGjEA= -are-we-there-yet@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz#679df222b278c64f2cdba1175cdc00b0d96164bd" - integrity sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg== - dependencies: - delegates "^1.0.0" - readable-stream "^3.6.0" - argparse@^1.0.7, argparse@~1.0.9: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -5284,7 +5271,7 @@ cacache@^13.0.1: ssri "^7.0.0" unique-filename "^1.1.1" -cacache@^15.0.5, cacache@^15.2.0: +cacache@^15.0.5: version "15.3.0" resolved "https://registry.yarnpkg.com/cacache/-/cacache-15.3.0.tgz#dc85380fb2f556fe3dda4c719bfa0ec875a7f1eb" integrity sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ== @@ -5842,11 +5829,6 @@ color-string@^1.4.0: color-name "^1.0.0" simple-swizzle "^0.2.2" -color-support@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" - integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== - color@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/color/-/color-1.0.3.tgz#e48e832d85f14ef694fb468811c2d5cfe729b55d" @@ -5973,11 +5955,6 @@ console-browserify@^1.1.0: resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336" integrity sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA== -console-control-strings@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" - integrity sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ== - console-log-level@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/console-log-level/-/console-log-level-1.4.1.tgz#9c5a6bb9ef1ef65b05aba83028b0ff894cdf630a" @@ -6655,7 +6632,7 @@ debug@3.X, debug@^3.2.6, debug@^3.2.7: dependencies: ms "^2.1.1" -debug@4, debug@4.3.4, debug@^4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: +debug@4, debug@4.3.4, debug@^4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -6886,11 +6863,6 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= -delegates@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" - integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= - delete-empty@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/delete-empty/-/delete-empty-2.0.0.tgz#dcf7c4f93a98445119acd57b137d13e7af78fa39" @@ -7337,13 +7309,6 @@ emoticon@^3.2.0: resolved "https://registry.yarnpkg.com/emoticon/-/emoticon-3.2.0.tgz#c008ca7d7620fac742fe1bf4af8ff8fed154ae7f" integrity sha512-SNujglcLTTg+lDAcApPNgEdudaqQFiAbJCqzjNxJkvN9vAwCGi0uu8IUVvx+f16h+V44KCY6Y2yboroc9pilHg== -encoding@^0.1.12: - version "0.1.13" - resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.13.tgz#56574afdd791f54a8e9b2785c0582a2d26210fa9" - integrity sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A== - dependencies: - iconv-lite "^0.6.2" - end-of-stream@^1.0.0, end-of-stream@^1.1.0, end-of-stream@^1.4.1, end-of-stream@^1.4.4: version "1.4.4" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" @@ -7389,11 +7354,6 @@ entities@~2.1.0: resolved "https://registry.yarnpkg.com/entities/-/entities-2.1.0.tgz#992d3129cf7df6870b96c57858c249a120f8b8b5" integrity sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w== -env-paths@^2.2.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2" - integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A== - envinfo@^7.7.3: version "7.8.1" resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.8.1.tgz#06377e3e5f4d379fea7ac592d5ad8927e0c4d475" @@ -7472,11 +7432,6 @@ enzyme@^3.11.0: rst-selector-parser "^2.2.3" string.prototype.trim "^1.2.1" -err-code@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/err-code/-/err-code-2.0.3.tgz#23c2f3b756ffdfc608d30e27c9a941024807e7f9" - integrity sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA== - errno@^0.1.1, errno@^0.1.3, errno@~0.1.7: version "0.1.8" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.8.tgz#8bb3e9c7d463be4976ff888f76b4809ebc2e811f" @@ -8795,20 +8750,6 @@ functions-have-names@^1.2.2: resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.2.tgz#98d93991c39da9361f8e50b337c4f6e41f120e21" integrity sha512-bLgc3asbWdwPbx2mNk2S49kmJCuQeu0nfmaOgbs8WIyzzkw3r4htszdIi9Q9EMezDPTYuJx2wvjZ/EwgAthpnA== -gauge@^4.0.3: - version "4.0.4" - resolved "https://registry.yarnpkg.com/gauge/-/gauge-4.0.4.tgz#52ff0652f2bbf607a989793d53b751bef2328dce" - integrity sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg== - dependencies: - aproba "^1.0.3 || ^2.0.0" - color-support "^1.1.3" - console-control-strings "^1.1.0" - has-unicode "^2.0.1" - signal-exit "^3.0.7" - string-width "^4.2.3" - strip-ansi "^6.0.1" - wide-align "^1.1.5" - geckodriver@^3.0.2: version "3.2.0" resolved "https://registry.yarnpkg.com/geckodriver/-/geckodriver-3.2.0.tgz#6b0a85e2aafbce209bca30e2d53af857707b1034" @@ -9389,11 +9330,6 @@ has-tostringtag@^1.0.0: dependencies: has-symbols "^1.0.2" -has-unicode@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" - integrity sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ== - has-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" @@ -9707,7 +9643,7 @@ http-aws-es@6.0.0: resolved "https://registry.yarnpkg.com/http-aws-es/-/http-aws-es-6.0.0.tgz#1528978d2bee718b8732dcdced0856efa747aeff" integrity sha512-g+qp7J110/m4aHrR3iit4akAlnW0UljZ6oTq/rCcbsI8KP9x+95vqUtx49M2XQ2JMpwJio3B6gDYx+E8WDxqiA== -http-cache-semantics@^4.0.0, http-cache-semantics@^4.1.0: +http-cache-semantics@^4.0.0: version "4.1.1" resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a" integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ== @@ -9786,7 +9722,7 @@ iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: dependencies: safer-buffer ">= 2.1.2 < 3" -iconv-lite@0.6, iconv-lite@^0.6.2: +iconv-lite@0.6: version "0.6.3" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== @@ -9974,11 +9910,6 @@ inquirer@^7.0.0, inquirer@^7.3.3: strip-ansi "^6.0.0" through "^2.3.6" -install-artifact-from-github@^1.3.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/install-artifact-from-github/-/install-artifact-from-github-1.3.1.tgz#eefaad9af35d632e5d912ad1569c1de38c3c2462" - integrity sha512-3l3Bymg2eKDsN5wQuMfgGEj2x6l5MCAv0zPL6rxHESufFVlEAKW/6oY9F1aGgvY/EgWm5+eWGRjINveL4X7Hgg== - internal-slot@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.3.tgz#7347e307deeea2faac2ac6205d4bc7d34967f59c" @@ -10070,11 +10001,6 @@ ip-regex@^4.1.0: resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-4.3.0.tgz#687275ab0f57fa76978ff8f4dddc8a23d5990db5" integrity sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q== -ip@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ip/-/ip-2.0.0.tgz#4cf4ab182fee2314c75ede1276f8c80b479936da" - integrity sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ== - irregular-plurals@^3.2.0: version "3.3.0" resolved "https://registry.yarnpkg.com/irregular-plurals/-/irregular-plurals-3.3.0.tgz#67d0715d4361a60d9fd9ee80af3881c631a31ee2" @@ -10315,11 +10241,6 @@ is-interactive@^1.0.0: resolved "https://registry.yarnpkg.com/is-interactive/-/is-interactive-1.0.0.tgz#cea6e6ae5c870a7b0a0004070b7b587e0252912e" integrity sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w== -is-lambda@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-lambda/-/is-lambda-1.0.1.tgz#3d9877899e6a53efc0160504cde15f82e6f061d5" - integrity sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ== - is-map@^2.0.1, is-map@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.2.tgz#00922db8c9bf73e81b7a335827bc2a43f2b91127" @@ -11988,28 +11909,6 @@ make-dir@^3.0.0, make-dir@^3.0.2, make-dir@^3.1.0: dependencies: semver "^6.0.0" -make-fetch-happen@^9.1.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-9.1.0.tgz#53085a09e7971433e6765f7971bf63f4e05cb968" - integrity sha512-+zopwDy7DNknmwPQplem5lAZX/eCOzSvSNNcSKm5eVwTkOBzoktEfXsa9L23J/GIRhxRsaxzkPEhrJEpE2F4Gg== - dependencies: - agentkeepalive "^4.1.3" - cacache "^15.2.0" - http-cache-semantics "^4.1.0" - http-proxy-agent "^4.0.1" - https-proxy-agent "^5.0.0" - is-lambda "^1.0.1" - lru-cache "^6.0.0" - minipass "^3.1.3" - minipass-collect "^1.0.2" - minipass-fetch "^1.3.2" - minipass-flush "^1.0.5" - minipass-pipeline "^1.2.4" - negotiator "^0.6.2" - promise-retry "^2.0.1" - socks-proxy-agent "^6.0.0" - ssri "^8.0.0" - make-iterator@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6" @@ -12385,17 +12284,6 @@ minipass-collect@^1.0.2: dependencies: minipass "^3.0.0" -minipass-fetch@^1.3.2: - version "1.4.1" - resolved "https://registry.yarnpkg.com/minipass-fetch/-/minipass-fetch-1.4.1.tgz#d75e0091daac1b0ffd7e9d41629faff7d0c1f1b6" - integrity sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw== - dependencies: - minipass "^3.1.0" - minipass-sized "^1.0.3" - minizlib "^2.0.0" - optionalDependencies: - encoding "^0.1.12" - minipass-flush@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/minipass-flush/-/minipass-flush-1.0.5.tgz#82e7135d7e89a50ffe64610a787953c4c4cbb373" @@ -12403,20 +12291,13 @@ minipass-flush@^1.0.5: dependencies: minipass "^3.0.0" -minipass-pipeline@^1.2.2, minipass-pipeline@^1.2.4: +minipass-pipeline@^1.2.2: version "1.2.4" resolved "https://registry.yarnpkg.com/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz#68472f79711c084657c067c5c6ad93cddea8214c" integrity sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A== dependencies: minipass "^3.0.0" -minipass-sized@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/minipass-sized/-/minipass-sized-1.0.3.tgz#70ee5a7c5052070afacfbc22977ea79def353b70" - integrity sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g== - dependencies: - minipass "^3.0.0" - minipass@^3.0.0, minipass@^3.1.1: version "3.1.6" resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.6.tgz#3b8150aa688a711a1521af5e8779c1d3bb4f45ee" @@ -12424,13 +12305,6 @@ minipass@^3.0.0, minipass@^3.1.1: dependencies: yallist "^4.0.0" -minipass@^3.1.0, minipass@^3.1.3: - version "3.3.6" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.3.6.tgz#7bba384db3a1520d18c9c0e5251c3444e95dd94a" - integrity sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw== - dependencies: - yallist "^4.0.0" - minipass@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/minipass/-/minipass-4.0.0.tgz#7cebb0f9fa7d56f0c5b17853cbe28838a8dbbd3b" @@ -12438,7 +12312,7 @@ minipass@^4.0.0: dependencies: yallist "^4.0.0" -minizlib@^2.0.0, minizlib@^2.1.1: +minizlib@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931" integrity sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg== @@ -12656,11 +12530,6 @@ nan@^2.12.1, nan@^2.14.2: resolved "https://registry.yarnpkg.com/nan/-/nan-2.15.0.tgz#3f34a473ff18e15c1b5626b62903b5ad6e665fee" integrity sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ== -nan@^2.15.0: - version "2.17.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz#c0150a2368a182f033e9aa5195ec76ea41a199cb" - integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ== - nano-css@^5.2.1: version "5.3.4" resolved "https://registry.yarnpkg.com/nano-css/-/nano-css-5.3.4.tgz#40af6a83a76f84204f346e8ccaa9169cdae9167b" @@ -12731,11 +12600,6 @@ needle@^2.5.2: iconv-lite "^0.4.4" sax "^1.2.4" -negotiator@^0.6.2: - version "0.6.3" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" - integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== - neo-async@^2.5.0, neo-async@^2.6.0, neo-async@^2.6.1, neo-async@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" @@ -12819,22 +12683,6 @@ node-gyp-build@^4.2.3: resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.3.0.tgz#9f256b03e5826150be39c764bf51e993946d71a3" integrity sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q== -node-gyp@^8.4.1: - version "8.4.1" - resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-8.4.1.tgz#3d49308fc31f768180957d6b5746845fbd429937" - integrity sha512-olTJRgUtAb/hOXG0E93wZDs5YiJlgbXxTwQAFHyNlRsXQnYzUaF2aGgujZbw+hR8aF4ZG/rST57bWMWD16jr9w== - dependencies: - env-paths "^2.2.0" - glob "^7.1.4" - graceful-fs "^4.2.6" - make-fetch-happen "^9.1.0" - nopt "^5.0.0" - npmlog "^6.0.0" - rimraf "^3.0.2" - semver "^7.3.5" - tar "^6.1.2" - which "^2.0.2" - node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" @@ -12908,13 +12756,6 @@ nopt@^2.2.0: dependencies: abbrev "1" -nopt@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-5.0.0.tgz#530942bb58a512fccafe53fe210f13a25355dc88" - integrity sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ== - dependencies: - abbrev "1" - nopt@~3.0.6: version "3.0.6" resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" @@ -12996,16 +12837,6 @@ npm-run-path@^4.0.0, npm-run-path@^4.0.1: dependencies: path-key "^3.0.0" -npmlog@^6.0.0: - version "6.0.2" - resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-6.0.2.tgz#c8166017a42f2dea92d6453168dd865186a70830" - integrity sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg== - dependencies: - are-we-there-yet "^3.0.0" - console-control-strings "^1.1.0" - gauge "^4.0.3" - set-blocking "^2.0.0" - nth-check@^2.0.1, nth-check@~1.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-2.0.1.tgz#2efe162f5c3da06a28959fbd3db75dbeea9f0fc2" @@ -13969,14 +13800,6 @@ promise-polyfill@^8.1.3: resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-8.2.3.tgz#2edc7e4b81aff781c88a0d577e5fe9da822107c6" integrity sha512-Og0+jCRQetV84U8wVjMNccfGCnMQ9mGs9Hv78QFe+pSDD3gWTpz0y+1QCuxy5d/vBFuZ3iwP2eycAkvqIMPmWg== -promise-retry@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/promise-retry/-/promise-retry-2.0.1.tgz#ff747a13620ab57ba688f5fc67855410c370da22" - integrity sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g== - dependencies: - err-code "^2.0.2" - retry "^0.12.0" - prompts@^2.0.1: version "2.4.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" @@ -14219,15 +14042,6 @@ re-reselect@^3.4.0: resolved "https://registry.yarnpkg.com/re-reselect/-/re-reselect-3.4.0.tgz#0f2303f3c84394f57f0cd31fea08a1ca4840a7cd" integrity sha512-JsecfN+JlckncVXTWFWjn0Vk6uInl8GSf4eEd9tTk5qXHlgqkPdILpnYpgZcISXNYAzvfvsCZviaDk8AxyS5sg== -re2@1.17.4: - version "1.17.4" - resolved "https://registry.yarnpkg.com/re2/-/re2-1.17.4.tgz#7bf29290bdde963014e77bd2c2e799a6d788386e" - integrity sha512-xyZ4h5PqE8I9tAxTh3G0UttcK5ufrcUxReFjGzfX61vtanNbS1XZHjnwRSyPcLgChI4KLxVgOT/ioZXnUAdoTA== - dependencies: - install-artifact-from-github "^1.3.0" - nan "^2.15.0" - node-gyp "^8.4.1" - react-ace@^7.0.5: version "7.0.5" resolved "https://registry.yarnpkg.com/react-ace/-/react-ace-7.0.5.tgz#798299fd52ddf3a3dcc92afc5865538463544f01" @@ -15149,11 +14963,6 @@ ret@~0.1.10: resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== -retry@^0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" - integrity sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow== - reusify@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" @@ -15599,11 +15408,6 @@ slide@~1.1.3: resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" integrity sha1-VusCfWW00tzmyy4tMsTUr8nh1wc= -smart-buffer@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" - integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== - snapdragon-node@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" @@ -15634,23 +15438,6 @@ snapdragon@^0.8.1: source-map-resolve "^0.5.0" use "^3.1.0" -socks-proxy-agent@^6.0.0: - version "6.2.1" - resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-6.2.1.tgz#2687a31f9d7185e38d530bef1944fe1f1496d6ce" - integrity sha512-a6KW9G+6B3nWZ1yB8G7pJwL3ggLy1uTzKAgCb7ttblwqdz9fMGJUuTy3uFzEP48FAs9FLILlmzDlE2JJhVQaXQ== - dependencies: - agent-base "^6.0.2" - debug "^4.3.3" - socks "^2.6.2" - -socks@^2.6.2: - version "2.7.1" - resolved "https://registry.yarnpkg.com/socks/-/socks-2.7.1.tgz#d8e651247178fde79c0663043e07240196857d55" - integrity sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ== - dependencies: - ip "^2.0.0" - smart-buffer "^4.2.0" - sonic-boom@^1.0.2: version "1.4.1" resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-1.4.1.tgz#d35d6a74076624f12e6f917ade7b9d75e918f53e" @@ -15895,7 +15682,7 @@ ssri@^7.0.0: figgy-pudding "^3.5.1" minipass "^3.1.1" -ssri@^8.0.0, ssri@^8.0.1: +ssri@^8.0.1: version "8.0.1" resolved "https://registry.yarnpkg.com/ssri/-/ssri-8.0.1.tgz#638e4e439e2ffbd2cd289776d5ca457c4f51a2af" integrity sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ== @@ -16032,15 +15819,6 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" @@ -16058,6 +15836,15 @@ string-width@^3.0.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string.prototype.matchall@^4.0.6: version "4.0.7" resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.7.tgz#8e6ecb0d8a1fb1fda470d81acecb2dba057a481d" @@ -16546,7 +16333,7 @@ tar@6.1.11: mkdirp "^1.0.3" yallist "^4.0.0" -tar@^6.0.2, tar@^6.1.11, tar@^6.1.2: +tar@^6.0.2, tar@^6.1.11: version "6.1.13" resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.13.tgz#46e22529000f612180601a6fe0680e7da508847b" integrity sha512-jdIBIN6LTIe2jqzay/2vtYLlBHa3JF42ot3h1dW8Q0PaAG4v8rm0cvpVePtau5C6OKXGGcgO9q2AMNSWxiLqKw== @@ -18265,13 +18052,6 @@ which@^2.0.1, which@^2.0.2, which@~2.0.2: dependencies: isexe "^2.0.0" -wide-align@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.5.tgz#df1d4c206854369ecf3c9a4898f1b23fbd9d15d3" - integrity sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg== - dependencies: - string-width "^1.0.2 || 2 || 3 || 4" - wildcard@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec" From b04e6579650b15665458855b5fd322d70552262b Mon Sep 17 00:00:00 2001 From: Sirazh Gabdullin Date: Wed, 17 May 2023 23:46:38 +0600 Subject: [PATCH 31/38] [Console] [CCI] Remove unused ul element and its custom styling. (#3993) * remove unused ul element Signed-off-by: Sirazh Gabdullin * Update CHANGELOG.md Signed-off-by: Sirazh Gabdullin --------- Signed-off-by: Sirazh Gabdullin --- CHANGELOG.md | 1 + .../editor/legacy/console_editor/editor.tsx | 1 - src/plugins/console/public/styles/_app.scss | 12 ------------ 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17c86ec89bb..80c247b9404 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -199,6 +199,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Console] Replace jQuery.ajax with core.http when calling OSD APIs in console ([#3080](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3080)) - [I18n] Fix Listr type errors and error handlers ([#3629](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3629)) - [Multiple DataSource] Present the authentication type choices in a drop-down ([#3693](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3693)) +- [Console] Remove unused ul element and its custom styling ([#3993](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3993)) - Fix EUI/OUI type errors ([#3798](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3798)) ### ๐Ÿ”ฉ Tests diff --git a/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.tsx b/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.tsx index 876e94d4cbc..1c47cc41e92 100644 --- a/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.tsx +++ b/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.tsx @@ -231,7 +231,6 @@ function EditorUI({ initialTextValue, dataSourceId }: EditorProps) { return (
-
    Date: Thu, 18 May 2023 11:37:36 -0700 Subject: [PATCH 32/38] Add 1.3.10 release note (#4060) (#4063) * Add release note for 1.3.10 * Address comments and add one CVE PR --------- (cherry picked from commit 43715871f3a9fc9b2a0fcac765805a33b4b305d5) Signed-off-by: abbyhu2000 Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- ...nsearch-dashboards.release-notes-1.3.10.md | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 release-notes/opensearch-dashboards.release-notes-1.3.10.md diff --git a/release-notes/opensearch-dashboards.release-notes-1.3.10.md b/release-notes/opensearch-dashboards.release-notes-1.3.10.md new file mode 100644 index 00000000000..be08d46aac9 --- /dev/null +++ b/release-notes/opensearch-dashboards.release-notes-1.3.10.md @@ -0,0 +1,33 @@ +# Version 1.3.10 Release Notes + +### ๐Ÿ›ก Security + +- [CVE-2020-15366][1.x] Bump ajv from 4.11.8 to 6.12.6 ([#4035](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4035)) +- [CVE-2022-48285][1.x] Bump jszip from 3.7.1 to 3.10.1 ([#4011](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4011)) +- [CVE-2021-35065][1.x] Bump glob-parent from 6.0.0 to 6.0.2 ([#4005](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4005)) +- [CVE-2022-25851][1.x] Bump jpeg-js from 0.4.1 to 0.4.4 ([#3860](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3860)) +- [CVE-2022-25858][1.x] Bump terser from 4.8.0 to 4.8.1 ([#3786](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3786)) +- [CVE-2021-23490][1.x] Bump parse-link-header from 1.0.1 to 2.0.0 ([#3820](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3820)) +- [CVE-2021-3765][1.x] Bump validator from 8.2.0 to 13.9.0 ([#3753](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3753)) +- [CVE-2022-25758][1.x] Bump scss-tokenizer from 0.3.0 to 0.4.3 ([#3789](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3789)) +- [CVE-2021-3803][1.x] Bump nth-check from 1.0.2 to 2.0.1 ([#3745](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3745)) +- Bump highlight.js from 9.18.5 to 10.7.3 to solve security concerns ๏ผˆ[#4062](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4062)) + +### ๐Ÿ“ˆ Features/Enhancements + +- Add tooltip to help icon ([#3872](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3872)) + +### ๐Ÿ› Bug Fixes + +- [TSVB] Fix the link to "serial differencing aggregation" documentation ([#3503](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3503)) + +### ๐Ÿ“ Documentation + +- Update jest documentation links ([#3939](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3939)) + +### ๐Ÿ›  Maintenance + +- Add threshold to code coverage changes for project ([#4050](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4050)) +- Temporarily hardcode chromedriver to 112.0.0 to enable all ftr tests ([#4039]()) +- Update MAINTAINERS.md and CODEOWNERS ([#3938](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3938)) +- Add opensearch-dashboards-docker-dev to .gitignore ([#3781](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3781)) From e73779084f34b28e2cf69f28a8563e44e09f168d Mon Sep 17 00:00:00 2001 From: Zhongnan Su Date: Fri, 19 May 2023 11:49:17 -0700 Subject: [PATCH 33/38] [Multiple Datasource] Support Amazon OpenSearch Serverless (#3957) * [Multiple Datasource]Support Amazon OpenSearch Serverless in SigV4 * remove experimental text in yml * Refactor create data source form for authentication Signed-off-by: Su --- CHANGELOG.md | 2 +- config/opensearch_dashboards.yml | 3 +- package.json | 4 +- packages/osd-opensearch/package.json | 2 +- .../data_source/common/data_sources/types.ts | 6 + .../data_source/opensearch_dashboards.json | 3 +- .../server/client/configure_client.test.ts | 24 ++ .../server/client/configure_client.ts | 3 +- .../server/client/configure_client_utils.ts | 3 +- .../legacy/configure_legacy_client.test.ts | 45 +- .../server/legacy/configure_legacy_client.ts | 8 +- .../data_source_connection_validator.ts | 12 +- .../server/routes/test_connection.ts | 14 +- ...ata_source_saved_objects_client_wrapper.ts | 11 +- .../create_data_source_form.test.tsx | 2 + .../create_form/create_data_source_form.tsx | 386 +++++++++++------- .../create_data_source_wizard.test.tsx | 13 + .../create_data_source_wizard.tsx | 1 + .../edit_form/edit_data_source_form.tsx | 64 ++- .../update_aws_credential_modal.tsx | 14 + .../validation/datasource_form_validation.ts | 7 + .../data_source_management/public/types.ts | 17 + yarn.lock | 26 +- 23 files changed, 468 insertions(+), 202 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80c247b9404..fa5a9f577a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -85,7 +85,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Add satisfaction survey link to help menu ([#3676] (https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3676)) - [Vis Builder] Add persistence to visualizations inner state ([#3751](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3751)) - [Table Visualization] Move format table, consolidate types and add unit tests ([#3397](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3397)) - +- [Multiple Datasource] Support Amazon OpenSearch Serverless ([#3957](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3957)) ### ๐Ÿ› Bug Fixes - [Vis Builder] Fixes auto bounds for timeseries bar chart visualization ([2401](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2401)) diff --git a/config/opensearch_dashboards.yml b/config/opensearch_dashboards.yml index 1d751769f70..d7e0d390b0f 100644 --- a/config/opensearch_dashboards.yml +++ b/config/opensearch_dashboards.yml @@ -229,8 +229,7 @@ # functionality in Visualization. # vis_builder.enabled: false -# Set the value of this setting to true to enable the experimental multiple data source -# support feature. Use with caution. +# Set the value of this setting to true to enable multiple data source feature. #data_source.enabled: false # Set the value of these settings to customize crypto materials to encryption saved credentials # in data sources. diff --git a/package.json b/package.json index 676bd6cb653..06442016f42 100644 --- a/package.json +++ b/package.json @@ -136,7 +136,7 @@ "@hapi/podium": "^4.1.3", "@hapi/vision": "^6.1.0", "@hapi/wreck": "^17.1.0", - "@opensearch-project/opensearch": "^2.1.0", + "@opensearch-project/opensearch": "^2.2.0", "@osd/ace": "1.0.0", "@osd/analytics": "1.0.0", "@osd/apm-config-loader": "1.0.0", @@ -169,7 +169,7 @@ "dns-sync": "^0.2.1", "elastic-apm-node": "^3.7.0", "elasticsearch": "^16.7.0", - "http-aws-es": "6.0.0", + "http-aws-es": "npm:@zhongnansu/http-aws-es@6.0.1", "execa": "^4.0.2", "expiry-js": "0.1.7", "fast-deep-equal": "^3.1.1", diff --git a/packages/osd-opensearch/package.json b/packages/osd-opensearch/package.json index 02fcddb36e6..44404a9ae5a 100644 --- a/packages/osd-opensearch/package.json +++ b/packages/osd-opensearch/package.json @@ -12,7 +12,7 @@ "osd:watch": "../../scripts/use_node scripts/build --watch" }, "dependencies": { - "@opensearch-project/opensearch": "^2.1.0", + "@opensearch-project/opensearch": "^2.2.0", "@osd/dev-utils": "1.0.0", "abort-controller": "^3.0.0", "chalk": "^4.1.0", diff --git a/src/plugins/data_source/common/data_sources/types.ts b/src/plugins/data_source/common/data_sources/types.ts index 366e5a0f3f5..8763c5306c1 100644 --- a/src/plugins/data_source/common/data_sources/types.ts +++ b/src/plugins/data_source/common/data_sources/types.ts @@ -25,6 +25,7 @@ export interface SigV4Content extends SavedObjectAttributes { accessKey: string; secretKey: string; region: string; + service?: SigV4ServiceName; } export interface UsernamePasswordTypedContent extends SavedObjectAttributes { @@ -37,3 +38,8 @@ export enum AuthType { UsernamePasswordType = 'username_password', SigV4 = 'sigv4', } + +export enum SigV4ServiceName { + OpenSearch = 'es', + OpenSearchServerless = 'aoss', +} diff --git a/src/plugins/data_source/opensearch_dashboards.json b/src/plugins/data_source/opensearch_dashboards.json index 71183a411c7..871858403cf 100644 --- a/src/plugins/data_source/opensearch_dashboards.json +++ b/src/plugins/data_source/opensearch_dashboards.json @@ -5,5 +5,6 @@ "server": true, "ui": true, "requiredPlugins": [], - "optionalPlugins": [] + "optionalPlugins": [], + "extraPublicDirs": ["common/data_sources"] } diff --git a/src/plugins/data_source/server/client/configure_client.test.ts b/src/plugins/data_source/server/client/configure_client.test.ts index 1499ccd411c..aa367f0a6f8 100644 --- a/src/plugins/data_source/server/client/configure_client.test.ts +++ b/src/plugins/data_source/server/client/configure_client.test.ts @@ -167,6 +167,30 @@ describe('configureClient', () => { expect(decodeAndDecryptSpy).toHaveBeenCalledTimes(2); }); + test('configure client with auth.type == sigv4, service == aoss, should successfully call new Client()', async () => { + savedObjectsMock.get.mockReset().mockResolvedValueOnce({ + id: DATA_SOURCE_ID, + type: DATA_SOURCE_SAVED_OBJECT_TYPE, + attributes: { + ...dataSourceAttr, + auth: { + type: AuthType.SigV4, + credentials: { ...sigV4AuthContent, service: 'aoss' }, + }, + }, + references: [], + }); + + jest.spyOn(cryptographyMock, 'decodeAndDecrypt').mockResolvedValue({ + decryptedText: 'accessKey', + encryptionContext: { endpoint: 'http://localhost' }, + }); + + await configureClient(dataSourceClientParams, clientPoolSetup, config, logger); + + expect(ClientMock).toHaveBeenCalledTimes(1); + }); + test('configure test client for non-exist datasource should not call saved object api, nor decode any credential', async () => { const decodeAndDecryptSpy = jest.spyOn(cryptographyMock, 'decodeAndDecrypt').mockResolvedValue({ decryptedText: 'password', diff --git a/src/plugins/data_source/server/client/configure_client.ts b/src/plugins/data_source/server/client/configure_client.ts index 8b43ffa80b2..77a0e067bbc 100644 --- a/src/plugins/data_source/server/client/configure_client.ts +++ b/src/plugins/data_source/server/client/configure_client.ts @@ -160,7 +160,7 @@ const getBasicAuthClient = ( }; const getAWSClient = (credential: SigV4Content, clientOptions: ClientOptions): Client => { - const { accessKey, secretKey, region } = credential; + const { accessKey, secretKey, region, service } = credential; const credentialProvider = (): Promise => { return new Promise((resolve) => { @@ -172,6 +172,7 @@ const getAWSClient = (credential: SigV4Content, clientOptions: ClientOptions): C ...AwsSigv4Signer({ region, getCredentials: credentialProvider, + service, }), ...clientOptions, }); diff --git a/src/plugins/data_source/server/client/configure_client_utils.ts b/src/plugins/data_source/server/client/configure_client_utils.ts index 3ef8acc97b5..2ca6c6f2a83 100644 --- a/src/plugins/data_source/server/client/configure_client_utils.ts +++ b/src/plugins/data_source/server/client/configure_client_utils.ts @@ -91,7 +91,7 @@ export const getAWSCredential = async ( cryptography: CryptographyServiceSetup ): Promise => { const { endpoint } = dataSource; - const { accessKey, secretKey, region } = dataSource.auth.credentials! as SigV4Content; + const { accessKey, secretKey, region, service } = dataSource.auth.credentials! as SigV4Content; const { decryptedText: accessKeyText, @@ -122,6 +122,7 @@ export const getAWSCredential = async ( region, accessKey: accessKeyText, secretKey: secretKeyText, + service, }; return credential; diff --git a/src/plugins/data_source/server/legacy/configure_legacy_client.test.ts b/src/plugins/data_source/server/legacy/configure_legacy_client.test.ts index c047da70b28..59c110d06dc 100644 --- a/src/plugins/data_source/server/legacy/configure_legacy_client.test.ts +++ b/src/plugins/data_source/server/legacy/configure_legacy_client.test.ts @@ -6,7 +6,7 @@ import { SavedObjectsClientContract } from '../../../../core/server'; import { loggingSystemMock, savedObjectsClientMock } from '../../../../core/server/mocks'; import { DATA_SOURCE_SAVED_OBJECT_TYPE } from '../../common'; -import { AuthType, DataSourceAttributes } from '../../common/data_sources'; +import { AuthType, DataSourceAttributes, SigV4Content } from '../../common/data_sources'; import { DataSourcePluginConfigType } from '../../config'; import { cryptographyServiceSetupMock } from '../cryptography_service.mocks'; import { CryptographyServiceSetup } from '../cryptography_service'; @@ -27,6 +27,7 @@ describe('configureLegacyClient', () => { let clientPoolSetup: OpenSearchClientPoolSetup; let configOptions: ConfigOptions; let dataSourceAttr: DataSourceAttributes; + let sigV4AuthContent: SigV4Content; let mockOpenSearchClientInstance: { close: jest.Mock; @@ -71,6 +72,12 @@ describe('configureLegacyClient', () => { }, } as DataSourceAttributes; + sigV4AuthContent = { + region: 'us-east-1', + accessKey: 'accessKey', + secretKey: 'secretKey', + }; + clientPoolSetup = { getClientFromPool: jest.fn(), addClientToPool: jest.fn(), @@ -157,6 +164,42 @@ describe('configureLegacyClient', () => { expect(mockResult).toBeDefined(); }); + test('configure client with auth.type == sigv4 and service param, should call new Client() with service param', async () => { + savedObjectsMock.get.mockReset().mockResolvedValueOnce({ + id: DATA_SOURCE_ID, + type: DATA_SOURCE_SAVED_OBJECT_TYPE, + attributes: { + ...dataSourceAttr, + auth: { + type: AuthType.SigV4, + credentials: { ...sigV4AuthContent, service: 'aoss' }, + }, + }, + references: [], + }); + + parseClientOptionsMock.mockReturnValue(configOptions); + + jest.spyOn(cryptographyMock, 'decodeAndDecrypt').mockResolvedValue({ + decryptedText: 'accessKey', + encryptionContext: { endpoint: 'http://localhost' }, + }); + + await configureLegacyClient( + dataSourceClientParams, + callApiParams, + clientPoolSetup, + config, + logger + ); + + expect(parseClientOptionsMock).toHaveBeenCalled(); + expect(ClientMock).toHaveBeenCalledTimes(1); + expect(ClientMock).toHaveBeenCalledWith(expect.objectContaining({ service: 'aoss' })); + + expect(savedObjectsMock.get).toHaveBeenCalledTimes(1); + }); + test('configure client with auth.type == username_password and password contaminated', async () => { const decodeAndDecryptSpy = jest .spyOn(cryptographyMock, 'decodeAndDecrypt') diff --git a/src/plugins/data_source/server/legacy/configure_legacy_client.ts b/src/plugins/data_source/server/legacy/configure_legacy_client.ts index 3a9b65634a2..0d074cf77d4 100644 --- a/src/plugins/data_source/server/legacy/configure_legacy_client.ts +++ b/src/plugins/data_source/server/legacy/configure_legacy_client.ts @@ -5,10 +5,9 @@ import { Client } from '@opensearch-project/opensearch'; import { Client as LegacyClient, ConfigOptions } from 'elasticsearch'; -import { Credentials } from 'aws-sdk'; +import { Credentials, Config } from 'aws-sdk'; import { get } from 'lodash'; import HttpAmazonESConnector from 'http-aws-es'; -import { Config } from 'aws-sdk'; import { Headers, LegacyAPICaller, @@ -27,7 +26,7 @@ import { CryptographyServiceSetup } from '../cryptography_service'; import { DataSourceClientParams, LegacyClientCallAPIParams } from '../types'; import { OpenSearchClientPoolSetup } from '../client'; import { parseClientOptions } from './client_config'; -import { createDataSourceError, DataSourceError } from '../lib/error'; +import { createDataSourceError } from '../lib/error'; import { getRootClient, getAWSCredential, @@ -195,13 +194,14 @@ const getBasicAuthClient = async ( }; const getAWSClient = (credential: SigV4Content, clientOptions: ConfigOptions): LegacyClient => { - const { accessKey, secretKey, region } = credential; + const { accessKey, secretKey, region, service } = credential; const client = new LegacyClient({ connectionClass: HttpAmazonESConnector, awsConfig: new Config({ region, credentials: new Credentials({ accessKeyId: accessKey, secretAccessKey: secretKey }), }), + service, ...clientOptions, }); return client; diff --git a/src/plugins/data_source/server/routes/data_source_connection_validator.ts b/src/plugins/data_source/server/routes/data_source_connection_validator.ts index ecec07dafcc..f3233859e85 100644 --- a/src/plugins/data_source/server/routes/data_source_connection_validator.ts +++ b/src/plugins/data_source/server/routes/data_source_connection_validator.ts @@ -5,13 +5,19 @@ import { OpenSearchClient } from 'opensearch-dashboards/server'; import { createDataSourceError } from '../lib/error'; - +import { SigV4ServiceName } from '../../common/data_sources'; export class DataSourceConnectionValidator { - constructor(private readonly callDataCluster: OpenSearchClient) {} + constructor( + private readonly callDataCluster: OpenSearchClient, + private readonly dataSourceAttr: any + ) {} async validate() { try { - return await this.callDataCluster.info(); + // Amazon OpenSearch Serverless does not support .info() API + if (this.dataSourceAttr.auth?.credentials?.service === SigV4ServiceName.OpenSearchServerless) + return await this.callDataCluster.cat.indices(); + return await this.callDataCluster.info(); } catch (e) { throw createDataSourceError(e); } diff --git a/src/plugins/data_source/server/routes/test_connection.ts b/src/plugins/data_source/server/routes/test_connection.ts index f36702171b4..cba42517e53 100644 --- a/src/plugins/data_source/server/routes/test_connection.ts +++ b/src/plugins/data_source/server/routes/test_connection.ts @@ -5,7 +5,7 @@ import { schema } from '@osd/config-schema'; import { IRouter, OpenSearchClient } from 'opensearch-dashboards/server'; -import { AuthType, DataSourceAttributes } from '../../common/data_sources'; +import { AuthType, DataSourceAttributes, SigV4ServiceName } from '../../common/data_sources'; import { DataSourceConnectionValidator } from './data_source_connection_validator'; import { DataSourceServiceSetup } from '../data_source_service'; import { CryptographyServiceSetup } from '../cryptography_service'; @@ -40,6 +40,10 @@ export const registerTestConnectionRoute = ( region: schema.string(), accessKey: schema.string(), secretKey: schema.string(), + service: schema.oneOf([ + schema.literal(SigV4ServiceName.OpenSearch), + schema.literal(SigV4ServiceName.OpenSearchServerless), + ]), }), ]) ), @@ -61,9 +65,13 @@ export const registerTestConnectionRoute = ( testClientDataSourceAttr: dataSourceAttr as DataSourceAttributes, } ); - const dsValidator = new DataSourceConnectionValidator(dataSourceClient); - await dsValidator.validate(); + const dataSourceValidator = new DataSourceConnectionValidator( + dataSourceClient, + dataSourceAttr + ); + + await dataSourceValidator.validate(); return response.ok({ body: { diff --git a/src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts b/src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts index 6abcaa6c790..12d60b8da51 100644 --- a/src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts +++ b/src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts @@ -301,7 +301,7 @@ export class DataSourceSavedObjectsClientWrapper { ); } - const { accessKey, secretKey, region } = credentials as SigV4Content; + const { accessKey, secretKey, region, service } = credentials as SigV4Content; if (!accessKey) { throw SavedObjectsErrorHelpers.createBadRequestError( @@ -320,6 +320,12 @@ export class DataSourceSavedObjectsClientWrapper { '"auth.credentials.region" attribute is required' ); } + + if (!service) { + throw SavedObjectsErrorHelpers.createBadRequestError( + '"auth.credentials.service" attribute is required' + ); + } break; default: throw SavedObjectsErrorHelpers.createBadRequestError(`Invalid auth type: '${type}'`); @@ -457,7 +463,7 @@ export class DataSourceSavedObjectsClientWrapper { private async encryptSigV4Credential(auth: T, encryptionContext: EncryptionContext) { const { - credentials: { accessKey, secretKey, region }, + credentials: { accessKey, secretKey, region, service }, } = auth; return { @@ -466,6 +472,7 @@ export class DataSourceSavedObjectsClientWrapper { region, accessKey: await this.cryptography.encryptAndEncode(accessKey, encryptionContext), secretKey: await this.cryptography.encryptAndEncode(secretKey, encryptionContext), + service, }, }; } diff --git a/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.test.tsx b/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.test.tsx index efb3453b6f3..ad1d02c87db 100644 --- a/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.test.tsx +++ b/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.test.tsx @@ -27,6 +27,7 @@ describe('Datasource Management: Create Datasource form', () => { let component: ReactWrapper, React.Component<{}, {}, any>>; const mockSubmitHandler = jest.fn(); const mockTestConnectionHandler = jest.fn(); + const mockCancelHandler = jest.fn(); const getFields = (comp: ReactWrapper, React.Component<{}, {}, any>>) => { return { @@ -65,6 +66,7 @@ describe('Datasource Management: Create Datasource form', () => { ), diff --git a/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx b/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx index 1c08da5d637..8b36e13e7de 100644 --- a/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx +++ b/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx @@ -5,7 +5,9 @@ import React from 'react'; import { + EuiBottomBar, EuiButton, + EuiButtonEmpty, EuiFieldPassword, EuiFieldText, EuiFlexGroup, @@ -19,13 +21,14 @@ import { } from '@elastic/eui'; import { i18n } from '@osd/i18n'; import { FormattedMessage } from '@osd/i18n/react'; +import { SigV4Content, SigV4ServiceName } from '../../../../../../data_source/common/data_sources'; import { AuthType, credentialSourceOptions, DataSourceAttributes, DataSourceManagementContextValue, UsernamePasswordTypedContent, - SigV4Content, + sigV4ServiceOptions, } from '../../../../types'; import { Header } from '../header'; import { context as contextType } from '../../../../../../opensearch_dashboards_react/public'; @@ -41,6 +44,7 @@ export interface CreateDataSourceProps { existingDatasourceNamesList: string[]; handleSubmit: (formValues: DataSourceAttributes) => void; handleTestConnection: (formValues: DataSourceAttributes) => void; + handleCancel: () => void; } export interface CreateDataSourceState { /* Validation */ @@ -121,7 +125,31 @@ export class CreateDataSourceForm extends React.Component< }; onChangeAuthType = (e: React.ChangeEvent) => { - this.setState({ auth: { ...this.state.auth, type: e.target.value as AuthType } }); + const authType = e.target.value as AuthType; + this.setState({ + auth: { + ...this.state.auth, + type: authType, + credentials: { + ...this.state.auth.credentials, + service: + (this.state.auth.credentials.service as SigV4ServiceName) || + SigV4ServiceName.OpenSearch, + }, + }, + }); + }; + + onChangeSigV4ServiceName = (e: React.ChangeEvent) => { + this.setState({ + auth: { + ...this.state.auth, + credentials: { + ...this.state.auth.credentials, + service: e.target.value as SigV4ServiceName, + }, + }, + }); }; onChangeUsername = (e: { target: { value: any } }) => { @@ -267,6 +295,7 @@ export class CreateDataSourceForm extends React.Component< region: this.state.auth.credentials.region, accessKey: this.state.auth.credentials.accessKey, secretKey: this.state.auth.credentials.secretKey, + service: this.state.auth.credentials.service || SigV4ServiceName.OpenSearch, } as SigV4Content; } @@ -391,6 +420,19 @@ export class CreateDataSourceForm extends React.Component< data-test-subj="createDataSourceFormRegionField" /> + + this.onChangeSigV4ServiceName(e)} + name="ServiceName" + data-test-subj="createDataSourceFormAuthTypeSelect" + /> + { return ( - - {this.renderHeader()} - - - {/* Endpoint section */} - {this.renderSectionHeader( - 'dataSourceManagement.connectToDataSource.connectionDetails', - 'Connection Details' - )} - - - {/* Title */} - - + + {this.renderHeader()} + + + {/* Endpoint section */} + {this.renderSectionHeader( + 'dataSourceManagement.connectToDataSource.connectionDetails', + 'Connection Details' + )} + + + {/* Title */} + - + error={this.state.formErrorsByField.title} + > + + - {/* Description */} - - - - - {/* Endpoint URL */} - - + + + + {/* Endpoint URL */} + - + error={this.state.formErrorsByField.endpoint} + > + + - {/* Authentication Section: */} + {/* Authentication Section: */} - + - {this.renderSectionHeader( - 'dataSourceManagement.connectToDataSource.authenticationHeader', - 'Authentication Method' - )} - + {this.renderSectionHeader( + 'dataSourceManagement.connectToDataSource.authenticationHeader', + 'Authentication Method' + )} + - - - - + + - - - - - {/* Credential source */} - - - this.onChangeAuthType(e)} - name="Credential" - data-test-subj="createDataSourceFormAuthTypeSelect" - /> - - - {/* Create New credentials */} - {this.state.auth.type === AuthType.UsernamePasswordType - ? this.renderCreateNewCredentialsForm(this.state.auth.type) - : null} - - {this.state.auth.type === AuthType.SigV4 - ? this.renderCreateNewCredentialsForm(this.state.auth.type) - : null} - - - - - - {/* Test Connection button*/} - - - - - {/* Create Data Source button*/} - - + - - - - - - + + + + + {/* Credential source */} + + + this.onChangeAuthType(e)} + name="Credential" + data-test-subj="createDataSourceFormAuthTypeSelect" + /> + + + {/* Create New credentials */} + {this.state.auth.type === AuthType.UsernamePasswordType + ? this.renderCreateNewCredentialsForm(this.state.auth.type) + : null} + + {this.state.auth.type === AuthType.SigV4 + ? this.renderCreateNewCredentialsForm(this.state.auth.type) + : null} + + + + + + {/* Test Connection button*/} + + + + + + + + + + + {this.renderBottomBar()} + + ); + }; + + renderBottomBar = () => { + return ( + + + + + + + + + + + + + + + + ); }; diff --git a/src/plugins/data_source_management/public/components/create_data_source_wizard/create_data_source_wizard.test.tsx b/src/plugins/data_source_management/public/components/create_data_source_wizard/create_data_source_wizard.test.tsx index 162af4c891f..adfbe880863 100644 --- a/src/plugins/data_source_management/public/components/create_data_source_wizard/create_data_source_wizard.test.tsx +++ b/src/plugins/data_source_management/public/components/create_data_source_wizard/create_data_source_wizard.test.tsx @@ -46,6 +46,7 @@ describe('Datasource Management: Create Datasource Wizard', () => { }); component.update(); }); + test('should create datasource successfully', async () => { spyOn(utils, 'createSingleDataSource').and.returnValue({}); @@ -58,6 +59,7 @@ describe('Datasource Management: Create Datasource Wizard', () => { expect(utils.createSingleDataSource).toHaveBeenCalled(); expect(history.push).toBeCalledWith(''); }); + test('should fail to create datasource', async () => { spyOn(utils, 'createSingleDataSource').and.throwError('error'); await act(async () => { @@ -93,7 +95,17 @@ describe('Datasource Management: Create Datasource Wizard', () => { component.update(); expect(utils.testConnection).toHaveBeenCalled(); }); + + test('should go back to listing page if clicked on cancel button', async () => { + await act(async () => { + // @ts-ignore + await component.find(formIdentifier).first().prop('handleCancel')(); + }); + + expect(history.push).toBeCalledWith(''); + }); }); + describe('case2: should fail to load resources', () => { beforeEach(async () => { spyOn(utils, 'getDataSources').and.throwError(''); @@ -116,6 +128,7 @@ describe('Datasource Management: Create Datasource Wizard', () => { }); component.update(); }); + test('should not render component and go back to listing page', () => { expect(history.push).toBeCalledWith(''); }); diff --git a/src/plugins/data_source_management/public/components/create_data_source_wizard/create_data_source_wizard.tsx b/src/plugins/data_source_management/public/components/create_data_source_wizard/create_data_source_wizard.tsx index 83477b7a242..05489ca6258 100644 --- a/src/plugins/data_source_management/public/components/create_data_source_wizard/create_data_source_wizard.tsx +++ b/src/plugins/data_source_management/public/components/create_data_source_wizard/create_data_source_wizard.tsx @@ -116,6 +116,7 @@ export const CreateDataSourceWizard: React.FunctionComponent props.history.push('')} existingDatasourceNamesList={existingDatasourceNamesList} /> {isLoading ? : null} diff --git a/src/plugins/data_source_management/public/components/edit_data_source/components/edit_form/edit_data_source_form.tsx b/src/plugins/data_source_management/public/components/edit_data_source/components/edit_form/edit_data_source_form.tsx index 8e3128c7e98..2ea63e25229 100644 --- a/src/plugins/data_source_management/public/components/edit_data_source/components/edit_form/edit_data_source_form.tsx +++ b/src/plugins/data_source_management/public/components/edit_data_source/components/edit_form/edit_data_source_form.tsx @@ -23,13 +23,14 @@ import { } from '@elastic/eui'; import { i18n } from '@osd/i18n'; import { FormattedMessage } from '@osd/i18n/react'; +import { SigV4Content, SigV4ServiceName } from '../../../../../../data_source/common/data_sources'; import { Header } from '../header'; import { AuthType, credentialSourceOptions, DataSourceAttributes, DataSourceManagementContextValue, - SigV4Content, + sigV4ServiceOptions, ToastMessageItem, UsernamePasswordTypedContent, } from '../../../../types'; @@ -46,9 +47,9 @@ import { UpdateAwsCredentialModal } from '../update_aws_credential_modal'; export interface EditDataSourceProps { existingDataSource: DataSourceAttributes; existingDatasourceNamesList: string[]; - handleSubmit: (formValues: DataSourceAttributes) => void; - handleTestConnection: (formValues: DataSourceAttributes) => void; - onDeleteDataSource?: () => void; + handleSubmit: (formValues: DataSourceAttributes) => Promise; + handleTestConnection: (formValues: DataSourceAttributes) => Promise; + onDeleteDataSource?: () => Promise; displayToastMessage: (info: ToastMessageItem) => void; } export interface EditDataSourceState { @@ -123,7 +124,10 @@ export class EditDataSourceForm extends React.Component { const isValid = !!this.state.auth.credentials.username?.trim().length; this.setState({ @@ -221,6 +226,18 @@ export class EditDataSourceForm extends React.Component) => { + this.setState({ + auth: { + ...this.state.auth, + credentials: { + ...this.state.auth.credentials, + service: e.target.value as SigV4ServiceName, + } as SigV4Content, + }, + }); + }; + onChangeRegion = (e: { target: { value: any } }) => { this.setState({ auth: { @@ -253,7 +270,7 @@ export class EditDataSourceForm extends React.Component { - const isValid = !!this.state.auth.credentials.accessKey; + const isValid = !!this.state.auth.credentials?.accessKey; this.setState({ formErrorsByField: { ...this.state.formErrorsByField, @@ -275,7 +292,7 @@ export class EditDataSourceForm extends React.Component { - const isValid = !!this.state.auth.credentials.secretKey; + const isValid = !!this.state.auth.credentials?.secretKey; this.setState({ formErrorsByField: { ...this.state.formErrorsByField, @@ -338,9 +355,9 @@ export class EditDataSourceForm extends React.Component { + onClickDeleteDataSource = async () => { if (this.props.onDeleteDataSource) { - this.props.onDeleteDataSource(); + await this.props.onDeleteDataSource(); } }; @@ -359,6 +376,7 @@ export class EditDataSourceForm extends React.Component @@ -788,6 +807,19 @@ export class EditDataSourceForm extends React.Component + + this.onChangeSigV4ServiceName(e)} + name="ServiceName" + data-test-subj="createDataSourceFormAuthTypeSelect" + /> + void; closeUpdateAwsCredentialModal: () => void; } export const UpdateAwsCredentialModal = ({ region, + service, handleUpdateAwsCredential, closeUpdateAwsCredentialModal, }: UpdateAwsCredentialModalProps) => { @@ -87,6 +91,16 @@ export const UpdateAwsCredentialModal = ({ + {/* Service Name */} + + + {sigV4ServiceOptions.find((option) => option.value === service)?.text} + + {/* Region */} Date: Tue, 23 May 2023 01:10:06 -0700 Subject: [PATCH 34/38] Remove Sass from `tile_map` plugin (#4110) * Remove Sass from tile_map plugin Signed-off-by: Matt Provost * Update changelog Signed-off-by: Matt Provost --------- Signed-off-by: Matt Provost --- CHANGELOG.md | 1 + src/plugins/tile_map/public/_tile_map.scss | 15 --------------- src/plugins/tile_map/public/index.scss | 8 -------- 3 files changed, 1 insertion(+), 23 deletions(-) delete mode 100644 src/plugins/tile_map/public/_tile_map.scss delete mode 100644 src/plugins/tile_map/public/index.scss diff --git a/CHANGELOG.md b/CHANGELOG.md index fa5a9f577a4..ba97e49b658 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -201,6 +201,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Multiple DataSource] Present the authentication type choices in a drop-down ([#3693](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3693)) - [Console] Remove unused ul element and its custom styling ([#3993](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3993)) - Fix EUI/OUI type errors ([#3798](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3798)) +- Remove unused Sass in `tile_map` plugin ([#4110](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4110)) ### ๐Ÿ”ฉ Tests diff --git a/src/plugins/tile_map/public/_tile_map.scss b/src/plugins/tile_map/public/_tile_map.scss deleted file mode 100644 index 5e4b20f79fe..00000000000 --- a/src/plugins/tile_map/public/_tile_map.scss +++ /dev/null @@ -1,15 +0,0 @@ -// SASSTODO: Does this selector exist today? -.tilemap { - margin-bottom: 6px; - border: $euiBorderThin; - position: relative; -} - -/** -* 1. Visualizations have some padding by default but tilemaps look nice flush against the edge to maximize viewing -* space. -*/ -// SASSTODO: Does this selector exist today? -.tile_map { - padding: 0; /* 1. */ -} diff --git a/src/plugins/tile_map/public/index.scss b/src/plugins/tile_map/public/index.scss deleted file mode 100644 index aa2117cb0c0..00000000000 --- a/src/plugins/tile_map/public/index.scss +++ /dev/null @@ -1,8 +0,0 @@ -// Prefix all styles with "tlm" to avoid conflicts. -// Examples -// tlmChart -// tlmChart__legend -// tlmChart__legend--small -// tlmChart__legend-isLoading - -@import "tile_map"; From 61ea841e4eab621d86aed9274c95b1bcc2f66c55 Mon Sep 17 00:00:00 2001 From: Bandini <63824432+bandinib-amzn@users.noreply.github.com> Date: Tue, 23 May 2023 09:59:25 -0700 Subject: [PATCH 35/38] Design for New Saved Object Service Interface for Custom Repository (#3954) * Adds design document for new saved object service interface for custom repository Signed-off-by: Bandini Bhopi --- CHANGELOG.md | 1 + .../current_saved_object_service_workflow.png | Bin 0 -> 26471 bytes ...proposed_saved_object_service_workflow.png | Bin 0 -> 53121 bytes ...current_saved_object_service_workflow.puml | 19 ++ ...roposed_saved_object_service_workflow.puml | 38 ++++ .../saved_object_repository_factory_design.md | 171 ++++++++++++++++++ 6 files changed, 229 insertions(+) create mode 100644 docs/saved_objects/img/current_saved_object_service_workflow.png create mode 100644 docs/saved_objects/img/proposed_saved_object_service_workflow.png create mode 100644 docs/saved_objects/resources/current_saved_object_service_workflow.puml create mode 100644 docs/saved_objects/resources/proposed_saved_object_service_workflow.puml create mode 100644 docs/saved_objects/saved_object_repository_factory_design.md diff --git a/CHANGELOG.md b/CHANGELOG.md index ba97e49b658..cfa5aebd2ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -172,6 +172,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Doc] Update DEVELOPER_GUIDE.md with added manual bootstrap timeout solution and max virtual memory error solution with docker ([#3764](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3764)) - [Doc] Add COMMUNICATIONS.md with info about Slack, forum, office hours ([#3837](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3837)) - [Doc] Add docker files and instructions for debugging Selenium functional tests ([#3747](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3747)) +- [Saved Object Service] Adds design doc for new Saved Object Service Interface for Custom Repository [#3954](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3954) ### ๐Ÿ›  Maintenance diff --git a/docs/saved_objects/img/current_saved_object_service_workflow.png b/docs/saved_objects/img/current_saved_object_service_workflow.png new file mode 100644 index 0000000000000000000000000000000000000000..b763101b698793e87822e61d5fca0b2915d4e2f9 GIT binary patch literal 26471 zcmd432{_g3+cvyVkuqjTLRMxWLYcLYc?g9}ndh0zQ<14s$(*SSA@iJBAydW*8IyU+ z9Kw4oYVT_A|NDI3_dMTwyvNaA**{s_Ii#+hG+C$&zL$o+VXR7*jnmY zJ33ievK!b~5uN8djX+>Ho2jZh{=AOBfTwYJ>aW~nU3Z?aQnOj)-lbaFKzY)(Boy9Z zp2LS9)eX|A%&_!68cQBu6fibBO5(Qijcr9R{<3u`Z#{!k6cK|2!FQC!lOsqSeaz7r zECUv$NaU51DKp)Ag1j=Xk&^Sd_r4&>C>W))o-L_d7Umh*9CZm1Y?K?nZCN7V%ho=n zcb7{tdu)U1?7hrRza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b zVj?3$;8F#E7#y5f2{KueX_GN=Ve#$Fp)3kPGKAFphZ{E{;anFbD?tq9Q4oTcrJ>ag33xG`1}X*6h+(tH}$x`bi*6&c6sq3w4Iw!GLv zIy#K~X>jA7+6dIv)N~s8qD?k+elQez_0}W7^g`XowR096txg*$qE&>||iW0vyj9 zQ~?(hNY9Z4#>_(ZY8e@^`QLMhg98yZ4NE*Lrx2DA0ZnS-%MQW`?1zOtPyq32Yj4-< zT!PXd7wB4xANT$>`|wG91PxO>^93q}4wJP?FH--b*RVsup2l$!$YkN*1hTWHmGU-$ zvPq(s{{38}1%ie?o4o^wobaj~S;SpO@6gS~NZ zyvNB39UdDW?~#(e8`5sVll|!535cb4x%wv(0$##F2nK({^!?s&c-YDKV-*i0*rUH9 zZR}LJ3E!&p4=Hrf*EkMPv?CWKXP+R{gWztSdj%Xr-@bh2#L<6V2wy&vL5{r$_7(gB m_pkqe+xY$K7sB0a`_vMoK|d(Hy7u7eIFe$rcQQnDUj9G9r^6!v literal 0 HcmV?d00001 diff --git a/docs/saved_objects/resources/current_saved_object_service_workflow.puml b/docs/saved_objects/resources/current_saved_object_service_workflow.puml new file mode 100644 index 00000000000..bc5bbf82c62 --- /dev/null +++ b/docs/saved_objects/resources/current_saved_object_service_workflow.puml @@ -0,0 +1,19 @@ +@startuml +title: Current Saved Object Service Flow +actor User +participant "Saved Object Client" as Client +participant "Saved Object Repository" as Repo +participant "Opensearch" as OS + +User -> Client: Create Saved Object +Client -> Repo: Create Saved Object +Repo -> OS: Index Saved Object +OS --> Repo: Saved Object Saved +Client -> User: Saved Object Created +User -> Client: Get Saved Object +Client -> Repo: Get Saved Object +Repo -> OS: Get Saved Object +OS --> Repo: Return Saved Object +Repo -> Client: Return Saved Object +Client -> User: Saved Object Data +@enduml \ No newline at end of file diff --git a/docs/saved_objects/resources/proposed_saved_object_service_workflow.puml b/docs/saved_objects/resources/proposed_saved_object_service_workflow.puml new file mode 100644 index 00000000000..27a5e1cd49e --- /dev/null +++ b/docs/saved_objects/resources/proposed_saved_object_service_workflow.puml @@ -0,0 +1,38 @@ +@startuml + +title: Proposed Saved Object Service Flow + +actor User + +participant "OpenSearch-Dashboards" as OSD + +box "Saved Object Service" #LightBlue +participant "Saved Object Client" as Client +participant "Repository Factory Provider" as Factory +end box + +box "Dashboards Storage Plugin" #LightYellow +participant "Repository\n(e.g. PostgresRepository,\nDynamoDBRepository)" as Repo +participant "Metadata Storage\n(e.g. Postgres, \nDynamoDB etc)" as Meta +end box + +autonumber +group OSD Bootstrap +Repo -> Factory: Register custom repository +Factory -> Client: Returns repository +Client -> OSD: Returns Saved Object Client +end group +User -> Client: Create Saved Object +Client -> Repo: Create Saved Object +Repo -> Meta: Create/Update Record +Meta --> Repo: Saved Object Saved +Client -> User: Saved Object Created +User -> Client: Get Saved Object +Client -> Repo: Get Saved Object +Repo -> Meta: Fetch Saved Object from storage +Meta --> Repo: Return Saved Object +Repo -> Client: Return Saved Object +Client -> User: Saved Object Data + +skinparam BoxPadding 15 +@enduml \ No newline at end of file diff --git a/docs/saved_objects/saved_object_repository_factory_design.md b/docs/saved_objects/saved_object_repository_factory_design.md new file mode 100644 index 00000000000..d3fedd3575d --- /dev/null +++ b/docs/saved_objects/saved_object_repository_factory_design.md @@ -0,0 +1,171 @@ +# Proposed Saved Object Service Interface for Custom Repository + +## Introduction + +The new saved object service interface for custom repository is a project that aims to improve scalability of the existing saved object service by introducing a new interface. The goal of this project is to provide a more efficient and flexible interface that will make it easier for developers to configure metadata of Dashboards in any different storage than OpenSearch, such as mysql, postgres, DDB, serverless (S3+ Athena). + +Currently, Dashboards stores its metadata configuration inside OpenSearch index (called .kibana). This approach is by design of Dashboards and biased towards product decision by upstream which works seamlessly and out of the box for customers but it introduces challenges while operating at scale and providing high availability for Dashboards. While choosing OpenSearch as a storage for Dashboards metadata, availability of Dashboards depends on OpenSearch clusterโ€™s availability and other cluster parameters such as cluster health, state, versions which could make Dashboards unavailable. + +To mitigate above problem and unblock future extensibility of Dashboards, we are building Dashboards Meta storage adaptor to decouple Dashboards metadata storage from OpenSearch. This project will focus on introducing new interface in Saved Object Service using which developer can build their custom repository and save Dashboards metadata in storage of their choice. + +The stakeholders of this new interface include the developers of the Dashboards and community contributors who wants to use other metadata store. + +## Architecture Overview + +The Saved Object Service is a critical component of Dashboards that provides a way to store and manage application data. It is built using a modular architecture that provides a high degree of flexibility and extensibility. The new interface will be designed to replace [ISavedObjectRepository](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/core/server/saved_objects/service/lib/repository.ts#L134) implementation so that developers can build plugins that leverage the power of existing saved object service and use their own database to store and retrieve metadata of OpenSearch Dashboards. + +### Current Architecture + +The repository interface named [ISavedObjectRepository](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/core/server/saved_objects/service/lib/repository.ts#L134) in OpenSearch-Dashboards is a module that provides an interface for managing saved objects. The [SavedObjectRepository](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/core/server/saved_objects/service/lib/repository.ts#L139) is the implementation of [ISavedObjectRepository](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/core/server/saved_objects/service/lib/repository.ts#L134), which uses OpenSearch index as itโ€™s data store. It is responsible for storing, retrieving, and deleting saved objects for Dashboards, such as visualizations, dashboards, and searches. + +The Saved Object Repository is built on top of the OpenSearch client and provides a simplified interface for working with OpenSearch. It uses the Saved Object Serializer to convert saved objects between their internal and external representations. The repository is then being consumed by Saved object client to create scoped saved object client. + +![img](./img/current_saved_object_service_workflow.png) + +### Proposed Architecture + +- **Approach 1 (Preferred)**: The proposed architecture will add one more layer of abstraction in Saved Object Service. `The Repository Factory Provider` in OpenSearch Dashboards will be responsible for creating and managing instances of the Repository (e.g. SavedObjectRepository, PostgresRepository, DynamoDBRepository etc.), which is used to interact with the metadata storage that stores the saved objects. Currently we have an repository interface named [ISavedObjectRepository](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/core/server/saved_objects/service/lib/repository.ts#L134), and the [SavedObjectRepository](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/core/server/saved_objects/service/lib/repository.ts#L139) is the implementation, which use an OpenSearch index as its data store. This approach would make the implementation of [ISavedObjectRepository](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/core/server/saved_objects/service/lib/repository.ts#L134) replaceable by plugin. + + ![img](./img/proposed_saved_object_service_workflow.png) + + * Pros: + * Only change needed in Dashboard is to introduce one more abstraction layer in Saved Object Service. + * Adds opportunity for community developers to contribute for other meta store. + + * Cons + * Code reusability is low. +
    + +**POC**: +1) Core Dashboards Change: https://github.com/bandinib-amzn/OpenSearch-Dashboards/commit/b9cfc14 +2) Postgres Repository Plugin: https://github.com/bandinib-amzn/metadata_plugin/commit/dac35f0 + +`SavedObjectsServiceSetup` provides interface to create custom Saved Object Repository. +``` +/** +* Set the default {@link SavedObjectRepositoryFactoryProvider | factory provider} for creating Saved Objects repository. +* Only one repository can be set, subsequent calls to this method will fail. +*/ +registerRepositoryFactoryProvider: ( +respositoryFactoryProvider: SavedObjectRepositoryFactoryProvider +) => void; +``` + +Here are the main steps involved in using the Saved Objects Repository Factory in Dashboards: +1. Define the dependencies: The Saved Object Repository Factory Provider requires the function which creates instance of [ISavedObjectRepository](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/core/server/saved_objects/service/lib/repository.ts#L134). + ``` + export const repositoryFactoryProvider: SavedObjectRepositoryFactoryProvider = ( + options: SavedObjectsRepositoryOptions + ) => { + . + . + . + return new PostgresRepository({ + typeRegistry, + serializer, + migrator, + allowedTypes, + }); + } + ``` +2. Register the provider: Register the repository factory provider with right dependencies. + ``` + core.savedObjects.registerRepositoryFactoryProvider(repositoryFactoryProvider); + ``` +3. Implement the Saved Object Operations for chosen storage type: Implement the CRUD and other operations for contracts defined in [ISavedObjectRepository](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/core/server/saved_objects/service/lib/repository.ts#L134) + ``` + async create( + type: string, + attributes: T, + options: SavedObjectsCreateOptions = {} + ): Promise> { + ... + } + + async get( + type: string, + id: string, + options: SavedObjectsBaseOptions = {} + ): Promise> { + ... + } + + async update( + type: string, + id: string, + attributes: Partial, + options: SavedObjectsUpdateOptions = {} + ): Promise> { + ... + } + + async deleteFromNamespaces( + type: string, + id: string, + namespaces: string[], + options: SavedObjectsDeleteFromNamespacesOptions = {} + ): Promise { + ... + } + . + . + . + ``` + +- **Approach 2**: Build external plugin and using saved object client wrapper or client factory provider injection mechanism we can build custom object for Postgres or other DB. + + * Pros: + * No changes in core Dashboards. That means we can keep Dashboards as it is with very minimal changes. + + + * Cons + * Code reusability is low. + * Some components of Saved object service such as Serializer, Type registry, interface to create internal and scoped repository are only available during Saved Object Service Start. As per the current architecture, first Saved Object Service Setup โ†’ Plugin Setup โ†’ Saved Object Service Start โ†’ Plugin Start. Some core plugin (e.g. opensearch_dashboards_usage_collection) calls find operation before plugin start and it fails because some components are still not available before plugin start. +
    + + **POC**: https://github.com/bandinib-amzn/metadata_plugin/compare/f040daf...89213eb + + +- **Approach 3**: In this approach, we just extend the `SavedObjectsRepository` class and override CRUD and other saved object operation in core Dashboards. + + * Pros: + * As we are extending the repository in core saved object service itself, we can reuse the validation and utility functions for other database options. + + + * Cons + * Changes in core Dashboards : We will be making considerable changes in critical component of Dashboards. + * With this approach, user will have to use the data storage option that we choose. +
    + + **POC**: https://github.com/bandinib-amzn/OpenSearch-Dashboards/compare/main...22d7f30 + +## Implementation Details + + +| Repository | Component | Change | +| ----------- | ----------- | ----------- | +| OpenSearch-Dashboards | Saved Object Service | Add Saved object repository factory provider | +| OpenSearch-Dashboards | Config | Configuration for metadata storage | +| MetaStorage-Plugin [Name TBD] | Plugin / Extension | We will build new plugin for Postgres. This is use case for new interface in Saved Object Repository. | + +### Configuration for metadata storage: +``` +metaStorage.enabled: true +metaStorage.config: { + type: 'xxxx', + hostName: 'xxxx', + userName: 'xxxx', + password: 'xxxx', + port: xxxx, +} +``` + +## Testing and Quality Assurance + +### Testing Approach + +The following testing approach will be used to ensure the quality of the system: + +1. **Unit testing**: Metadata store plugin will be thoroughly unit tested to ensure it meets its requirements and performs as expected. Also we will add new test cases in OpenSearch-Dashboards to test new repository factory provider. +2. **Integration testing**: Components will be integrated and tested together to ensure they work together seamlessly and without conflicts. + From 1524784ee403712c9db99b01610e147fe685eb07 Mon Sep 17 00:00:00 2001 From: David Sinclair <24573542+sikhote@users.noreply.github.com> Date: Wed, 24 May 2023 15:03:53 -0700 Subject: [PATCH 36/38] enhance grouping for context menu options (#3924) * enhance grouping for context menu options * build panels tests and more comments Signed-off-by: David Sinclair --------- Signed-off-by: David Sinclair Signed-off-by: David Sinclair Signed-off-by: Josh Romero Co-authored-by: Josh Romero --- CHANGELOG.md | 1 + .../context_menu_examples.tsx | 2 + .../ui_actions/public/actions/action.ts | 2 +- .../public/actions/action_internal.ts | 2 +- .../build_eui_context_menu_panels.test.ts | 202 +++++++++++++++++- .../build_eui_context_menu_panels.tsx | 57 +++-- 6 files changed, 249 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfa5aebd2ab..2bb0133dfe6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -250,6 +250,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Multi DataSource] UX enhancement on Data source management stack ([#2521](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2521)) - [Multi DataSource] UX enhancement on Update stored password modal for Data source management stack ([#2532](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2532)) - [Monaco editor] Add json worker support ([#3424](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3424)) +- Enhance grouping for context menus ([#3169](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3169)) - Replace re2 with RegExp in timeline and add unit tests ([#3908](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3908)) ### ๐Ÿ› Bug Fixes diff --git a/examples/ui_actions_explorer/public/context_menu_examples/context_menu_examples.tsx b/examples/ui_actions_explorer/public/context_menu_examples/context_menu_examples.tsx index d38d80d0fac..b01d04c1608 100644 --- a/examples/ui_actions_explorer/public/context_menu_examples/context_menu_examples.tsx +++ b/examples/ui_actions_explorer/public/context_menu_examples/context_menu_examples.tsx @@ -44,6 +44,8 @@ export const ContextMenuExamples: React.FC = () => {

    Below examples show how context menu panels look with varying number of actions and how the actions can be grouped into different panels using grouping field. + Grouping can only be one layer deep. A group needs to have at least two items for grouping + to work. A separator is automatically added between groups.

    diff --git a/src/plugins/ui_actions/public/actions/action.ts b/src/plugins/ui_actions/public/actions/action.ts index b38e2bd4e40..76fc2ddb3be 100644 --- a/src/plugins/ui_actions/public/actions/action.ts +++ b/src/plugins/ui_actions/public/actions/action.ts @@ -92,7 +92,7 @@ export interface Action * Returns a title to be displayed to the user. * @param context */ - getDisplayName(context: ActionExecutionContext): string; + getDisplayName(context: ActionExecutionContext): JSX.Element | string; /** * `UiComponent` to render when displaying this action as a context menu item. diff --git a/src/plugins/ui_actions/public/actions/action_internal.ts b/src/plugins/ui_actions/public/actions/action_internal.ts index fb39a01ed69..5610051dc3f 100644 --- a/src/plugins/ui_actions/public/actions/action_internal.ts +++ b/src/plugins/ui_actions/public/actions/action_internal.ts @@ -59,7 +59,7 @@ export class ActionInternal return this.definition.getIconType(context); } - public getDisplayName(context: Context): string { + public getDisplayName(context: Context): JSX.Element | string { if (!this.definition.getDisplayName) return `Action: ${this.id}`; return this.definition.getDisplayName(context); } diff --git a/src/plugins/ui_actions/public/context_menu/build_eui_context_menu_panels.test.ts b/src/plugins/ui_actions/public/context_menu/build_eui_context_menu_panels.test.ts index 949595d6093..b9afca9fb99 100644 --- a/src/plugins/ui_actions/public/context_menu/build_eui_context_menu_panels.test.ts +++ b/src/plugins/ui_actions/public/context_menu/build_eui_context_menu_panels.test.ts @@ -36,20 +36,28 @@ const createTestAction = ({ type, dispayName, order, + grouping, }: { type?: string; dispayName: string; order?: number; + grouping?: any[]; }) => createAction({ type: type as any, // mapping doesn't matter for this test getDisplayName: () => dispayName, order, execute: async () => {}, + grouping, }); const resultMapper = (panel: EuiContextMenuPanelDescriptor) => ({ - items: panel.items ? panel.items.map((item) => ({ name: item.name })) : [], + items: panel.items + ? panel.items.map((item) => ({ + ...(item.name ? { name: item.name } : {}), + ...(item.isSeparator ? { isSeparator: true } : {}), + })) + : [], }); test('sorts items in DESC order by "order" field first, then by display name', async () => { @@ -248,3 +256,195 @@ test('hides items behind in "More" submenu if there are more than 4 actions', as ] `); }); + +test('flattening of group with only one action', async () => { + const grouping1 = [ + { + id: 'test-group', + getDisplayName: () => 'Test group', + getIconType: () => 'bell', + }, + ]; + const actions = [ + createTestAction({ + dispayName: 'Foo 1', + }), + createTestAction({ + dispayName: 'Bar 1', + grouping: grouping1, + }), + ]; + const menu = await buildContextMenuForActions({ + actions: actions.map((action) => ({ action, context: {}, trigger: 'TEST' as any })), + }); + + expect(menu.map(resultMapper)).toMatchInlineSnapshot(` + Array [ + Object { + "items": Array [ + Object { + "name": "Foo 1", + }, + Object { + "isSeparator": true, + }, + Object { + "name": "Bar 1", + }, + ], + }, + Object { + "items": Array [ + Object { + "name": "Bar 1", + }, + ], + }, + ] + `); +}); + +test('grouping with only two actions', async () => { + const grouping1 = [ + { + id: 'test-group', + getDisplayName: () => 'Test group', + getIconType: () => 'bell', + }, + ]; + const actions = [ + createTestAction({ + dispayName: 'Foo 1', + }), + createTestAction({ + dispayName: 'Bar 1', + grouping: grouping1, + }), + createTestAction({ + dispayName: 'Bar 2', + grouping: grouping1, + }), + ]; + const menu = await buildContextMenuForActions({ + actions: actions.map((action) => ({ action, context: {}, trigger: 'TEST' as any })), + }); + + expect(menu.map(resultMapper)).toMatchInlineSnapshot(` + Array [ + Object { + "items": Array [ + Object { + "name": "Foo 1", + }, + Object { + "isSeparator": true, + }, + Object { + "name": "Test group", + }, + ], + }, + Object { + "items": Array [ + Object { + "name": "Bar 1", + }, + Object { + "name": "Bar 2", + }, + ], + }, + ] + `); +}); + +test('groups with deep nesting', async () => { + const grouping1 = [ + { + id: 'test-group', + getDisplayName: () => 'Test group', + getIconType: () => 'bell', + }, + ]; + const grouping2 = [ + { + id: 'test-group-2', + getDisplayName: () => 'Test group 2', + getIconType: () => 'bell', + }, + { + id: 'test-group-3', + getDisplayName: () => 'Test group 3', + getIconType: () => 'bell', + }, + ]; + + const actions = [ + createTestAction({ + dispayName: 'Foo 1', + }), + createTestAction({ + dispayName: 'Bar 1', + grouping: grouping1, + }), + createTestAction({ + dispayName: 'Bar 2', + grouping: grouping1, + }), + createTestAction({ + dispayName: 'Qux 1', + grouping: grouping2, + }), + ]; + const menu = await buildContextMenuForActions({ + actions: actions.map((action) => ({ action, context: {}, trigger: 'TEST' as any })), + }); + + expect(menu.map(resultMapper)).toMatchInlineSnapshot(` + Array [ + Object { + "items": Array [ + Object { + "name": "Foo 1", + }, + Object { + "isSeparator": true, + }, + Object { + "name": "Test group", + }, + Object { + "isSeparator": true, + }, + Object { + "name": "Test group 3", + }, + ], + }, + Object { + "items": Array [ + Object { + "name": "Bar 1", + }, + Object { + "name": "Bar 2", + }, + ], + }, + Object { + "items": Array [ + Object { + "name": "Test group 3", + }, + ], + }, + Object { + "items": Array [ + Object { + "name": "Qux 1", + }, + ], + }, + ] + `); +}); diff --git a/src/plugins/ui_actions/public/context_menu/build_eui_context_menu_panels.tsx b/src/plugins/ui_actions/public/context_menu/build_eui_context_menu_panels.tsx index 054900f52b7..6d69be1f3fa 100644 --- a/src/plugins/ui_actions/public/context_menu/build_eui_context_menu_panels.tsx +++ b/src/plugins/ui_actions/public/context_menu/build_eui_context_menu_panels.tsx @@ -146,6 +146,7 @@ export async function buildContextMenuForActions({ closeMenu = () => {}, }: BuildContextMenuParams): Promise { const panels: Record = { + // This is the first panel which links out to all others via items property mainMenu: { id: 'mainMenu', title, @@ -157,35 +158,51 @@ export async function buildContextMenuForActions({ const context: ActionExecutionContext = { ...item.context, trigger: item.trigger }; const isCompatible = await item.action.isCompatible(context); if (!isCompatible) return; - let parentPanel = ''; - let currentPanel = ''; + + // Reference to the last/parent/upper group. + // Groups are provided in order of parent to children. + let parentGroupId = ''; + if (action.grouping) { for (let i = 0; i < action.grouping.length; i++) { const group = action.grouping[i]; - currentPanel = group.id; - if (!panels[currentPanel]) { + const groupId = group.id; + + // If a panel does not exist for the current group, then create it + if (!panels[groupId]) { const name = group.getDisplayName ? group.getDisplayName(context) : group.id; - panels[currentPanel] = { - id: currentPanel, + + // Create panel for group + panels[groupId] = { + id: groupId, title: name, items: [], _level: i, _icon: group.getIconType ? group.getIconType(context) : 'empty', }; - if (parentPanel) { - panels[parentPanel].items!.push({ + + // If there are multiple groups and this is not the first group, + // then add an item to the parent group relating to this group + if (parentGroupId) { + panels[parentGroupId].items!.push({ name, - panel: currentPanel, + panel: groupId, icon: group.getIconType ? group.getIconType(context) : 'empty', _order: group.order || 0, _title: group.getDisplayName ? group.getDisplayName(context) : '', }); } } - parentPanel = currentPanel; + + // Save the current group, because it will be used as the parent group + // for adding items to it for any additional groups in the array + parentGroupId = groupId; } } - panels[parentPanel || 'mainMenu'].items!.push({ + + // Add a context menu item for this action so it shows up on a context menu panel. + // We add this within the parent group or default to the mainMenu panel. + panels[parentGroupId || 'mainMenu'].items!.push({ name: action.MenuItem ? React.createElement(uiToReactComponent(action.MenuItem), { context }) : action.getDisplayName(context), @@ -197,8 +214,10 @@ export async function buildContextMenuForActions({ _title: action.getDisplayName(context), }); }); + await Promise.all(promises); + // For each panel, sort items by order and title for (const panel of Object.values(panels)) { const items = panel.items.filter(Boolean) as ItemDescriptor[]; panel.items = _.sortBy( @@ -208,13 +227,23 @@ export async function buildContextMenuForActions({ ); } + // On the mainMenu, before adding in items for other groups, the first 4 items are shown. + // Any additional items are hidden behind a "more" item wrapMainPanelItemsIntoSubmenu(panels, 'mainMenu'); for (const panel of Object.values(panels)) { + // If the panel is a root-level panel, such as the parent of a group, + // then create mainMenu item for this panel if (panel._level === 0) { - // TODO: Add separator line here once it is available in EUI. - // See https://github.com/elastic/eui/pull/4018 - if (panel.items.length > 3) { + // Add separator with unique key if needed + if (panels.mainMenu.items.length) { + panels.mainMenu.items.push({ isSeparator: true, key: `${panel.id}separator` }); + } + + // If a panel has more than one child, then allow items to be grouped + // and link to it in the mainMenu. Otherwise, flatten the group. + // Note: this only happens on the root level panels, not for inner groups. + if (panel.items.length > 1) { panels.mainMenu.items.push({ name: panel.title || panel.id, icon: panel._icon || 'empty', From 6399a6ccb12f3b6f1aa263c2a7af2faf80292cdc Mon Sep 17 00:00:00 2001 From: Yan Zeng <46499415+zengyan-amazon@users.noreply.github.com> Date: Thu, 25 May 2023 11:45:56 -0700 Subject: [PATCH 37/38] Adding Tao and Zilong to MAINTAINERS (#4137) * Adding Tao and Zilong to MAINTAINERS Signed-off-by: Yan Zeng --- CHANGELOG.md | 1 + MAINTAINERS.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bb0133dfe6..1b8ae297fc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -191,6 +191,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Bump `styled-components` from 5.3.5 to 5.3.9 ([#3678](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3678)) - Bump `js-yaml` from 3.14.0 to 4.1.0 ([#3770](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3770)) - Bump `oui` from `1.0.0` to `1.1.1` ([#3884](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3884)) +- Adding @ZilongX and @Flyingliuhub as maintainers. ([#4137](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4137)) ### ๐Ÿช› Refactoring diff --git a/MAINTAINERS.md b/MAINTAINERS.md index ecb3f292861..ae42e47b014 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -17,6 +17,8 @@ This document contains a list of maintainers in this repo. See [opensearch-proje | Kristen Tian | [kristenTian](https://github.com/kristenTian) | Amazon | | Zhongnan Su | [zhongnansu](https://github.com/zhongnansu) | Amazon | | Manasvini B Suryanarayana | [manasvinibs](https://github.com/manasvinibs) | Amazon | +| Tao Liu | [Flyingliuhub](https://github.com/Flyingliuhub) | Amazon | +| Zilong Xia | [ZilongX](https://github.com/ZilongX) | Amazon | ## Emeritus From 574f1192931bdd87a509b8ef6e93dfd885cd96d1 Mon Sep 17 00:00:00 2001 From: Zhongnan Su Date: Thu, 25 May 2023 13:15:18 -0700 Subject: [PATCH 38/38] [MD]Update data-test-subj for functional tests & fix bug in edit flow (#4126) Signed-off-by: Su --- .../create_form/create_data_source_form.tsx | 2 +- .../edit_form/edit_data_source_form.tsx | 31 ++++++++++++++----- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx b/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx index 8b36e13e7de..9f320400fb7 100644 --- a/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx +++ b/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx @@ -430,7 +430,7 @@ export class CreateDataSourceForm extends React.Component< value={this.state.auth.credentials.service} onChange={(e) => this.onChangeSigV4ServiceName(e)} name="ServiceName" - data-test-subj="createDataSourceFormAuthTypeSelect" + data-test-subj="createDataSourceFormSigV4ServiceTypeSelect" /> ) => { - this.setState({ auth: { ...this.state.auth, type: e.target.value as AuthType } }, () => { - this.onChangeFormValues(); - }); + const authType = e.target.value as AuthType; + this.setState( + { + auth: { + ...this.state.auth, + type: authType, + credentials: { + ...this.state.auth.credentials, + service: + (this.state.auth.credentials?.service as SigV4ServiceName) || + SigV4ServiceName.OpenSearch, + }, + }, + }, + () => { + this.onChangeFormValues(); + } + ); }; onChangeDescription = (e: { target: { value: any } }) => { @@ -804,7 +819,7 @@ export class EditDataSourceForm extends React.Component this.onChangeSigV4ServiceName(e)} name="ServiceName" - data-test-subj="createDataSourceFormAuthTypeSelect" + data-test-subj="editDataSourceFormSigV4ServiceTypeSelect" />