From d900299e731fccaca5c70889371a2760da794da1 Mon Sep 17 00:00:00 2001 From: Jesus Wahrman <41008968+jesuswr@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:46:18 +0100 Subject: [PATCH] Clean code related to savedObjectClientContrat that wasn't being used (#200629) ## Summary Resolves: https://github.com/elastic/kibana/issues/197216 Removed all code that wasn't being used in https://github.com/elastic/kibana/tree/main/src/plugins/saved_objects/public. Didn't remove the actual client since it's still being used here: https://github.com/elastic/kibana/blob/dbab2214e9451d3a262007660cc0b7cdcea5307c/src/plugins/home/public/application/kibana_services.ts#L46-L48 Checked everything with `node scripts/type_check` ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_node:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- src/plugins/saved_objects/public/index.ts | 2 +- .../saved_object/helpers/apply_es_resp.ts | 101 --------------- .../helpers/check_for_duplicate_title.ts | 65 ---------- .../helpers/confirm_modal_promise.tsx | 51 -------- .../saved_object/helpers/create_source.ts | 74 ----------- .../display_duplicate_title_confirm_modal.ts | 38 ------ .../helpers/field_mapping/index.ts | 11 -- .../field_mapping/mapping_setup.test.ts | 45 ------- .../helpers/field_mapping/mapping_setup.ts | 35 ------ .../helpers/field_mapping/types.ts | 20 --- .../helpers/find_object_by_title.test.ts | 38 ------ .../helpers/find_object_by_title.ts | 45 ------- .../helpers/hydrate_index_pattern.ts | 40 ------ .../helpers/initialize_saved_object.ts | 50 -------- .../saved_object/helpers/save_saved_object.ts | 107 +--------------- .../helpers/save_with_confirmation.test.ts | 118 ------------------ .../helpers/save_with_confirmation.ts | 79 ------------ .../helpers/serialize_saved_object.ts | 55 -------- .../public/saved_object/index.ts | 2 - src/plugins/saved_objects/public/types.ts | 20 +-- src/plugins/saved_objects/tsconfig.json | 1 - .../translations/translations/fr-FR.json | 8 +- .../translations/translations/ja-JP.json | 8 +- .../translations/translations/zh-CN.json | 4 +- 24 files changed, 7 insertions(+), 1010 deletions(-) delete mode 100644 src/plugins/saved_objects/public/saved_object/helpers/apply_es_resp.ts delete mode 100644 src/plugins/saved_objects/public/saved_object/helpers/check_for_duplicate_title.ts delete mode 100644 src/plugins/saved_objects/public/saved_object/helpers/confirm_modal_promise.tsx delete mode 100644 src/plugins/saved_objects/public/saved_object/helpers/create_source.ts delete mode 100644 src/plugins/saved_objects/public/saved_object/helpers/display_duplicate_title_confirm_modal.ts delete mode 100644 src/plugins/saved_objects/public/saved_object/helpers/field_mapping/index.ts delete mode 100644 src/plugins/saved_objects/public/saved_object/helpers/field_mapping/mapping_setup.test.ts delete mode 100644 src/plugins/saved_objects/public/saved_object/helpers/field_mapping/mapping_setup.ts delete mode 100644 src/plugins/saved_objects/public/saved_object/helpers/field_mapping/types.ts delete mode 100644 src/plugins/saved_objects/public/saved_object/helpers/find_object_by_title.test.ts delete mode 100644 src/plugins/saved_objects/public/saved_object/helpers/find_object_by_title.ts delete mode 100644 src/plugins/saved_objects/public/saved_object/helpers/hydrate_index_pattern.ts delete mode 100644 src/plugins/saved_objects/public/saved_object/helpers/initialize_saved_object.ts delete mode 100644 src/plugins/saved_objects/public/saved_object/helpers/save_with_confirmation.test.ts delete mode 100644 src/plugins/saved_objects/public/saved_object/helpers/save_with_confirmation.ts delete mode 100644 src/plugins/saved_objects/public/saved_object/helpers/serialize_saved_object.ts diff --git a/src/plugins/saved_objects/public/index.ts b/src/plugins/saved_objects/public/index.ts index 6d7a013cf59c..c0c8ae33f6b9 100644 --- a/src/plugins/saved_objects/public/index.ts +++ b/src/plugins/saved_objects/public/index.ts @@ -11,7 +11,7 @@ import { SavedObjectsPublicPlugin } from './plugin'; export type { OnSaveProps, OriginSaveModalProps, SaveModalState, SaveResult } from './save_modal'; export { SavedObjectSaveModal, SavedObjectSaveModalOrigin, showSaveModal } from './save_modal'; -export { checkForDuplicateTitle, saveWithConfirmation, isErrorNonFatal } from './saved_object'; +export { isErrorNonFatal } from './saved_object'; export type { SavedObjectSaveOpts, SavedObject, SavedObjectConfig } from './types'; export const plugin = () => new SavedObjectsPublicPlugin(); diff --git a/src/plugins/saved_objects/public/saved_object/helpers/apply_es_resp.ts b/src/plugins/saved_objects/public/saved_object/helpers/apply_es_resp.ts deleted file mode 100644 index 1bd1a7de29ec..000000000000 --- a/src/plugins/saved_objects/public/saved_object/helpers/apply_es_resp.ts +++ /dev/null @@ -1,101 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { cloneDeep, defaults, forOwn, assign } from 'lodash'; -import { SavedObjectNotFound } from '@kbn/kibana-utils-plugin/public'; -import { injectSearchSourceReferences, parseSearchSourceJSON } from '@kbn/data-plugin/public'; -import type { DataView } from '@kbn/data-views-plugin/public'; -import { EsResponse, SavedObject, SavedObjectConfig, SavedObjectKibanaServices } from '../../types'; -import { expandShorthand } from './field_mapping'; - -/** - * A given response of and ElasticSearch containing a plain saved object is applied to the given - * savedObject - */ -export async function applyESResp( - resp: EsResponse, - savedObject: SavedObject, - config: SavedObjectConfig, - dependencies: SavedObjectKibanaServices -) { - const mapping = expandShorthand(config.mapping ?? {}); - const savedObjectType = config.type || ''; - savedObject._source = cloneDeep(resp._source); - if (typeof resp.found === 'boolean' && !resp.found) { - throw new SavedObjectNotFound(savedObjectType, savedObject.id || ''); - } - - const meta = resp._source.kibanaSavedObjectMeta || {}; - delete resp._source.kibanaSavedObjectMeta; - - if (!config.indexPattern && savedObject._source.indexPattern) { - config.indexPattern = savedObject._source.indexPattern as DataView; - delete savedObject._source.indexPattern; - } - - // assign the defaults to the response - defaults(savedObject._source, savedObject.defaults); - - // transform the source using _deserializers - forOwn(mapping, (fieldMapping, fieldName) => { - if (fieldMapping._deserialize && typeof fieldName === 'string') { - savedObject._source[fieldName] = fieldMapping._deserialize( - savedObject._source[fieldName] as string - ); - } - }); - - // Give obj all of the values in _source.fields - assign(savedObject, savedObject._source); - savedObject.lastSavedTitle = savedObject.title; - - if (meta.searchSourceJSON) { - try { - let searchSourceValues = parseSearchSourceJSON(meta.searchSourceJSON); - - if (config.searchSource) { - searchSourceValues = injectSearchSourceReferences( - searchSourceValues as any, - resp.references - ); - savedObject.searchSource = await dependencies.search.searchSource.create( - searchSourceValues - ); - } else { - savedObject.searchSourceFields = searchSourceValues; - } - } catch (error) { - if ( - error.constructor.name === 'SavedObjectNotFound' && - error.savedObjectType === 'index-pattern' - ) { - // if parsing the search source fails because the index pattern wasn't found, - // remember the reference - this is required for error handling on legacy imports - savedObject.unresolvedIndexPatternReference = { - name: 'kibanaSavedObjectMeta.searchSourceJSON.index', - id: JSON.parse(meta.searchSourceJSON).index, - type: 'index-pattern', - }; - } - - throw error; - } - } - - const injectReferences = config.injectReferences; - if (injectReferences && resp.references && resp.references.length > 0) { - injectReferences(savedObject, resp.references); - } - - if (typeof config.afterESResp === 'function') { - savedObject = await config.afterESResp(savedObject); - } - - return savedObject; -} diff --git a/src/plugins/saved_objects/public/saved_object/helpers/check_for_duplicate_title.ts b/src/plugins/saved_objects/public/saved_object/helpers/check_for_duplicate_title.ts deleted file mode 100644 index 78f7a5cb31d8..000000000000 --- a/src/plugins/saved_objects/public/saved_object/helpers/check_for_duplicate_title.ts +++ /dev/null @@ -1,65 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { SavedObject, SavedObjectKibanaServices, StartServices } from '../../types'; -import { findObjectByTitle } from './find_object_by_title'; -import { SAVE_DUPLICATE_REJECTED } from '../../constants'; -import { displayDuplicateTitleConfirmModal } from './display_duplicate_title_confirm_modal'; - -/** - * check for an existing SavedObject with the same title in ES - * returns Promise when it's no duplicate, or the modal displaying the warning - * that's there's a duplicate is confirmed, else it returns a rejected Promise - * @param savedObject - * @param isTitleDuplicateConfirmed - * @param onTitleDuplicate - * @param services - * @param startServices - */ -export async function checkForDuplicateTitle( - savedObject: Pick< - SavedObject, - 'id' | 'title' | 'getDisplayName' | 'lastSavedTitle' | 'copyOnSave' | 'getEsType' - >, - isTitleDuplicateConfirmed: boolean, - onTitleDuplicate: (() => void) | undefined, - services: Pick, - startServices: StartServices -): Promise { - const { savedObjectsClient, overlays } = services; - // Don't check for duplicates if user has already confirmed save with duplicate title - if (isTitleDuplicateConfirmed) { - return true; - } - - // Don't check if the user isn't updating the title, otherwise that would become very annoying to have - // to confirm the save every time, except when copyOnSave is true, then we do want to check. - if (savedObject.title === savedObject.lastSavedTitle && !savedObject.copyOnSave) { - return true; - } - - const duplicate = await findObjectByTitle( - savedObjectsClient, - savedObject.getEsType(), - savedObject.title - ); - - if (!duplicate || duplicate.id === savedObject.id) { - return true; - } - - if (onTitleDuplicate) { - onTitleDuplicate(); - return Promise.reject(new Error(SAVE_DUPLICATE_REJECTED)); - } - - // TODO: make onTitleDuplicate a required prop and remove UI components from this class - // Need to leave here until all users pass onTitleDuplicate. - return displayDuplicateTitleConfirmModal(savedObject, overlays, startServices); -} diff --git a/src/plugins/saved_objects/public/saved_object/helpers/confirm_modal_promise.tsx b/src/plugins/saved_objects/public/saved_object/helpers/confirm_modal_promise.tsx deleted file mode 100644 index afdafaa5483c..000000000000 --- a/src/plugins/saved_objects/public/saved_object/helpers/confirm_modal_promise.tsx +++ /dev/null @@ -1,51 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import React from 'react'; -import { CoreStart, OverlayStart } from '@kbn/core/public'; -import { i18n } from '@kbn/i18n'; -import { EuiConfirmModal } from '@elastic/eui'; -import { toMountPoint } from '@kbn/react-kibana-mount'; - -type StartServices = Pick; - -export function confirmModalPromise( - message = '', - title = '', - confirmBtnText = '', - overlays: OverlayStart, - startServices: StartServices -): Promise { - return new Promise((resolve, reject) => { - const cancelButtonText = i18n.translate('savedObjects.confirmModal.cancelButtonLabel', { - defaultMessage: 'Cancel', - }); - - const modal = overlays.openModal( - toMountPoint( - { - modal.close(); - reject(); - }} - onConfirm={() => { - modal.close(); - resolve(true); - }} - confirmButtonText={confirmBtnText} - cancelButtonText={cancelButtonText} - title={title} - > - {message} - , - startServices - ) - ); - }); -} diff --git a/src/plugins/saved_objects/public/saved_object/helpers/create_source.ts b/src/plugins/saved_objects/public/saved_object/helpers/create_source.ts deleted file mode 100644 index 42d3c956cdad..000000000000 --- a/src/plugins/saved_objects/public/saved_object/helpers/create_source.ts +++ /dev/null @@ -1,74 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { get } from 'lodash'; -import { i18n } from '@kbn/i18n'; -import { SavedObjectAttributes } from '@kbn/core/public'; -import { SavedObject, SavedObjectKibanaServices, StartServices } from '../../types'; -import { OVERWRITE_REJECTED } from '../../constants'; -import { confirmModalPromise } from './confirm_modal_promise'; - -/** - * Attempts to create the current object using the serialized source. If an object already - * exists, a warning message requests an overwrite confirmation. - * @param source - serialized version of this object (return value from this._serialize()) - * What will be indexed into elasticsearch. - * @param savedObject - savedObject - * @param esType - type of the saved object - * @param options - options to pass to the saved object create method - * @param services - provides Kibana services savedObjectsClient and overlays - * @returns {Promise} - A promise that is resolved with the objects id if the object is - * successfully indexed. If the overwrite confirmation was rejected, an error is thrown with - * a confirmRejected = true parameter so that case can be handled differently than - * a create or index error. - * @resolved {SavedObject} - */ -export async function createSource( - source: SavedObjectAttributes, - savedObject: SavedObject, - esType: string, - options = {}, - services: SavedObjectKibanaServices, - startServices: StartServices -) { - const { savedObjectsClient, overlays } = services; - try { - return await savedObjectsClient.create(esType, source, options); - } catch (err) { - // record exists, confirm overwriting - if (get(err, 'res.status') === 409) { - const confirmMessage = i18n.translate( - 'savedObjects.confirmModal.overwriteConfirmationMessage', - { - defaultMessage: 'Are you sure you want to overwrite {title}?', - values: { title: savedObject.title }, - } - ); - - const title = i18n.translate('savedObjects.confirmModal.overwriteTitle', { - defaultMessage: 'Overwrite {name}?', - values: { name: savedObject.getDisplayName() }, - }); - const confirmButtonText = i18n.translate('savedObjects.confirmModal.overwriteButtonLabel', { - defaultMessage: 'Overwrite', - }); - - return confirmModalPromise(confirmMessage, title, confirmButtonText, overlays, startServices) - .then(() => - savedObjectsClient.create( - esType, - source, - savedObject.creationOpts({ overwrite: true, ...options }) - ) - ) - .catch(() => Promise.reject(new Error(OVERWRITE_REJECTED))); - } - return await Promise.reject(err); - } -} diff --git a/src/plugins/saved_objects/public/saved_object/helpers/display_duplicate_title_confirm_modal.ts b/src/plugins/saved_objects/public/saved_object/helpers/display_duplicate_title_confirm_modal.ts deleted file mode 100644 index 3dec7f93f1d1..000000000000 --- a/src/plugins/saved_objects/public/saved_object/helpers/display_duplicate_title_confirm_modal.ts +++ /dev/null @@ -1,38 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { i18n } from '@kbn/i18n'; -import { OverlayStart } from '@kbn/core/public'; -import { SAVE_DUPLICATE_REJECTED } from '../../constants'; -import { confirmModalPromise } from './confirm_modal_promise'; -import { SavedObject, StartServices } from '../../types'; - -export function displayDuplicateTitleConfirmModal( - savedObject: Pick, - overlays: OverlayStart, - startServices: StartServices -): Promise { - const confirmMessage = i18n.translate( - 'savedObjects.confirmModal.saveDuplicateConfirmationMessage', - { - defaultMessage: `A {name} with the title ''{title}'' already exists. Would you like to save anyway?`, - values: { title: savedObject.title, name: savedObject.getDisplayName() }, - } - ); - - const confirmButtonText = i18n.translate('savedObjects.confirmModal.saveDuplicateButtonLabel', { - defaultMessage: 'Save {name}', - values: { name: savedObject.getDisplayName() }, - }); - try { - return confirmModalPromise(confirmMessage, '', confirmButtonText, overlays, startServices); - } catch (_) { - return Promise.reject(new Error(SAVE_DUPLICATE_REJECTED)); - } -} diff --git a/src/plugins/saved_objects/public/saved_object/helpers/field_mapping/index.ts b/src/plugins/saved_objects/public/saved_object/helpers/field_mapping/index.ts deleted file mode 100644 index 850352da2b18..000000000000 --- a/src/plugins/saved_objects/public/saved_object/helpers/field_mapping/index.ts +++ /dev/null @@ -1,11 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -export type { FieldMappingSpec, MappingObject } from './types'; -export { expandShorthand } from './mapping_setup'; diff --git a/src/plugins/saved_objects/public/saved_object/helpers/field_mapping/mapping_setup.test.ts b/src/plugins/saved_objects/public/saved_object/helpers/field_mapping/mapping_setup.test.ts deleted file mode 100644 index dbf7d5c38eec..000000000000 --- a/src/plugins/saved_objects/public/saved_object/helpers/field_mapping/mapping_setup.test.ts +++ /dev/null @@ -1,45 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { expandShorthand } from './mapping_setup'; -import { ES_FIELD_TYPES } from '@kbn/data-plugin/public'; - -describe('mapping_setup', () => { - it('allows shortcuts for field types by just setting the value to the type name', () => { - const mapping = expandShorthand({ foo: ES_FIELD_TYPES.BOOLEAN }); - - expect(mapping.foo.type).toBe('boolean'); - }); - - it('can set type as an option', () => { - const mapping = expandShorthand({ foo: { type: ES_FIELD_TYPES.INTEGER } }); - - expect(mapping.foo.type).toBe('integer'); - }); - - describe('when type is json', () => { - it('returned object is type text', () => { - const mapping = expandShorthand({ foo: 'json' }); - - expect(mapping.foo.type).toBe('text'); - }); - - it('returned object has _serialize function', () => { - const mapping = expandShorthand({ foo: 'json' }); - - expect(mapping.foo._serialize).toBeInstanceOf(Function); - }); - - it('returned object has _deserialize function', () => { - const mapping = expandShorthand({ foo: 'json' }); - - expect(mapping.foo._serialize).toBeInstanceOf(Function); - }); - }); -}); diff --git a/src/plugins/saved_objects/public/saved_object/helpers/field_mapping/mapping_setup.ts b/src/plugins/saved_objects/public/saved_object/helpers/field_mapping/mapping_setup.ts deleted file mode 100644 index cc4de351eb3c..000000000000 --- a/src/plugins/saved_objects/public/saved_object/helpers/field_mapping/mapping_setup.ts +++ /dev/null @@ -1,35 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { mapValues, isString } from 'lodash'; -import { ES_FIELD_TYPES } from '@kbn/data-plugin/public'; -import { FieldMappingSpec, MappingObject } from './types'; - -// import from ./common/types to prevent circular dependency of kibana_utils <-> data plugin - -/** @private */ -type ShorthandFieldMapObject = FieldMappingSpec | ES_FIELD_TYPES | 'json'; - -/** @public */ -export const expandShorthand = (sh: Record): MappingObject => { - return mapValues(sh, (val: ShorthandFieldMapObject) => { - const fieldMap = isString(val) ? { type: val } : val; - const json: FieldMappingSpec = { - type: ES_FIELD_TYPES.TEXT, - _serialize(v) { - if (v) return JSON.stringify(v); - }, - _deserialize(v) { - if (v) return JSON.parse(v); - }, - }; - - return fieldMap.type === 'json' ? json : fieldMap; - }) as MappingObject; -}; diff --git a/src/plugins/saved_objects/public/saved_object/helpers/field_mapping/types.ts b/src/plugins/saved_objects/public/saved_object/helpers/field_mapping/types.ts deleted file mode 100644 index 4a1b3e0d3892..000000000000 --- a/src/plugins/saved_objects/public/saved_object/helpers/field_mapping/types.ts +++ /dev/null @@ -1,20 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { ES_FIELD_TYPES } from '@kbn/data-plugin/public'; - -/** @public */ -export interface FieldMappingSpec { - type: ES_FIELD_TYPES; - _serialize?: (mapping: any) => string | undefined; - _deserialize?: (mapping: string) => any | undefined; -} - -/** @public */ -export type MappingObject = Record; diff --git a/src/plugins/saved_objects/public/saved_object/helpers/find_object_by_title.test.ts b/src/plugins/saved_objects/public/saved_object/helpers/find_object_by_title.test.ts deleted file mode 100644 index c570165ae1f8..000000000000 --- a/src/plugins/saved_objects/public/saved_object/helpers/find_object_by_title.test.ts +++ /dev/null @@ -1,38 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { findObjectByTitle } from './find_object_by_title'; -import { SavedObjectsClientContract, SavedObject } from '@kbn/core/public'; -import { simpleSavedObjectMock } from '@kbn/core/public/mocks'; - -describe('findObjectByTitle', () => { - const savedObjectsClient: SavedObjectsClientContract = {} as SavedObjectsClientContract; - - beforeEach(() => { - savedObjectsClient.find = jest.fn(); - }); - - it('returns undefined if title is not provided', async () => { - const match = await findObjectByTitle(savedObjectsClient, 'index-pattern', ''); - expect(match).toBeUndefined(); - }); - - it('matches any case', async () => { - const indexPattern = simpleSavedObjectMock.create(savedObjectsClient, { - attributes: { title: 'foo' }, - } as SavedObject); - savedObjectsClient.find = jest.fn().mockImplementation(() => - Promise.resolve({ - savedObjects: [indexPattern], - }) - ); - const match = await findObjectByTitle(savedObjectsClient, 'index-pattern', 'FOO'); - expect(match).toEqual(indexPattern); - }); -}); diff --git a/src/plugins/saved_objects/public/saved_object/helpers/find_object_by_title.ts b/src/plugins/saved_objects/public/saved_object/helpers/find_object_by_title.ts deleted file mode 100644 index 2ec7cf89d7d3..000000000000 --- a/src/plugins/saved_objects/public/saved_object/helpers/find_object_by_title.ts +++ /dev/null @@ -1,45 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { - SavedObjectsClientContract, - SimpleSavedObject, - SavedObjectAttributes, -} from '@kbn/core/public'; - -/** - * Returns an object matching a given title - * - * @param savedObjectsClient {SavedObjectsClientContract} - * @param type {string} - * @param title {string} - * @returns {Promise} - */ -export async function findObjectByTitle( - savedObjectsClient: SavedObjectsClientContract, - type: string, - title: string -): Promise | void> { - if (!title) { - return; - } - - // Elastic search will return the most relevant results first, which means exact matches should come - // first, and so we shouldn't need to request everything. Using 10 just to be on the safe side. - const response = await savedObjectsClient.find({ - type, - perPage: 10, - search: `"${title}"`, - searchFields: ['title'], - fields: ['title'], - }); - return response.savedObjects.find( - (obj) => obj.get('title').toLowerCase() === title.toLowerCase() - ); -} diff --git a/src/plugins/saved_objects/public/saved_object/helpers/hydrate_index_pattern.ts b/src/plugins/saved_objects/public/saved_object/helpers/hydrate_index_pattern.ts deleted file mode 100644 index 42de37dcb71d..000000000000 --- a/src/plugins/saved_objects/public/saved_object/helpers/hydrate_index_pattern.ts +++ /dev/null @@ -1,40 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { DataViewsContract } from '@kbn/data-views-plugin/public'; -import { SavedObject, SavedObjectConfig } from '../../types'; - -/** - * After creation or fetching from ES, ensure that the searchSources index indexPattern - * is an bonafide IndexPattern object. - * - * @return {Promise} - */ -export async function hydrateIndexPattern( - id: string, - savedObject: SavedObject, - dataViews: DataViewsContract, - config: SavedObjectConfig -) { - const indexPattern = config.indexPattern; - - if (!savedObject.searchSource) { - return null; - } - - const index = id || indexPattern || savedObject.searchSource.getOwnField('index'); - - if (typeof index !== 'string' || !index) { - return null; - } - - const indexObj = await dataViews.get(index); - savedObject.searchSource.setField('index', indexObj); - return indexObj; -} diff --git a/src/plugins/saved_objects/public/saved_object/helpers/initialize_saved_object.ts b/src/plugins/saved_objects/public/saved_object/helpers/initialize_saved_object.ts deleted file mode 100644 index a7428156176a..000000000000 --- a/src/plugins/saved_objects/public/saved_object/helpers/initialize_saved_object.ts +++ /dev/null @@ -1,50 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { cloneDeep, assign } from 'lodash'; -import { SavedObjectsClientContract } from '@kbn/core/public'; -import { SavedObject, SavedObjectConfig } from '../../types'; - -/** - * Initialize saved object - */ -export async function intializeSavedObject( - savedObject: SavedObject, - savedObjectsClient: SavedObjectsClientContract, - config: SavedObjectConfig -) { - const esType = config.type; - // ensure that the esType is defined - if (!esType) throw new Error('You must define a type name to use SavedObject objects.'); - - if (!savedObject.id) { - // just assign the defaults and be done - assign(savedObject, savedObject.defaults); - await savedObject.hydrateIndexPattern!(); - if (typeof config.afterESResp === 'function') { - savedObject = await config.afterESResp(savedObject); - } - return savedObject; - } - - const resp = await savedObjectsClient.get(esType, savedObject.id); - const respMapped = { - _id: resp.id, - _type: resp.type, - _source: cloneDeep(resp.attributes), - references: resp.references, - found: !!resp._version, - }; - await savedObject.applyESResp(respMapped); - if (typeof config.init === 'function') { - await config.init.call(savedObject); - } - - return savedObject; -} diff --git a/src/plugins/saved_objects/public/saved_object/helpers/save_saved_object.ts b/src/plugins/saved_objects/public/saved_object/helpers/save_saved_object.ts index 76ac6bc3c0b3..429a96eb19f4 100644 --- a/src/plugins/saved_objects/public/saved_object/helpers/save_saved_object.ts +++ b/src/plugins/saved_objects/public/saved_object/helpers/save_saved_object.ts @@ -7,118 +7,13 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { - SavedObject, - SavedObjectConfig, - SavedObjectKibanaServices, - SavedObjectSaveOpts, - StartServices, -} from '../../types'; import { OVERWRITE_REJECTED, SAVE_DUPLICATE_REJECTED } from '../../constants'; -import { createSource } from './create_source'; -import { checkForDuplicateTitle } from './check_for_duplicate_title'; /** * @param error {Error} the error * @return {boolean} */ -export function isErrorNonFatal(error: { message: string }) { +export function isErrorNonFatal(error: { message: string }): boolean { if (!error) return false; return error.message === OVERWRITE_REJECTED || error.message === SAVE_DUPLICATE_REJECTED; } - -/** - * Saves this object. - * - * @param {string} [esType] - * @param {SavedObject} [savedObject] - * @param {SavedObjectConfig} [config] - * @param {object} [options={}] - * @property {boolean} [options.confirmOverwrite=false] - If true, attempts to create the source so it - * can confirm an overwrite if a document with the id already exists. - * @property {boolean} [options.isTitleDuplicateConfirmed=false] - If true, save allowed with duplicate title - * @property {func} [options.onTitleDuplicate] - function called if duplicate title exists. - * When not provided, confirm modal will be displayed asking user to confirm or cancel save. - * @param {SavedObjectKibanaServices} [services] - * @param {StartServices} [startServices] - * @return {Promise} - * @resolved {String} - The id of the doc - */ -export async function saveSavedObject( - savedObject: SavedObject, - config: SavedObjectConfig, - { - confirmOverwrite = false, - isTitleDuplicateConfirmed = false, - onTitleDuplicate, - }: SavedObjectSaveOpts = {}, - services: SavedObjectKibanaServices, - startServices: StartServices -): Promise { - const { savedObjectsClient, chrome } = services; - - const esType = config.type || ''; - const extractReferences = config.extractReferences; - // Save the original id in case the save fails. - const originalId = savedObject.id; - // Read https://github.com/elastic/kibana/issues/9056 and - // https://github.com/elastic/kibana/issues/9012 for some background into why this copyOnSave variable - // exists. - // The goal is to move towards a better rename flow, but since our users have been conditioned - // to expect a 'save as' flow during a rename, we are keeping the logic the same until a better - // UI/UX can be worked out. - if (savedObject.copyOnSave) { - delete savedObject.id; - } - - // Here we want to extract references and set them within "references" attribute - let { attributes, references } = savedObject._serialize(); - if (extractReferences) { - ({ attributes, references } = extractReferences({ attributes, references })); - } - if (!references) throw new Error('References not returned from extractReferences'); - - try { - await checkForDuplicateTitle( - savedObject, - isTitleDuplicateConfirmed, - onTitleDuplicate, - services, - startServices - ); - savedObject.isSaving = true; - const resp = confirmOverwrite - ? await createSource( - attributes, - savedObject, - esType, - savedObject.creationOpts({ references }), - services, - startServices - ) - : await savedObjectsClient.create( - esType, - attributes, - savedObject.creationOpts({ references, overwrite: true }) - ); - - savedObject.id = resp.id; - if (savedObject.showInRecentlyAccessed && savedObject.getFullPath) { - chrome.recentlyAccessed.add( - savedObject.getFullPath(), - savedObject.title, - String(savedObject.id) - ); - } - savedObject.isSaving = false; - savedObject.lastSavedTitle = savedObject.title; - return savedObject.id; - } catch (err) { - savedObject.isSaving = false; - savedObject.id = originalId; - if (isErrorNonFatal(err)) { - return ''; - } - return Promise.reject(err); - } -} diff --git a/src/plugins/saved_objects/public/saved_object/helpers/save_with_confirmation.test.ts b/src/plugins/saved_objects/public/saved_object/helpers/save_with_confirmation.test.ts deleted file mode 100644 index 00c8a01026ef..000000000000 --- a/src/plugins/saved_objects/public/saved_object/helpers/save_with_confirmation.test.ts +++ /dev/null @@ -1,118 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { SavedObjectAttributes, SavedObjectsCreateOptions, OverlayStart } from '@kbn/core/public'; -import { SavedObjectsClientContract } from '@kbn/core/public'; -import { analyticsServiceMock, i18nServiceMock, themeServiceMock } from '@kbn/core/public/mocks'; -import { saveWithConfirmation } from './save_with_confirmation'; -import * as deps from './confirm_modal_promise'; -import { OVERWRITE_REJECTED } from '../../constants'; - -describe('saveWithConfirmation', () => { - const savedObjectsClient: SavedObjectsClientContract = {} as SavedObjectsClientContract; - const overlays: OverlayStart = {} as OverlayStart; - const source: SavedObjectAttributes = {} as SavedObjectAttributes; - const options: SavedObjectsCreateOptions = {} as SavedObjectsCreateOptions; - const savedObject = { - getEsType: () => 'test type', - title: 'test title', - displayName: 'test display name', - }; - const startServices = { - analytics: analyticsServiceMock.createAnalyticsServiceStart(), - i18n: i18nServiceMock.createStartContract(), - theme: themeServiceMock.createStartContract(), - }; - - beforeEach(() => { - savedObjectsClient.create = jest.fn(); - jest.spyOn(deps, 'confirmModalPromise').mockReturnValue(Promise.resolve({} as any)); - }); - - test('should call create of savedObjectsClient', async () => { - await saveWithConfirmation( - source, - savedObject, - options, - { savedObjectsClient, overlays }, - startServices - ); - expect(savedObjectsClient.create).toHaveBeenCalledWith( - savedObject.getEsType(), - source, - options - ); - }); - - test('should call confirmModalPromise when such record exists', async () => { - savedObjectsClient.create = jest - .fn() - .mockImplementation((type, src, opt) => - opt && opt.overwrite ? Promise.resolve({} as any) : Promise.reject({ res: { status: 409 } }) - ); - - await saveWithConfirmation( - source, - savedObject, - options, - { savedObjectsClient, overlays }, - startServices - ); - expect(deps.confirmModalPromise).toHaveBeenCalledWith( - expect.any(String), - expect.any(String), - expect.any(String), - overlays, - expect.objectContaining({ - analytics: expect.any(Object), - i18n: expect.any(Object), - theme: expect.any(Object), - }) - ); - }); - - test('should call create of savedObjectsClient when overwriting confirmed', async () => { - savedObjectsClient.create = jest - .fn() - .mockImplementation((type, src, opt) => - opt && opt.overwrite ? Promise.resolve({} as any) : Promise.reject({ res: { status: 409 } }) - ); - - await saveWithConfirmation( - source, - savedObject, - options, - { savedObjectsClient, overlays }, - startServices - ); - expect(savedObjectsClient.create).toHaveBeenLastCalledWith(savedObject.getEsType(), source, { - overwrite: true, - ...options, - }); - }); - - test('should reject when overwriting denied', async () => { - savedObjectsClient.create = jest.fn().mockReturnValue(Promise.reject({ res: { status: 409 } })); - jest.spyOn(deps, 'confirmModalPromise').mockReturnValue(Promise.reject()); - - expect.assertions(1); - await expect( - saveWithConfirmation( - source, - savedObject, - options, - { - savedObjectsClient, - overlays, - }, - startServices - ) - ).rejects.toThrow(OVERWRITE_REJECTED); - }); -}); diff --git a/src/plugins/saved_objects/public/saved_object/helpers/save_with_confirmation.ts b/src/plugins/saved_objects/public/saved_object/helpers/save_with_confirmation.ts deleted file mode 100644 index d80e2179b532..000000000000 --- a/src/plugins/saved_objects/public/saved_object/helpers/save_with_confirmation.ts +++ /dev/null @@ -1,79 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { get } from 'lodash'; -import { i18n } from '@kbn/i18n'; -import { - SavedObjectAttributes, - SavedObjectsCreateOptions, - OverlayStart, - SavedObjectsClientContract, -} from '@kbn/core/public'; -import { OVERWRITE_REJECTED } from '../../constants'; -import type { StartServices } from '../../types'; -import { confirmModalPromise } from './confirm_modal_promise'; - -/** - * Attempts to create the current object using the serialized source. If an object already - * exists, a warning message requests an overwrite confirmation. - * @param source - serialized version of this object what will be indexed into elasticsearch. - * @param savedObject - a simple object that contains properties title and displayName, and getEsType method - * @param options - options to pass to the saved object create method - * @param services - provides Kibana services savedObjectsClient and overlays - * @returns {Promise} - A promise that is resolved with the objects id if the object is - * successfully indexed. If the overwrite confirmation was rejected, an error is thrown with - * a confirmRejected = true parameter so that case can be handled differently than - * a create or index error. - * @resolved {SavedObject} - */ -export async function saveWithConfirmation( - source: SavedObjectAttributes, - savedObject: { - getEsType(): string; - title: string; - displayName: string; - }, - options: SavedObjectsCreateOptions, - services: { savedObjectsClient: SavedObjectsClientContract; overlays: OverlayStart }, - startServices: StartServices -) { - const { savedObjectsClient, overlays } = services; - try { - return await savedObjectsClient.create(savedObject.getEsType(), source, options); - } catch (err) { - // record exists, confirm overwriting - if (get(err, 'res.status') === 409) { - const confirmMessage = i18n.translate( - 'savedObjects.confirmModal.overwriteConfirmationMessage', - { - defaultMessage: 'Are you sure you want to overwrite {title}?', - values: { title: savedObject.title }, - } - ); - - const title = i18n.translate('savedObjects.confirmModal.overwriteTitle', { - defaultMessage: 'Overwrite {name}?', - values: { name: savedObject.displayName }, - }); - const confirmButtonText = i18n.translate('savedObjects.confirmModal.overwriteButtonLabel', { - defaultMessage: 'Overwrite', - }); - - return confirmModalPromise(confirmMessage, title, confirmButtonText, overlays, startServices) - .then(() => - savedObjectsClient.create(savedObject.getEsType(), source, { - overwrite: true, - ...options, - }) - ) - .catch(() => Promise.reject(new Error(OVERWRITE_REJECTED))); - } - return await Promise.reject(err); - } -} diff --git a/src/plugins/saved_objects/public/saved_object/helpers/serialize_saved_object.ts b/src/plugins/saved_objects/public/saved_object/helpers/serialize_saved_object.ts deleted file mode 100644 index 3150f6ad3f00..000000000000 --- a/src/plugins/saved_objects/public/saved_object/helpers/serialize_saved_object.ts +++ /dev/null @@ -1,55 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { forOwn } from 'lodash'; -import { extractSearchSourceReferences } from '@kbn/data-plugin/public'; -import { SavedObject, SavedObjectConfig } from '../../types'; -import { expandShorthand } from './field_mapping'; - -export function serializeSavedObject(savedObject: SavedObject, config: SavedObjectConfig) { - // mapping definition for the fields that this object will expose - const mapping = expandShorthand(config.mapping ?? {}); - const attributes = {} as Record; - const references = []; - - forOwn(mapping, (fieldMapping, fieldName) => { - if (typeof fieldName !== 'string') { - return; - } - // @ts-ignore - const savedObjectFieldVal = savedObject[fieldName]; - if (savedObjectFieldVal != null) { - attributes[fieldName] = fieldMapping._serialize - ? fieldMapping._serialize(savedObjectFieldVal) - : savedObjectFieldVal; - } - }); - - if (savedObject.searchSource) { - const { searchSourceJSON, references: searchSourceReferences } = - savedObject.searchSource.serialize(); - attributes.kibanaSavedObjectMeta = { searchSourceJSON }; - references.push(...searchSourceReferences); - } - - if (savedObject.searchSourceFields) { - const [searchSourceFields, searchSourceReferences] = extractSearchSourceReferences( - savedObject.searchSourceFields - ); - const searchSourceJSON = JSON.stringify(searchSourceFields); - attributes.kibanaSavedObjectMeta = { searchSourceJSON }; - references.push(...searchSourceReferences); - } - - if (savedObject.unresolvedIndexPatternReference) { - references.push(savedObject.unresolvedIndexPatternReference); - } - - return { attributes, references }; -} diff --git a/src/plugins/saved_objects/public/saved_object/index.ts b/src/plugins/saved_objects/public/saved_object/index.ts index 560178fdf4f3..68639d030317 100644 --- a/src/plugins/saved_objects/public/saved_object/index.ts +++ b/src/plugins/saved_objects/public/saved_object/index.ts @@ -7,6 +7,4 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -export { checkForDuplicateTitle } from './helpers/check_for_duplicate_title'; -export { saveWithConfirmation } from './helpers/save_with_confirmation'; export { isErrorNonFatal } from './helpers/save_saved_object'; diff --git a/src/plugins/saved_objects/public/types.ts b/src/plugins/saved_objects/public/types.ts index c34ef878b5d7..0919c24ab2c6 100644 --- a/src/plugins/saved_objects/public/types.ts +++ b/src/plugins/saved_objects/public/types.ts @@ -7,16 +7,8 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { - ChromeStart, - CoreStart, - OverlayStart, - SavedObjectsClientContract, - SavedObjectAttributes, - SavedObjectReference, -} from '@kbn/core/public'; -import { ISearchSource, ISearchStart, SerializedSearchSourceFields } from '@kbn/data-plugin/public'; -import { DataViewsContract } from '@kbn/data-views-plugin/public'; +import { CoreStart, SavedObjectAttributes, SavedObjectReference } from '@kbn/core/public'; +import { ISearchSource, SerializedSearchSourceFields } from '@kbn/data-plugin/public'; import type { DataView } from '@kbn/data-views-plugin/common'; /** @@ -62,14 +54,6 @@ export interface SavedObjectCreationOpts { overwrite?: boolean; } -export interface SavedObjectKibanaServices { - savedObjectsClient: SavedObjectsClientContract; - dataViews: DataViewsContract; - search: ISearchStart; - chrome: ChromeStart; - overlays: OverlayStart; -} - export type StartServices = Pick; export interface SavedObjectAttributesAndRefs { diff --git a/src/plugins/saved_objects/tsconfig.json b/src/plugins/saved_objects/tsconfig.json index ccec7b43ad9f..83e113a7e4e1 100644 --- a/src/plugins/saved_objects/tsconfig.json +++ b/src/plugins/saved_objects/tsconfig.json @@ -7,7 +7,6 @@ "kbn_references": [ "@kbn/core", "@kbn/data-plugin", - "@kbn/kibana-utils-plugin", "@kbn/i18n", "@kbn/data-views-plugin", "@kbn/i18n-react", diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index e977ae228fdf..5a5e006df3f2 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -6689,12 +6689,6 @@ "reporting.share.screenCapturePanelContent.optimizeForPrintingLabel": "Optimiser pour l'impression", "reporting.shareContextMenu.ExportsButtonLabel": "PDF", "reporting.shareContextMenu.ExportsButtonLabelPNG": "Export PNG", - "savedObjects.confirmModal.cancelButtonLabel": "Annuler", - "savedObjects.confirmModal.overwriteButtonLabel": "Écraser", - "savedObjects.confirmModal.overwriteConfirmationMessage": "Êtes-vous sûr de vouloir écraser {title} ?", - "savedObjects.confirmModal.overwriteTitle": "Écraser {name} ?", - "savedObjects.confirmModal.saveDuplicateButtonLabel": "Enregistrer {name}", - "savedObjects.confirmModal.saveDuplicateConfirmationMessage": "Il y a déjà une occurrence de {name} avec le titre \"{title}\". Voulez-vous tout de même enregistrer ?", "savedObjects.overwriteRejectedDescription": "La confirmation d'écrasement a été rejetée.", "savedObjects.saveDuplicateRejectedDescription": "La confirmation d'enregistrement avec un doublon de titre a été rejetée.", "savedObjects.saveModal.cancelButtonLabel": "Annuler", @@ -26193,7 +26187,6 @@ "xpack.inventory.badgeFilterWithPopover.openPopoverBadgeLabel": "Ouvrir la fenêtre contextuelle", "xpack.inventory.data_view.creation_failed": "Une erreur s'est produite lors de la création de la vue de données", "xpack.inventory.eemEnablement.errorTitle": "Erreur lors de l'activation du nouveau modèle d'entité", - "xpack.inventory.entityActions.discoverLink": "Ouvrir dans Discover", "xpack.inventory.entitiesGrid.euiDataGrid.alertsLabel": "Alertes", "xpack.inventory.entitiesGrid.euiDataGrid.alertsTooltip": "Le nombre d'alertes actives", "xpack.inventory.entitiesGrid.euiDataGrid.entityNameLabel": "Nom de l'entité", @@ -26206,6 +26199,7 @@ "xpack.inventory.entitiesGrid.euiDataGrid.lastSeenTooltip": "Horodatage des dernières données reçues pour l'entité (entity.lastSeenTimestamp)", "xpack.inventory.entitiesGrid.euiDataGrid.typeLabel": "Type", "xpack.inventory.entitiesGrid.euiDataGrid.typeTooltip": "Type d'entité (entity.type)", + "xpack.inventory.entityActions.discoverLink": "Ouvrir dans Discover", "xpack.inventory.featureRegistry.inventoryFeatureName": "Inventory", "xpack.inventory.home.serviceAlertsTable.tooltip.activeAlertsExplanation": "Alertes actives", "xpack.inventory.inventoryLinkTitle": "Inventory", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 05416471642c..640d5d403d88 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -6682,12 +6682,6 @@ "reporting.share.screenCapturePanelContent.optimizeForPrintingLabel": "印刷用に最適化", "reporting.shareContextMenu.ExportsButtonLabel": "PDF", "reporting.shareContextMenu.ExportsButtonLabelPNG": "PNGエクスポート", - "savedObjects.confirmModal.cancelButtonLabel": "キャンセル", - "savedObjects.confirmModal.overwriteButtonLabel": "上書き", - "savedObjects.confirmModal.overwriteConfirmationMessage": "{title}を上書きしてよろしいですか?", - "savedObjects.confirmModal.overwriteTitle": "{name} を上書きしますか?", - "savedObjects.confirmModal.saveDuplicateButtonLabel": "{name} を保存", - "savedObjects.confirmModal.saveDuplicateConfirmationMessage": "''{title}''というタイトルの {name} がすでに存在します。保存しますか?", "savedObjects.overwriteRejectedDescription": "上書き確認が拒否されました", "savedObjects.saveDuplicateRejectedDescription": "重複ファイルの保存確認が拒否されました", "savedObjects.saveModal.cancelButtonLabel": "キャンセル", @@ -26165,7 +26159,6 @@ "xpack.inventory.badgeFilterWithPopover.openPopoverBadgeLabel": "ポップオーバーを開く", "xpack.inventory.data_view.creation_failed": "データビューの作成中にエラーが発生しました", "xpack.inventory.eemEnablement.errorTitle": "新しいエンティティモデルの有効化エラー", - "xpack.inventory.entityActions.discoverLink": "Discoverで開く", "xpack.inventory.entitiesGrid.euiDataGrid.alertsLabel": "アラート", "xpack.inventory.entitiesGrid.euiDataGrid.alertsTooltip": "アクティブなアラートの件数", "xpack.inventory.entitiesGrid.euiDataGrid.entityNameLabel": "エンティティ名", @@ -26178,6 +26171,7 @@ "xpack.inventory.entitiesGrid.euiDataGrid.lastSeenTooltip": "エンティティで最後に受信したデータのタイムスタンプ(entity.lastSeenTimestamp)", "xpack.inventory.entitiesGrid.euiDataGrid.typeLabel": "型", "xpack.inventory.entitiesGrid.euiDataGrid.typeTooltip": "エンティティのタイプ(entity.type)", + "xpack.inventory.entityActions.discoverLink": "Discoverで開く", "xpack.inventory.featureRegistry.inventoryFeatureName": "インベントリ", "xpack.inventory.home.serviceAlertsTable.tooltip.activeAlertsExplanation": "アクティブアラート", "xpack.inventory.inventoryLinkTitle": "インベントリ", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 0e0b68b1a3ef..991c23b73faa 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -6601,8 +6601,6 @@ "reporting.share.screenCapturePanelContent.optimizeForPrintingLabel": "打印优化", "reporting.shareContextMenu.ExportsButtonLabel": "PDF", "reporting.shareContextMenu.ExportsButtonLabelPNG": "PNG 导出", - "savedObjects.confirmModal.cancelButtonLabel": "取消", - "savedObjects.confirmModal.overwriteButtonLabel": "覆盖", "savedObjects.overwriteRejectedDescription": "已拒绝覆盖确认", "savedObjects.saveDuplicateRejectedDescription": "已拒绝使用重复标题保存确认", "savedObjects.saveModal.cancelButtonLabel": "取消", @@ -25691,7 +25689,6 @@ "xpack.inventory.badgeFilterWithPopover.openPopoverBadgeLabel": "打开弹出框", "xpack.inventory.data_view.creation_failed": "创建数据视图时出错", "xpack.inventory.eemEnablement.errorTitle": "启用新实体模型时出错", - "xpack.inventory.entityActions.discoverLink": "在 Discover 中打开", "xpack.inventory.entitiesGrid.euiDataGrid.alertsLabel": "告警", "xpack.inventory.entitiesGrid.euiDataGrid.alertsTooltip": "活动告警计数", "xpack.inventory.entitiesGrid.euiDataGrid.entityNameLabel": "实体名称", @@ -25704,6 +25701,7 @@ "xpack.inventory.entitiesGrid.euiDataGrid.lastSeenTooltip": "上次接收的实体数据的时间戳 (entity.lastSeenTimestamp)", "xpack.inventory.entitiesGrid.euiDataGrid.typeLabel": "类型", "xpack.inventory.entitiesGrid.euiDataGrid.typeTooltip": "实体的类型 (entity.type)", + "xpack.inventory.entityActions.discoverLink": "在 Discover 中打开", "xpack.inventory.featureRegistry.inventoryFeatureName": "库存", "xpack.inventory.home.serviceAlertsTable.tooltip.activeAlertsExplanation": "活动告警", "xpack.inventory.inventoryLinkTitle": "库存",