mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
show error toast each time the visualize tilemap vis is created
This commit is contained in:
parent
c0bec83a6d
commit
5769991f3f
3 changed files with 13 additions and 18 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -7,16 +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: 'Tilemap'
|
||||
});
|
||||
const previousErrors = [];
|
||||
|
||||
const markerTypes = {
|
||||
'Scaled Circle Markers': Private(VislibVisualizationsMarkerTypesScaledCirclesProvider),
|
||||
'Shaded Circle Markers': Private(VislibVisualizationsMarkerTypesShadedCirclesProvider),
|
||||
|
@ -61,16 +56,7 @@ export default function MapFactory(Private, tilemapSettings, Notifier) {
|
|||
fadeAnimation: false,
|
||||
};
|
||||
|
||||
let url;
|
||||
if (tilemapSettings.hasError()) {
|
||||
if (!previousErrors.includes(tilemapSettings.getError())) {
|
||||
notify.warning(tilemapSettings.getError().message);
|
||||
previousErrors.push(tilemapSettings.getError());
|
||||
}
|
||||
url = '';
|
||||
} else {
|
||||
url = tilemapSettings.getUrl();
|
||||
}
|
||||
const url = tilemapSettings.hasError() ? '' : tilemapSettings.getUrl();
|
||||
this._createMap(options, url);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue