From ba186b216b6a2fef9bfbe069c418aa852e30b168 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Mon, 9 Feb 2015 10:19:18 +0100 Subject: [PATCH] Show error dialog when WPS execution fails (see https://github.com/MapStory/story-tools/issues/144) --- .../style/services/layerClassificationService.js | 15 +++++++++++---- lib/templates/core/error-dialog.html | 11 +++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 lib/templates/core/error-dialog.html diff --git a/lib/ng/edit/style/services/layerClassificationService.js b/lib/ng/edit/style/services/layerClassificationService.js index 89adb62..1fc8e67 100644 --- a/lib/ng/edit/style/services/layerClassificationService.js +++ b/lib/ng/edit/style/services/layerClassificationService.js @@ -3,7 +3,7 @@ var module = angular.module('storytools.edit.style.layerClassificationService', []); - module.factory('stLayerClassificationService', function($q, $http) { + module.factory('stLayerClassificationService', function($q, $http, $modal, $sce, $log) { return { classify: function(layer, attribute, method, numClasses) { if (!this.cache) { @@ -81,9 +81,16 @@ service.cache[key] = response.rules; return response.rules; } else { - if (window.console) { - window.console.warn(response.msg); - } + $modal.open({ + templateUrl: '/lib/templates/core/error-dialog.html', + controller: function($scope) { + $scope.title = 'Error'; + $scope.msg = $sce.trustAsHtml( + 'An error occurred when communicating with the classification ' + + 'service:
' + response.msg); + } + }); + $log.warn(response.msg); return []; } }); diff --git a/lib/templates/core/error-dialog.html b/lib/templates/core/error-dialog.html new file mode 100644 index 0000000..dccb082 --- /dev/null +++ b/lib/templates/core/error-dialog.html @@ -0,0 +1,11 @@ +
+ + + +