Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] avoid using MAP_SAVED_OBJECT_TYPE constant when defining URL paths #69723

Merged
merged 4 commits into from
Jun 26, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions x-pack/plugins/maps/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ export const APP_ID = 'maps';
export const APP_ICON = 'gisApp';
export const TELEMETRY_TYPE = 'maps-telemetry';

export const MAP_APP_PATH = `app/${APP_ID}`;
export const MAPS_APP_PATH = `app/${APP_ID}`;
export const MAP_PATH = 'map';
export const GIS_API_PATH = `api/${APP_ID}`;
export const INDEX_SETTINGS_API_PATH = `${GIS_API_PATH}/indexSettings`;
export const FONTS_API_PATH = `${GIS_API_PATH}/fonts`;

export const MAP_BASE_URL = `/${MAP_APP_PATH}/${MAP_SAVED_OBJECT_TYPE}`;

const MAP_BASE_URL = `/${MAPS_APP_PATH}/${MAP_PATH}`;
export function createNewMapPath() {
return MAP_BASE_URL;
}
export function createMapPath(id: string) {
nreese marked this conversation as resolved.
Show resolved Hide resolved
return `${MAP_BASE_URL}/${id}`;
}
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/maps/public/maps_vis_type_alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { i18n } from '@kbn/i18n';
import { APP_ID, APP_ICON, MAP_SAVED_OBJECT_TYPE } from '../common/constants';
import { APP_ID, APP_ICON, MAP_PATH } from '../common/constants';
import { getShowMapVisualizationTypes, getVisualizations } from './kibana_services';

export function getMapsVisTypeAlias() {
Expand All @@ -28,7 +28,7 @@ The Maps app offers more functionality and is easier to use.`,

return {
aliasApp: APP_ID,
aliasPath: `/${MAP_SAVED_OBJECT_TYPE}`,
aliasPath: `/${MAP_PATH}`,
name: APP_ID,
title: i18n.translate('xpack.maps.visTypeAlias.title', {
defaultMessage: 'Maps',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
import { getIsLayerTOCOpen, getOpenTOCDetails } from '../../../selectors/ui_selectors';
import { copyPersistentState } from '../../../reducers/util';
import { extractReferences, injectReferences } from '../../../../common/migrations/references';
import { MAP_BASE_URL, MAP_SAVED_OBJECT_TYPE } from '../../../../common/constants';
import { createMapPath, MAP_SAVED_OBJECT_TYPE } from '../../../../common/constants';
import { getStore } from '../../store_operations';

export function createSavedGisMapClass(services) {
Expand Down Expand Up @@ -76,7 +76,7 @@ export function createSavedGisMapClass(services) {
}

getFullPath() {
return `${MAP_BASE_URL}/${this.id}`;
return createMapPath(this.id);
}

getLayerList() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { i18n } from '@kbn/i18n';
import { getCoreChrome } from '../../kibana_services';
import { MAP_SAVED_OBJECT_TYPE } from '../../../common/constants';
import { MAP_PATH } from '../../../common/constants';
import _ from 'lodash';
import { getLayerListRaw } from '../../selectors/map_selectors';
import { copyPersistentState } from '../../reducers/util';
Expand All @@ -31,7 +31,7 @@ function hasUnsavedChanges(savedMap, initialLayerListConfig) {
}

export const updateBreadcrumbs = (savedMap, initialLayerListConfig, currentPath = '') => {
const isOnMapNow = currentPath.startsWith(`/${MAP_SAVED_OBJECT_TYPE}`);
const isOnMapNow = currentPath.startsWith(`/${MAP_PATH}`);
const breadCrumbs = isOnMapNow
? [
{
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/maps/server/tutorials/ems/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { i18n } from '@kbn/i18n';
import { TutorialsCategory } from '../../../../../../src/plugins/home/server';
import { MAP_BASE_URL } from '../../../common/constants';
import { createNewMapPath } from '../../../common/constants';

export function emsBoundariesSpecProvider({
emsLandingPageUrl,
Expand Down Expand Up @@ -64,7 +64,7 @@ Indexing EMS administrative boundaries in Elasticsearch allows for search on bou
2. Click `Add layer`, then select `Upload GeoJSON`.\n\
3. Upload the GeoJSON file and click `Import file`.',
values: {
newMapUrl: prependBasePath(MAP_BASE_URL),
newMapUrl: prependBasePath(createNewMapPath()),
},
}),
},
Expand Down