Skip to content

Commit

Permalink
[Maps] Support by value saved objects. (#82486) (#83091)
Browse files Browse the repository at this point in the history
* [Maps] saved objects by value

* inject references when unwrapping

* clean up map embeddable initialize

* use attribute service to load savedMap

* clean up

* remove clear ui since each route has its own store instance

* save

* update for API changes

* pass input to stateTransfer

* remove map saved object loader

* remove unused store_operations

* add saved objects to recently accessed

* provide default description

* break originatingApp connection when not returnToOrigin

* clean up file structure

* clean up adding help menu

* use SavedMap in map_embeddable to remove dupicated load attributes code

* clean up

* restore imports

* clean up breadcrumbs to match lens

* fix check for duplicate title

* tslint

* make title map saved object attribute required

* fix jest tests

* fix logic for hasSaveAndReturnConfig to not show save and return button with new map and allowByValueEmbeddables disabled

* tslint

* fix functional test by triggering MapApp render after save

* rename map_app_container to map_page

* move MapApp and redux connector into folder

* review feedback

* use MAP_PATH constant

* update by reference saved object on save and return

* cleanup breadcrumbs and title

* properly handle deleted map saved objects

* tslint cleanup

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
nreese and kibanamachine authored Nov 10, 2020
1 parent a6dc55f commit e9c1b01
Show file tree
Hide file tree
Showing 54 changed files with 1,347 additions and 1,116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export function EmbeddedMapComponent() {
);

const input: MapEmbeddableInput = {
attributes: { title: '' },
id: uuid.v4(),
filters: mapFilters,
refreshConfig: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export function savedMap(): ExpressionFunctionDefinition<
return {
type: EmbeddableExpressionType,
input: {
attributes: { title: '' },
id: args.id,
filters: getQueryFilters(filters),
timeRange: args.timerange || defaultTimeRange,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { MapEmbeddableInput } from '../../../../../../plugins/maps/public/embedd
import { fromExpression, Ast } from '@kbn/interpreter/common';

const baseSavedMapInput = {
attributes: { title: '' },
id: 'embeddableId',
filters: [],
isLayerTOCOpen: false,
Expand Down
6 changes: 6 additions & 0 deletions x-pack/plugins/maps/common/i18n_getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ export function getAppTitle() {
});
}

export function getMapEmbeddableDisplayName() {
return i18n.translate('xpack.maps.embeddableDisplayName', {
defaultMessage: 'map',
});
}

export function getDataSourceLabel() {
return i18n.translate('xpack.maps.source.dataSourceLabel', {
defaultMessage: 'Data source',
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/maps/common/map_saved_object_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { SavedObject } from '../../../../src/core/types/saved_objects';

export type MapSavedObjectAttributes = {
title?: string;
title: string;
description?: string;
mapStateJSON?: string;
layerListJSON?: string;
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/maps/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"uiActions",
"navigation",
"visualizations",
"dashboard",
"embeddable",
"mapsLegacy",
"usageCollection",
Expand Down
8 changes: 8 additions & 0 deletions x-pack/plugins/maps/public/actions/layer_actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ import { addLayer } from './layer_actions';
import { LayerDescriptor } from '../../common/descriptor_types';
import { LICENSED_FEATURES } from '../licensed_features';

jest.mock('../kibana_services', () => {
return {
getMapsCapabilities() {
return { save: true };
},
};
});

const getStoreMock = jest.fn();
const dispatchMock = jest.fn();

Expand Down
7 changes: 7 additions & 0 deletions x-pack/plugins/maps/public/actions/map_actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ jest.mock('./data_request_actions', () => {
syncDataForAllLayers: () => {},
};
});
jest.mock('../kibana_services', () => {
return {
getMapsCapabilities() {
return { save: true };
},
};
});

import { mapExtentChanged, setMouseCoordinates, setQuery } from './map_actions';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
import React from 'react';
import { shallow } from 'enzyme';

jest.mock('../../kibana_services', () => {
return {
getMapsCapabilities() {
return { save: true };
},
};
});

// @ts-ignore
import { ToolbarOverlay } from './toolbar_overlay';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
import React from 'react';
import { shallowWithIntl } from 'test_utils/enzyme_helpers';

jest.mock('../../../../../kibana_services', () => {
return {
getMapsCapabilities() {
return { save: true };
},
};
});

import { TOCEntry } from './view';

const LAYER_ID = '1';
Expand Down
Loading

0 comments on commit e9c1b01

Please sign in to comment.