[Maps] remove undefined from map embeddable by_value URL (#102949)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
4fa939d9c9
commit
91295fddd7
|
@ -58,15 +58,14 @@ export const KBN_IS_CENTROID_FEATURE = '__kbn_is_centroid_feature__';
|
|||
|
||||
export const MVT_TOKEN_PARAM_NAME = 'token';
|
||||
|
||||
const MAP_BASE_URL = `/${MAPS_APP_PATH}/${MAP_PATH}`;
|
||||
export function getNewMapPath() {
|
||||
return MAP_BASE_URL;
|
||||
return `/${MAPS_APP_PATH}/${MAP_PATH}`;
|
||||
}
|
||||
export function getExistingMapPath(id: string) {
|
||||
return `${MAP_BASE_URL}/${id}`;
|
||||
export function getFullPath(id: string | undefined) {
|
||||
return `/${MAPS_APP_PATH}${getEditPath(id)}`;
|
||||
}
|
||||
export function getEditPath(id: string) {
|
||||
return `/${MAP_PATH}/${id}`;
|
||||
export function getEditPath(id: string | undefined) {
|
||||
return id ? `/${MAP_PATH}/${id}` : `/${MAP_PATH}`;
|
||||
}
|
||||
|
||||
export enum LAYER_TYPE {
|
||||
|
|
|
@ -54,9 +54,9 @@ import {
|
|||
} from '../selectors/map_selectors';
|
||||
import {
|
||||
APP_ID,
|
||||
getExistingMapPath,
|
||||
getEditPath,
|
||||
getFullPath,
|
||||
MAP_SAVED_OBJECT_TYPE,
|
||||
MAP_PATH,
|
||||
RawValue,
|
||||
} from '../../common/constants';
|
||||
import { RenderToolTipContent } from '../classes/tooltips/tooltip_property';
|
||||
|
@ -180,13 +180,13 @@ export class MapEmbeddable
|
|||
: '';
|
||||
const input = this.getInput();
|
||||
const title = input.hidePanelTitles ? '' : input.title || savedMapTitle;
|
||||
const savedObjectId = (input as MapByReferenceInput).savedObjectId;
|
||||
const savedObjectId = 'savedObjectId' in input ? input.savedObjectId : undefined;
|
||||
this.updateOutput({
|
||||
...this.getOutput(),
|
||||
defaultTitle: savedMapTitle,
|
||||
title,
|
||||
editPath: `/${MAP_PATH}/${savedObjectId}`,
|
||||
editUrl: getHttp().basePath.prepend(getExistingMapPath(savedObjectId)),
|
||||
editPath: getEditPath(savedObjectId),
|
||||
editUrl: getHttp().basePath.prepend(getFullPath(savedObjectId)),
|
||||
indexPatterns: await this._getIndexPatterns(),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ import { getTopNavConfig } from '../top_nav_config';
|
|||
import { MapQuery } from '../../../../common/descriptor_types';
|
||||
import { goToSpecifiedPath } from '../../../render_app';
|
||||
import { MapSavedObjectAttributes } from '../../../../common/map_saved_object_type';
|
||||
import { getExistingMapPath, APP_ID } from '../../../../common/constants';
|
||||
import { getFullPath, APP_ID } from '../../../../common/constants';
|
||||
import {
|
||||
getInitialQuery,
|
||||
getInitialRefreshConfig,
|
||||
|
@ -356,7 +356,7 @@ export class MapApp extends React.Component<Props, State> {
|
|||
const savedObjectId = this.props.savedMap.getSavedObjectId();
|
||||
if (savedObjectId) {
|
||||
getCoreChrome().recentlyAccessed.add(
|
||||
getExistingMapPath(savedObjectId),
|
||||
getFullPath(savedObjectId),
|
||||
this.props.savedMap.getTitle(),
|
||||
savedObjectId
|
||||
);
|
||||
|
|
|
@ -22,7 +22,7 @@ import { getFlightsSavedObjects } from './sample_data/flights_saved_objects.js';
|
|||
// @ts-ignore
|
||||
import { getWebLogsSavedObjects } from './sample_data/web_logs_saved_objects.js';
|
||||
import { registerMapsUsageCollector } from './maps_telemetry/collectors/register';
|
||||
import { APP_ID, APP_ICON, MAP_SAVED_OBJECT_TYPE, getExistingMapPath } from '../common/constants';
|
||||
import { APP_ID, APP_ICON, MAP_SAVED_OBJECT_TYPE, getFullPath } from '../common/constants';
|
||||
import { mapSavedObjects, mapsTelemetrySavedObjects } from './saved_objects';
|
||||
import { MapsXPackConfig } from '../config';
|
||||
// @ts-ignore
|
||||
|
@ -77,7 +77,7 @@ export class MapsPlugin implements Plugin {
|
|||
|
||||
home.sampleData.addAppLinksToSampleDataset('ecommerce', [
|
||||
{
|
||||
path: getExistingMapPath('2c9c1f60-1909-11e9-919b-ffe5949a18d2'),
|
||||
path: getFullPath('2c9c1f60-1909-11e9-919b-ffe5949a18d2'),
|
||||
label: sampleDataLinkLabel,
|
||||
icon: APP_ICON,
|
||||
},
|
||||
|
@ -99,7 +99,7 @@ export class MapsPlugin implements Plugin {
|
|||
|
||||
home.sampleData.addAppLinksToSampleDataset('flights', [
|
||||
{
|
||||
path: getExistingMapPath('5dd88580-1906-11e9-919b-ffe5949a18d2'),
|
||||
path: getFullPath('5dd88580-1906-11e9-919b-ffe5949a18d2'),
|
||||
label: sampleDataLinkLabel,
|
||||
icon: APP_ICON,
|
||||
},
|
||||
|
@ -120,7 +120,7 @@ export class MapsPlugin implements Plugin {
|
|||
home.sampleData.addSavedObjectsToSampleDataset('logs', getWebLogsSavedObjects());
|
||||
home.sampleData.addAppLinksToSampleDataset('logs', [
|
||||
{
|
||||
path: getExistingMapPath('de71f4f0-1902-11e9-919b-ffe5949a18d2'),
|
||||
path: getFullPath('de71f4f0-1902-11e9-919b-ffe5949a18d2'),
|
||||
label: sampleDataLinkLabel,
|
||||
icon: APP_ICON,
|
||||
},
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { SavedObjectsType } from 'src/core/server';
|
||||
import { APP_ICON, getExistingMapPath } from '../../common/constants';
|
||||
import { APP_ICON, getFullPath } from '../../common/constants';
|
||||
// @ts-ignore
|
||||
import { savedObjectMigrations } from './saved_object_migrations';
|
||||
|
||||
|
@ -34,7 +34,7 @@ export const mapSavedObjects: SavedObjectsType = {
|
|||
},
|
||||
getInAppUrl(obj) {
|
||||
return {
|
||||
path: getExistingMapPath(obj.id),
|
||||
path: getFullPath(obj.id),
|
||||
uiCapabilitiesPath: 'maps.show',
|
||||
};
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue