Browse Source

show dialog error on lu busy error

tags/0.1.0
Robin Thoni 9 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
  */
3
  */
4
 
4
 
5
 angular.module('luticateUtils')
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
         return {
8
         return {
8
             restrict: 'A',
9
             restrict: 'A',
9
             scope: {
10
             scope: {
57
                     return $scope.hasError;
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
                 function addTemplate(template, ngShow) {
75
                 function addTemplate(template, ngShow) {
61
 
76
 
62
                     $http.get(template, {cache: $templateCache}).success(function (indicatorTemplate) {
77
                     $http.get(template, {cache: $templateCache}).success(function (indicatorTemplate) {
115
         "\n" +
130
         "\n" +
116
         "   <div class=\"lu-busy-default-sign\">\n" +
131
         "   <div class=\"lu-busy-default-sign\">\n" +
117
         "\n" +
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
         "\n" +
134
         "\n" +
120
         "   </div>\n" +
135
         "   </div>\n" +
121
         "\n" +
136
         "\n" +

Loading…
Cancel
Save