From 0b537f0da3970a852b5540647d42becdd13b7769 Mon Sep 17 00:00:00 2001 From: Miki Date: Thu, 9 Feb 2023 12:56:53 -0800 Subject: [PATCH 1/9] Prevent primitive linting limitations from being applied to unit tests found under `src/setup_node_env` (#3403) Signed-off-by: Miki --- .eslintrc.js | 2 +- CHANGELOG.md | 1 + .../node_version_validator.test.js | 26 +++++++++---------- src/setup_node_env/root/force.test.js | 4 +-- src/setup_node_env/root/is_root.test.js | 2 +- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 2381a3071913..90e789d38e58 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -459,7 +459,7 @@ module.exports = { * Files that run BEFORE node version check */ { - files: ['scripts/**/*.js', 'src/setup_node_env/**/*.js'], + files: ['scripts/**/*.js', 'src/setup_node_env/**/!(*.test).js'], rules: { 'import/no-commonjs': 'off', 'prefer-object-spread/prefer-object-spread': 'off', diff --git a/CHANGELOG.md b/CHANGELOG.md index d659c28afce2..f17b9cfa2af2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -142,6 +142,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Tests] Bumps `chromedriver` to v107 ([#3017](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3017)) - [Vis Builder] Adds field unit tests ([#3211](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3211)) - [BWC Tests] Add BWC tests for 2.6.0 ([#3356](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3356)) +- 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)) ## [2.x] diff --git a/src/setup_node_env/node_version_validator.test.js b/src/setup_node_env/node_version_validator.test.js index cb3639154c6c..92c596548207 100644 --- a/src/setup_node_env/node_version_validator.test.js +++ b/src/setup_node_env/node_version_validator.test.js @@ -28,10 +28,10 @@ * under the License. */ -var exec = require('child_process').exec; -var pkg = require('../../package.json'); +const exec = require('child_process').exec; +const pkg = require('../../package.json'); -var REQUIRED_NODE_JS_VERSION = 'v' + pkg.engines.node; +const REQUIRED_NODE_JS_VERSION = 'v' + pkg.engines.node; describe('NodeVersionValidator', function () { it('should run the script WITHOUT error when the version is the same', function (done) { @@ -43,7 +43,7 @@ describe('NodeVersionValidator', function () { }); it('should run the script WITH error if the patch version is lower', function (done) { - var lowerPatchversion = requiredNodeVersionWithDiff(0, 0, -1); + const lowerPatchversion = requiredNodeVersionWithDiff(0, 0, -1); testValidateNodeVersion( done, lowerPatchversion, @@ -56,7 +56,7 @@ describe('NodeVersionValidator', function () { }); it('should run the script WITH error if the major version is lower', function (done) { - var lowerMajorVersion = requiredNodeVersionWithDiff(-1, 0, 0); + const lowerMajorVersion = requiredNodeVersionWithDiff(-1, 0, 0); testValidateNodeVersion( done, lowerMajorVersion, @@ -69,7 +69,7 @@ describe('NodeVersionValidator', function () { }); it('should run the script WITH error if the minor version is lower', function (done) { - var lowerMinorVersion = requiredNodeVersionWithDiff(0, -1, 0); + const lowerMinorVersion = requiredNodeVersionWithDiff(0, -1, 0); testValidateNodeVersion( done, lowerMinorVersion, @@ -79,24 +79,24 @@ describe('NodeVersionValidator', function () { }); function requiredNodeVersionWithDiff(majorDiff, minorDiff, patchDiff) { - var matches = REQUIRED_NODE_JS_VERSION.match(/^v(\d+)\.(\d+)\.(\d+)/); - var major = Math.max(parseInt(matches[1], 10) + majorDiff, 0); - var minor = Math.max(parseInt(matches[2], 10) + minorDiff, 0); - var patch = Math.max(parseInt(matches[3], 10) + patchDiff, 0); + const matches = REQUIRED_NODE_JS_VERSION.match(/^v(\d+)\.(\d+)\.(\d+)/); + const major = Math.max(parseInt(matches[1], 10) + majorDiff, 0); + const minor = Math.max(parseInt(matches[2], 10) + minorDiff, 0); + const patch = Math.max(parseInt(matches[3], 10) + patchDiff, 0); return `v${major}.${minor}.${patch}`; } function testValidateNodeVersion(done, versionToTest, expectError = false) { - var processVersionOverwrite = `Object.defineProperty(process, 'version', { value: '${versionToTest}', writable: true });`; - var command = `node -e "${processVersionOverwrite}require('./node_version_validator.js')"`; + const processVersionOverwrite = `Object.defineProperty(process, 'version', { value: '${versionToTest}', writable: true });`; + const command = `node -e "${processVersionOverwrite}require('./node_version_validator.js')"`; exec(command, { cwd: __dirname }, function (error, _stdout, stderr) { expect(stderr).toBeDefined(); if (expectError) { expect(error.code).toBe(1); - var speficicErrorMessage = + const speficicErrorMessage = `OpenSearch Dashboards was built with ${REQUIRED_NODE_JS_VERSION} and does not support the current Node.js version ${versionToTest}. ` + `Please use Node.js ${REQUIRED_NODE_JS_VERSION} or a higher patch version.\n`; diff --git a/src/setup_node_env/root/force.test.js b/src/setup_node_env/root/force.test.js index f48f3255e4ed..eca20f9547b2 100644 --- a/src/setup_node_env/root/force.test.js +++ b/src/setup_node_env/root/force.test.js @@ -28,7 +28,7 @@ * under the License. */ -var forceRoot = require('./force'); +const forceRoot = require('./force'); describe('forceRoot', function () { it('with flag', function () { @@ -40,7 +40,7 @@ describe('forceRoot', function () { }); test('remove argument', function () { - var args = ['--allow-root', 'foo']; + const args = ['--allow-root', 'foo']; forceRoot(args); expect(args.includes('--allow-root')).toBeFalsy(); }); diff --git a/src/setup_node_env/root/is_root.test.js b/src/setup_node_env/root/is_root.test.js index 81dfbe3616cb..e7f8e0670b77 100644 --- a/src/setup_node_env/root/is_root.test.js +++ b/src/setup_node_env/root/is_root.test.js @@ -28,7 +28,7 @@ * under the License. */ -var isRoot = require('./is_root'); +const isRoot = require('./is_root'); describe('isRoot', function () { test('0 is root', function () { From c42f9dc761d87ff9ee5944ba09031240623c93b8 Mon Sep 17 00:00:00 2001 From: Anan Zhuang Date: Thu, 9 Feb 2023 15:44:13 -0800 Subject: [PATCH 2/9] [Security] Bumps hapi/statehood to 7.0.4 (#3411) Bump hapi/statehood to 7.0.4 to solve security concerns. Issue Resolved: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3406 Signed-off-by: Anan Zhuang --- CHANGELOG.md | 1 + yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f17b9cfa2af2..394ec6f5f9b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [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)) ### 📈 Features/Enhancements diff --git a/yarn.lock b/yarn.lock index d4c3e3187449..d6a6fc47aedb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1645,9 +1645,9 @@ "@hapi/hoek" "9.x.x" "@hapi/statehood@^7.0.3": - version "7.0.3" - resolved "https://registry.yarnpkg.com/@hapi/statehood/-/statehood-7.0.3.tgz#655166f3768344ed3c3b50375a303cdeca8040d9" - integrity sha512-pYB+pyCHkf2Amh67QAXz7e/DN9jcMplIL7Z6N8h0K+ZTy0b404JKPEYkbWHSnDtxLjJB/OtgElxocr2fMH4G7w== + version "7.0.4" + resolved "https://registry.yarnpkg.com/@hapi/statehood/-/statehood-7.0.4.tgz#6acb9d0817b5c657089356f7d9fd60af0bce4f41" + integrity sha512-Fia6atroOVmc5+2bNOxF6Zv9vpbNAjEXNcUbWXavDqhnJDlchwUUwKS5LCi5mGtCTxRhUKKHwuxuBZJkmLZ7fw== dependencies: "@hapi/boom" "9.x.x" "@hapi/bounce" "2.x.x" From 16a2b578551183c2c8b45874df83bf2a8a97c785 Mon Sep 17 00:00:00 2001 From: Zhongnan Su Date: Fri, 10 Feb 2023 15:09:30 -0800 Subject: [PATCH 3/9] [CVE-2022-25881] Resolve http-cache-semantics to 4.1.1 (#3409) Signed-off-by: Su Co-authored-by: Anan Zhuang --- CHANGELOG.md | 1 + yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 394ec6f5f9b2..45509e565491 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -163,6 +163,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [CVE-2022-37599] Bump loader-utils to 2.0.4 ([#3031](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3031)) - [CVE-2022-37603] Bump loader-utils to 2.0.4 ([#3031](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3031)) - [WS-2021-0638][security] bump mocha to 10.1.0 ([#2711](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2711)) +- [CVE-2022-25881] Resolve http-cache-semantics to 4.1.1 ([#3409](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3409)) ### 📈 Features/Enhancements diff --git a/yarn.lock b/yarn.lock index d6a6fc47aedb..35c597fb8496 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9677,9 +9677,9 @@ htmlparser2@^7.0: entities "^3.0.1" http-cache-semantics@^4.0.0, http-cache-semantics@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390" - integrity sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ== + 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== http-headers@^3.0.2: version "3.0.2" From 0cab6fe336768aeb3e6416f42205244f41633541 Mon Sep 17 00:00:00 2001 From: Zhongnan Su Date: Fri, 10 Feb 2023 23:44:08 -0800 Subject: [PATCH 4/9] [CVE-2023-25166] Bump formula to 3.0.1 (#3416) * [CVE-2023-25166] Bumps formula to 3.0.1 Signed-off-by: Su Co-authored-by: Miki Co-authored-by: Anan Zhuang --- CHANGELOG.md | 1 + yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45509e565491..d0fbda0e9625 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [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)) +- [CVE-2023-25166] Bump formula to 3.0.1 ([#3416](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3416)) ### 📈 Features/Enhancements diff --git a/yarn.lock b/yarn.lock index 35c597fb8496..0fe724b4feb5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2540,9 +2540,9 @@ "@hapi/hoek" "^9.0.0" "@sideway/formula@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.0.tgz#fe158aee32e6bd5de85044be615bc08478a0a13c" - integrity sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg== + version "3.0.1" + resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.1.tgz#80fcbcbaf7ce031e0ef2dd29b1bfc7c3f583611f" + integrity sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg== "@sideway/pinpoint@^2.0.0": version "2.0.0" From e30a0ee49b46d4b2d9f3c2661ac206a0fccb8b45 Mon Sep 17 00:00:00 2001 From: Vijayan Balasubramanian Date: Mon, 13 Feb 2023 09:16:29 -0800 Subject: [PATCH 5/9] Add new ui setting for size (#3399) Introduce new ui setting for custom vector map's size parameter. The default value is 1000. Users can increase this limit by updating this value in Advanced Settings. Signed-off-by: Vijayan Balasubramanian --- CHANGELOG.md | 1 + .../region_map/common/constants/shared.ts | 1 + src/plugins/region_map/common/index.ts | 8 ++++++-- .../region_map/public/choropleth_layer.js | 19 ++++++++++++++----- .../public/components/map_choice_options.tsx | 2 +- .../public/region_map_visualization.js | 6 ++++-- src/plugins/region_map/public/services.ts | 5 +++-- .../region_map/server/routes/opensearch.ts | 5 +++-- src/plugins/region_map/server/ui_settings.ts | 16 ++++++++++++++++ 9 files changed, 49 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0fbda0e9625..af5048796c61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -95,6 +95,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [VisBuilder] Fixes pipeline aggs ([#3137](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3137)) - [Region Maps] Fixes bug that prevents selected join field to be used ([#3213](Fix bug that prevents selected join field to be used)) - [Multi DataSource]Update test connection button text([#3247](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3247)) +- [Region Maps] Add ui setting to configure custom vector map's size parameter([#3399](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3399)) ### 🚞 Infrastructure diff --git a/src/plugins/region_map/common/constants/shared.ts b/src/plugins/region_map/common/constants/shared.ts index 6d82a3a33600..3dc3e6ce6e80 100644 --- a/src/plugins/region_map/common/constants/shared.ts +++ b/src/plugins/region_map/common/constants/shared.ts @@ -5,3 +5,4 @@ export const DEFAULT_MAP_CHOICE = 'default'; export const CUSTOM_MAP_CHOICE = 'custom'; +export const CUSTOM_VECTOR_MAP_MAX_SIZE_SETTING = 'visualization:regionmap:customVectorMapMaxSize'; diff --git a/src/plugins/region_map/common/index.ts b/src/plugins/region_map/common/index.ts index bdda981590ef..f7f2062b4910 100644 --- a/src/plugins/region_map/common/index.ts +++ b/src/plugins/region_map/common/index.ts @@ -3,6 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { DEFAULT_MAP_CHOICE, CUSTOM_MAP_CHOICE } from './constants/shared'; +import { + DEFAULT_MAP_CHOICE, + CUSTOM_MAP_CHOICE, + CUSTOM_VECTOR_MAP_MAX_SIZE_SETTING, +} from './constants/shared'; -export { DEFAULT_MAP_CHOICE, CUSTOM_MAP_CHOICE }; +export { DEFAULT_MAP_CHOICE, CUSTOM_MAP_CHOICE, CUSTOM_VECTOR_MAP_MAX_SIZE_SETTING }; diff --git a/src/plugins/region_map/public/choropleth_layer.js b/src/plugins/region_map/public/choropleth_layer.js index e0213108f64a..10d2389c5761 100644 --- a/src/plugins/region_map/public/choropleth_layer.js +++ b/src/plugins/region_map/public/choropleth_layer.js @@ -37,7 +37,11 @@ import { getNotifications } from './opensearch_dashboards_services'; import { colorUtil, OpenSearchDashboardsMapLayer } from '../../maps_legacy/public'; import { truncatedColorMaps } from '../../charts/public'; import { getServices } from './services'; -import { DEFAULT_MAP_CHOICE, CUSTOM_MAP_CHOICE } from '../common'; +import { + DEFAULT_MAP_CHOICE, + CUSTOM_MAP_CHOICE, + CUSTOM_VECTOR_MAP_MAX_SIZE_SETTING, +} from '../common'; const EMPTY_STYLE = { weight: 1, @@ -94,7 +98,8 @@ export class ChoroplethLayer extends OpenSearchDashboardsMapLayer { serviceSettings, leaflet, layerChosenByUser, - http + http, + uiSettings ) { super(); this._serviceSettings = serviceSettings; @@ -112,6 +117,7 @@ export class ChoroplethLayer extends OpenSearchDashboardsMapLayer { this._layerChosenByUser = layerChosenByUser; this._http = http; this._visParams = null; + this._uiSettings = uiSettings; // eslint-disable-next-line no-undef this._leafletLayer = this._leaflet.geoJson(null, { @@ -241,7 +247,8 @@ CORS configuration of the server permits requests from the OpenSearch Dashboards // fetch data from index and transform it to feature collection try { const services = getServices(this._http); - const result = await services.getIndexData(this._layerName); + const indexSize = this._uiSettings.get(CUSTOM_VECTOR_MAP_MAX_SIZE_SETTING); + const result = await services.getIndexData(this._layerName, indexSize); const finalResult = { type: 'FeatureCollection', @@ -337,7 +344,8 @@ CORS configuration of the server permits requests from the OpenSearch Dashboards serviceSettings, leaflet, layerChosenByUser, - http + http, + uiSettings ) { const clonedLayer = new ChoroplethLayer( name, @@ -349,7 +357,8 @@ CORS configuration of the server permits requests from the OpenSearch Dashboards serviceSettings, leaflet, layerChosenByUser, - http + http, + uiSettings ); clonedLayer.setJoinField(this._joinField); clonedLayer.setColorRamp(this._colorRamp); diff --git a/src/plugins/region_map/public/components/map_choice_options.tsx b/src/plugins/region_map/public/components/map_choice_options.tsx index f18cf88b3712..f08f026233a6 100644 --- a/src/plugins/region_map/public/components/map_choice_options.tsx +++ b/src/plugins/region_map/public/components/map_choice_options.tsx @@ -4,7 +4,7 @@ */ import './map_choice_options.scss'; -import React, { useCallback, useMemo, useState } from 'react'; +import React, { useCallback, useMemo } from 'react'; import { EuiPanel, EuiSpacer, diff --git a/src/plugins/region_map/public/region_map_visualization.js b/src/plugins/region_map/public/region_map_visualization.js index 81afee4671ca..69dca0525b89 100644 --- a/src/plugins/region_map/public/region_map_visualization.js +++ b/src/plugins/region_map/public/region_map_visualization.js @@ -230,7 +230,8 @@ export function createRegionMapVisualization({ await getServiceSettings(), (await lazyLoadMapsLegacyModules()).L, this._params.layerChosenByUser, - http + http, + uiSettings ); } else { const { ChoroplethLayer } = await import('./choropleth_layer'); @@ -244,7 +245,8 @@ export function createRegionMapVisualization({ await getServiceSettings(), (await lazyLoadMapsLegacyModules()).L, this._params.layerChosenByUser, - http + http, + uiSettings ); } this._choroplethLayer.setLayerChosenByUser(this._params.layerChosenByUser); diff --git a/src/plugins/region_map/public/services.ts b/src/plugins/region_map/public/services.ts index dd26be3ccd7a..ba182c7aa0fa 100644 --- a/src/plugins/region_map/public/services.ts +++ b/src/plugins/region_map/public/services.ts @@ -7,7 +7,7 @@ import { CoreStart, HttpFetchError } from 'opensearch-dashboards/public'; export interface Services { getCustomIndices: () => Promise; - getIndexData: (indexName: string) => Promise; + getIndexData: (indexName: string, size: number) => Promise; getIndexMapping: (indexName: string) => Promise; } @@ -25,11 +25,12 @@ export function getServices(http: CoreStart['http']): Services { return e; } }, - getIndexData: async (indexName: string) => { + getIndexData: async (indexName: string, size: number) => { try { const response = await http.post('../api/geospatial/_search', { body: JSON.stringify({ index: indexName, + size, }), }); return response; diff --git a/src/plugins/region_map/server/routes/opensearch.ts b/src/plugins/region_map/server/routes/opensearch.ts index 5eebc9a0ffda..dfdcb4a1900d 100644 --- a/src/plugins/region_map/server/routes/opensearch.ts +++ b/src/plugins/region_map/server/routes/opensearch.ts @@ -57,14 +57,15 @@ export function registerGeospatialRoutes(router: IRouter) { validate: { body: schema.object({ index: schema.string(), + size: schema.number(), }), }, }, async (context, req, res) => { const client = context.core.opensearch.client.asCurrentUser; try { - const { index } = req.body; - const params = { index, body: {} }; + const { index, size } = req.body; + const params = { index, body: {}, size }; const results = await client.search(params); return res.ok({ body: { diff --git a/src/plugins/region_map/server/ui_settings.ts b/src/plugins/region_map/server/ui_settings.ts index e5c90f6779b1..037ee4b67b9a 100644 --- a/src/plugins/region_map/server/ui_settings.ts +++ b/src/plugins/region_map/server/ui_settings.ts @@ -31,6 +31,7 @@ import { i18n } from '@osd/i18n'; import { UiSettingsParams } from 'opensearch-dashboards/server'; import { schema } from '@osd/config-schema'; +import { CUSTOM_VECTOR_MAP_MAX_SIZE_SETTING } from '../common'; export function getUiSettings(): Record> { return { @@ -49,5 +50,20 @@ export function getUiSettings(): Record> { schema: schema.boolean(), category: ['visualization'], }, + [CUSTOM_VECTOR_MAP_MAX_SIZE_SETTING]: { + name: i18n.translate('regionMap.advancedSettings.visualization.customVectorMapDefaultSize', { + defaultMessage: 'Custom vector map size', + }), + value: 1000, + description: i18n.translate( + 'regionMap.advancedSettings.visualization.customVectorMapDefaultSizeText', + { + defaultMessage: + 'The maximum number of features to load from custom vector map. A higher number might have negative impact on browser rendering performance.', + } + ), + schema: schema.number(), + category: ['visualization'], + }, }; } From 7794b622579d7634090fac40c7c66fa79f502d6d Mon Sep 17 00:00:00 2001 From: Tao Liu <33105471+Flyingliuhub@users.noreply.github.com> Date: Mon, 13 Feb 2023 12:31:29 -0800 Subject: [PATCH 6/9] [search telemetry] Fixes search telemetry's observable object that won't be GC-ed (#3390) The search telemetry was disabled by default, there is a issue when search telemetry read configuration and creates an Observable object that won't be GC-ed. Signed-off-by: Tao Liu --- CHANGELOG.md | 1 + src/plugins/data/server/plugin.ts | 4 ++-- src/plugins/data/server/search/collectors/usage.ts | 12 ++---------- .../data/server/search/search_service.test.ts | 2 +- src/plugins/data/server/search/search_service.ts | 10 +++++++--- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af5048796c61..209e2cdd8732 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -96,6 +96,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Region Maps] Fixes bug that prevents selected join field to be used ([#3213](Fix bug that prevents selected join field to be used)) - [Multi DataSource]Update test connection button text([#3247](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3247)) - [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)) ### 🚞 Infrastructure diff --git a/src/plugins/data/server/plugin.ts b/src/plugins/data/server/plugin.ts index f9159b3246ff..a1e52fbb66a1 100644 --- a/src/plugins/data/server/plugin.ts +++ b/src/plugins/data/server/plugin.ts @@ -96,7 +96,7 @@ export class DataServerPlugin this.autocompleteService = new AutocompleteService(initializerContext); } - public setup( + public async setup( core: CoreSetup, { expressions, usageCollection, dataSource }: DataPluginSetupDependencies ) { @@ -108,7 +108,7 @@ export class DataServerPlugin core.uiSettings.register(getUiSettings()); - const searchSetup = this.searchService.setup(core, { + const searchSetup = await this.searchService.setup(core, { registerFunction: expressions.registerFunction, usageCollection, dataSource, diff --git a/src/plugins/data/server/search/collectors/usage.ts b/src/plugins/data/server/search/collectors/usage.ts index d227dea8057c..6bf6a90c63bd 100644 --- a/src/plugins/data/server/search/collectors/usage.ts +++ b/src/plugins/data/server/search/collectors/usage.ts @@ -28,8 +28,7 @@ * under the License. */ -import { CoreSetup, PluginInitializerContext } from 'opensearch-dashboards/server'; -import { first } from 'rxjs/operators'; +import { CoreSetup } from 'opensearch-dashboards/server'; import { Usage } from './register'; import { ConfigSchema } from '../../../config'; @@ -40,16 +39,9 @@ export interface SearchUsage { trackSuccess(duration: number): Promise; } -export function usageProvider( - core: CoreSetup, - initializerContext: PluginInitializerContext -): SearchUsage { +export function usageProvider(core: CoreSetup, config: ConfigSchema): SearchUsage { const getTracker = (eventType: keyof Usage) => { return async (duration?: number) => { - const config = await initializerContext.config - .create() - .pipe(first()) - .toPromise(); if (config?.search?.usageTelemetry?.enabled) { const repository = await core .getStartServices() diff --git a/src/plugins/data/server/search/search_service.test.ts b/src/plugins/data/server/search/search_service.test.ts index 1cece2277c09..4a608c3df7e9 100644 --- a/src/plugins/data/server/search/search_service.test.ts +++ b/src/plugins/data/server/search/search_service.test.ts @@ -53,7 +53,7 @@ describe('Search service', () => { describe('setup()', () => { it('exposes proper contract', async () => { - const setup = plugin.setup(mockCoreSetup, ({ + const setup = await plugin.setup(mockCoreSetup, ({ packageInfo: { version: '8' }, registerFunction: jest.fn(), } as unknown) as SearchServiceSetupDependencies); diff --git a/src/plugins/data/server/search/search_service.ts b/src/plugins/data/server/search/search_service.ts index 0c33b95f4606..6620b88a0fe3 100644 --- a/src/plugins/data/server/search/search_service.ts +++ b/src/plugins/data/server/search/search_service.ts @@ -105,11 +105,15 @@ export class SearchService implements Plugin { private readonly logger: Logger ) {} - public setup( + public async setup( core: CoreSetup<{}, DataPluginStart>, { registerFunction, usageCollection, dataSource }: SearchServiceSetupDependencies - ): ISearchSetup { - const usage = usageCollection ? usageProvider(core, this.initializerContext) : undefined; + ): Promise { + const config = await this.initializerContext.config + .create() + .pipe(first()) + .toPromise(); + const usage = usageCollection ? usageProvider(core, config) : undefined; const router = core.http.createRouter(); const routeDependencies = { From e3a0b7c3727f6d354b0488e0b43be020a0e7e579 Mon Sep 17 00:00:00 2001 From: Tommy Markley <5437176+tmarkley@users.noreply.github.com> Date: Wed, 15 Feb 2023 17:59:41 -0600 Subject: [PATCH 7/9] Corrects NOTICE file copyright date range (#3308) * Corrects NOTICE file copyright date range * Follow-up on #3051 Resolves #765 Signed-off-by: Tommy Markley <5437176+tmarkley@users.noreply.github.com> * Update CHANGELOG.md Co-authored-by: Miki Signed-off-by: Tommy Markley <5437176+tmarkley@users.noreply.github.com> Co-authored-by: Zhongnan Su Co-authored-by: Miki --- CHANGELOG.md | 1 + NOTICE.txt | 2 +- src/dev/notice/generate_notice_from_source.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 209e2cdd8732..1761d99f9033 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -119,6 +119,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Doc] Add readme for global query persistence ([#3001](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3001)) - Updates NOTICE file, adds validation to GitHub CI ([#3051](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3051)) - [Doc] Add current plugin persistence implementation readme ([#3081](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3081)) +- Correct copyright date range of NOTICE file and notice generator ([#3308](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3308)) ### 🛠 Maintenance diff --git a/NOTICE.txt b/NOTICE.txt index 5962cc847b61..34da5d0a6f44 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -3,7 +3,7 @@ Copyright OpenSearch Contributors This product includes software, including Kibana source code, developed by Elasticsearch (http://www.elastic.co). -Copyright 2009-2018 Elasticsearch B.V. +Copyright 2009-2021 Elasticsearch B.V. This product includes software developed by The Apache Software Foundation (http://www.apache.org/) diff --git a/src/dev/notice/generate_notice_from_source.ts b/src/dev/notice/generate_notice_from_source.ts index 458d123c934e..0bfc2a978e0f 100644 --- a/src/dev/notice/generate_notice_from_source.ts +++ b/src/dev/notice/generate_notice_from_source.ts @@ -37,7 +37,7 @@ const NOTICE_TEXT = `Copyright OpenSearch Contributors This product includes software, including Kibana source code, developed by Elasticsearch (http://www.elastic.co). -Copyright 2009-2018 Elasticsearch B.V. +Copyright 2009-2021 Elasticsearch B.V. This product includes software developed by The Apache Software Foundation (http://www.apache.org/) From 64488202eb921ac2c61656ba83ae02987d831e69 Mon Sep 17 00:00:00 2001 From: Jovan Cvetkovic Date: Thu, 16 Feb 2023 04:44:30 +0100 Subject: [PATCH 8/9] Upgrade vega-tooltip to 0.30.0 to support custom tooltips #3358 (#3359) * Upgrade vega-tooltip to 0.30.0 to support custom tooltips #3358 Signed-off-by: Jovan Cvetkovic * Upgrade vega-tooltip to 0.30.0 to support custom tooltips #3358 Signed-off-by: Jovan Cvetkovic * Upgrade vega-tooltip to 0.30.0 to support custom tooltips #3358 Signed-off-by: Jovan Cvetkovic --------- Signed-off-by: Jovan Cvetkovic --- CHANGELOG.md | 1 + package.json | 2 +- yarn.lock | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1761d99f9033..f8a1c37f79f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -128,6 +128,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Remove `github-checks-reporter`, an unused dependency ([#3126](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3126)) - Upgrade `vega-lite` dependency to ^5.6.0 ([#3076](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3076)) - Bumps `re2` and `supertest` ([3018](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3018)) +- Bump `vega-tooltip` version from ^0.24.2 to ^0.30.0 ([#3358](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3358)) ### 🪛 Refactoring diff --git a/package.json b/package.json index 605bcb1865d6..d807fc1f58af 100644 --- a/package.json +++ b/package.json @@ -457,7 +457,7 @@ "vega-interpreter": "npm:@amoo-miki/vega-forced-csp-compliant-interpreter@1.0.6", "vega-lite": "^5.6.0", "vega-schema-url-parser": "^2.1.0", - "vega-tooltip": "^0.24.2", + "vega-tooltip": "^0.30.0", "vinyl-fs": "^3.0.3", "xml2js": "^0.4.22", "xmlbuilder": "13.0.2", diff --git a/yarn.lock b/yarn.lock index 0fe724b4feb5..19d3ec0e5ff6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17769,12 +17769,12 @@ vega-time@^2.0.3, vega-time@^2.1.0, vega-time@~2.1.0: d3-time "^3.0.0" vega-util "^1.15.2" -vega-tooltip@^0.24.2: - version "0.24.2" - resolved "https://registry.yarnpkg.com/vega-tooltip/-/vega-tooltip-0.24.2.tgz#da55a171a96ea48a8ff135a728622e1cbb1152af" - integrity sha512-b7IeYQl/piNVsMmTliOgTnwSOhBs67KqoZ9UzP1I3XpH7TKbSuc3YHA7b1CSxkRR0hHKdradby4UI8c9rdH74w== +vega-tooltip@^0.30.0: + version "0.30.0" + resolved "https://registry.yarnpkg.com/vega-tooltip/-/vega-tooltip-0.30.0.tgz#b8a48a0d1be717b7410cf75021aaaff75818b212" + integrity sha512-dBuqp1HgNvxrc3MU4KAE3gU7AiD0AvCiyu7IMwubI6TQa0l9A5c+B+ZLjDZP2Ool0J9eAaGgVhqjXWaUjUAfAQ== dependencies: - vega-util "^1.15.2" + vega-util "^1.17.0" vega-transforms@~4.10.0: version "4.10.0" From 7177fe337706c68edbbb2bf7374c7aa2c6ea3251 Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Thu, 16 Feb 2023 14:00:24 -0500 Subject: [PATCH 9/9] Added untriaged issue workflow. (#3427) * Created untriaged issue workflow. Signed-off-by: dblock * Remove existing untriaged workflow with wrong name Signed-off-by: Josh Romero --------- Signed-off-by: dblock Signed-off-by: Josh Romero Co-authored-by: Josh Romero --- ..._untriaged_label.yml => add-untriaged.yml} | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) rename .github/workflows/{add_untriaged_label.yml => add-untriaged.yml} (96%) diff --git a/.github/workflows/add_untriaged_label.yml b/.github/workflows/add-untriaged.yml similarity index 96% rename from .github/workflows/add_untriaged_label.yml rename to .github/workflows/add-untriaged.yml index 15b9a5565125..9dcc7020d245 100644 --- a/.github/workflows/add_untriaged_label.yml +++ b/.github/workflows/add-untriaged.yml @@ -1,19 +1,19 @@ -name: Apply 'untriaged' label during issue lifecycle - -on: - issues: - types: [opened, reopened, transferred] - -jobs: - apply-label: - runs-on: ubuntu-latest - steps: - - uses: actions/github-script@v6 - with: - script: | - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['untriaged'] - }) +name: Apply 'untriaged' label during issue lifecycle + +on: + issues: + types: [opened, reopened, transferred] + +jobs: + apply-label: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v6 + with: + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['untriaged'] + })