From dc273d7e3d53537fa3b39811642d7c85c57543c9 Mon Sep 17 00:00:00 2001 From: Mihir Soni Date: Wed, 10 Mar 2021 07:20:01 +0000 Subject: [PATCH 1/5] [Rename] src/fixtures directory --- src/fixtures/config_upgrade_from_4.0.0.json | 2 +- ...onfig_upgrade_from_4.0.0_to_4.0.1-snapshot.json | 4 ++-- .../config_upgrade_from_4.0.0_to_4.0.1.json | 4 ++-- src/fixtures/logstash_fields.js | 14 +++++++------- src/fixtures/stubbed_logstash_index_pattern.js | 10 +++++----- .../telemetry_collectors/working_collector.ts | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/fixtures/config_upgrade_from_4.0.0.json b/src/fixtures/config_upgrade_from_4.0.0.json index 522de78648c9..23075676600d 100644 --- a/src/fixtures/config_upgrade_from_4.0.0.json +++ b/src/fixtures/config_upgrade_from_4.0.0.json @@ -11,7 +11,7 @@ "max_score": 1, "hits": [ { - "_index": ".kibana", + "_index": ".opensearch-dashboards", "_type": "config", "_id": "4.0.0", "_score": 1, diff --git a/src/fixtures/config_upgrade_from_4.0.0_to_4.0.1-snapshot.json b/src/fixtures/config_upgrade_from_4.0.0_to_4.0.1-snapshot.json index 8767232dcdc1..7ccc17d4cb60 100644 --- a/src/fixtures/config_upgrade_from_4.0.0_to_4.0.1-snapshot.json +++ b/src/fixtures/config_upgrade_from_4.0.0_to_4.0.1-snapshot.json @@ -11,7 +11,7 @@ "max_score": 1, "hits": [ { - "_index": ".kibana", + "_index": ".opensearch-dashboards", "_type": "config", "_id": "4.0.1-SNAPSHOT", "_score": 1, @@ -21,7 +21,7 @@ } }, { - "_index": ".kibana", + "_index": ".opensearch-dashboards", "_type": "config", "_id": "4.0.0", "_score": 1, diff --git a/src/fixtures/config_upgrade_from_4.0.0_to_4.0.1.json b/src/fixtures/config_upgrade_from_4.0.0_to_4.0.1.json index 57b486491b39..4f4d2b71e8db 100644 --- a/src/fixtures/config_upgrade_from_4.0.0_to_4.0.1.json +++ b/src/fixtures/config_upgrade_from_4.0.0_to_4.0.1.json @@ -11,7 +11,7 @@ "max_score": 1, "hits": [ { - "_index": ".kibana", + "_index": ".opensearch-dashboards", "_type": "config", "_id": "4.0.1", "_score": 1, @@ -21,7 +21,7 @@ } }, { - "_index": ".kibana", + "_index": ".opensearch-dashboards", "_type": "config", "_id": "4.0.0", "_score": 1, diff --git a/src/fixtures/logstash_fields.js b/src/fixtures/logstash_fields.js index a824a94dbd93..4f58d2a2c415 100644 --- a/src/fixtures/logstash_fields.js +++ b/src/fixtures/logstash_fields.js @@ -17,13 +17,13 @@ * under the License. */ -import { shouldReadFieldFromDocValues, castEsToKbnFieldTypeName } from '../plugins/data/server'; +import { shouldReadFieldFromDocValues, castOpenSearchToOsdFieldTypeName } from '../plugins/data/server'; function stubbedLogstashFields() { return [ // |aggregatable // | |searchable - // name esType | | |metadata | subType + // name opensearchType | | |metadata | subType ['bytes', 'long', true, true, { count: 10 }], ['ssl', 'boolean', true, true, { count: 20 }], ['@timestamp', 'date', true, true, { count: 30 }], @@ -53,7 +53,7 @@ function stubbedLogstashFields() { ['script date', 'date', true, false, { script: '1234', lang: 'painless' }], ['script murmur3', 'murmur3', true, false, { script: '1234' }], ].map(function (row) { - const [name, esType, aggregatable, searchable, metadata = {}, subType = undefined] = row; + const [name, opensearchType, aggregatable, searchable, metadata = {}, subType = undefined] = row; const { count = 0, @@ -62,15 +62,15 @@ function stubbedLogstashFields() { scripted = !!script, } = metadata; - // the conflict type is actually a kbnFieldType, we + // the conflict type is actually a osdFieldType, we // don't have any other way to represent it here - const type = esType === 'conflict' ? esType : castEsToKbnFieldTypeName(esType); + const type = opensearchType === 'conflict' ? opensearchType : castOpenSearchToOsdFieldTypeName(opensearchType); return { name, type, - esTypes: [esType], - readFromDocValues: shouldReadFieldFromDocValues(aggregatable, esType), + opensearchTypes: [opensearchType], + readFromDocValues: shouldReadFieldFromDocValues(aggregatable, opensearchType), aggregatable, searchable, count, diff --git a/src/fixtures/stubbed_logstash_index_pattern.js b/src/fixtures/stubbed_logstash_index_pattern.js index 5d6d254b9a00..0d32fe25fd56 100644 --- a/src/fixtures/stubbed_logstash_index_pattern.js +++ b/src/fixtures/stubbed_logstash_index_pattern.js @@ -19,7 +19,7 @@ import stubbedLogstashFields from 'fixtures/logstash_fields'; -import { getKbnFieldType } from '../plugins/data/common'; +import { getOsdFieldType } from '../plugins/data/common'; import { getStubIndexPattern } from '../plugins/data/public/test_utils'; import { uiSettingsServiceMock } from '../core/public/ui_settings/ui_settings_service.mock'; @@ -32,16 +32,16 @@ export default function stubbedLogstashIndexPatternService() { const mockLogstashFields = stubbedLogstashFields(); const fields = mockLogstashFields.map(function (field) { - const kbnType = getKbnFieldType(field.type); + const osdType = getOsdFieldType(field.type); - if (!kbnType || kbnType.name === 'unknown') { + if (!osdType || osdType.name === 'unknown') { throw new TypeError(`unknown type ${field.type}`); } return { ...field, - sortable: 'sortable' in field ? !!field.sortable : kbnType.sortable, - filterable: 'filterable' in field ? !!field.filterable : kbnType.filterable, + sortable: 'sortable' in field ? !!field.sortable : osdType.sortable, + filterable: 'filterable' in field ? !!field.filterable : osdType.filterable, displayName: field.name, }; }); diff --git a/src/fixtures/telemetry_collectors/working_collector.ts b/src/fixtures/telemetry_collectors/working_collector.ts index 0a3bf49638a7..dd57fa144397 100644 --- a/src/fixtures/telemetry_collectors/working_collector.ts +++ b/src/fixtures/telemetry_collectors/working_collector.ts @@ -47,7 +47,7 @@ export const myCollector = makeUsageCollector({ isReady: () => true, fetch() { const testString = '123'; - // query ES and get some data + // query OpenSearch and get some data // summarize the data into a model // return the modeled object that includes whatever you want to track From ccc21d3416b8413115b0493e055c4f7d17bbe99c Mon Sep 17 00:00:00 2001 From: Mihir Soni Date: Wed, 10 Mar 2021 07:22:31 +0000 Subject: [PATCH 2/5] [Rename] src/setup_node_env directory --- src/setup_node_env/index.js | 2 +- src/setup_node_env/node_version_validator.js | 6 +++--- src/setup_node_env/root/index.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/setup_node_env/index.js b/src/setup_node_env/index.js index 55539c56a364..7a2cc01b0ec4 100644 --- a/src/setup_node_env/index.js +++ b/src/setup_node_env/index.js @@ -18,4 +18,4 @@ */ require('./no_transpilation'); -require('@kbn/optimizer').registerNodeAutoTranspilation(); +require('@osd/optimizer').registerNodeAutoTranspilation(); diff --git a/src/setup_node_env/node_version_validator.js b/src/setup_node_env/node_version_validator.js index 84d4159c1f78..a1bd9f3b7c25 100644 --- a/src/setup_node_env/node_version_validator.js +++ b/src/setup_node_env/node_version_validator.js @@ -19,17 +19,17 @@ var pkg = require('../../package.json'); -// Note: This is written in ES5 so we can run this before anything else +// Note: This is written in OpenSearch5 so we can run this before anything else // and gives support for older NodeJS versions var currentVersion = (process && process.version) || null; var rawRequiredVersion = (pkg && pkg.engines && pkg.engines.node) || null; var requiredVersion = rawRequiredVersion ? 'v' + rawRequiredVersion : rawRequiredVersion; var isVersionValid = !!currentVersion && !!requiredVersion && currentVersion === requiredVersion; -// Validates current the NodeJS version compatibility when Kibana starts. +// Validates current the NodeJS version compatibility when OpenSearch Dashboards starts. if (!isVersionValid) { var errorMessage = - 'Kibana does not support the current Node.js version ' + + 'OpenSearch Dashboards does not support the current Node.js version ' + currentVersion + '. Please use Node.js ' + requiredVersion + diff --git a/src/setup_node_env/root/index.js b/src/setup_node_env/root/index.js index 1d752f8078af..300c6a8734ea 100644 --- a/src/setup_node_env/root/index.js +++ b/src/setup_node_env/root/index.js @@ -23,6 +23,6 @@ var uid = process.getuid && process.getuid(); var isRoot = require('./is_root')(uid); if (isRoot && !force) { - console.error('Kibana should not be run as root. Use --allow-root to continue.'); + console.error('OpenSearch Dashboards should not be run as root. Use --allow-root to continue.'); process.exit(1); } From baf4505d05efbadbffd815d835e2acd0611cd8cd Mon Sep 17 00:00:00 2001 From: Mihir Soni Date: Wed, 10 Mar 2021 07:23:52 +0000 Subject: [PATCH 3/5] [Rename] src/test_utils directory --- src/test_utils/__tests__/get_url.js | 2 +- src/test_utils/get_url.js | 4 ++-- src/test_utils/public/enzyme_helpers.tsx | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test_utils/__tests__/get_url.js b/src/test_utils/__tests__/get_url.js index c9dd4d5a6d61..e1b7d9aa366f 100644 --- a/src/test_utils/__tests__/get_url.js +++ b/src/test_utils/__tests__/get_url.js @@ -17,7 +17,7 @@ * under the License. */ -import expect from '@kbn/expect'; +import expect from '@osd/expect'; import getUrl from '../get_url'; describe('getUrl', function () { diff --git a/src/test_utils/get_url.js b/src/test_utils/get_url.js index 182cb8e6e118..c6e3a02344d4 100644 --- a/src/test_utils/get_url.js +++ b/src/test_utils/get_url.js @@ -28,12 +28,12 @@ import url from 'url'; * protocol: 'http', * hostname: 'localhost', * port: 9220, - * auth: kibanaTestUser.username + ':' + kibanaTestUser.password + * auth: opensearchDashboardsTestUser.username + ':' + opensearchDashboardsTestUser.password * } * @param {object} app The params to append * example: * { - * pathname: 'app/kibana', + * pathname: 'app/opensearch-dashboards', * hash: '/discover' * } * @return {string} diff --git a/src/test_utils/public/enzyme_helpers.tsx b/src/test_utils/public/enzyme_helpers.tsx index ce4e7c729873..df4373852094 100644 --- a/src/test_utils/public/enzyme_helpers.tsx +++ b/src/test_utils/public/enzyme_helpers.tsx @@ -18,13 +18,13 @@ */ /** - * Components using the @kbn/i18n module require access to the intl context. + * Components using the @osd/i18n module require access to the intl context. * This is not available when mounting single components in Enzyme. * These helper functions aim to address that and wrap a valid, * intl context around them. */ -import { I18nProvider, InjectedIntl, intlShape, __IntlProvider } from '@kbn/i18n/react'; +import { I18nProvider, InjectedIntl, intlShape, __IntlProvider } from '@osd/i18n/react'; import { mount, ReactWrapper, render, shallow } from 'enzyme'; import React, { ReactElement, ValidationMap } from 'react'; @@ -52,7 +52,7 @@ function getOptions(context = {}, childContextTypes: ValidationMap = {}, pr } /** - * When using @kbn/i18n `injectI18n` on components, props.intl is required. + * When using @osd/i18n `injectI18n` on components, props.intl is required. */ function nodeWithIntlProp(node: ReactElement): ReactElement { return React.cloneElement(node, { intl }); From 4ca471269a5e55de6f5ea303de873e8d1144b6c5 Mon Sep 17 00:00:00 2001 From: Mihir Soni Date: Wed, 10 Mar 2021 07:31:50 +0000 Subject: [PATCH 4/5] [Rename] src/apm.js --- src/apm.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/apm.js b/src/apm.js index bde37fa006c6..6dbe7633316a 100644 --- a/src/apm.js +++ b/src/apm.js @@ -19,18 +19,18 @@ const { join } = require('path'); const { name, build } = require('../package.json'); -const { loadConfiguration } = require('@kbn/apm-config-loader'); +const { loadConfiguration } = require('@osd/apm-config-loader'); const ROOT_DIR = join(__dirname, '..'); let apmConfig; /** - * Flag to disable APM RUM support on all kibana builds by default + * Flag to disable APM RUM support on all opensearch-dashboards builds by default */ const isKibanaDistributable = Boolean(build && build.distributable === true); module.exports = function (serviceName = name) { - if (process.env.kbnWorkerType === 'optmzr') { + if (process.env.osdWorkerType === 'optmzr') { return; } @@ -55,7 +55,7 @@ module.exports = function (serviceName = name) { }; module.exports.getConfig = (serviceName) => { - // integration test runner starts a kibana server that import the module without initializing APM. + // integration test runner starts a opensearch-dashboards server that import the module without initializing APM. // so we need to check initialization of the config. // note that we can't just load the configuration during this module's import // because jest IT are ran with `--config path-to-jest-config.js` which conflicts with the CLI's `config` arg From 767e3284559913ec65b31fd5d947d18b556be257 Mon Sep 17 00:00:00 2001 From: Mihir Soni Date: Thu, 11 Mar 2021 02:27:33 +0000 Subject: [PATCH 5/5] [Rename] addressed review feedbacks --- src/apm.js | 4 ++-- src/setup_node_env/node_version_validator.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/apm.js b/src/apm.js index 6dbe7633316a..1e33f1f12ba6 100644 --- a/src/apm.js +++ b/src/apm.js @@ -27,14 +27,14 @@ let apmConfig; /** * Flag to disable APM RUM support on all opensearch-dashboards builds by default */ -const isKibanaDistributable = Boolean(build && build.distributable === true); +const isOpenSearchDashboardsDistributable = Boolean(build && build.distributable === true); module.exports = function (serviceName = name) { if (process.env.osdWorkerType === 'optmzr') { return; } - apmConfig = loadConfiguration(process.argv, ROOT_DIR, isKibanaDistributable); + apmConfig = loadConfiguration(process.argv, ROOT_DIR, isOpenSearchDashboardsDistributable); const conf = apmConfig.getConfig(serviceName); const apm = require('elastic-apm-node'); diff --git a/src/setup_node_env/node_version_validator.js b/src/setup_node_env/node_version_validator.js index a1bd9f3b7c25..1fe9a9a3dc4c 100644 --- a/src/setup_node_env/node_version_validator.js +++ b/src/setup_node_env/node_version_validator.js @@ -19,7 +19,7 @@ var pkg = require('../../package.json'); -// Note: This is written in OpenSearch5 so we can run this before anything else +// Note: This is written in ES5 so we can run this before anything else // and gives support for older NodeJS versions var currentVersion = (process && process.version) || null; var rawRequiredVersion = (pkg && pkg.engines && pkg.engines.node) || null;