Show warning instead of fatal error when map-proxy is not available (#9742)

This commit is contained in:
Thomas Neirynck 2017-01-06 13:54:12 -05:00 committed by GitHub
parent 37c858af2e
commit efc954ed3f
3 changed files with 14 additions and 12 deletions

View file

@ -151,7 +151,7 @@ uiModules.get('kibana')
}
/**
* Make this instance property to allow for overrides by test code
* Make this a method to allow for overrides by test code
*/
async _getTileServiceManifest(manifestUrl, additionalQueryParams) {
const manifestServiceTokens = url.parse(manifestUrl);
@ -161,7 +161,6 @@ uiModules.get('kibana')
url: requestUrl,
method: 'GET'
});
}
}

View file

@ -2,11 +2,15 @@ import _ from 'lodash';
import MapsProvider from 'ui/vis_maps/maps';
import VisRenderbotProvider from 'ui/vis/renderbot';
import MapsVisTypeBuildChartDataProvider from 'ui/vislib_vis_type/build_chart_data';
module.exports = function MapsRenderbotFactory(Private, $injector) {
module.exports = function MapsRenderbotFactory(Private, $injector, tilemapSettings, Notifier) {
const AngularPromise = $injector.get('Promise');
const Maps = Private(MapsProvider);
const Renderbot = Private(VisRenderbotProvider);
const buildChartData = Private(MapsVisTypeBuildChartDataProvider);
const notify = new Notifier({
location: 'Tilemap'
});
_.class(MapsRenderbot).inherits(Renderbot);
function MapsRenderbot(vis, $el, uiState) {
@ -15,6 +19,11 @@ module.exports = function MapsRenderbotFactory(Private, $injector) {
}
MapsRenderbot.prototype._createVis = function () {
if (tilemapSettings.getError()) {
//Still allow the visualization to be build, but show a toast that there was a problem retrieving map settings
//Even though the basemap will not display, the user will at least still see the overlay data
notify.warning(tilemapSettings.getError().message);
}
if (this.mapsVis) this.destroy();
this.mapsParams = this._getMapsParams();
this.mapsVis = new Maps(this.$el[0], this.vis, this.mapsParams);

View file

@ -7,15 +7,11 @@ import VislibVisualizationsMarkerTypesGeohashGridProvider from './marker_types/g
import VislibVisualizationsMarkerTypesHeatmapProvider from './marker_types/heatmap';
import '../lib/tilemap_settings';
export default function MapFactory(Private, tilemapSettings, Notifier) {
export default function MapFactory(Private, tilemapSettings) {
const defaultMapZoom = 2;
const defaultMapCenter = [15, 5];
const defaultMarkerType = 'Scaled Circle Markers';
const notify = new Notifier({
location: 'Vis'
});
const markerTypes = {
'Scaled Circle Markers': Private(VislibVisualizationsMarkerTypesScaledCirclesProvider),
'Shaded Circle Markers': Private(VislibVisualizationsMarkerTypesShadedCirclesProvider),
@ -60,10 +56,8 @@ export default function MapFactory(Private, tilemapSettings, Notifier) {
fadeAnimation: false,
};
if (tilemapSettings.hasError()) {
notify.fatal(tilemapSettings.getError());
}
this._createMap(options, tilemapSettings.getUrl());
const url = tilemapSettings.hasError() ? '' : tilemapSettings.getUrl();
this._createMap(options, url);
}