Skip to content

Commit

Permalink
[Map] Remove hardcoded AWS paths
Browse files Browse the repository at this point in the history
Clean up temp aws paths in code base.
Add a configurable flag `showRegionBlockedWarning` into map plugin level config file.

Signed-off-by: Zuocheng Ding <zding817@gmail.com>
  • Loading branch information
zuochengding committed Jan 4, 2022
1 parent ac9c837 commit 79dfd64
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion config/opensearch_dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,8 @@
# defaultUrl: ""
# darkModeUrl: ""
# faviconUrl: ""
# applicationTitle: ""
# applicationTitle: ""

# Set the value of this setting to true to capture region blocked warnings and errors
# for your map rendering services.
# map.showRegionBlockedWarning: false
1 change: 1 addition & 0 deletions src/legacy/server/config/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export default () =>
map: Joi.object({
includeOpenSearchMapsService: Joi.boolean().default(true),
proxyOpenSearchMapsServiceInMaps: Joi.boolean().default(false),
showRegionBlockedWarning: Joi.boolean().default(false),
tilemap: Joi.object({
url: Joi.string(),
options: Joi.object({
Expand Down
1 change: 1 addition & 0 deletions src/plugins/maps_legacy/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { configSchema as regionmapSchema } from '../region_map/config';
export const configSchema = schema.object({
includeOpenSearchMapsService: schema.boolean({ defaultValue: true }),
proxyOpenSearchMapsServiceInMaps: schema.boolean({ defaultValue: false }),
showRegionBlockedWarning: 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 @@ -611,7 +611,7 @@ export class OpenSearchDashboardsMap extends EventEmitter {
this.emit('baseLayer:loading');
});
baseLayer.on('tileerror', () => {
if (baseLayer._url.includes('search-services.aws.a2z.com')) {
if (settings.options.showRegionBlockedWarning) {
createRegionBlockedWarning();
}
});
Expand Down
1 change: 1 addition & 0 deletions src/plugins/maps_legacy/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const config: PluginConfigDescriptor<MapsLegacyConfig> = {
exposeToBrowser: {
includeOpenSearchMapsService: true,
proxyOpenSearchMapsServiceInMaps: true,
showRegionBlockedWarning: true,
tilemap: true,
regionmap: true,
manifestServiceUrl: true,
Expand Down
6 changes: 1 addition & 5 deletions src/plugins/region_map/public/choropleth_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,12 @@ Make sure the file exists at that location.",
values: { name: name },
}
);
} else if (e.config.url.includes('aws.a2z.com')) {
// AES Region Maps will throw CORS exception when accessed from Embargo Regions.
// OPTIONS will fail before GET. Thus CORS error.
errorMessage = 'The vector map ' + name + ' is not available.';
} else {
errorMessage = i18n.translate(
'regionMap.choroplethLayer.downloadingVectorDataErrorMessage',
{
defaultMessage:
'Cannot download {name} file. Please ensure the \
'The vector map {name} is not available. Please ensure the \
CORS configuration of the server permits requests from the OpenSearch Dashboards application on this host.',
values: { name: name },
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class VegaMapView extends VegaBaseView {
baseMapOpts = {
...baseMapOpts,
...(await this._serviceSettings.getAttributesForTMSLayer(baseMapOpts, true, isDarkMode)),
showRegionBlockedWarning: this._serviceSettings._mapConfig.showRegionBlockedWarning,
};
if (!baseMapOpts) {
this.onWarn(
Expand Down

0 comments on commit 79dfd64

Please sign in to comment.