From 1601f233721ba3c8298d42852832de599e772310 Mon Sep 17 00:00:00 2001 From: Su Date: Mon, 13 Mar 2023 15:52:24 -0700 Subject: [PATCH] removed non-related change Signed-off-by: Su --- .../saved_objects/saved_objects_client.ts | 10 +------ .../index_patterns/index_patterns.ts | 29 ++----------------- .../data/common/index_patterns/types.ts | 1 - .../public/finder/saved_object_finder.tsx | 2 +- 4 files changed, 4 insertions(+), 38 deletions(-) diff --git a/src/core/public/saved_objects/saved_objects_client.ts b/src/core/public/saved_objects/saved_objects_client.ts index 3fb34ad87ad1..d43b75b2171d 100644 --- a/src/core/public/saved_objects/saved_objects_client.ts +++ b/src/core/public/saved_objects/saved_objects_client.ts @@ -348,15 +348,7 @@ export class SavedObjectsClient { }; const renamedQuery = renameKeys(renameMap, options); - const query = pick.apply(null, [renamedQuery, ...Object.values(renameMap)]) as Record< - string, - any - >; - - // `has_references` is a structured object. we need to stringify it before sending - if (query.has_reference) { - query.has_reference = JSON.stringify(query.has_reference); - } + const query = pick.apply(null, [renamedQuery, ...Object.values(renameMap)]); const request: ReturnType = this.savedObjectsFetch(path, { method: 'GET', 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 688605821097..bd5bc48bba7c 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,6 @@ */ import { i18n } from '@osd/i18n'; -import { DataSourceAttributes } from 'src/plugins/data_source/common/data_sources'; import { SavedObjectsClientCommon } from '../..'; import { createIndexPatternCache } from '.'; import { IndexPattern } from './index_pattern'; @@ -54,7 +53,7 @@ import { FieldFormatsStartCommon } from '../../field_formats'; import { UI_SETTINGS, SavedObject } from '../../../common'; import { SavedObjectNotFound } from '../../../../opensearch_dashboards_utils/common'; import { IndexPatternMissingIndices } from '../lib'; -import { findByTitle, getIndexPatternTitle } from '../utils'; +import { findByTitle } from '../utils'; import { DuplicateIndexPatternError } from '../errors'; const indexPatternCache = createIndexPatternCache(); @@ -119,28 +118,8 @@ export class IndexPatternsService { fields: ['title'], perPage: 10000, }); - - this.savedObjectsCache = await Promise.all( - this.savedObjectsCache.map(async (obj) => { - if (obj.type === 'index-pattern') { - const result = { ...obj }; - result.attributes.title = await getIndexPatternTitle( - obj.attributes.title, - obj.references, - this.getDataSource - ); - return result; - } else { - return obj; - } - }) - ); } - getDataSource = async (id: string) => { - return await this.savedObjectsClient.get('data-source', id); - }; - /** * Get list of index pattern ids * @param refresh Force refresh of index pattern list @@ -578,11 +557,7 @@ export class IndexPatternsService { */ async createSavedObject(indexPattern: IndexPattern, override = false) { - const dupe = await findByTitle( - this.savedObjectsClient, - indexPattern.title, - indexPattern.dataSourceRef?.id - ); + const dupe = await findByTitle(this.savedObjectsClient, indexPattern.title); if (dupe) { if (override) { await this.delete(dupe.id); diff --git a/src/plugins/data/common/index_patterns/types.ts b/src/plugins/data/common/index_patterns/types.ts index 0460a7ac7a52..108a93a3725b 100644 --- a/src/plugins/data/common/index_patterns/types.ts +++ b/src/plugins/data/common/index_patterns/types.ts @@ -88,7 +88,6 @@ export interface SavedObjectsClientCommonFindArgs { perPage?: number; search?: string; searchFields?: string[]; - hasReference?: { type: string; id: string }; } export interface SavedObjectsClientCommon { diff --git a/src/plugins/saved_objects/public/finder/saved_object_finder.tsx b/src/plugins/saved_objects/public/finder/saved_object_finder.tsx index 0ad623721f62..b0b1409bf8b7 100644 --- a/src/plugins/saved_objects/public/finder/saved_object_finder.tsx +++ b/src/plugins/saved_objects/public/finder/saved_object_finder.tsx @@ -61,7 +61,7 @@ import { } from 'src/core/public'; import { DataSourceAttributes } from 'src/plugins/data_source/common/data_sources'; -import { getIndexPatternTitle } from '../../../data/common'; +import { getIndexPatternTitle } from '../../../data/common/index_patterns/utils'; import { LISTING_LIMIT_SETTING } from '../../common'; export interface SavedObjectMetaData {