Skip to content

Commit

Permalink
[BUILD] Maps service config (#308)
Browse files Browse the repository at this point in the history
This doesn't fix the maps out of the box but fixes the
issues that prevented users from settings the maps service
in the config.

Which can be set by adding:

map.tilemap.url: "https://tiles.maps.search-services.aws.a2z.com/tiles/{z}/{x}/{y}.png"
map.includeOpenSearchMapsService: false

Signed-off-by: Kawika Avilla <[email protected]>
  • Loading branch information
kavilla authored Apr 24, 2021
1 parent 1bfa6e4 commit 5e08fe3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/plugins/maps_legacy/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import { configSchema as tilemapSchema } from '../tile_map/config';
import { configSchema as regionmapSchema } from '../region_map/config';

export const configSchema = schema.object({
includeOpenSearchDashboardsMapsService: schema.boolean({ defaultValue: true }),
proxyOpenSearchDashboardsMapsServiceInMaps: schema.boolean({ defaultValue: false }),
includeOpenSearchMapsService: schema.boolean({ defaultValue: true }),
proxyOpenSearchMapsServiceInMaps: schema.boolean({ defaultValue: false }),
tilemap: tilemapSchema,
regionmap: regionmapSchema,
manifestServiceUrl: schema.string({ defaultValue: '' }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export function BaseMapsVisualizationProvider() {
options.center = centerFromUIState ? centerFromUIState : this.vis.params.mapCenter;

const modules = await lazyLoadMapsLegacyModules();
this._opensearchDashboardsMap = new modules.OpenSearchDashboardMap(this._container, options);
this._opensearchDashboardsMap = new modules.OpenSearchDashboardsMap(this._container, options);
this._opensearchDashboardsMap.setMinZoom(WMS_MINZOOM); //use a default
this._opensearchDashboardsMap.setMaxZoom(WMS_MAXZOOM); //use a default

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/maps_legacy/public/map/service_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class ServiceSettings {
};

async getFileLayers() {
if (!this._mapConfig.includeOpenSearchDashboardsMapsService) {
if (!this._mapConfig.includeOpenSearchMapsService) {
return [];
}

Expand All @@ -141,7 +141,7 @@ export class ServiceSettings {
allServices.push(tmsService);
}

if (this._mapConfig.includeOpenSearchDashboardsMapsService) {
if (this._mapConfig.includeOpenSearchMapsService) {
const servicesFromManifest = await this._emsClient.getTMSServices();
const strippedServiceFromManifest = await Promise.all(
servicesFromManifest
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/maps_legacy/public/map/service_settings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('service_settings (FKA tile_map test)', function () {
const defaultMapConfig = {
emsFileApiUrl,
emsTileApiUrl,
includeOpenSearchDashboardsMapsService: true,
includeOpenSearchMapsService: true,
emsTileLayerId: {
bright: 'road_map',
desaturated: 'road_map_desaturated',
Expand Down Expand Up @@ -252,7 +252,7 @@ describe('service_settings (FKA tile_map test)', function () {
it('should exclude EMS', async () => {
serviceSettings = makeServiceSettings(
{
includeOpenSearchDashboardsMapsService: false,
includeOpenSearchMapsService: false,
},
{
url: 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png',
Expand All @@ -276,7 +276,7 @@ describe('service_settings (FKA tile_map test)', function () {

it('should exclude all when not configured', async () => {
serviceSettings = makeServiceSettings({
includeOpenSearchDashboardsMapsService: false,
includeOpenSearchMapsService: false,
});
const tilemapServices = await serviceSettings.getTMSServices();
const expected = [];
Expand Down Expand Up @@ -331,7 +331,7 @@ describe('service_settings (FKA tile_map test)', function () {

it('should exclude all when not configured', async () => {
const serviceSettings = makeServiceSettings({
includeOpenSearchDashboardsMapsService: false,
includeOpenSearchMapsService: false,
});
const fileLayers = await serviceSettings.getFileLayers();
const expected = [];
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/maps_legacy/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import { getUiSettings } from './ui_settings';

export const config: PluginConfigDescriptor<MapsLegacyConfig> = {
exposeToBrowser: {
includeOpenSearchDashboardsMapsService: true,
proxyOpenSearchDashboardsMapsServiceInMaps: true,
includeOpenSearchMapsService: true,
proxyOpenSearchMapsServiceInMaps: true,
tilemap: true,
regionmap: true,
manifestServiceUrl: true,
Expand Down

0 comments on commit 5e08fe3

Please sign in to comment.