Browse Source

show dialog error on lu busy error

tags/0.1.0
Robin Thoni 8 years ago
parent
commit
97ab93fbd5
1 changed files with 17 additions and 2 deletions
  1. 17
    2
      src/lubusy.js

+ 17
- 2
src/lubusy.js View File

@@ -3,7 +3,8 @@
3 3
  */
4 4
 
5 5
 angular.module('luticateUtils')
6
-    .directive('luBusy', ['$compile', '$http', 'luticatePromises', '$templateCache', function($compile, $http, luticatePromises, $templateCache){
6
+    .directive('luBusy', ['$compile', '$http', 'luticatePromises', '$templateCache', 'luticateDialogErrorHelper',
7
+        function($compile, $http, luticatePromises, $templateCache, luticateDialogErrorHelper){
7 8
         return {
8 9
             restrict: 'A',
9 10
             scope: {
@@ -57,6 +58,20 @@ angular.module('luticateUtils')
57 58
                     return $scope.hasError;
58 59
                 };
59 60
 
61
+                $scope.showError = function()
62
+                {
63
+                    var errors = luticatePromises.getErrorsGroup(options.group);
64
+                    var error = null;
65
+                    if (errors != null) {
66
+                        error = errors.find(function (promise) {
67
+                            return promise.status == 2;
68
+                        });
69
+                    }
70
+                    if (error != null) {
71
+                        luticateDialogErrorHelper.errorDialog(error.value);
72
+                    }
73
+                };
74
+
60 75
                 function addTemplate(template, ngShow) {
61 76
 
62 77
                     $http.get(template, {cache: $templateCache}).success(function (indicatorTemplate) {
@@ -115,7 +130,7 @@ angular.module('luticateUtils').run(['$templateCache', function($templateCache)
115 130
         "\n" +
116 131
         "   <div class=\"lu-busy-default-sign\">\n" +
117 132
         "\n" +
118
-        "      <div class=\"lu-busy-default-error-text\">Error</div>\n" +
133
+        "      <div class=\"lu-busy-default-error-text\"><a href=\"\" ng-click=\"showError()\">Error</a></div>\n" +
119 134
         "\n" +
120 135
         "   </div>\n" +
121 136
         "\n" +

Loading…
Cancel
Save