mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Maps] change EMS tile layer display name to 'Basemap' (#136393)
* [Maps] change EMS basemap display name to 'Basemap' * add tooltip content * revert getLayerTypeIconName deletion * change i18n tag * rename * eslint * fix functional tests * Update x-pack/plugins/maps/public/classes/layers/ems_vector_tile_layer/ems_vector_tile_layer.tsx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>
This commit is contained in:
parent
93f6f89795
commit
d351c92b1a
6 changed files with 33 additions and 30 deletions
|
@ -5,13 +5,15 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import type { Map as MbMap, LayerSpecification, StyleSpecification } from '@kbn/mapbox-gl';
|
||||
import { type blendMode, type EmsSpriteSheet, TMSService } from '@elastic/ems-client';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import _ from 'lodash';
|
||||
import { EuiIcon } from '@elastic/eui';
|
||||
// @ts-expect-error
|
||||
import { RGBAImage } from './image_utils';
|
||||
import { AbstractLayer } from '../layer';
|
||||
import { AbstractLayer, type LayerIcon } from '../layer';
|
||||
import {
|
||||
AUTOSELECT_EMS_LOCALE,
|
||||
NO_EMS_LOCALE,
|
||||
|
@ -486,6 +488,15 @@ export class EmsVectorTileLayer extends AbstractLayer {
|
|||
return 'grid';
|
||||
}
|
||||
|
||||
getLayerIcon(): LayerIcon {
|
||||
return {
|
||||
icon: <EuiIcon size="m" type="grid" />,
|
||||
tooltipContent: i18n.translate('xpack.maps.emsVectorTileLayer.layerDescription', {
|
||||
defaultMessage: `Reference map provided by Elastic Maps Service (EMS).`,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
isBasemap(order: number) {
|
||||
return order === 0;
|
||||
}
|
|
@ -66,7 +66,7 @@ export class EMSTMSSource extends AbstractSource implements ITMSSource {
|
|||
}
|
||||
|
||||
async getImmutableProperties() {
|
||||
const displayName = await this.getDisplayName();
|
||||
const tileServiceName = await this._getTileServiceName();
|
||||
const autoSelectMsg = i18n.translate('xpack.maps.source.emsTile.isAutoSelectLabel', {
|
||||
defaultMessage: 'autoselect based on Kibana theme',
|
||||
});
|
||||
|
@ -80,7 +80,9 @@ export class EMSTMSSource extends AbstractSource implements ITMSSource {
|
|||
label: i18n.translate('xpack.maps.source.emsTile.serviceId', {
|
||||
defaultMessage: `Tile service`,
|
||||
}),
|
||||
value: this._descriptor.isAutoSelect ? `${displayName} - ${autoSelectMsg}` : displayName,
|
||||
value: this._descriptor.isAutoSelect
|
||||
? `${tileServiceName} - ${autoSelectMsg}`
|
||||
: tileServiceName,
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -114,6 +116,12 @@ export class EMSTMSSource extends AbstractSource implements ITMSSource {
|
|||
}
|
||||
|
||||
async getDisplayName() {
|
||||
return i18n.translate('xpack.maps.source.emsTile.basemapLabel', {
|
||||
defaultMessage: 'Basemap',
|
||||
});
|
||||
}
|
||||
|
||||
async _getTileServiceName() {
|
||||
try {
|
||||
const emsTMSService = await this._getEMSTMSService();
|
||||
return emsTMSService.getDisplayName();
|
||||
|
|
|
@ -68,7 +68,7 @@ export default function ({ getPageObjects, getService, updateBaselines }) {
|
|||
describe('ecommerce', () => {
|
||||
before(async () => {
|
||||
await PageObjects.maps.loadSavedMap('[eCommerce] Orders by Country');
|
||||
await PageObjects.maps.toggleLayerVisibility('Road map - desaturated');
|
||||
await PageObjects.maps.toggleEmsBasemapLayerVisibility();
|
||||
await PageObjects.maps.toggleLayerVisibility('United Kingdom');
|
||||
await PageObjects.maps.toggleLayerVisibility('France');
|
||||
await PageObjects.maps.toggleLayerVisibility('United States');
|
||||
|
@ -96,7 +96,7 @@ export default function ({ getPageObjects, getService, updateBaselines }) {
|
|||
describe('flights', () => {
|
||||
before(async () => {
|
||||
await PageObjects.maps.loadSavedMap('[Flights] Origin Time Delayed');
|
||||
await PageObjects.maps.toggleLayerVisibility('Road map - desaturated');
|
||||
await PageObjects.maps.toggleEmsBasemapLayerVisibility();
|
||||
await PageObjects.timePicker.setCommonlyUsedTime('sample_data range');
|
||||
await PageObjects.maps.enterFullScreen();
|
||||
await PageObjects.maps.closeLegend();
|
||||
|
@ -121,7 +121,7 @@ export default function ({ getPageObjects, getService, updateBaselines }) {
|
|||
before(async () => {
|
||||
await PageObjects.maps.loadSavedMap('[Logs] Total Requests and Bytes');
|
||||
await PageObjects.maps.toggleLayerVisibility('Total Requests by Destination');
|
||||
await PageObjects.maps.toggleLayerVisibility('Road map - desaturated');
|
||||
await PageObjects.maps.toggleEmsBasemapLayerVisibility();
|
||||
await PageObjects.timePicker.setCommonlyUsedTime('sample_data range');
|
||||
await PageObjects.maps.enterFullScreen();
|
||||
await PageObjects.maps.closeLegend();
|
||||
|
|
|
@ -302,6 +302,11 @@ export class GisPageObject extends FtrService {
|
|||
await this.testSubjects.click('layerVisibilityToggleButton');
|
||||
}
|
||||
|
||||
// In 8.4, EMS basemap layers no longer use EMS tile service name, instead using "Basemap"
|
||||
async toggleEmsBasemapLayerVisibility() {
|
||||
await this.toggleLayerVisibility('Basemap');
|
||||
}
|
||||
|
||||
async openLegend() {
|
||||
const isOpen = await this.testSubjects.exists('mapLayerTOC');
|
||||
if (isOpen === false) {
|
||||
|
|
|
@ -110,7 +110,7 @@ export default function ({
|
|||
await PageObjects.home.launchSampleMap('ecommerce');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.maps.waitForLayersToLoad();
|
||||
await mapsHelper.toggleLayerVisibilityRoadMap();
|
||||
await PageObjects.maps.toggleEmsBasemapLayerVisibility();
|
||||
await PageObjects.maps.toggleLayerVisibility('United Kingdom');
|
||||
await PageObjects.maps.toggleLayerVisibility('France');
|
||||
await PageObjects.maps.toggleLayerVisibility('United States');
|
||||
|
@ -138,7 +138,7 @@ export default function ({
|
|||
await PageObjects.home.launchSampleMap('flights');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.maps.waitForLayersToLoad();
|
||||
await mapsHelper.toggleLayerVisibilityRoadMap();
|
||||
await PageObjects.maps.toggleEmsBasemapLayerVisibility();
|
||||
await PageObjects.timePicker.setCommonlyUsedTime('sample_data range');
|
||||
await PageObjects.maps.enterFullScreen();
|
||||
await PageObjects.maps.closeLegend();
|
||||
|
@ -162,7 +162,7 @@ export default function ({
|
|||
await PageObjects.home.launchSampleMap('logs');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.maps.waitForLayersToLoad();
|
||||
await mapsHelper.toggleLayerVisibilityRoadMap();
|
||||
await PageObjects.maps.toggleEmsBasemapLayerVisibility();
|
||||
await mapsHelper.toggleLayerVisibilityTotalRequests();
|
||||
await PageObjects.timePicker.setCommonlyUsedTime('sample_data range');
|
||||
await PageObjects.maps.enterFullScreen();
|
||||
|
|
|
@ -25,27 +25,6 @@ export function MapsHelper({ getPageObjects, getService }: FtrProviderContext) {
|
|||
}
|
||||
},
|
||||
|
||||
// In v8.0, the default base map switched from bright to desaturated.
|
||||
// https://github.com/elastic/kibana/pull/116179
|
||||
// Maps created before this change will have a base map called "Road map"
|
||||
// Maps created after this change will have a base map called "Road map - desaturated"
|
||||
// toggleLayerVisibilityRoadMap will toggle layer visibility for either value
|
||||
async toggleLayerVisibilityRoadMap() {
|
||||
const isRoadMapDesaturated = await testSubjects.exists(
|
||||
'layerTocActionsPanelToggleButtonRoad_map_-_desaturated'
|
||||
);
|
||||
const isRoadMap = await testSubjects.exists('layerTocActionsPanelToggleButtonRoad_map');
|
||||
if (!isRoadMapDesaturated && !isRoadMap) {
|
||||
throw new Error('Layer road map not found');
|
||||
}
|
||||
if (isRoadMapDesaturated) {
|
||||
await this.toggleLayerVisibility('Road map - desaturated');
|
||||
}
|
||||
if (isRoadMap) {
|
||||
await this.toggleLayerVisibility('Road map');
|
||||
}
|
||||
},
|
||||
|
||||
// In v7.16, e-commerce sample data was re-worked so that geo.src field to match country code of geo.coordinates
|
||||
// https://github.com/elastic/kibana/pull/110885
|
||||
// Maps created before this change will have a layer called "Total Requests by Country"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue