diff --git a/src/plugins/dashboard/public/dashboard_container/embeddable/api/run_save_functions.tsx b/src/plugins/dashboard/public/dashboard_container/embeddable/api/run_save_functions.tsx index 66c52f14a0002..eb991da9f0199 100644 --- a/src/plugins/dashboard/public/dashboard_container/embeddable/api/run_save_functions.tsx +++ b/src/plugins/dashboard/public/dashboard_container/embeddable/api/run_save_functions.tsx @@ -14,7 +14,9 @@ import { showSaveModal } from '@kbn/saved-objects-plugin/public'; import { cloneDeep } from 'lodash'; import React from 'react'; import { batch } from 'react-redux'; -import { DashboardContainerInput } from '../../../../common'; + +import { EmbeddableInput, isReferenceOrValueEmbeddable } from '@kbn/embeddable-plugin/public'; +import { DashboardContainerInput, DashboardPanelMap } from '../../../../common'; import { DASHBOARD_CONTENT_ID, SAVED_OBJECT_POST_TIME } from '../../../dashboard_constants'; import { SaveDashboardReturn, @@ -241,12 +243,38 @@ export async function runClone(this: DashboardContainer) { }; } + const isManaged = this.getState().componentState.managed; + const newPanels = await (async () => { + if (!isManaged) return currentState.panels; + + // this is a managed dashboard - unlink all by reference embeddables on clone + const unlinkedPanels: DashboardPanelMap = {}; + for (const [panelId, panel] of Object.entries(currentState.panels)) { + const child = this.getChild(panelId); + if ( + child && + isReferenceOrValueEmbeddable(child) && + child.inputIsRefType(child.getInput() as EmbeddableInput) + ) { + const valueTypeInput = await child.getInputAsValueType(); + unlinkedPanels[panelId] = { + ...panel, + explicitInput: valueTypeInput, + }; + continue; + } + unlinkedPanels[panelId] = panel; + } + return unlinkedPanels; + })(); + const saveResult = await saveDashboardState({ saveOptions: { saveAsCopy: true, }, currentState: { ...stateToSave, + panels: newPanels, title: newTitle, }, }); diff --git a/src/plugins/embeddable/public/add_panel_flyout/add_panel_flyout.test.tsx b/src/plugins/embeddable/public/add_panel_flyout/add_panel_flyout.test.tsx index a39f4ee95f15b..3b8052c88a798 100644 --- a/src/plugins/embeddable/public/add_panel_flyout/add_panel_flyout.test.tsx +++ b/src/plugins/embeddable/public/add_panel_flyout/add_panel_flyout.test.tsx @@ -68,7 +68,7 @@ describe('add panel flyout', () => { getEmbeddableFactory: embeddableStart.getEmbeddableFactory, } ); - container.addNewEmbeddable = jest.fn(); + container.addNewEmbeddable = jest.fn().mockResolvedValue({ id: 'foo' }); }); test('add panel flyout renders SavedObjectFinder', async () => { diff --git a/src/plugins/embeddable/public/add_panel_flyout/add_panel_flyout.tsx b/src/plugins/embeddable/public/add_panel_flyout/add_panel_flyout.tsx index f0554fed61782..a407fb025e2c8 100644 --- a/src/plugins/embeddable/public/add_panel_flyout/add_panel_flyout.tsx +++ b/src/plugins/embeddable/public/add_panel_flyout/add_panel_flyout.tsx @@ -32,6 +32,7 @@ import { SavedObjectEmbeddableInput, EmbeddableFactoryNotFoundError, } from '../lib'; +import { savedObjectToPanel } from '../registry/saved_object_to_panel_methods'; type FactoryMap = { [key: string]: EmbeddableFactory }; @@ -101,12 +102,30 @@ export const AddPanelFlyout = ({ throw new EmbeddableFactoryNotFoundError(type); } - const embeddable = await container.addNewEmbeddable( - factoryForSavedObjectType.type, - { savedObjectId: id }, - savedObject.attributes - ); - onAddPanel?.(embeddable.id); + let embeddableId: string; + + if (savedObjectToPanel[type]) { + // this panel type has a custom method for converting saved objects to panels + const panel = savedObjectToPanel[type](savedObject); + + const { id: _embeddableId } = await container.addNewEmbeddable( + factoryForSavedObjectType.type, + panel, + savedObject.attributes + ); + + embeddableId = _embeddableId; + } else { + const { id: _embeddableId } = await container.addNewEmbeddable( + factoryForSavedObjectType.type, + { savedObjectId: id }, + savedObject.attributes + ); + + embeddableId = _embeddableId; + } + + onAddPanel?.(embeddableId); showSuccessToast(name); runAddTelemetry(container.type, factoryForSavedObjectType, savedObject); @@ -136,6 +155,14 @@ export const AddPanelFlyout = ({ noItemsMessage={i18n.translate('embeddableApi.addPanel.noMatchingObjectsMessage', { defaultMessage: 'No matching objects found.', })} + getTooltipText={(item) => { + return item.managed + ? i18n.translate('embeddableApi.addPanel.managedPanelTooltip', { + defaultMessage: + 'This panel is managed by Elastic. It can be added but will be unlinked from the library.', + }) + : undefined; + }} /> diff --git a/src/plugins/embeddable/public/index.ts b/src/plugins/embeddable/public/index.ts index 5f9254ae11748..2eec70d591db3 100644 --- a/src/plugins/embeddable/public/index.ts +++ b/src/plugins/embeddable/public/index.ts @@ -113,6 +113,8 @@ export { serializeReactEmbeddableTitles, } from './react_embeddable_system'; +export { registerSavedObjectToPanelMethod } from './registry/saved_object_to_panel_methods'; + export function plugin(initializerContext: PluginInitializerContext) { return new EmbeddablePublicPlugin(initializerContext); } diff --git a/src/plugins/embeddable/public/registry/saved_object_to_panel_methods.ts b/src/plugins/embeddable/public/registry/saved_object_to_panel_methods.ts new file mode 100644 index 0000000000000..2d996666d4042 --- /dev/null +++ b/src/plugins/embeddable/public/registry/saved_object_to_panel_methods.ts @@ -0,0 +1,22 @@ +/* + * 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 { SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common'; + +type SavedObjectToPanelMethod = ( + savedObject: SavedObjectCommon +) => { savedObjectId: string } | Partial; + +export const savedObjectToPanel: Record> = {}; + +export const registerSavedObjectToPanelMethod = ( + savedObjectType: string, + method: SavedObjectToPanelMethod +) => { + savedObjectToPanel[savedObjectType] = method; +}; diff --git a/src/plugins/saved_objects_finder/public/finder/saved_object_finder.test.tsx b/src/plugins/saved_objects_finder/public/finder/saved_object_finder.test.tsx index 8ac5715263e30..c3e143ddbac42 100644 --- a/src/plugins/saved_objects_finder/public/finder/saved_object_finder.test.tsx +++ b/src/plugins/saved_objects_finder/public/finder/saved_object_finder.test.tsx @@ -9,7 +9,12 @@ const nextTick = () => new Promise((res) => process.nextTick(res)); import lodash from 'lodash'; -jest.spyOn(lodash, 'debounce').mockImplementation((fn: any) => fn); +import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +jest.spyOn(lodash, 'debounce').mockImplementation((fn: any) => { + fn.cancel = jest.fn(); + return fn; +}); import { EuiInMemoryTable, EuiLink, @@ -962,4 +967,36 @@ describe('SavedObjectsFinder', () => { expect(findTestSubject(wrapper, 'tableHeaderCell_references_2')).toHaveLength(0); }); }); + + it('should add a tooltip when text is provided', async () => { + (contentClient.mSearch as any as jest.SpyInstance).mockResolvedValue({ + hits: [doc, doc2, doc3], + }); + + const tooltipText = 'This is a tooltip'; + + render( + (item.id === doc3.id ? tooltipText : undefined)} + /> + ); + + const assertTooltip = async (linkTitle: string, show: boolean) => { + const elem = await screen.findByText(linkTitle); + userEvent.hover(elem); + + const tooltip = screen.queryByText(tooltipText); + if (show) { + expect(tooltip).toBeInTheDocument(); + } else { + expect(tooltip).toBeNull(); + } + }; + + assertTooltip(doc.attributes.title, false); + assertTooltip(doc2.attributes.title, false); + assertTooltip(doc3.attributes.title, true); + }); }); diff --git a/src/plugins/saved_objects_finder/public/finder/saved_object_finder.tsx b/src/plugins/saved_objects_finder/public/finder/saved_object_finder.tsx index d660a8bf2857a..034f63083be1d 100644 --- a/src/plugins/saved_objects_finder/public/finder/saved_object_finder.tsx +++ b/src/plugins/saved_objects_finder/public/finder/saved_object_finder.tsx @@ -77,6 +77,7 @@ interface BaseSavedObjectFinder { leftChildren?: ReactElement | ReactElement[]; children?: ReactElement | ReactElement[]; helpText?: string; + getTooltipText?: (item: SavedObjectFinderItem) => string | undefined; } interface SavedObjectFinderFixedPage extends BaseSavedObjectFinder { @@ -288,7 +289,7 @@ export class SavedObjectFinderUi extends React.Component< ? currentSavedObjectMetaData.getTooltipForSavedObject(item.simple) : `${item.name} (${currentSavedObjectMetaData!.name})`; - return ( + const link = ( ); + + const tooltipText = this.props.getTooltipText?.(item); + + return tooltipText ? ( + + {link} + + ) : ( + link + ); }, }, ...(tagColumn ? [tagColumn] : []), diff --git a/src/plugins/saved_search/public/plugin.ts b/src/plugins/saved_search/public/plugin.ts index 8e8dd697cc55c..5b2d1e4e79fbf 100644 --- a/src/plugins/saved_search/public/plugin.ts +++ b/src/plugins/saved_search/public/plugin.ts @@ -17,13 +17,14 @@ import type { ContentManagementPublicStart, } from '@kbn/content-management-plugin/public'; import type { SOWithMetadata } from '@kbn/content-management-utils'; -import type { EmbeddableStart } from '@kbn/embeddable-plugin/public'; +import { EmbeddableStart, registerSavedObjectToPanelMethod } from '@kbn/embeddable-plugin/public'; import { getSavedSearch, saveSavedSearch, SaveSavedSearchOptions, getNewSavedSearch, SavedSearchUnwrapResult, + SearchByValueInput, } from './services/saved_searches'; import { SavedSearch, SavedSearchAttributes } from '../common/types'; import { SavedSearchType, LATEST_VERSION } from '../common'; @@ -35,6 +36,7 @@ import { getSavedSearchAttributeService, toSavedSearch, } from './services/saved_searches'; +import { savedObjectToEmbeddableAttributes } from './services/saved_searches/saved_search_attribute_service'; /** * Saved search plugin public Setup contract @@ -115,6 +117,19 @@ export class SavedSearchPublicPlugin expressions.registerType(kibanaContext); + registerSavedObjectToPanelMethod( + SavedSearchType, + (savedObject) => { + if (!savedObject.managed) { + return { savedObjectId: savedObject.id }; + } + + return { + attributes: savedObjectToEmbeddableAttributes(savedObject), + }; + } + ); + return {}; } diff --git a/src/plugins/saved_search/public/services/saved_searches/saved_search_attribute_service.ts b/src/plugins/saved_search/public/services/saved_searches/saved_search_attribute_service.ts index aff78e18b6bd1..726853d26ebe4 100644 --- a/src/plugins/saved_search/public/services/saved_searches/saved_search_attribute_service.ts +++ b/src/plugins/saved_search/public/services/saved_searches/saved_search_attribute_service.ts @@ -9,6 +9,8 @@ import type { AttributeService, EmbeddableStart } from '@kbn/embeddable-plugin/public'; import type { OnSaveProps } from '@kbn/saved-objects-plugin/public'; import { SEARCH_EMBEDDABLE_TYPE } from '@kbn/discover-utils'; +import { SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common'; +import { SavedSearchAttributes } from '../../../common'; import type { SavedSearch, SavedSearchByValueAttributes, @@ -41,6 +43,13 @@ export type SavedSearchAttributeService = AttributeService< SavedSearchUnwrapMetaInfo >; +export const savedObjectToEmbeddableAttributes = ( + savedObject: SavedObjectCommon +) => ({ + ...savedObject.attributes, + references: savedObject.references, +}); + export function getSavedSearchAttributeService( services: SavedSearchesServiceDeps & { embeddable: EmbeddableStart; @@ -67,10 +76,7 @@ export function getSavedSearchAttributeService( const so = await getSearchSavedObject(savedObjectId, createGetSavedSearchDeps(services)); return { - attributes: { - ...so.item.attributes, - references: so.item.references, - }, + attributes: savedObjectToEmbeddableAttributes(so.item), metaInfo: { sharingSavedObjectProps: so.meta, managed: so.item.managed, diff --git a/src/plugins/saved_search/tsconfig.json b/src/plugins/saved_search/tsconfig.json index b1aa1679469ee..c4ea0eaf4d5bc 100644 --- a/src/plugins/saved_search/tsconfig.json +++ b/src/plugins/saved_search/tsconfig.json @@ -32,6 +32,7 @@ "@kbn/logging", "@kbn/core-plugins-server", "@kbn/utility-types", + "@kbn/saved-objects-finder-plugin", ], "exclude": [ "target/**/*", diff --git a/src/plugins/visualizations/public/plugin.ts b/src/plugins/visualizations/public/plugin.ts index cd840302ff01d..594ea6ca9488a 100644 --- a/src/plugins/visualizations/public/plugin.ts +++ b/src/plugins/visualizations/public/plugin.ts @@ -47,7 +47,11 @@ import type { UsageCollectionStart } from '@kbn/usage-collection-plugin/public'; import type { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import type { ExpressionsSetup, ExpressionsStart } from '@kbn/expressions-plugin/public'; -import type { EmbeddableSetup, EmbeddableStart } from '@kbn/embeddable-plugin/public'; +import { + EmbeddableSetup, + EmbeddableStart, + registerSavedObjectToPanelMethod, +} from '@kbn/embeddable-plugin/public'; import type { SavedObjectTaggingOssPluginStart } from '@kbn/saved-objects-tagging-oss-plugin/public'; import type { NavigationPublicPluginStart as NavigationStart } from '@kbn/navigation-plugin/public'; import type { SharePluginSetup, SharePluginStart } from '@kbn/share-plugin/public'; @@ -112,8 +116,14 @@ import { } from './services'; import { VisualizeConstants } from '../common/constants'; import { EditInLensAction } from './actions/edit_in_lens_action'; -import { ListingViewRegistry } from './types'; -import { LATEST_VERSION, CONTENT_ID } from '../common/content_management'; +import { ListingViewRegistry, SerializedVis } from './types'; +import { + LATEST_VERSION, + CONTENT_ID, + VisualizationSavedObjectAttributes, +} from '../common/content_management'; +import { SerializedVisData } from '../common'; +import { VisualizeByValueInput } from './embeddable/visualize_embeddable'; /** * Interface for this plugin's returned setup/start contracts. @@ -397,6 +407,37 @@ export class VisualizationsPlugin name: 'Visualize Library', }); + registerSavedObjectToPanelMethod( + CONTENT_ID, + (savedObject) => { + const visState = savedObject.attributes.visState; + + // not sure if visState actually is ever undefined, but following the type + if (!savedObject.managed || !visState) { + return { + savedObjectId: savedObject.id, + }; + } + + // data is not always defined, so I added a default value since the extract + // routine in the embeddable factory expects it to be there + const savedVis = JSON.parse(visState) as Omit & { + data?: SerializedVisData; + }; + + if (!savedVis.data) { + savedVis.data = { + searchSource: {}, + aggs: [], + }; + } + + return { + savedVis: savedVis as SerializedVis, // now we're sure we have "data" prop + }; + } + ); + return { ...this.types.setup(), visEditorsRegistry, diff --git a/test/functional/fixtures/kbn_archiver/managed_content.json b/test/functional/fixtures/kbn_archiver/managed_content.json index 9e46c515d6b8b..d2cafbe0c842e 100644 --- a/test/functional/fixtures/kbn_archiver/managed_content.json +++ b/test/functional/fixtures/kbn_archiver/managed_content.json @@ -1,17 +1,19 @@ {"attributes":{"allowHidden":false,"fieldAttrs":"{}","fieldFormatMap":"{}","fields":"[]","name":"logstash-*","runtimeFieldMap":"{}","sourceFilters":"[]","timeFieldName":"@timestamp","title":"logstash-*"},"coreMigrationVersion":"8.8.0","created_at":"2024-01-18T17:35:58.606Z","id":"5f863f70-4728-4e8d-b441-db08f8c33b28","managed":false,"references":[],"type":"index-pattern","typeMigrationVersion":"8.0.0","updated_at":"2024-01-18T17:35:58.606Z","version":"WzI4LDFd"} -{"attributes":{"description":"","state":{"adHocDataViews":{},"datasourceStates":{"formBased":{"layers":{"e633b1af-3ab4-4bf5-8faa-fefde06c4a4a":{"columnOrder":["f2555a1a-6f93-43fd-bc63-acdfadd47729","d229daf9-9658-4579-99af-01d8adb2f25f"],"columns":{"d229daf9-9658-4579-99af-01d8adb2f25f":{"dataType":"number","isBucketed":false,"label":"Median of bytes","operationType":"median","params":{"emptyAsNull":true},"scale":"ratio","sourceField":"bytes"},"f2555a1a-6f93-43fd-bc63-acdfadd47729":{"dataType":"date","isBucketed":true,"label":"@timestamp","operationType":"date_histogram","params":{"dropPartials":false,"includeEmptyRows":true,"interval":"auto"},"scale":"interval","sourceField":"@timestamp"}},"incompleteColumns":{},"sampling":1}}},"indexpattern":{"layers":{}},"textBased":{"layers":{}}},"filters":[],"internalReferences":[],"query":{"language":"kuery","query":""},"visualization":{"axisTitlesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"fittingFunction":"None","gridlinesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"labelsOrientation":{"x":0,"yLeft":0,"yRight":0},"layers":[{"accessors":["d229daf9-9658-4579-99af-01d8adb2f25f"],"layerId":"e633b1af-3ab4-4bf5-8faa-fefde06c4a4a","layerType":"data","position":"top","seriesType":"bar_stacked","showGridlines":false,"xAccessor":"f2555a1a-6f93-43fd-bc63-acdfadd47729"}],"legend":{"isVisible":true,"position":"right"},"preferredSeriesType":"bar_stacked","tickLabelsVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"valueLabels":"hide"}},"title":"Lens vis (managed)","visualizationType":"lnsXY"},"coreMigrationVersion":"8.8.0","created_at":"2024-01-18T17:42:12.920Z","id":"managed-36db-4a3b-a4ba-7a64ab8f130b","managed":true,"references":[{"id":"5f863f70-4728-4e8d-b441-db08f8c33b28","name":"indexpattern-datasource-layer-e633b1af-3ab4-4bf5-8faa-fefde06c4a4a","type":"index-pattern"}],"type":"lens","typeMigrationVersion":"8.9.0","updated_at":"2024-01-18T17:42:12.920Z","version":"WzQ1LDFd"} +{"attributes":{"description":"","state":{"adHocDataViews":{},"datasourceStates":{"formBased":{"layers":{"e633b1af-3ab4-4bf5-8faa-fefde06c4a4a":{"columnOrder":["f2555a1a-6f93-43fd-bc63-acdfadd47729","d229daf9-9658-4579-99af-01d8adb2f25f"],"columns":{"d229daf9-9658-4579-99af-01d8adb2f25f":{"dataType":"number","isBucketed":false,"label":"Median of bytes","operationType":"median","params":{"emptyAsNull":true},"scale":"ratio","sourceField":"bytes"},"f2555a1a-6f93-43fd-bc63-acdfadd47729":{"dataType":"date","isBucketed":true,"label":"@timestamp","operationType":"date_histogram","params":{"dropPartials":false,"includeEmptyRows":true,"interval":"auto"},"scale":"interval","sourceField":"@timestamp"}},"incompleteColumns":{},"sampling":1}}},"indexpattern":{"layers":{}},"textBased":{"layers":{}}},"filters":[],"internalReferences":[],"query":{"language":"kuery","query":""},"visualization":{"axisTitlesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"fittingFunction":"None","gridlinesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"labelsOrientation":{"x":0,"yLeft":0,"yRight":0},"layers":[{"accessors":["d229daf9-9658-4579-99af-01d8adb2f25f"],"layerId":"e633b1af-3ab4-4bf5-8faa-fefde06c4a4a","layerType":"data","position":"top","seriesType":"bar_stacked","showGridlines":false,"xAccessor":"f2555a1a-6f93-43fd-bc63-acdfadd47729"}],"legend":{"isVisible":true,"position":"right"},"preferredSeriesType":"bar_stacked","tickLabelsVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"valueLabels":"hide"}},"title":"Managed lens vis","visualizationType":"lnsXY"},"coreMigrationVersion":"8.8.0","created_at":"2024-01-18T17:42:12.920Z","id":"managed-36db-4a3b-a4ba-7a64ab8f130b","managed":true,"references":[{"id":"5f863f70-4728-4e8d-b441-db08f8c33b28","name":"indexpattern-datasource-layer-e633b1af-3ab4-4bf5-8faa-fefde06c4a4a","type":"index-pattern"}],"type":"lens","typeMigrationVersion":"8.9.0","updated_at":"2024-01-18T17:42:12.920Z","version":"WzQ1LDFd"} -{"attributes":{"description":"","state":{"adHocDataViews":{},"datasourceStates":{"formBased":{"layers":{"e633b1af-3ab4-4bf5-8faa-fefde06c4a4a":{"columnOrder":["f2555a1a-6f93-43fd-bc63-acdfadd47729","d229daf9-9658-4579-99af-01d8adb2f25f"],"columns":{"d229daf9-9658-4579-99af-01d8adb2f25f":{"dataType":"number","isBucketed":false,"label":"Median of bytes","operationType":"median","params":{"emptyAsNull":true},"scale":"ratio","sourceField":"bytes"},"f2555a1a-6f93-43fd-bc63-acdfadd47729":{"dataType":"date","isBucketed":true,"label":"@timestamp","operationType":"date_histogram","params":{"dropPartials":false,"includeEmptyRows":true,"interval":"auto"},"scale":"interval","sourceField":"@timestamp"}},"incompleteColumns":{},"sampling":1}}},"indexpattern":{"layers":{}},"textBased":{"layers":{}}},"filters":[],"internalReferences":[],"query":{"language":"kuery","query":""},"visualization":{"axisTitlesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"fittingFunction":"None","gridlinesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"labelsOrientation":{"x":0,"yLeft":0,"yRight":0},"layers":[{"accessors":["d229daf9-9658-4579-99af-01d8adb2f25f"],"layerId":"e633b1af-3ab4-4bf5-8faa-fefde06c4a4a","layerType":"data","position":"top","seriesType":"bar_stacked","showGridlines":false,"xAccessor":"f2555a1a-6f93-43fd-bc63-acdfadd47729"}],"legend":{"isVisible":true,"position":"right"},"preferredSeriesType":"bar_stacked","tickLabelsVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"valueLabels":"hide"}},"title":"Lens vis (unmanaged)","visualizationType":"lnsXY"},"coreMigrationVersion":"8.8.0","created_at":"2024-01-18T17:42:12.920Z","id":"unmanaged-36db-4a3b-a4ba-7a64ab8f130b","managed":false,"references":[{"id":"5f863f70-4728-4e8d-b441-db08f8c33b28","name":"indexpattern-datasource-layer-e633b1af-3ab4-4bf5-8faa-fefde06c4a4a","type":"index-pattern"}],"type":"lens","typeMigrationVersion":"8.9.0","updated_at":"2024-01-18T17:42:12.920Z","version":"WzQ1LDFd"} +{"attributes":{"description":"","state":{"adHocDataViews":{},"datasourceStates":{"formBased":{"layers":{"e633b1af-3ab4-4bf5-8faa-fefde06c4a4a":{"columnOrder":["f2555a1a-6f93-43fd-bc63-acdfadd47729","d229daf9-9658-4579-99af-01d8adb2f25f"],"columns":{"d229daf9-9658-4579-99af-01d8adb2f25f":{"dataType":"number","isBucketed":false,"label":"Median of bytes","operationType":"median","params":{"emptyAsNull":true},"scale":"ratio","sourceField":"bytes"},"f2555a1a-6f93-43fd-bc63-acdfadd47729":{"dataType":"date","isBucketed":true,"label":"@timestamp","operationType":"date_histogram","params":{"dropPartials":false,"includeEmptyRows":true,"interval":"auto"},"scale":"interval","sourceField":"@timestamp"}},"incompleteColumns":{},"sampling":1}}},"indexpattern":{"layers":{}},"textBased":{"layers":{}}},"filters":[],"internalReferences":[],"query":{"language":"kuery","query":""},"visualization":{"axisTitlesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"fittingFunction":"None","gridlinesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"labelsOrientation":{"x":0,"yLeft":0,"yRight":0},"layers":[{"accessors":["d229daf9-9658-4579-99af-01d8adb2f25f"],"layerId":"e633b1af-3ab4-4bf5-8faa-fefde06c4a4a","layerType":"data","position":"top","seriesType":"bar_stacked","showGridlines":false,"xAccessor":"f2555a1a-6f93-43fd-bc63-acdfadd47729"}],"legend":{"isVisible":true,"position":"right"},"preferredSeriesType":"bar_stacked","tickLabelsVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"valueLabels":"hide"}},"title":"Unmanaged lens vis","visualizationType":"lnsXY"},"coreMigrationVersion":"8.8.0","created_at":"2024-01-18T17:42:12.920Z","id":"unmanaged-36db-4a3b-a4ba-7a64ab8f130b","managed":false,"references":[{"id":"5f863f70-4728-4e8d-b441-db08f8c33b28","name":"indexpattern-datasource-layer-e633b1af-3ab4-4bf5-8faa-fefde06c4a4a","type":"index-pattern"}],"type":"lens","typeMigrationVersion":"8.9.0","updated_at":"2024-01-18T17:42:12.920Z","version":"WzQ1LDFd"} -{"attributes":{"columns":["@tags","clientip"],"description":"","grid":{},"hideChart":false,"isTextBasedQuery":false,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"agent.raw:\\\"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)\\\" \",\"language\":\"kuery\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}"},"sort":[["@timestamp","desc"]],"timeRestore":false,"title":"Saved search","usesAdHocDataView":false},"coreMigrationVersion":"8.8.0","created_at":"2024-01-22T18:11:05.016Z","id":"managed-3d62-4113-ac7c-de2e20a68fbc","managed":true,"references":[{"id":"5f863f70-4728-4e8d-b441-db08f8c33b28","name":"kibanaSavedObjectMeta.searchSourceJSON.index","type":"index-pattern"}],"type":"search","typeMigrationVersion":"8.0.0","updated_at":"2024-01-22T18:11:05.016Z","version":"WzIzLDFd"} +{"attributes":{"columns":["@tags","clientip"],"description":"","grid":{},"hideChart":false,"isTextBasedQuery":false,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"agent.raw:\\\"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)\\\" \",\"language\":\"kuery\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}"},"sort":[["@timestamp","desc"]],"timeRestore":false,"title":"Managed saved search","usesAdHocDataView":false},"coreMigrationVersion":"8.8.0","created_at":"2024-01-22T18:11:05.016Z","id":"managed-3d62-4113-ac7c-de2e20a68fbc","managed":true,"references":[{"id":"5f863f70-4728-4e8d-b441-db08f8c33b28","name":"kibanaSavedObjectMeta.searchSourceJSON.index","type":"index-pattern"}],"type":"search","typeMigrationVersion":"8.0.0","updated_at":"2024-01-22T18:11:05.016Z","version":"WzIzLDFd"} -{"attributes":{"columns":["@tags","clientip"],"description":"","grid":{},"hideChart":false,"isTextBasedQuery":false,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"agent.raw:\\\"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)\\\" \",\"language\":\"kuery\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}"},"sort":[["@timestamp","desc"]],"timeRestore":false,"title":"Saved search","usesAdHocDataView":false},"coreMigrationVersion":"8.8.0","created_at":"2024-01-22T18:11:05.016Z","id":"unmanaged-3d62-4113-ac7c-de2e20a68fbc","managed":false,"references":[{"id":"5f863f70-4728-4e8d-b441-db08f8c33b28","name":"kibanaSavedObjectMeta.searchSourceJSON.index","type":"index-pattern"}],"type":"search","typeMigrationVersion":"8.0.0","updated_at":"2024-01-22T18:11:05.016Z","version":"WzIzLDFd"} +{"attributes":{"columns":["@tags","clientip"],"description":"","grid":{},"hideChart":false,"isTextBasedQuery":false,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"agent.raw:\\\"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)\\\" \",\"language\":\"kuery\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}"},"sort":[["@timestamp","desc"]],"timeRestore":false,"title":"Unmanaged saved search","usesAdHocDataView":false},"coreMigrationVersion":"8.8.0","created_at":"2024-01-22T18:11:05.016Z","id":"unmanaged-3d62-4113-ac7c-de2e20a68fbc","managed":false,"references":[{"id":"5f863f70-4728-4e8d-b441-db08f8c33b28","name":"kibanaSavedObjectMeta.searchSourceJSON.index","type":"index-pattern"}],"type":"search","typeMigrationVersion":"8.0.0","updated_at":"2024-01-22T18:11:05.016Z","version":"WzIzLDFd"} -{"attributes":{"description":"","kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"title":"Legacy visualization","uiStateJSON":"{}","version":1,"visState":"{\"title\":\"Legacy visualization\",\"type\":\"metrics\",\"aggs\":[],\"params\":{\"id\":\"1a14d0ad-0d74-4470-a189-8f040cddc1a1\",\"type\":\"timeseries\",\"series\":[{\"id\":\"daa8bbf7-86cc-4394-b249-be48da9f7351\",\"color\":\"#68BC00\",\"split_mode\":\"everything\",\"palette\":{\"type\":\"palette\",\"name\":\"default\"},\"metrics\":[{\"id\":\"795375d9-1aa6-454d-9b23-687e69f3382c\",\"type\":\"count\"}],\"separate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"default\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":0.5,\"stacked\":\"none\",\"override_index_pattern\":0,\"series_drop_last_bucket\":0}],\"time_field\":\"\",\"use_kibana_indexes\":true,\"interval\":\"\",\"axis_position\":\"left\",\"axis_formatter\":\"number\",\"axis_scale\":\"normal\",\"show_legend\":1,\"truncate_legend\":1,\"max_lines_legend\":1,\"show_grid\":1,\"tooltip_mode\":\"show_all\",\"drop_last_bucket\":0,\"index_pattern_ref_name\":\"metrics_0_index_pattern\"}}"},"coreMigrationVersion":"8.8.0","created_at":"2024-01-24T18:53:06.818Z","id":"managed-feb9-4ba6-9538-1b8f67fb4f57","managed":true,"references":[{"id":"5f863f70-4728-4e8d-b441-db08f8c33b28","name":"metrics_0_index_pattern","type":"index-pattern"}],"type":"visualization","typeMigrationVersion":"8.5.0","updated_at":"2024-01-24T18:53:06.818Z","version":"WzEzLDFd"} +{"attributes":{"description":"","kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"title":"Managed legacy visualization","uiStateJSON":"{}","version":1,"visState":"{\"title\":\"Legacy visualization\",\"type\":\"metrics\",\"aggs\":[],\"params\":{\"id\":\"1a14d0ad-0d74-4470-a189-8f040cddc1a1\",\"type\":\"timeseries\",\"series\":[{\"id\":\"daa8bbf7-86cc-4394-b249-be48da9f7351\",\"color\":\"#68BC00\",\"split_mode\":\"everything\",\"palette\":{\"type\":\"palette\",\"name\":\"default\"},\"metrics\":[{\"id\":\"795375d9-1aa6-454d-9b23-687e69f3382c\",\"type\":\"count\"}],\"separate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"default\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":0.5,\"stacked\":\"none\",\"override_index_pattern\":0,\"series_drop_last_bucket\":0}],\"time_field\":\"\",\"use_kibana_indexes\":true,\"interval\":\"\",\"axis_position\":\"left\",\"axis_formatter\":\"number\",\"axis_scale\":\"normal\",\"show_legend\":1,\"truncate_legend\":1,\"max_lines_legend\":1,\"show_grid\":1,\"tooltip_mode\":\"show_all\",\"drop_last_bucket\":0,\"index_pattern_ref_name\":\"metrics_0_index_pattern\"}}"},"coreMigrationVersion":"8.8.0","created_at":"2024-01-24T18:53:06.818Z","id":"managed-feb9-4ba6-9538-1b8f67fb4f57","managed":true,"references":[{"id":"5f863f70-4728-4e8d-b441-db08f8c33b28","name":"metrics_0_index_pattern","type":"index-pattern"}],"type":"visualization","typeMigrationVersion":"8.5.0","updated_at":"2024-01-24T18:53:06.818Z","version":"WzEzLDFd"} -{"attributes":{"description":"","kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"title":"Legacy visualization","uiStateJSON":"{}","version":1,"visState":"{\"title\":\"Legacy visualization\",\"type\":\"metrics\",\"aggs\":[],\"params\":{\"id\":\"1a14d0ad-0d74-4470-a189-8f040cddc1a1\",\"type\":\"timeseries\",\"series\":[{\"id\":\"daa8bbf7-86cc-4394-b249-be48da9f7351\",\"color\":\"#68BC00\",\"split_mode\":\"everything\",\"palette\":{\"type\":\"palette\",\"name\":\"default\"},\"metrics\":[{\"id\":\"795375d9-1aa6-454d-9b23-687e69f3382c\",\"type\":\"count\"}],\"separate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"default\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":0.5,\"stacked\":\"none\",\"override_index_pattern\":0,\"series_drop_last_bucket\":0}],\"time_field\":\"\",\"use_kibana_indexes\":true,\"interval\":\"\",\"axis_position\":\"left\",\"axis_formatter\":\"number\",\"axis_scale\":\"normal\",\"show_legend\":1,\"truncate_legend\":1,\"max_lines_legend\":1,\"show_grid\":1,\"tooltip_mode\":\"show_all\",\"drop_last_bucket\":0,\"index_pattern_ref_name\":\"metrics_0_index_pattern\"}}"},"coreMigrationVersion":"8.8.0","created_at":"2024-01-24T18:53:06.818Z","id":"unmanaged-feb9-4ba6-9538-1b8f67fb4f57","managed":false,"references":[{"id":"5f863f70-4728-4e8d-b441-db08f8c33b28","name":"metrics_0_index_pattern","type":"index-pattern"}],"type":"visualization","typeMigrationVersion":"8.5.0","updated_at":"2024-01-24T18:53:06.818Z","version":"WzEzLDFd"} +{"attributes":{"description":"","kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"title":"Unmanaged legacy visualization","uiStateJSON":"{}","version":1,"visState":"{\"title\":\"Legacy visualization\",\"type\":\"metrics\",\"aggs\":[],\"params\":{\"id\":\"1a14d0ad-0d74-4470-a189-8f040cddc1a1\",\"type\":\"timeseries\",\"series\":[{\"id\":\"daa8bbf7-86cc-4394-b249-be48da9f7351\",\"color\":\"#68BC00\",\"split_mode\":\"everything\",\"palette\":{\"type\":\"palette\",\"name\":\"default\"},\"metrics\":[{\"id\":\"795375d9-1aa6-454d-9b23-687e69f3382c\",\"type\":\"count\"}],\"separate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"default\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":0.5,\"stacked\":\"none\",\"override_index_pattern\":0,\"series_drop_last_bucket\":0}],\"time_field\":\"\",\"use_kibana_indexes\":true,\"interval\":\"\",\"axis_position\":\"left\",\"axis_formatter\":\"number\",\"axis_scale\":\"normal\",\"show_legend\":1,\"truncate_legend\":1,\"max_lines_legend\":1,\"show_grid\":1,\"tooltip_mode\":\"show_all\",\"drop_last_bucket\":0,\"index_pattern_ref_name\":\"metrics_0_index_pattern\"}}"},"coreMigrationVersion":"8.8.0","created_at":"2024-01-24T18:53:06.818Z","id":"unmanaged-feb9-4ba6-9538-1b8f67fb4f57","managed":false,"references":[{"id":"5f863f70-4728-4e8d-b441-db08f8c33b28","name":"metrics_0_index_pattern","type":"index-pattern"}],"type":"visualization","typeMigrationVersion":"8.5.0","updated_at":"2024-01-24T18:53:06.818Z","version":"WzEzLDFd"} -{"attributes":{"description":"","layerListJSON":"[{\"locale\":\"autoselect\",\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"isAutoSelect\":true,\"lightModeDefault\":\"road_map_desaturated\"},\"id\":\"5ff9c98e-e0d3-4aff-ac98-b33c191496b4\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":1,\"visible\":true,\"style\":{\"type\":\"EMS_VECTOR_TILE\",\"color\":\"\"},\"includeInFitToBounds\":true,\"type\":\"EMS_VECTOR_TILE\"}]","mapStateJSON":"{\"adHocDataViews\":[],\"zoom\":1.4,\"center\":{\"lon\":0,\"lat\":19.94277},\"timeFilters\":{\"from\":\"now-15m\",\"to\":\"now\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":60000},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[],\"settings\":{\"autoFitToDataBounds\":false,\"backgroundColor\":\"#ffffff\",\"customIcons\":[],\"disableInteractive\":false,\"disableTooltipControl\":false,\"hideToolbarOverlay\":false,\"hideLayerControl\":false,\"hideViewControl\":false,\"initialLocation\":\"LAST_SAVED_LOCATION\",\"fixedLocation\":{\"lat\":0,\"lon\":0,\"zoom\":2},\"browserLocation\":{\"zoom\":2},\"keydownScrollZoom\":false,\"maxZoom\":24,\"minZoom\":0,\"showScaleControl\":false,\"showSpatialFilters\":true,\"showTimesliderToggleButton\":true,\"spatialFiltersAlpa\":0.3,\"spatialFiltersFillColor\":\"#DA8B45\",\"spatialFiltersLineColor\":\"#DA8B45\"}}","title":"Map","uiStateJSON":"{\"isLayerTOCOpen\":true,\"openTOCDetails\":[]}"},"coreMigrationVersion":"8.8.0","created_at":"2024-01-24T18:22:40.360Z","id":"managed-d7ab-46eb-a807-8fed28ed8566","managed":true,"references":[],"type":"map","typeMigrationVersion":"8.4.0","updated_at":"2024-01-24T18:23:07.090Z","version":"WzEyLDFd"} +{"attributes":{"description":"","layerListJSON":"[{\"locale\":\"autoselect\",\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"isAutoSelect\":true,\"lightModeDefault\":\"road_map_desaturated\"},\"id\":\"5ff9c98e-e0d3-4aff-ac98-b33c191496b4\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":1,\"visible\":true,\"style\":{\"type\":\"EMS_VECTOR_TILE\",\"color\":\"\"},\"includeInFitToBounds\":true,\"type\":\"EMS_VECTOR_TILE\"}]","mapStateJSON":"{\"adHocDataViews\":[],\"zoom\":1.4,\"center\":{\"lon\":0,\"lat\":19.94277},\"timeFilters\":{\"from\":\"now-15m\",\"to\":\"now\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":60000},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[],\"settings\":{\"autoFitToDataBounds\":false,\"backgroundColor\":\"#ffffff\",\"customIcons\":[],\"disableInteractive\":false,\"disableTooltipControl\":false,\"hideToolbarOverlay\":false,\"hideLayerControl\":false,\"hideViewControl\":false,\"initialLocation\":\"LAST_SAVED_LOCATION\",\"fixedLocation\":{\"lat\":0,\"lon\":0,\"zoom\":2},\"browserLocation\":{\"zoom\":2},\"keydownScrollZoom\":false,\"maxZoom\":24,\"minZoom\":0,\"showScaleControl\":false,\"showSpatialFilters\":true,\"showTimesliderToggleButton\":true,\"spatialFiltersAlpa\":0.3,\"spatialFiltersFillColor\":\"#DA8B45\",\"spatialFiltersLineColor\":\"#DA8B45\"}}","title":"Managed map","uiStateJSON":"{\"isLayerTOCOpen\":true,\"openTOCDetails\":[]}"},"coreMigrationVersion":"8.8.0","created_at":"2024-01-24T18:22:40.360Z","id":"managed-d7ab-46eb-a807-8fed28ed8566","managed":true,"references":[],"type":"map","typeMigrationVersion":"8.4.0","updated_at":"2024-01-24T18:23:07.090Z","version":"WzEyLDFd"} -{"attributes":{"description":"","layerListJSON":"[{\"locale\":\"autoselect\",\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"isAutoSelect\":true,\"lightModeDefault\":\"road_map_desaturated\"},\"id\":\"5ff9c98e-e0d3-4aff-ac98-b33c191496b4\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":1,\"visible\":true,\"style\":{\"type\":\"EMS_VECTOR_TILE\",\"color\":\"\"},\"includeInFitToBounds\":true,\"type\":\"EMS_VECTOR_TILE\"}]","mapStateJSON":"{\"adHocDataViews\":[],\"zoom\":1.4,\"center\":{\"lon\":0,\"lat\":19.94277},\"timeFilters\":{\"from\":\"now-15m\",\"to\":\"now\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":60000},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[],\"settings\":{\"autoFitToDataBounds\":false,\"backgroundColor\":\"#ffffff\",\"customIcons\":[],\"disableInteractive\":false,\"disableTooltipControl\":false,\"hideToolbarOverlay\":false,\"hideLayerControl\":false,\"hideViewControl\":false,\"initialLocation\":\"LAST_SAVED_LOCATION\",\"fixedLocation\":{\"lat\":0,\"lon\":0,\"zoom\":2},\"browserLocation\":{\"zoom\":2},\"keydownScrollZoom\":false,\"maxZoom\":24,\"minZoom\":0,\"showScaleControl\":false,\"showSpatialFilters\":true,\"showTimesliderToggleButton\":true,\"spatialFiltersAlpa\":0.3,\"spatialFiltersFillColor\":\"#DA8B45\",\"spatialFiltersLineColor\":\"#DA8B45\"}}","title":"Map","uiStateJSON":"{\"isLayerTOCOpen\":true,\"openTOCDetails\":[]}"},"coreMigrationVersion":"8.8.0","created_at":"2024-01-24T18:22:40.360Z","id":"unmanaged-d7ab-46eb-a807-8fed28ed8566","managed":false,"references":[],"type":"map","typeMigrationVersion":"8.4.0","updated_at":"2024-01-24T18:23:07.090Z","version":"WzEyLDFd"} +{"attributes":{"description":"","layerListJSON":"[{\"locale\":\"autoselect\",\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"isAutoSelect\":true,\"lightModeDefault\":\"road_map_desaturated\"},\"id\":\"5ff9c98e-e0d3-4aff-ac98-b33c191496b4\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":1,\"visible\":true,\"style\":{\"type\":\"EMS_VECTOR_TILE\",\"color\":\"\"},\"includeInFitToBounds\":true,\"type\":\"EMS_VECTOR_TILE\"}]","mapStateJSON":"{\"adHocDataViews\":[],\"zoom\":1.4,\"center\":{\"lon\":0,\"lat\":19.94277},\"timeFilters\":{\"from\":\"now-15m\",\"to\":\"now\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":60000},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[],\"settings\":{\"autoFitToDataBounds\":false,\"backgroundColor\":\"#ffffff\",\"customIcons\":[],\"disableInteractive\":false,\"disableTooltipControl\":false,\"hideToolbarOverlay\":false,\"hideLayerControl\":false,\"hideViewControl\":false,\"initialLocation\":\"LAST_SAVED_LOCATION\",\"fixedLocation\":{\"lat\":0,\"lon\":0,\"zoom\":2},\"browserLocation\":{\"zoom\":2},\"keydownScrollZoom\":false,\"maxZoom\":24,\"minZoom\":0,\"showScaleControl\":false,\"showSpatialFilters\":true,\"showTimesliderToggleButton\":true,\"spatialFiltersAlpa\":0.3,\"spatialFiltersFillColor\":\"#DA8B45\",\"spatialFiltersLineColor\":\"#DA8B45\"}}","title":"Unmanaged map","uiStateJSON":"{\"isLayerTOCOpen\":true,\"openTOCDetails\":[]}"},"coreMigrationVersion":"8.8.0","created_at":"2024-01-24T18:22:40.360Z","id":"unmanaged-d7ab-46eb-a807-8fed28ed8566","managed":false,"references":[],"type":"map","typeMigrationVersion":"8.4.0","updated_at":"2024-01-24T18:23:07.090Z","version":"WzEyLDFd"} + +{"attributes":{"description":"","kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"optionsJSON":"{\"useMargins\":true,\"syncColors\":false,\"syncCursor\":true,\"syncTooltips\":false,\"hidePanelTitles\":false}","panelsJSON":"[{\"type\":\"visualization\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"536c52e4-ecf1-4cde-9323-cc1c3de1fdd2\"},\"panelIndex\":\"536c52e4-ecf1-4cde-9323-cc1c3de1fdd2\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_536c52e4-ecf1-4cde-9323-cc1c3de1fdd2\"},{\"type\":\"lens\",\"gridData\":{\"x\":24,\"y\":0,\"w\":24,\"h\":15,\"i\":\"f19bd0df-03e7-4181-9adf-e3b3b4c97e19\"},\"panelIndex\":\"f19bd0df-03e7-4181-9adf-e3b3b4c97e19\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_f19bd0df-03e7-4181-9adf-e3b3b4c97e19\"},{\"type\":\"map\",\"gridData\":{\"x\":0,\"y\":15,\"w\":24,\"h\":15,\"i\":\"26f25c71-2b7c-4540-8c1c-c003b5657978\"},\"panelIndex\":\"26f25c71-2b7c-4540-8c1c-c003b5657978\",\"embeddableConfig\":{\"mapCenter\":{\"lat\":19.94277,\"lon\":0,\"zoom\":1.4},\"mapBuffer\":{\"minLon\":-180,\"minLat\":-66.51326,\"maxLon\":180,\"maxLat\":66.51326},\"isLayerTOCOpen\":true,\"openTOCDetails\":[],\"hiddenLayers\":[],\"enhancements\":{}},\"panelRefName\":\"panel_26f25c71-2b7c-4540-8c1c-c003b5657978\"},{\"type\":\"search\",\"gridData\":{\"x\":24,\"y\":15,\"w\":24,\"h\":15,\"i\":\"d7e33257-de57-40cb-9171-3dd739dd1875\"},\"panelIndex\":\"d7e33257-de57-40cb-9171-3dd739dd1875\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_d7e33257-de57-40cb-9171-3dd739dd1875\"}]","timeRestore":false,"title":"Managed dashboard with by-ref panels","version":1},"coreMigrationVersion":"8.8.0","created_at":"2024-01-31T21:57:49.102Z","id":"c44c86f9-b105-4a9c-9a24-449a58a827f3","managed":true,"references":[{"id":"managed-feb9-4ba6-9538-1b8f67fb4f57","name":"536c52e4-ecf1-4cde-9323-cc1c3de1fdd2:panel_536c52e4-ecf1-4cde-9323-cc1c3de1fdd2","type":"visualization"},{"id":"managed-36db-4a3b-a4ba-7a64ab8f130b","name":"f19bd0df-03e7-4181-9adf-e3b3b4c97e19:panel_f19bd0df-03e7-4181-9adf-e3b3b4c97e19","type":"lens"},{"id":"managed-d7ab-46eb-a807-8fed28ed8566","name":"26f25c71-2b7c-4540-8c1c-c003b5657978:panel_26f25c71-2b7c-4540-8c1c-c003b5657978","type":"map"},{"id":"managed-3d62-4113-ac7c-de2e20a68fbc","name":"d7e33257-de57-40cb-9171-3dd739dd1875:panel_d7e33257-de57-40cb-9171-3dd739dd1875","type":"search"}],"type":"dashboard","typeMigrationVersion":"8.9.0","updated_at":"2024-01-31T21:57:49.102Z","version":"WzEwOSwxXQ=="} diff --git a/test/functional/services/dashboard/add_panel.ts b/test/functional/services/dashboard/add_panel.ts index 65adf6dee5359..5b16c6af9ca20 100644 --- a/test/functional/services/dashboard/add_panel.ts +++ b/test/functional/services/dashboard/add_panel.ts @@ -230,22 +230,41 @@ export class DashboardAddPanelService extends FtrService { return this.addEmbeddable(vizName, 'Visualization'); } - async addEmbeddable(embeddableName: string, embeddableType: string) { + async addEmbeddable( + embeddableName: string, + embeddableType?: string, + closePanelWhenComplete: boolean = true + ) { this.log.debug( `DashboardAddPanel.addEmbeddable, name: ${embeddableName}, type: ${embeddableType}` ); await this.ensureAddPanelIsShowing(); - await this.savedObjectsFinder.toggleFilter(embeddableType); - await this.savedObjectsFinder.filterEmbeddableNames(`"${embeddableName.replace('-', ' ')}"`); + await this.savedObjectsFinder.filterEmbeddableNames( + `${embeddableType ? 'type:(' + embeddableType + ') ' : ''}"${embeddableName.replace( + '-', + ' ' + )}"` + ); await this.testSubjects.click(`savedObjectTitle${embeddableName.split(' ').join('-')}`); await this.testSubjects.exists('addObjectToDashboardSuccess'); - await this.closeAddPanel(); + if (closePanelWhenComplete) { + await this.closeAddPanel(); + } // close "Added successfully" toast await this.common.clearAllToasts(); return embeddableName; } + async addEmbeddables(embeddables: Array<{ name: string; type?: string }>) { + const addedEmbeddables: string[] = []; + for (const { name, type } of embeddables) { + addedEmbeddables.push(await this.addEmbeddable(name, type, false)); + } + await this.closeAddPanel(); + return addedEmbeddables; + } + async panelAddLinkExists(name: string) { this.log.debug(`DashboardAddPanel.panelAddLinkExists(${name})`); await this.ensureAddPanelIsShowing(); diff --git a/x-pack/plugins/lens/public/lens_attribute_service.ts b/x-pack/plugins/lens/public/lens_attribute_service.ts index c63d9c1dd5c3d..69b76669695fe 100644 --- a/x-pack/plugins/lens/public/lens_attribute_service.ts +++ b/x-pack/plugins/lens/public/lens_attribute_service.ts @@ -8,7 +8,9 @@ import type { CoreStart } from '@kbn/core/public'; import type { AttributeService } from '@kbn/embeddable-plugin/public'; import { OnSaveProps } from '@kbn/saved-objects-plugin/public'; +import { SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common'; import type { LensPluginStartDependencies } from './plugin'; +import type { LensSavedObjectAttributes as LensSavedObjectAttributesWithoutReferences } from '../common/content_management'; import type { LensSavedObjectAttributes, LensByValueInput, @@ -26,6 +28,16 @@ export type LensAttributeService = AttributeService< LensUnwrapMetaInfo >; +export const savedObjectToEmbeddableAttributes = ( + savedObject: SavedObjectCommon +): LensSavedObjectAttributes => { + return { + ...savedObject.attributes, + state: savedObject.attributes.state as LensSavedObjectAttributes['state'], + references: savedObject.references, + }; +}; + export function getLensAttributeService( core: CoreStart, startDependencies: LensPluginStartDependencies @@ -51,11 +63,7 @@ export function getLensAttributeService( item: savedObject, meta: { outcome, aliasTargetId, aliasPurpose }, } = await savedObjectStore.load(savedObjectId); - const { attributes, references, id } = savedObject; - const document = { - ...attributes, - references, - }; + const { id } = savedObject; const sharingSavedObjectProps = { aliasTargetId, @@ -65,10 +73,7 @@ export function getLensAttributeService( }; return { - attributes: { - ...document, - state: document.state as LensSavedObjectAttributes['state'], - }, + attributes: savedObjectToEmbeddableAttributes(savedObject), metaInfo: { sharingSavedObjectProps, managed: savedObject.managed, diff --git a/x-pack/plugins/lens/public/plugin.ts b/x-pack/plugins/lens/public/plugin.ts index 61ffb1d0686d0..663a5d8b574c2 100644 --- a/x-pack/plugins/lens/public/plugin.ts +++ b/x-pack/plugins/lens/public/plugin.ts @@ -64,6 +64,7 @@ import { } from '@kbn/content-management-plugin/public'; import { i18n } from '@kbn/i18n'; import type { ServerlessPluginStart } from '@kbn/serverless/public'; +import { registerSavedObjectToPanelMethod } from '@kbn/embeddable-plugin/public'; import type { EditorFrameService as EditorFrameServiceType } from './editor_frame_service'; import type { FormBasedDatasource as FormBasedDatasourceType, @@ -117,7 +118,7 @@ import { visualizeTSVBAction } from './trigger_actions/visualize_tsvb_actions'; import { visualizeAggBasedVisAction } from './trigger_actions/visualize_agg_based_vis_actions'; import { visualizeDashboardVisualizePanelction } from './trigger_actions/dashboard_visualize_panel_actions'; -import type { LensEmbeddableInput } from './embeddable'; +import type { LensByValueInput, LensEmbeddableInput } from './embeddable'; import { EmbeddableFactory, LensEmbeddableStartServices } from './embeddable/embeddable_factory'; import { EmbeddableComponent, getEmbeddableComponent } from './embeddable/embeddable_component'; import { getSaveModalComponent } from './app_plugin/shared/saved_modal_lazy'; @@ -130,8 +131,13 @@ import { ChartInfoApi } from './chart_info_api'; import { type LensAppLocator, LensAppLocatorDefinition } from '../common/locator/locator'; import { downloadCsvShareProvider } from './app_plugin/csv_download_provider/csv_download_provider'; -import { CONTENT_ID, LATEST_VERSION } from '../common/content_management'; +import { + CONTENT_ID, + LATEST_VERSION, + LensSavedObjectAttributes, +} from '../common/content_management'; import type { EditLensConfigurationProps } from './app_plugin/shared/edit_on_the_fly/get_edit_lens_configuration'; +import { savedObjectToEmbeddableAttributes } from './lens_attribute_service'; export type { SaveProps } from './app_plugin'; @@ -424,6 +430,21 @@ export class LensPlugin { () => startServices().plugins.data.nowProvider.get() ); + registerSavedObjectToPanelMethod( + CONTENT_ID, + (savedObject) => { + if (!savedObject.managed) { + return { savedObjectId: savedObject.id }; + } + + const panel = { + attributes: savedObjectToEmbeddableAttributes(savedObject), + }; + + return panel; + } + ); + const getPresentationUtilContext = () => startServices().plugins.presentationUtil.ContextProvider; diff --git a/x-pack/plugins/lens/tsconfig.json b/x-pack/plugins/lens/tsconfig.json index 779aa6886b05e..73883bc849e27 100644 --- a/x-pack/plugins/lens/tsconfig.json +++ b/x-pack/plugins/lens/tsconfig.json @@ -109,7 +109,8 @@ "@kbn/text-based-editor", "@kbn/managed-content-badge", "@kbn/sort-predicates", - "@kbn/presentation-publishing" + "@kbn/presentation-publishing", + "@kbn/saved-objects-finder-plugin" ], "exclude": ["target/**/*"] } diff --git a/x-pack/plugins/maps/public/map_attribute_service.ts b/x-pack/plugins/maps/public/map_attribute_service.ts index 6cc226b72dc4b..5f07f3954eecd 100644 --- a/x-pack/plugins/maps/public/map_attribute_service.ts +++ b/x-pack/plugins/maps/public/map_attribute_service.ts @@ -9,6 +9,7 @@ import { SavedObjectReference } from '@kbn/core/types'; import type { ResolvedSimpleSavedObject } from '@kbn/core/public'; import { AttributeService } from '@kbn/embeddable-plugin/public'; import type { OnSaveProps } from '@kbn/saved-objects-plugin/public'; +import { SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common'; import type { MapAttributes } from '../common/content_management'; import { MAP_EMBEDDABLE_NAME, MAP_SAVED_OBJECT_TYPE } from '../common/constants'; import { getCoreOverlays, getEmbeddableService } from './kibana_services'; @@ -39,6 +40,17 @@ export type MapAttributeService = AttributeService< MapUnwrapMetaInfo >; +export const savedObjectToEmbeddableAttributes = ( + savedObject: SavedObjectCommon +) => { + const { attributes } = injectReferences(savedObject); + + return { + ...attributes, + references: savedObject.references, + }; +}; + let mapAttributeService: MapAttributeService | null = null; export function getMapAttributeService(): MapAttributeService { @@ -90,12 +102,8 @@ export function getMapAttributeService(): MapAttributeService { throw savedObject.error; } - const { attributes } = injectReferences(savedObject); return { - attributes: { - ...attributes, - references: savedObject.references, - }, + attributes: savedObjectToEmbeddableAttributes(savedObject), metaInfo: { sharingSavedObjectProps: { aliasTargetId, diff --git a/x-pack/plugins/maps/public/plugin.ts b/x-pack/plugins/maps/public/plugin.ts index 4e654f9e5c641..351f49fcfd077 100644 --- a/x-pack/plugins/maps/public/plugin.ts +++ b/x-pack/plugins/maps/public/plugin.ts @@ -25,7 +25,11 @@ import type { HomePublicPluginSetup } from '@kbn/home-plugin/public'; import type { VisualizationsSetup, VisualizationsStart } from '@kbn/visualizations-plugin/public'; import type { Plugin as ExpressionsPublicPlugin } from '@kbn/expressions-plugin/public'; import { VISUALIZE_GEO_FIELD_TRIGGER } from '@kbn/ui-actions-plugin/public'; -import type { EmbeddableSetup, EmbeddableStart } from '@kbn/embeddable-plugin/public'; +import { + EmbeddableSetup, + EmbeddableStart, + registerSavedObjectToPanelMethod, +} from '@kbn/embeddable-plugin/public'; import { CONTEXT_MENU_TRIGGER } from '@kbn/embeddable-plugin/public'; import type { SharePluginSetup, SharePluginStart } from '@kbn/share-plugin/public'; import type { MapsEmsPluginPublicStart } from '@kbn/maps-ems-plugin/public'; @@ -82,7 +86,9 @@ import { MapInspectorView } from './inspector/map_adapter/map_inspector_view'; import { VectorTileInspectorView } from './inspector/vector_tile_adapter/vector_tile_inspector_view'; import { setupLensChoroplethChart } from './lens'; -import { CONTENT_ID, LATEST_VERSION } from '../common/content_management'; +import { CONTENT_ID, LATEST_VERSION, MapAttributes } from '../common/content_management'; +import { savedObjectToEmbeddableAttributes } from './map_attribute_service'; +import { MapByValueInput } from './embeddable'; export interface MapsPluginSetupDependencies { cloud?: CloudSetup; @@ -214,6 +220,16 @@ export class MapsPlugin name: APP_NAME, }); + registerSavedObjectToPanelMethod(CONTENT_ID, (savedObject) => { + if (!savedObject.managed) { + return { savedObjectId: savedObject.id }; + } + + return { + attributes: savedObjectToEmbeddableAttributes(savedObject), + }; + }); + setupLensChoroplethChart(core, plugins.expressions, plugins.lens); // register wrapper around legacy tile_map and region_map visualizations diff --git a/x-pack/plugins/maps/tsconfig.json b/x-pack/plugins/maps/tsconfig.json index 8dcb5e3db7a26..27cdf35bfb949 100644 --- a/x-pack/plugins/maps/tsconfig.json +++ b/x-pack/plugins/maps/tsconfig.json @@ -85,6 +85,7 @@ "@kbn/code-editor", "@kbn/managed-content-badge", "@kbn/presentation-publishing", + "@kbn/saved-objects-finder-plugin", "@kbn/esql-utils", ], "exclude": [ diff --git a/x-pack/test/functional/apps/managed_content/managed_content.ts b/x-pack/test/functional/apps/managed_content/managed_content.ts index a42d5b5a0c94c..545d7ad1c4dee 100644 --- a/x-pack/test/functional/apps/managed_content/managed_content.ts +++ b/x-pack/test/functional/apps/managed_content/managed_content.ts @@ -16,10 +16,12 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { 'common', 'discover', 'maps', + 'dashboard', ]); const kibanaServer = getService('kibanaServer'); const esArchiver = getService('esArchiver'); const testSubjects = getService('testSubjects'); + const dashboardAddPanel = getService('dashboardAddPanel'); describe('Managed Content', () => { before(async () => { @@ -32,19 +34,19 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/managed_content'); }); - const expectManagedContentSignifiers = async ( - expected: boolean, - saveButtonTestSubject: string - ) => { - await testSubjects[expected ? 'existOrFail' : 'missingOrFail']('managedContentBadge'); - await testSubjects.click(saveButtonTestSubject); - - const saveAsNewCheckbox = await testSubjects.find('saveAsNewCheckbox'); - expect(await testSubjects.isEuiSwitchChecked(saveAsNewCheckbox)).to.be(expected); - expect(await saveAsNewCheckbox.getAttribute('disabled')).to.be(expected ? 'true' : null); - }; - describe('preventing the user from overwriting managed content', () => { + const expectManagedContentSignifiers = async ( + expected: boolean, + saveButtonTestSubject: string + ) => { + await testSubjects[expected ? 'existOrFail' : 'missingOrFail']('managedContentBadge'); + await testSubjects.click(saveButtonTestSubject); + + const saveAsNewCheckbox = await testSubjects.find('saveAsNewCheckbox'); + expect(await testSubjects.isEuiSwitchChecked(saveAsNewCheckbox)).to.be(expected); + expect(await saveAsNewCheckbox.getAttribute('disabled')).to.be(expected ? 'true' : null); + }; + it('lens', async () => { await PageObjects.common.navigateToActualUrl( 'lens', @@ -64,60 +66,105 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await expectManagedContentSignifiers(false, 'lnsApp_saveButton'); }); - }); - it('discover', async () => { - await PageObjects.common.navigateToActualUrl( - 'discover', - 'view/managed-3d62-4113-ac7c-de2e20a68fbc' - ); - await PageObjects.discover.waitForDiscoverAppOnScreen(); + it('discover', async () => { + await PageObjects.common.navigateToActualUrl( + 'discover', + 'view/managed-3d62-4113-ac7c-de2e20a68fbc' + ); + await PageObjects.discover.waitForDiscoverAppOnScreen(); + + await expectManagedContentSignifiers(true, 'discoverSaveButton'); + + await PageObjects.common.navigateToActualUrl( + 'discover', + 'view/unmanaged-3d62-4113-ac7c-de2e20a68fbc' + ); + await PageObjects.discover.waitForDiscoverAppOnScreen(); + + await expectManagedContentSignifiers(false, 'discoverSaveButton'); + }); - await expectManagedContentSignifiers(true, 'discoverSaveButton'); + it('visualize', async () => { + await PageObjects.common.navigateToActualUrl( + 'visualize', + 'edit/managed-feb9-4ba6-9538-1b8f67fb4f57' + ); + await PageObjects.visChart.waitForVisualization(); - await PageObjects.common.navigateToActualUrl( - 'discover', - 'view/unmanaged-3d62-4113-ac7c-de2e20a68fbc' - ); - await PageObjects.discover.waitForDiscoverAppOnScreen(); + await expectManagedContentSignifiers(true, 'visualizeSaveButton'); - await expectManagedContentSignifiers(false, 'discoverSaveButton'); - }); + await PageObjects.common.navigateToActualUrl( + 'visualize', + 'edit/unmanaged-feb9-4ba6-9538-1b8f67fb4f57' + ); + await PageObjects.visChart.waitForVisualization(); + + await expectManagedContentSignifiers(false, 'visualizeSaveButton'); + }); - it('visualize', async () => { - await PageObjects.common.navigateToActualUrl( - 'visualize', - 'edit/managed-feb9-4ba6-9538-1b8f67fb4f57' - ); - await PageObjects.visChart.waitForVisualization(); + it('maps', async () => { + await PageObjects.common.navigateToActualUrl( + 'maps', + 'map/managed-d7ab-46eb-a807-8fed28ed8566' + ); + await PageObjects.maps.waitForLayerAddPanelClosed(); - await expectManagedContentSignifiers(true, 'visualizeSaveButton'); + await expectManagedContentSignifiers(true, 'mapSaveButton'); - await PageObjects.common.navigateToActualUrl( - 'visualize', - 'edit/unmanaged-feb9-4ba6-9538-1b8f67fb4f57' - ); - await PageObjects.visChart.waitForVisualization(); + await PageObjects.common.navigateToActualUrl( + 'maps', + 'map/unmanaged-d7ab-46eb-a807-8fed28ed8566' + ); + await PageObjects.maps.waitForLayerAddPanelClosed(); - await expectManagedContentSignifiers(false, 'visualizeSaveButton'); + await expectManagedContentSignifiers(false, 'mapSaveButton'); + }); }); - it('maps', async () => { - await PageObjects.common.navigateToActualUrl( - 'maps', - 'map/managed-d7ab-46eb-a807-8fed28ed8566' - ); - await PageObjects.maps.waitForLayerAddPanelClosed(); + describe('managed panels in dashboards', () => { + it('inlines panels when managed dashboard cloned', async () => { + await PageObjects.common.navigateToActualUrl( + 'dashboard', + 'view/c44c86f9-b105-4a9c-9a24-449a58a827f3' + ); + + await PageObjects.dashboard.waitForRenderComplete(); + + await PageObjects.dashboard.clickClone(); - await expectManagedContentSignifiers(true, 'mapSaveButton'); + await PageObjects.dashboard.waitForRenderComplete(); - await PageObjects.common.navigateToActualUrl( - 'maps', - 'map/unmanaged-d7ab-46eb-a807-8fed28ed8566' - ); - await PageObjects.maps.waitForLayerAddPanelClosed(); + await testSubjects.missingOrFail('embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION'); + }); + + it('adds managed panels by-value', async () => { + await PageObjects.common.navigateToApp('dashboard'); + await PageObjects.dashboard.gotoDashboardLandingPage(); + await PageObjects.dashboard.clickNewDashboard(); + + await dashboardAddPanel.addEmbeddables([ + { name: 'Managed lens vis', type: 'lens' }, + { name: 'Managed legacy visualization', type: 'visualization' }, + { name: 'Managed map', type: 'map' }, + { name: 'Managed saved search', type: 'search' }, + ]); + + await testSubjects.missingOrFail('embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION'); + + await dashboardAddPanel.addEmbeddables([ + { name: 'Unmanaged lens vis', type: 'lens' }, + { name: 'Unmanaged legacy visualization', type: 'visualization' }, + { name: 'Unmanaged map', type: 'map' }, + { name: 'Unmanaged saved search', type: 'search' }, + ]); + + const byRefSignifiers = await testSubjects.findAll( + 'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION' + ); - await expectManagedContentSignifiers(false, 'mapSaveButton'); + expect(byRefSignifiers.length).to.be(4); + }); }); }); }