Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Kristen Tian <[email protected]>
  • Loading branch information
kristenTian committed Sep 14, 2022
1 parent 680fe55 commit 48ea2fe
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export async function callIndexAliasApi(
indices: string[] | string
): Promise<IndicesAliasResponse> {
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({
Expand Down Expand Up @@ -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({
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data_source/README.md
Original file line number Diff line number Diff line change
@@ -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.

---

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data_source/server/client/client_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 48ea2fe

Please sign in to comment.