From 4c0f26b6a244ef51f3a49754cdf7a3185eeb9308 Mon Sep 17 00:00:00 2001 From: Alexey Antonov Date: Fri, 8 May 2020 19:01:48 +0300 Subject: [PATCH] [7.x] [Data plugin] cleanup - remove unused getRoutes / routes from indexPattern object (#65683) (#65772) * [Data plugin] cleanup - remove unused getRoutes / routes from indexPattern object (#65683) * [Data plugin] cleanup - remove unused getRoutes / routes from indexPattern object * Update index.ts * fix merge conflict --- ...plugin-plugins-data-public.indexpattern.md | 1 - ...plugins-data-public.indexpattern.routes.md | 17 ------- ...lugin-plugins-data-public.indexpatterns.md | 1 - src/plugins/data/public/index.ts | 3 -- .../data/public/index_patterns/index.ts | 1 - .../index_patterns/index_pattern.tsx | 9 +--- .../data/public/index_patterns/utils.ts | 10 ---- src/plugins/data/public/public.api.md | 50 ++++++++----------- src/test_utils/public/stub_index_pattern.js | 1 - 9 files changed, 22 insertions(+), 71 deletions(-) delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.routes.md diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md index 7cd7eb222fadd..589069e63e7c9 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md @@ -29,7 +29,6 @@ export declare class IndexPattern implements IIndexPattern | [id](./kibana-plugin-plugins-data-public.indexpattern.id.md) | | string | | | [intervalName](./kibana-plugin-plugins-data-public.indexpattern.intervalname.md) | | string | undefined | null | | | [metaFields](./kibana-plugin-plugins-data-public.indexpattern.metafields.md) | | string[] | | -| [routes](./kibana-plugin-plugins-data-public.indexpattern.routes.md) | | {
edit: string;
addField: string;
indexedFields: string;
scriptedFields: string;
sourceFilters: string;
} | | | [timeFieldName](./kibana-plugin-plugins-data-public.indexpattern.timefieldname.md) | | string | undefined | | | [title](./kibana-plugin-plugins-data-public.indexpattern.title.md) | | string | | | [type](./kibana-plugin-plugins-data-public.indexpattern.type.md) | | string | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.routes.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.routes.md deleted file mode 100644 index 81e7abd4f9609..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.routes.md +++ /dev/null @@ -1,17 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [routes](./kibana-plugin-plugins-data-public.indexpattern.routes.md) - -## IndexPattern.routes property - -Signature: - -```typescript -get routes(): { - edit: string; - addField: string; - indexedFields: string; - scriptedFields: string; - sourceFilters: string; - }; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterns.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterns.md index fa97666a61b93..39c8b0a700c8a 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterns.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterns.md @@ -18,7 +18,6 @@ indexPatterns: { validate: typeof validateIndexPattern; getFromSavedObject: typeof getFromSavedObject; flattenHitWrapper: typeof flattenHitWrapper; - getRoutes: typeof getRoutes; formatHitProvider: typeof formatHitProvider; } ``` diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index 2f7e50578b45f..42a2d0840a261 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -230,7 +230,6 @@ import { validateIndexPattern, getFromSavedObject, flattenHitWrapper, - getRoutes, formatHitProvider, } from './index_patterns'; @@ -246,8 +245,6 @@ export const indexPatterns = { validate: validateIndexPattern, getFromSavedObject, flattenHitWrapper, - // TODO: exported only in stub_index_pattern test. Move into data plugin and remove export. - getRoutes, formatHitProvider, }; diff --git a/src/plugins/data/public/index_patterns/index.ts b/src/plugins/data/public/index_patterns/index.ts index e05db0e4d4cec..58c2cae1de0f3 100644 --- a/src/plugins/data/public/index_patterns/index.ts +++ b/src/plugins/data/public/index_patterns/index.ts @@ -26,7 +26,6 @@ export { getFromSavedObject, isDefault, } from './lib'; -export { getRoutes } from './utils'; export { flattenHitWrapper, formatHitProvider } from './index_patterns'; export { getIndexPatternFieldListCreator, Field, IIndexPatternFieldList } from './fields'; diff --git a/src/plugins/data/public/index_patterns/index_patterns/index_pattern.tsx b/src/plugins/data/public/index_patterns/index_patterns/index_pattern.tsx index 42f007d9ce2e6..a370718aae3fa 100644 --- a/src/plugins/data/public/index_patterns/index_patterns/index_pattern.tsx +++ b/src/plugins/data/public/index_patterns/index_patterns/index_pattern.tsx @@ -35,7 +35,7 @@ import { toMountPoint } from '../../../../kibana_react/public'; import { ES_FIELD_TYPES, KBN_FIELD_TYPES, IIndexPattern, IFieldType } from '../../../common'; -import { findByTitle, getRoutes } from '../utils'; +import { findByTitle } from '../utils'; import { IndexPatternMissingIndices } from '../lib'; import { Field, IIndexPatternFieldList, getIndexPatternFieldListCreator } from '../fields'; import { createFieldsFetcher } from './_fields_fetcher'; @@ -215,8 +215,7 @@ export class IndexPattern implements IIndexPattern { // 2019-12-01 The usage of kbnUrl had to be removed due to the transition to NP. // It's now temporarily replaced by a simple replace of the single argument used by all URLs. // Once kbnUrl is migrated to NP, this can be updated. - const editUrlTemplate = getRoutes().edit; - const editUrl = '/app/kibana#' + editUrlTemplate.replace('{{id}}', this.id!); + const editUrl = `/app/kibana#/management/kibana/index_patterns/${this.id! || ''}`; const { toasts } = getNotifications(); @@ -243,10 +242,6 @@ export class IndexPattern implements IIndexPattern { return this.indexFields(forceFieldRefresh); } - public get routes() { - return getRoutes(); - } - getComputedFields() { const scriptFields: any = {}; if (!this.fields) { diff --git a/src/plugins/data/public/index_patterns/utils.ts b/src/plugins/data/public/index_patterns/utils.ts index 0ecc87f3080fd..c3f9af62f8c0e 100644 --- a/src/plugins/data/public/index_patterns/utils.ts +++ b/src/plugins/data/public/index_patterns/utils.ts @@ -48,13 +48,3 @@ export async function findByTitle( (obj: SimpleSavedObject) => obj.get('title').toLowerCase() === title.toLowerCase() ); } - -export function getRoutes() { - return { - edit: '/management/kibana/index_patterns/{{id}}', - addField: '/management/kibana/index_patterns/{{id}}/create-field', - indexedFields: '/management/kibana/index_patterns/{{id}}?_a=(tab:indexedFields)', - scriptedFields: '/management/kibana/index_patterns/{{id}}?_a=(tab:scriptedFields)', - sourceFilters: '/management/kibana/index_patterns/{{id}}?_a=(tab:sourceFilters)', - }; -} diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index f518bd926cc6c..11d0c6c5dcf6f 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -922,14 +922,6 @@ export class IndexPattern implements IIndexPattern { // (undocumented) removeScriptedField(field: IFieldType): Promise; // (undocumented) - get routes(): { - edit: string; - addField: string; - indexedFields: string; - scriptedFields: string; - sourceFilters: string; - }; - // (undocumented) save(saveAttempts?: number): Promise; // (undocumented) timeFieldName: string | undefined; @@ -1031,7 +1023,6 @@ export const indexPatterns: { validate: typeof validateIndexPattern; getFromSavedObject: typeof getFromSavedObject; flattenHitWrapper: typeof flattenHitWrapper; - getRoutes: typeof getRoutes; formatHitProvider: typeof formatHitProvider; }; @@ -1822,27 +1813,26 @@ export type TSearchStrategyProvider = (context: ISearc // src/plugins/data/public/index.ts:179:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:179:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:179:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "getFromSavedObject" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "getRoutes" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:379:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:380:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:389:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:390:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:391:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:395:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:396:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:399:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:400:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:403:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:237:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:237:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:237:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:237:27 - (ae-forgotten-export) The symbol "getFromSavedObject" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:237:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:237:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:374:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:374:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:374:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:374:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:376:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:377:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:386:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:387:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:388:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:392:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:393:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:396:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:397:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:400:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts // src/plugins/data/public/query/state_sync/connect_to_query_state.ts:33:33 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts // src/plugins/data/public/query/state_sync/connect_to_query_state.ts:37:1 - (ae-forgotten-export) The symbol "QueryStateChange" needs to be exported by the entry point index.d.ts // src/plugins/data/public/types.ts:52:5 - (ae-forgotten-export) The symbol "createFiltersFromValueClickAction" needs to be exported by the entry point index.d.ts diff --git a/src/test_utils/public/stub_index_pattern.js b/src/test_utils/public/stub_index_pattern.js index e4bb4d88c925b..7302fe9c00421 100644 --- a/src/test_utils/public/stub_index_pattern.js +++ b/src/test_utils/public/stub_index_pattern.js @@ -65,7 +65,6 @@ export default function StubIndexPattern(pattern, getConfig, timeField, fields, this.getSourceFiltering = sinon.stub(); this.metaFields = ['_id', '_type', '_source']; this.fieldFormatMap = {}; - this.routes = indexPatterns.getRoutes(); this.getIndex = () => pattern; this.getComputedFields = IndexPattern.prototype.getComputedFields.bind(this);