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

[BUG] show region blocked warning config not respected #2042

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,13 @@ export function BaseMapsVisualizationProvider() {
isDarkMode
);
const showZoomMessage = serviceSettings.shouldShowZoomMessage(tmsLayer);
const showRegionBlockedWarning = serviceSettings.shouldShowRegionBlockedWarning();
const options = { ...tmsLayer };
delete options.id;
delete options.subdomains;
this._opensearchDashboardsMap.setBaseLayer({
baseLayerType: 'tms',
options: { ...options, showZoomMessage, ...meta },
options: { ...options, showZoomMessage, showRegionBlockedWarning, ...meta },
});
}

Expand Down
5 changes: 5 additions & 0 deletions src/plugins/maps_legacy/public/map/service_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class ServiceSettings {
this._hasTmsConfigured = typeof tilemapsConfig.url === 'string' && tilemapsConfig.url !== '';

this._showZoomMessage = true;
this._showRegionBlockedWarning = this._mapConfig.showRegionBlockedWarning;
this._emsClient = null;
this._opensearchMapsClient = new OpenSearchMapsClient({
language: i18n.getLocale(),
Expand Down Expand Up @@ -88,6 +89,10 @@ export class ServiceSettings {
});
}

shouldShowRegionBlockedWarning() {
return this._showRegionBlockedWarning;
}

shouldShowZoomMessage({ origin }) {
return origin === ORIGIN.EMS && this._showZoomMessage;
}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/vis_type_vega/public/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ export const [getMapsLegacyConfig, setMapsLegacyConfig] = createGetterSetter<Map

export const getEnableExternalUrls = () => getInjectedVars().enableExternalUrls;
export const getEmsTileLayerId = () => getMapsLegacyConfig().emsTileLayerId;
export const getShowRegionBlockedWarning = () => getMapsLegacyConfig().showRegionBlockedWarning;
4 changes: 2 additions & 2 deletions src/plugins/vis_type_vega/public/vega_view/vega_map_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { i18n } from '@osd/i18n';
import { vega } from '../lib/vega';
import { VegaBaseView } from './vega_base_view';
import { VegaMapLayer } from './vega_map_layer';
import { getEmsTileLayerId, getUISettings } from '../services';
import { getEmsTileLayerId, getShowRegionBlockedWarning, getUISettings } from '../services';
import { lazyLoadMapsLegacyModules } from '../../../maps_legacy/public';

export class VegaMapView extends VegaBaseView {
Expand All @@ -58,7 +58,7 @@ export class VegaMapView extends VegaBaseView {
baseMapOpts = {
...baseMapOpts,
...(await this._serviceSettings.getAttributesForTMSLayer(baseMapOpts, true, isDarkMode)),
showRegionBlockedWarning: this._serviceSettings._mapConfig.showRegionBlockedWarning,
showRegionBlockedWarning: getShowRegionBlockedWarning(),
};
if (!baseMapOpts) {
this.onWarn(
Expand Down