mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[data views] remove ensureDefaultDataView and unused deprecated types (#133391)
* remove deprecated methods * remove deprecated methods * remove kibanaReact from kibana.json * remove dataView.flattenHit * revert flattenHit changes
This commit is contained in:
parent
a47da23a7d
commit
7f2fcee1da
17 changed files with 7 additions and 151 deletions
|
@ -134,7 +134,6 @@ export {
|
|||
fieldList,
|
||||
DataViewField,
|
||||
DataViewType,
|
||||
IndexPatternsService,
|
||||
DataViewsService,
|
||||
DataView,
|
||||
DuplicateDataViewError,
|
||||
|
|
|
@ -58,8 +58,6 @@ import {
|
|||
validateDataView,
|
||||
} from './data_views';
|
||||
|
||||
export type { IndexPatternsService } from './data_views';
|
||||
|
||||
// Index patterns namespace:
|
||||
export const indexPatterns = {
|
||||
ILLEGAL_CHARACTERS_KEY,
|
||||
|
|
|
@ -45,8 +45,7 @@ export {
|
|||
ES_FIELD_TYPES,
|
||||
KBN_FIELD_TYPES,
|
||||
UI_SETTINGS,
|
||||
IndexPatternsService,
|
||||
IndexPatternsService as IndexPatternsCommonService,
|
||||
DataViewsService as DataViewsCommonService,
|
||||
DataView,
|
||||
} from '../common';
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
/* eslint-disable max-classes-per-file */
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import { castEsToKbnFieldTypeName } from '@kbn/field-types';
|
||||
|
@ -19,7 +17,6 @@ import { SavedObjectsClientCommon } from '../types';
|
|||
import { createDataViewCache } from '.';
|
||||
import type { RuntimeField, RuntimeFieldSpec, RuntimeType } from '../types';
|
||||
import { DataView } from './data_view';
|
||||
import { createEnsureDefaultDataView, EnsureDefaultDataView } from './ensure_default_data_view';
|
||||
import {
|
||||
OnNotification,
|
||||
OnError,
|
||||
|
@ -149,11 +146,6 @@ export interface DataViewsServicePublicMethods {
|
|||
* @param indexPatternId - Id of the data view to delete.
|
||||
*/
|
||||
delete: (indexPatternId: string) => Promise<{}>;
|
||||
/**
|
||||
* @deprecated Use `getDefaultDataView` instead (when loading data view) and handle
|
||||
* 'no data view' case in api consumer code - no more auto redirect
|
||||
*/
|
||||
ensureDefaultDataView: EnsureDefaultDataView;
|
||||
/**
|
||||
* Takes field array and field attributes and returns field map by name.
|
||||
* @param fields - Array of fieldspecs
|
||||
|
@ -283,12 +275,6 @@ export class DataViewsService {
|
|||
*/
|
||||
public getCanSave: () => Promise<boolean>;
|
||||
|
||||
/**
|
||||
* @deprecated Use `getDefaultDataView` instead (when loading data view) and handle
|
||||
* 'no data view' case in api consumer code - no more auto redirect
|
||||
*/
|
||||
ensureDefaultDataView: EnsureDefaultDataView;
|
||||
|
||||
/**
|
||||
* DataViewsService constructor
|
||||
* @param deps Service dependencies
|
||||
|
@ -301,7 +287,6 @@ export class DataViewsService {
|
|||
fieldFormats,
|
||||
onNotification,
|
||||
onError,
|
||||
onRedirectNoIndexPattern = () => {},
|
||||
getCanSave = () => Promise.resolve(false),
|
||||
} = deps;
|
||||
this.apiClient = apiClient;
|
||||
|
@ -310,7 +295,6 @@ export class DataViewsService {
|
|||
this.fieldFormats = fieldFormats;
|
||||
this.onNotification = onNotification;
|
||||
this.onError = onError;
|
||||
this.ensureDefaultDataView = createEnsureDefaultDataView(onRedirectNoIndexPattern);
|
||||
this.getCanSave = getCanSave;
|
||||
|
||||
this.dataViewCache = createDataViewCache();
|
||||
|
@ -986,11 +970,6 @@ export class DataViewsService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use DataViewsService. All index pattern interfaces were renamed.
|
||||
*/
|
||||
export class IndexPatternsService extends DataViewsService {}
|
||||
|
||||
/**
|
||||
* Data views service interface
|
||||
* @public
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { DataViewsContract } from './data_views';
|
||||
/**
|
||||
* Checks whether a default data view is set and exists and defines
|
||||
* one otherwise.
|
||||
* @public
|
||||
*/
|
||||
export type EnsureDefaultDataView = () => Promise<void> | void;
|
||||
|
||||
/**
|
||||
* Checks whether a default data view is set and exists and defines
|
||||
* one otherwise.
|
||||
* @public
|
||||
* @param onRedirectNoDefaultView - Callback to redirect to a new data view
|
||||
* @return returned promise resolves when the default data view is set
|
||||
*/
|
||||
export const createEnsureDefaultDataView = (onRedirectNoDefaultView: EnsureDefaultDataView) => {
|
||||
return async function ensureDefaultDataView(this: DataViewsContract) {
|
||||
if (!(await this.getDefaultDataView())) {
|
||||
return onRedirectNoDefaultView();
|
||||
}
|
||||
};
|
||||
};
|
|
@ -56,8 +56,7 @@ export type {
|
|||
export { DataViewType } from './types';
|
||||
|
||||
export type { DataViewsContract, DataViewsServiceDeps } from './data_views';
|
||||
export type { EnsureDefaultDataView } from './data_views/ensure_default_data_view';
|
||||
export { IndexPatternsService, DataViewsService } from './data_views';
|
||||
export { DataViewsService } from './data_views';
|
||||
export type {
|
||||
DataViewListItem,
|
||||
DataViewsServicePublicMethods,
|
||||
|
|
|
@ -22,9 +22,3 @@ export class DataViewMissingIndices extends KbnError {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use DataViewMissingIndices. All index pattern interfaces were renamed.
|
||||
*/
|
||||
|
||||
export class IndexPatternMissingIndices extends DataViewMissingIndices {}
|
||||
|
|
|
@ -352,14 +352,6 @@ export enum DataViewType {
|
|||
ROLLUP = 'rollup',
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use DataViewType. All index pattern interfaces were renamed.
|
||||
*/
|
||||
export enum IndexPatternType {
|
||||
DEFAULT = DataViewType.DEFAULT,
|
||||
ROLLUP = DataViewType.ROLLUP,
|
||||
}
|
||||
|
||||
export type FieldSpecConflictDescriptions = Record<string, string[]>;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"requiredPlugins": ["fieldFormats", "expressions"],
|
||||
"optionalPlugins": ["usageCollection"],
|
||||
"extraPublicDirs": ["common"],
|
||||
"requiredBundles": ["kibanaUtils", "kibanaReact"],
|
||||
"requiredBundles": ["kibanaUtils"],
|
||||
"owner": {
|
||||
"name": "App Services",
|
||||
"githubTeam": "kibana-app-services"
|
||||
|
|
|
@ -7,5 +7,4 @@
|
|||
*/
|
||||
|
||||
export * from '../../common/data_views';
|
||||
export * from './redirect_no_index_pattern';
|
||||
export * from './data_views_api_client';
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { EuiCallOut } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import React from 'react';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import { toMountPoint } from '@kbn/kibana-react-plugin/public';
|
||||
|
||||
let bannerId: string;
|
||||
|
||||
export const onRedirectNoIndexPattern =
|
||||
(
|
||||
capabilities: CoreStart['application']['capabilities'],
|
||||
navigateToApp: CoreStart['application']['navigateToApp'],
|
||||
overlays: CoreStart['overlays'],
|
||||
theme: CoreStart['theme']
|
||||
) =>
|
||||
() => {
|
||||
const canManageIndexPatterns = capabilities.management.kibana.indexPatterns;
|
||||
const redirectTarget = canManageIndexPatterns ? '/management/kibana/dataViews' : '/home';
|
||||
let timeoutId: NodeJS.Timeout | undefined;
|
||||
|
||||
if (timeoutId) {
|
||||
clearTimeout(timeoutId);
|
||||
}
|
||||
|
||||
const bannerMessage = i18n.translate('dataViews.ensureDefaultIndexPattern.bannerLabel', {
|
||||
defaultMessage:
|
||||
'To visualize and explore data in Kibana, you must create an index pattern to retrieve data from Elasticsearch.',
|
||||
});
|
||||
|
||||
// Avoid being hostile to new users who don't have an index pattern setup yet
|
||||
// give them a friendly info message instead of a terse error message
|
||||
bannerId = overlays.banners.replace(
|
||||
bannerId,
|
||||
toMountPoint(<EuiCallOut color="warning" iconType="iInCircle" title={bannerMessage} />, {
|
||||
theme$: theme.theme$,
|
||||
})
|
||||
);
|
||||
|
||||
// hide the message after the user has had a chance to acknowledge it -- so it doesn't permanently stick around
|
||||
timeoutId = setTimeout(() => {
|
||||
overlays.banners.remove(bannerId);
|
||||
timeoutId = undefined;
|
||||
}, 15000);
|
||||
|
||||
if (redirectTarget === '/home') {
|
||||
navigateToApp('home');
|
||||
} else {
|
||||
navigateToApp('management', {
|
||||
path: `/kibana/indexPatterns?bannerMessage=${bannerMessage}`,
|
||||
});
|
||||
}
|
||||
|
||||
// return never-resolving promise to stop resolving and wait for the url change
|
||||
return new Promise<void>(() => {});
|
||||
};
|
|
@ -37,7 +37,7 @@ export type {
|
|||
DataViewsServicePublic,
|
||||
DataViewsServicePublicDeps,
|
||||
} from './data_views_service_public';
|
||||
export { IndexPatternsService, DataViewsApiClient, DataViewsService, DataView } from './data_views';
|
||||
export { DataViewsApiClient, DataViewsService, DataView } from './data_views';
|
||||
export type { DataViewListItem } from './data_views';
|
||||
export { UiSettingsPublicToCommon } from './ui_settings_wrapper';
|
||||
export { SavedObjectsClientPublicToCommon } from './saved_objects_client_wrapper';
|
||||
|
|
|
@ -16,7 +16,6 @@ import {
|
|||
} from './types';
|
||||
|
||||
import { DataViewsApiClient } from '.';
|
||||
import { onRedirectNoIndexPattern } from './data_views';
|
||||
import { SavedObjectsClientPublicToCommon } from './saved_objects_client_wrapper';
|
||||
|
||||
import { UiSettingsPublicToCommon } from './ui_settings_wrapper';
|
||||
|
@ -50,7 +49,7 @@ export class DataViewsPublicPlugin
|
|||
core: CoreStart,
|
||||
{ fieldFormats }: DataViewsPublicStartDependencies
|
||||
): DataViewsPublicPluginStart {
|
||||
const { uiSettings, http, notifications, savedObjects, theme, overlays, application } = core;
|
||||
const { uiSettings, http, notifications, savedObjects, application } = core;
|
||||
|
||||
const onNotifDebounced = debounceByKey(
|
||||
notifications.toasts.add.bind(notifications.toasts),
|
||||
|
@ -73,12 +72,6 @@ export class DataViewsPublicPlugin
|
|||
onError: (error, toastInputFields, key) => {
|
||||
onErrorDebounced(key)(error, toastInputFields);
|
||||
},
|
||||
onRedirectNoIndexPattern: onRedirectNoIndexPattern(
|
||||
application.capabilities,
|
||||
application.navigateToApp,
|
||||
overlays,
|
||||
theme
|
||||
),
|
||||
getCanSave: () => Promise.resolve(application.capabilities.indexPatterns.save === true),
|
||||
getCanSaveSync: () => application.capabilities.indexPatterns.save === true,
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { ElasticsearchClient, IScopedClusterClient } from '@kbn/core/server';
|
||||
import { IndexPatternsCommonService } from '@kbn/data-plugin/server';
|
||||
import { DataViewsCommonService } from '@kbn/data-plugin/server';
|
||||
import { CreateDocSourceResp, IndexSourceMappings, BodySettings } from '../../common/types';
|
||||
import { MAPS_NEW_VECTOR_LAYER_META_CREATED_BY } from '../../common/constants';
|
||||
|
||||
|
@ -21,7 +21,7 @@ export async function createDocSource(
|
|||
index: string,
|
||||
mappings: IndexSourceMappings,
|
||||
{ asCurrentUser }: IScopedClusterClient,
|
||||
indexPatternsService: IndexPatternsCommonService
|
||||
indexPatternsService: DataViewsCommonService
|
||||
): Promise<CreateDocSourceResp> {
|
||||
try {
|
||||
await createIndex(index, mappings, asCurrentUser);
|
||||
|
|
|
@ -2711,7 +2711,6 @@
|
|||
"dataViews.deprecations.scriptedFields.manualStepTwoMessage": "Mettez à jour les vues de données {numberOfIndexPatternsWithScriptedFields} qui ont des champs scriptés pour qu’elles utilisent des champs d’exécution. Dans la plupart des cas, pour migrer des scripts existants, vous devrez remplacer \"return <value>;\" par \"emit(<value>);\". Vues de données avec au moins un champ scripté : {allTitles}",
|
||||
"dataViews.deprecations.scriptedFieldsMessage": "Vous avez {numberOfIndexPatternsWithScriptedFields} vues de données ({titlesPreview}...) qui utilisent des champs scriptés. Les champs scriptés sont déclassés et seront supprimés à l’avenir. Utilisez plutôt des champs d’exécution.",
|
||||
"dataViews.deprecations.scriptedFieldsTitle": "Vues de données utilisant des champs scriptés trouvées",
|
||||
"dataViews.ensureDefaultIndexPattern.bannerLabel": "Pour visualiser et explorer des données dans Kibana, vous devez créer un modèle d'indexation afin d’extraire les données d'Elasticsearch.",
|
||||
"dataViews.fetchFieldErrorTitle": "Erreur lors de l’extraction des champs pour la vue de données {title} (ID : {id})",
|
||||
"dataViews.functions.dataViewLoad.help": "Charge une vue de données",
|
||||
"dataViews.functions.dataViewLoad.id.help": "ID de vue de données à charger",
|
||||
|
|
|
@ -2804,7 +2804,6 @@
|
|||
"dataViews.deprecations.scriptedFields.manualStepTwoMessage": "ランタイムフィールドを使用するには、スクリプト化されたフィールドがある{numberOfIndexPatternsWithScriptedFields}インデックスパターンを更新します。ほとんどの場合、既存のスクリプトを移行するには、「return <value>;」から「emit(<value>);」に変更する必要があります。1つ以上のスクリプト化されたフィールドがあるインデックスパターン:{allTitles}",
|
||||
"dataViews.deprecations.scriptedFieldsMessage": "スクリプト化されたフィールドを使用する{numberOfIndexPatternsWithScriptedFields}インデックスパターン({titlesPreview}...)があります。スクリプト化されたフィールドは廃止予定であり、今後は削除されます。ランタイムフィールドを使用してください。",
|
||||
"dataViews.deprecations.scriptedFieldsTitle": "スクリプト化されたフィールドを使用しているインデックスパターンが見つかりました",
|
||||
"dataViews.ensureDefaultIndexPattern.bannerLabel": "Kibanaでデータの可視化と閲覧を行うには、Elasticsearchからデータを取得するためのインデックスパターンの作成が必要です。",
|
||||
"dataViews.fetchFieldErrorTitle": "データビューのフィールド取得中にエラーが発生 {title}(ID:{id})",
|
||||
"dataViews.functions.dataViewLoad.help": "データビューを読み込みます",
|
||||
"dataViews.functions.dataViewLoad.id.help": "読み込むデータビューID",
|
||||
|
|
|
@ -2812,7 +2812,6 @@
|
|||
"dataViews.deprecations.scriptedFields.manualStepTwoMessage": "更新 {numberOfIndexPatternsWithScriptedFields} 个具有脚本字段的数据视图以改为使用运行时字段。多数情况下,要迁移现有脚本,您需要将“return <value>;”更改为“emit(<value>);”。至少有一个脚本字段的数据视图:{allTitles}",
|
||||
"dataViews.deprecations.scriptedFieldsMessage": "您具有 {numberOfIndexPatternsWithScriptedFields} 个使用脚本字段的数据视图 ({titlesPreview}...)。脚本字段已过时,将在未来移除。请改为使用运行时脚本。",
|
||||
"dataViews.deprecations.scriptedFieldsTitle": "找到使用脚本字段的数据视图",
|
||||
"dataViews.ensureDefaultIndexPattern.bannerLabel": "要在 Kibana 中可视化和浏览数据,必须创建索引模式,以从 Elasticsearch 中检索数据。",
|
||||
"dataViews.fetchFieldErrorTitle": "提取数据视图 {title}(ID:{id})的字段时出错",
|
||||
"dataViews.functions.dataViewLoad.help": "加载数据视图",
|
||||
"dataViews.functions.dataViewLoad.id.help": "要加载的数据视图 ID",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue