Skip to content

Commit 5fb4143

Browse files
authored
[BUG] show region blocked warning config not respected (#2042)
The configuration wasn't passed down to the options that was expecting it to be available for the plugin to run the conditional logic. Value was undefined for region map. Also, cleaned up the vega map view code. Issue: #2041 Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
1 parent 28fd642 commit 5fb4143

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

src/plugins/maps_legacy/public/map/base_maps_visualization.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,13 @@ export function BaseMapsVisualizationProvider() {
205205
isDarkMode
206206
);
207207
const showZoomMessage = serviceSettings.shouldShowZoomMessage(tmsLayer);
208+
const showRegionBlockedWarning = serviceSettings.shouldShowRegionBlockedWarning();
208209
const options = { ...tmsLayer };
209210
delete options.id;
210211
delete options.subdomains;
211212
this._opensearchDashboardsMap.setBaseLayer({
212213
baseLayerType: 'tms',
213-
options: { ...options, showZoomMessage, ...meta },
214+
options: { ...options, showZoomMessage, showRegionBlockedWarning, ...meta },
214215
});
215216
}
216217

src/plugins/maps_legacy/public/map/service_settings.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export class ServiceSettings {
5858
this._hasTmsConfigured = typeof tilemapsConfig.url === 'string' && tilemapsConfig.url !== '';
5959

6060
this._showZoomMessage = true;
61+
this._showRegionBlockedWarning = this._mapConfig.showRegionBlockedWarning;
6162
this._emsClient = null;
6263
this._opensearchMapsClient = new OpenSearchMapsClient({
6364
language: i18n.getLocale(),
@@ -88,6 +89,10 @@ export class ServiceSettings {
8889
});
8990
}
9091

92+
shouldShowRegionBlockedWarning() {
93+
return this._showRegionBlockedWarning;
94+
}
95+
9196
shouldShowZoomMessage({ origin }) {
9297
return origin === ORIGIN.EMS && this._showZoomMessage;
9398
}

src/plugins/vis_type_vega/public/services.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ export const [getMapsLegacyConfig, setMapsLegacyConfig] = createGetterSetter<Map
5757

5858
export const getEnableExternalUrls = () => getInjectedVars().enableExternalUrls;
5959
export const getEmsTileLayerId = () => getMapsLegacyConfig().emsTileLayerId;
60+
export const getShowRegionBlockedWarning = () => getMapsLegacyConfig().showRegionBlockedWarning;

src/plugins/vis_type_vega/public/vega_view/vega_map_view.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { i18n } from '@osd/i18n';
3232
import { vega } from '../lib/vega';
3333
import { VegaBaseView } from './vega_base_view';
3434
import { VegaMapLayer } from './vega_map_layer';
35-
import { getEmsTileLayerId, getUISettings } from '../services';
35+
import { getEmsTileLayerId, getShowRegionBlockedWarning, getUISettings } from '../services';
3636
import { lazyLoadMapsLegacyModules } from '../../../maps_legacy/public';
3737

3838
export class VegaMapView extends VegaBaseView {
@@ -58,7 +58,7 @@ export class VegaMapView extends VegaBaseView {
5858
baseMapOpts = {
5959
...baseMapOpts,
6060
...(await this._serviceSettings.getAttributesForTMSLayer(baseMapOpts, true, isDarkMode)),
61-
showRegionBlockedWarning: this._serviceSettings._mapConfig.showRegionBlockedWarning,
61+
showRegionBlockedWarning: getShowRegionBlockedWarning(),
6262
};
6363
if (!baseMapOpts) {
6464
this.onWarn(

0 commit comments

Comments
 (0)