Skip to content

Commit

Permalink
[Maps] avoid using MAP_SAVED_OBJECT_TYPE constant when defining URL p…
Browse files Browse the repository at this point in the history
…aths
  • Loading branch information
nreese committed Jun 23, 2020
1 parent 1cdeec0 commit d9ce877
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
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) {
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

0 comments on commit d9ce877

Please sign in to comment.