瀏覽代碼

error handling fixes

tags/0.1.0
Robin Thoni 8 年之前
父節點
當前提交
d3a5c6504b
共有 2 個檔案被更改,包括 17 行新增4 行删除
  1. 14
    3
      src/lubasictable.js
  2. 3
    1
      src/modals/dialogerror.js

+ 14
- 3
src/lubasictable.js 查看文件

36
                     if ($scope.tableOptions.perPage == null) {
36
                     if ($scope.tableOptions.perPage == null) {
37
                         $scope.tableOptions.perPage = 15;
37
                         $scope.tableOptions.perPage = 15;
38
                     }
38
                     }
39
+                    if ($scope.tableOptions.query == null) {
40
+                        $scope.tableOptions.query = "";
41
+                    }
39
                     if ($scope.tableOptions.checkedItems == null) {
42
                     if ($scope.tableOptions.checkedItems == null) {
40
                         $scope.tableOptions.checkedItems = [];
43
                         $scope.tableOptions.checkedItems = [];
41
                     }
44
                     }
51
                             return false;
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
                     var onItemClicked = $scope.tableOptions.onItemClicked;
63
                     var onItemClicked = $scope.tableOptions.onItemClicked;
55
                     $scope.tableOptions.onItemClicked = function(item)
64
                     $scope.tableOptions.onItemClicked = function(item)
56
                     {
65
                     {
81
                             id: "promiseLoadItems_" + $scope.$id,
90
                             id: "promiseLoadItems_" + $scope.$id,
82
                             groups: [$scope.tableOptions.luBusy.group]
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
                             .then(function (items) {
95
                             .then(function (items) {
86
                                 $scope.tableOptions.page = page;
96
                                 $scope.tableOptions.page = page;
87
                                 $scope.items = items;
97
                                 $scope.items = items;
93
                                     $scope.pages.push(i);
103
                                     $scope.pages.push(i);
94
                                 }
104
                                 }
95
                                 $scope.tableOptions.onPageChanged();
105
                                 $scope.tableOptions.onPageChanged();
96
-                            }, function (error) {
97
-                            });
106
+                            }, luticateDialogErrorHelper.errorDialog);
98
                     };
107
                     };
99
 
108
 
100
                     $scope.toggleCheckedItem = function (item) {
109
                     $scope.toggleCheckedItem = function (item) {
161
 angular.module('luticateUtils').run(['$templateCache', function($templateCache)
170
 angular.module('luticateUtils').run(['$templateCache', function($templateCache)
162
 {
171
 {
163
     $templateCache.put('/luticate/lubasictable.html', '<div lu-busy="tableOptions.luBusy">' +
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
 '        <table class="col-sm-12 table table-hover">' +
175
 '        <table class="col-sm-12 table table-hover">' +
165
 '    <thead>' +
176
 '    <thead>' +
166
 '    <tr>' +
177
 '    <tr>' +

+ 3
- 1
src/modals/dialogerror.js 查看文件

5
 'use strict';
5
 'use strict';
6
 
6
 
7
 angular.module('luticateUtils').
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
         $scope.message = data.message;
10
         $scope.message = data.message;
10
         $scope.showLogin = data.data.Status == 401;
11
         $scope.showLogin = data.data.Status == 401;
11
         $scope.reconnect = function()
12
         $scope.reconnect = function()
12
         {
13
         {
13
             $scope.$dismiss();
14
             $scope.$dismiss();
15
+            luticateAuthCache.removeUser();
14
             $state.go('login');
16
             $state.go('login');
15
         };
17
         };
16
     }]);
18
     }]);

Loading…
取消
儲存