From 0991e2203db85369f38795fd9773a57bc4f862b8 Mon Sep 17 00:00:00 2001 From: Kristen Tian Date: Tue, 13 Sep 2022 22:05:51 -0700 Subject: [PATCH] Address comments Signed-off-by: Kristen Tian --- .../common/index_patterns/index_patterns/index_patterns.ts | 4 ++-- .../server/index_patterns/fetcher/lib/opensearch_api.ts | 6 ++++++ src/plugins/data_source/README.md | 4 ++-- src/plugins/data_source/server/client/client_pool.ts | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts index 05c34ea817e4..d05a5357e007 100644 --- a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts +++ b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts @@ -29,7 +29,7 @@ */ import { i18n } from '@osd/i18n'; -import _ from 'lodash'; +import { isEmpty } from 'lodash'; import { SavedObjectsClientCommon } from '../..'; import { createIndexPatternCache } from '.'; import { IndexPattern } from './index_pattern'; @@ -364,7 +364,7 @@ export class IndexPatternsService { const parsedTypeMeta = typeMeta ? JSON.parse(typeMeta) : undefined; const parsedFieldFormatMap = fieldFormatMap ? JSON.parse(fieldFormatMap) : {}; const parsedFields: FieldSpec[] = fields ? JSON.parse(fields) : []; - const dataSourceRef = !_.isEmpty(references) ? references[0] : undefined; + const dataSourceRef = !isEmpty(references) ? references[0] : undefined; this.addFormatsToFields(parsedFields, parsedFieldFormatMap); return { diff --git a/src/plugins/data/server/index_patterns/fetcher/lib/opensearch_api.ts b/src/plugins/data/server/index_patterns/fetcher/lib/opensearch_api.ts index 4400925e4dd4..5fcbb01ce07a 100644 --- a/src/plugins/data/server/index_patterns/fetcher/lib/opensearch_api.ts +++ b/src/plugins/data/server/index_patterns/fetcher/lib/opensearch_api.ts @@ -61,6 +61,9 @@ export async function callIndexAliasApi( indices: string[] | string ): Promise { try { + // This approach of identify between OpenSearchClient vs LegacyAPICaller + // will be deprecated after support data client with legacy client + // https://github.com/opensearch-project/OpenSearch-Dashboards/issues/2133 if ('transport' in callCluster) { return ( await callCluster.indices.getAlias({ @@ -99,6 +102,9 @@ export async function callFieldCapsApi( fieldCapsOptions: { allowNoIndices: boolean } = { allowNoIndices: false } ) { try { + // This approach of identify between OpenSearchClient vs LegacyAPICaller + // will be deprecated after support data client with legacy client + // https://github.com/opensearch-project/OpenSearch-Dashboards/issues/2133 if ('transport' in callCluster) { return ( await callCluster.fieldCaps({ diff --git a/src/plugins/data_source/README.md b/src/plugins/data_source/README.md index 7ccdeb62b7c4..53a96aa2146b 100755 --- a/src/plugins/data_source/README.md +++ b/src/plugins/data_source/README.md @@ -1,8 +1,8 @@ # data_source -A OpenSearch Dashboards plugin +An OpenSearch Dashboards plugin -This plugin introduce OpenSearch data source into OpenSearch Dashboards, and provides related functions to connect to OpenSearch data sources. +This plugin introduces OpenSearch data source into OpenSearch Dashboards, and provides related functions to connect to OpenSearch data sources. --- diff --git a/src/plugins/data_source/server/client/client_pool.ts b/src/plugins/data_source/server/client/client_pool.ts index fe6f20e51ae4..be1957bc769e 100644 --- a/src/plugins/data_source/server/client/client_pool.ts +++ b/src/plugins/data_source/server/client/client_pool.ts @@ -70,7 +70,7 @@ export class OpenSearchClientPool { if (this.isClosed) { return; } - this.isClosed = true; await Promise.all(this.cache!.values().map((client) => client.close())); + this.isClosed = true; } }