Browse Source

error handling fixes

tags/0.1.0
Robin Thoni 8 years ago
parent
commit
d3a5c6504b
2 changed files with 17 additions and 4 deletions
  1. 14
    3
      src/lubasictable.js
  2. 3
    1
      src/modals/dialogerror.js

+ 14
- 3
src/lubasictable.js View File

@@ -36,6 +36,9 @@ angular.module('luticateUtils')
36 36
                     if ($scope.tableOptions.perPage == null) {
37 37
                         $scope.tableOptions.perPage = 15;
38 38
                     }
39
+                    if ($scope.tableOptions.query == null) {
40
+                        $scope.tableOptions.query = "";
41
+                    }
39 42
                     if ($scope.tableOptions.checkedItems == null) {
40 43
                         $scope.tableOptions.checkedItems = [];
41 44
                     }
@@ -51,6 +54,12 @@ angular.module('luticateUtils')
51 54
                             return false;
52 55
                         }
53 56
                     }
57
+                    if ($scope.tableOptions.canFilter == null) {
58
+                        $scope.tableOptions.canFilter = function()
59
+                        {
60
+                            return true;
61
+                        }
62
+                    }
54 63
                     var onItemClicked = $scope.tableOptions.onItemClicked;
55 64
                     $scope.tableOptions.onItemClicked = function(item)
56 65
                     {
@@ -81,7 +90,8 @@ angular.module('luticateUtils')
81 90
                             id: "promiseLoadItems_" + $scope.$id,
82 91
                             groups: [$scope.tableOptions.luBusy.group]
83 92
                         };
84
-                        $scope.tableOptions.getLoadPagePromise(page, $scope.tableOptions.perPage, promiseLoadItems)
93
+                        $scope.tableOptions.getLoadPagePromise(page, $scope.tableOptions.perPage,
94
+                            $scope.tableOptions.query, promiseLoadItems)
85 95
                             .then(function (items) {
86 96
                                 $scope.tableOptions.page = page;
87 97
                                 $scope.items = items;
@@ -93,8 +103,7 @@ angular.module('luticateUtils')
93 103
                                     $scope.pages.push(i);
94 104
                                 }
95 105
                                 $scope.tableOptions.onPageChanged();
96
-                            }, function (error) {
97
-                            });
106
+                            }, luticateDialogErrorHelper.errorDialog);
98 107
                     };
99 108
 
100 109
                     $scope.toggleCheckedItem = function (item) {
@@ -161,6 +170,8 @@ angular.module('luticateUtils')
161 170
 angular.module('luticateUtils').run(['$templateCache', function($templateCache)
162 171
 {
163 172
     $templateCache.put('/luticate/lubasictable.html', '<div lu-busy="tableOptions.luBusy">' +
173
+'<div class="col-sm-3 pull-right" ng-show="tableOptions.canFilter()"><input placeholder="Filter" class="form-control" ng-model-options="{debounce: 500}" ' +
174
+        'ng-model="tableOptions.query" ng-change="loadPage(0)"/></div>' +
164 175
 '        <table class="col-sm-12 table table-hover">' +
165 176
 '    <thead>' +
166 177
 '    <tr>' +

+ 3
- 1
src/modals/dialogerror.js View File

@@ -5,12 +5,14 @@
5 5
 'use strict';
6 6
 
7 7
 angular.module('luticateUtils').
8
-    controller('luticateDialogError', ['$scope', 'data', '$state', function ($scope, data, $state) {
8
+    controller('luticateDialogError', ['$scope', 'data', '$state', 'luticateAuthCache',
9
+    function ($scope, data, $state, luticateAuthCache) {
9 10
         $scope.message = data.message;
10 11
         $scope.showLogin = data.data.Status == 401;
11 12
         $scope.reconnect = function()
12 13
         {
13 14
             $scope.$dismiss();
15
+            luticateAuthCache.removeUser();
14 16
             $state.go('login');
15 17
         };
16 18
     }]);

Loading…
Cancel
Save