##// END OF EJS Templates
search pages: got rid of $scope
ergo -
Show More

The requested changes are too big and content was truncated. Show full diff

1 NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
@@ -31,7 +31,7 b''
31 31 "angular-mocks": "1.5.5",
32 32 "angular-scenario": "1.5.5",
33 33 "angular-bootstrap": "1.3.2",
34 "angular-ui-router": "1.0.0-alpha.5",
34 "angular-ui-router": "1.0.0-beta.3",
35 35 "angular-toArrayFilter" : "1.0.1",
36 36 "d3": "3.5.0",
37 37 "c3": "0.4.11",
@@ -655,13 +655,4 b' function IndexDashboardController($rootScope, $scope, $location, $cookies, $inte'
655 655 vm.determineStartState();
656 656 vm.refreshData();
657 657 }
658
659 $scope.$on('$locationChangeSuccess', function () {
660 console.log('$locationChangeSuccess IndexDashboardController');
661 if (vm.loading.series === false) {
662 vm.determineStartState();
663 vm.refreshData();
664 }
665 });
666
667 658 }
@@ -19,9 +19,9 b''
19 19
20 20 angular.module('appenlight.controllers').controller('LogsController', LogsController);
21 21
22 LogsController.$inject = ['$scope', '$location', 'stateHolder', 'typeAheadTagHelper', 'logsNoIdResource', 'sectionViewResource'];
22 LogsController.$inject = ['$location', 'stateHolder', 'typeAheadTagHelper', 'logsNoIdResource', 'sectionViewResource'];
23 23
24 function LogsController($scope, $location, stateHolder, typeAheadTagHelper, logsNoIdResource, sectionViewResource) {
24 function LogsController($location, stateHolder, typeAheadTagHelper, logsNoIdResource, sectionViewResource) {
25 25 var vm = this;
26 26 vm.logEventsChartConfig = {
27 27 data: {
@@ -87,7 +87,7 b' function LogsController($scope, $location, stateHolder, typeAheadTagHelper, logs'
87 87 vm.logsPage = [];
88 88 vm.itemCount = 0;
89 89 vm.itemsPerPage = 250;
90 vm.searchParams = parseSearchToTags($location.search());
90 vm.page = 1;
91 91 vm.$location = $location;
92 92 vm.isLoading = {
93 93 logs: true,
@@ -161,13 +161,16 b' function LogsController($scope, $location, stateHolder, typeAheadTagHelper, logs'
161 161 vm.aheadFilter = typeAheadTagHelper.aheadFilter;
162 162 vm.removeSearchTag = function (tag) {
163 163 $location.search(tag.type, null);
164 vm.refresh();
164 165 };
165 166 vm.addSearchTag = function (tag) {
166 167 $location.search(tag.type, tag.value);
168 vm.refresh();
167 169 };
168 170
169 171 vm.paginationChange = function(){
170 $location.search('page', vm.searchParams.page);
172 $location.search('page', vm.page);
173 vm.refresh();
171 174 };
172 175
173 176
@@ -185,8 +188,7 b' function LogsController($scope, $location, stateHolder, typeAheadTagHelper, logs'
185 188 var text = vm.filterTypeAhead;
186 189 if (_.isObject(vm.filterTypeAhead)) {
187 190 text = vm.filterTypeAhead.text;
188 }
189 ;
191 };
190 192 if (!vm.filterTypeAhead) {
191 193 return
192 194 }
@@ -222,8 +224,7 b' function LogsController($scope, $location, stateHolder, typeAheadTagHelper, logs'
222 224 }
223 225 vm.showDatePicker = false;
224 226 // aka we selected one of main options
225 $location.search(tag.type, tag.value);
226
227 vm.addSearchTag({type: tag.type, value: tag.value});
227 228 // clear typeahead
228 229 vm.filterTypeAhead = undefined;
229 230 };
@@ -278,22 +279,16 b' function LogsController($scope, $location, stateHolder, typeAheadTagHelper, logs'
278 279
279 280 vm.filterId = function (log) {
280 281 $location.search('request_id', log.request_id);
282 vm.refresh();
281 283 };
282 284
283 var params = parseTagsToSearch(vm.searchParams);
284 vm.fetchLogs(params);
285 vm.fetchSeriesData(params);
286
287 $scope.$on('$locationChangeSuccess', function () {
288 console.log('$locationChangeSuccess LogsController');
285 vm.refresh = function(){
289 286 vm.searchParams = parseSearchToTags($location.search());
287 vm.page = Number(vm.searchParams.page) || 1;
290 288 var params = parseTagsToSearch(vm.searchParams);
291 console.log($location.path());
292 if (vm.isLoading.logs === false) {
293 console.log(params);
294 vm.fetchLogs(params);
295 vm.fetchSeriesData(params);
296 }
297 });
298
289 vm.fetchLogs(params);
290 vm.fetchSeriesData(params);
291 };
292 console.info('page load');
293 vm.refresh();
299 294 }
@@ -20,10 +20,10 b''
20 20 angular.module('appenlight.controllers')
21 21 .controller('ReportsListController', ReportsListController);
22 22
23 ReportsListController.$inject = ['$scope', '$location', '$cookies',
23 ReportsListController.$inject = ['$location', '$cookies',
24 24 'stateHolder', 'typeAheadTagHelper', 'reportsResource'];
25 25
26 function ReportsListController($scope, $location, $cookies, stateHolder,
26 function ReportsListController($location, $cookies, stateHolder,
27 27 typeAheadTagHelper, reportsResource) {
28 28 var vm = this;
29 29 vm.applications = stateHolder.AeUser.applications_map;
@@ -33,11 +33,11 b' function ReportsListController($scope, $location, $cookies, stateHolder,'
33 33 };
34 34 vm.today();
35 35 vm.reportsPage = [];
36 vm.page = 1;
36 37 vm.itemCount = 0;
37 38 vm.itemsPerPage = 250;
38 39 typeAheadTagHelper.tags = [];
39 40 vm.searchParams = {tags: [], page: 1, type: 'report'};
40 vm.searchParams = parseSearchToTags($location.search());
41 41 vm.is_loading = false;
42 42 vm.filterTypeAheadOptions = [
43 43 {
@@ -153,9 +153,11 b' function ReportsListController($scope, $location, $cookies, stateHolder,'
153 153 vm.aheadFilter = typeAheadTagHelper.aheadFilter;
154 154 vm.removeSearchTag = function (tag) {
155 155 $location.search(tag.type, null);
156 vm.refresh();
156 157 };
157 158 vm.addSearchTag = function (tag) {
158 159 $location.search(tag.type, tag.value);
160 vm.refresh();
159 161 };
160 162 vm.notRelativeTime = false;
161 163 if ($cookies.notRelativeTime) {
@@ -164,7 +166,7 b' function ReportsListController($scope, $location, $cookies, stateHolder,'
164 166
165 167 vm.changeRelativeTime = function () {
166 168 $cookies.notRelativeTime = JSON.stringify(vm.notRelativeTime);
167 }
169 };
168 170
169 171 _.each(_.range(1, 11), function (priority) {
170 172 vm.filterTypeAheadOptions.push({
@@ -195,7 +197,8 b' function ReportsListController($scope, $location, $cookies, stateHolder,'
195 197 });
196 198
197 199 vm.paginationChange = function(){
198 $location.search('page', vm.searchParams.page);
200 $location.search('page', vm.page);
201 vm.refresh();
199 202 };
200 203
201 204 vm.typeAheadTag = function (event) {
@@ -242,10 +245,10 b' function ReportsListController($scope, $location, $cookies, stateHolder,'
242 245 }
243 246 vm.showDatePicker = false;
244 247 // aka we selected one of main options
245 $location.search(tag.type, tag.value);
248 vm.addSearchTag({type: tag.type, value: tag.value});
246 249 // clear typeahead
247 250 vm.filterTypeAhead = undefined;
248 }
251 };
249 252
250 253 vm.pickerDateChanged = function(){
251 254 if (vm.filterTypeAhead.indexOf('start_date:') == '0') {
@@ -299,22 +302,16 b' function ReportsListController($scope, $location, $cookies, stateHolder,'
299 302 type: "request_id",
300 303 value: log.request_id
301 304 });
305 vm.refresh();
302 306 };
303 // initial load
304 var params = parseTagsToSearch(vm.searchParams);
305 vm.fetchReports(params);
306 307
307 $scope.$on('$locationChangeSuccess', function () {
308 console.log('$locationChangeSuccess ReportsListController ');
308 vm.refresh = function(){
309 309 vm.searchParams = parseSearchToTags($location.search());
310 vm.page = Number(vm.searchParams.page) || 1;
310 311 var params = parseTagsToSearch(vm.searchParams);
311 console.log($location.path());
312 if (vm.is_loading === false) {
313 console.log(params);
314 vm.fetchReports(params);
315 }
316
317 });
318
319
312 console.log(params);
313 vm.fetchReports(params);
314 };
315 // initial load
316 vm.refresh();
320 317 }
@@ -24,10 +24,10 b''
24 24 angular.module('appenlight.controllers')
25 25 .controller('ReportsListSlowController', ReportsListSlowController);
26 26
27 ReportsListSlowController.$inject = ['$scope', '$location', '$cookies',
27 ReportsListSlowController.$inject = ['$location', '$cookies',
28 28 'stateHolder', 'typeAheadTagHelper', 'slowReportsResource']
29 29
30 function ReportsListSlowController($scope, $location, $cookies, stateHolder, typeAheadTagHelper, slowReportsResource) {
30 function ReportsListSlowController($location, $cookies, stateHolder, typeAheadTagHelper, slowReportsResource) {
31 31 var vm = this;
32 32 vm.applications = stateHolder.AeUser.applications_map;
33 33 stateHolder.section = 'slow_reports';
@@ -36,11 +36,11 b' function ReportsListSlowController($scope, $location, $cookies, stateHolder, typ'
36 36 };
37 37 vm.today();
38 38 vm.reportsPage = [];
39 vm.page = 1;
39 40 vm.itemCount = 0;
40 41 vm.itemsPerPage = 250;
41 42 typeAheadTagHelper.tags = [];
42 43 vm.searchParams = {tags: [], page: 1, type: 'slow_report'};
43 vm.searchParams = parseSearchToTags($location.search());
44 44 vm.is_loading = false;
45 45 vm.filterTypeAheadOptions = [
46 46 {
@@ -134,9 +134,11 b' function ReportsListSlowController($scope, $location, $cookies, stateHolder, typ'
134 134 vm.aheadFilter = typeAheadTagHelper.aheadFilter;
135 135 vm.removeSearchTag = function (tag) {
136 136 $location.search(tag.type, null);
137 vm.refresh();
137 138 };
138 139 vm.addSearchTag = function (tag) {
139 140 $location.search(tag.type, tag.value);
141 vm.refresh();
140 142 };
141 143 vm.manualOpen = false;
142 144 vm.notRelativeTime = false;
@@ -181,8 +183,7 b' function ReportsListSlowController($scope, $location, $cookies, stateHolder, typ'
181 183 var text = vm.filterTypeAhead;
182 184 if (_.isObject(vm.filterTypeAhead)) {
183 185 text = vm.filterTypeAhead.text;
184 }
185 ;
186 };
186 187 if (!vm.filterTypeAhead) {
187 188 return
188 189 }
@@ -217,14 +218,15 b' function ReportsListSlowController($scope, $location, $cookies, stateHolder, typ'
217 218 }
218 219 vm.showDatePicker = false;
219 220 // aka we selected one of main options
220 $location.search(tag.type, tag.value);
221 vm.addSearchTag({type: tag.type, value: tag.value});
221 222 // clear typeahead
222 223 vm.filterTypeAhead = undefined;
223 }
224 };
224 225
225 226 vm.paginationChange = function(){
226 $location.search('page', vm.searchParams.page);
227 }
227 $location.search('page', vm.page);
228 vm.refresh();
229 };
228 230
229 231 vm.pickerDateChanged = function(){
230 232 if (vm.filterTypeAhead.indexOf('start_date:') == '0') {
@@ -234,7 +236,7 b' function ReportsListSlowController($scope, $location, $cookies, stateHolder, typ'
234 236 vm.filterTypeAhead = 'end_date:' + moment(vm.pickerDate).utc().hour(23).minute(59).format();
235 237 }
236 238 vm.showDatePicker = false;
237 }
239 };
238 240
239 241 var reportPresentation = function (report) {
240 242 report.presentation = {};
@@ -255,7 +257,7 b' function ReportsListSlowController($scope, $location, $cookies, stateHolder, typ'
255 257 report.presentation.tooltip = 'New';
256 258 }
257 259 return report;
258 }
260 };
259 261
260 262 vm.fetchReports = function (searchParams) {
261 263 vm.is_loading = true;
@@ -271,28 +273,22 b' function ReportsListSlowController($scope, $location, $cookies, stateHolder, typ'
271 273 }, function () {
272 274 vm.is_loading = false;
273 275 });
274 }
276 };
275 277
276 278 vm.filterId = function (log) {
277 279 vm.searchParams.tags.push({
278 280 type: "request_id",
279 281 value: log.request_id
280 282 });
281 }
282 //initial load
283 var params = parseTagsToSearch(vm.searchParams);
284 vm.fetchReports(params);
285
286 $scope.$on('$locationChangeSuccess', function () {
287 console.log('$locationChangeSuccess ReportsListSlowController ');
283 vm.refresh();
284 };
285 vm.refresh = function(){
288 286 vm.searchParams = parseSearchToTags($location.search());
287 vm.page = Number(vm.searchParams.page) || 1;
289 288 var params = parseTagsToSearch(vm.searchParams);
290 console.log($location.path());
291 if (vm.is_loading === false) {
292 console.log(params);
293 vm.fetchReports(params);
294 }
295 });
296
289 vm.fetchReports(params);
290 };
297 291
292 //initial load
293 vm.refresh();
298 294 }
@@ -105,7 +105,6 b" angular.module('appenlight.directives.c3chart', [])"
105 105 scope.chart = scope.chart.destroy();
106 106 delete element;
107 107 delete scope.chart;
108 console.log('destroy called');
109 108 }
110 109 }
111 110 );
@@ -44,7 +44,7 b''
44 44
45 45
46 46 <div class="text-center">
47 <uib-pagination total-items="logs.itemCount" items-per-page="logs.itemsPerPage" ng-model="logs.searchParams.page" max-size="10"
47 <uib-pagination total-items="logs.itemCount" items-per-page="logs.itemsPerPage" ng-model="logs.page" max-size="10"
48 48 ng-change="logs.paginationChange()"
49 49 class="pagination pagination-sm" boundary-links="true" direction-links="false"></uib-pagination>
50 50 </div>
@@ -88,7 +88,7 b''
88 88 </div>
89 89
90 90 <div class="text-center">
91 <uib-pagination total-items="logs.itemCount" items-per-page="logs.itemsPerPage" ng-model="logs.searchParams.page" max-size="10"
91 <uib-pagination total-items="logs.itemCount" items-per-page="logs.itemsPerPage" ng-model="logs.page" max-size="10"
92 92 ng-change="logs.paginationChange()"
93 93 class="pagination pagination-sm" boundary-links="true" direction-links="false"></uib-pagination>
94 94 </div>
@@ -32,7 +32,7 b''
32 32
33 33
34 34 <div class="text-center">
35 <uib-pagination total-items="reports_list.itemCount" items-per-page="reports_list.itemsPerPage" ng-model="reports_list.searchParams.page" max-size="10"
35 <uib-pagination total-items="reports_list.itemCount" items-per-page="reports_list.itemsPerPage" ng-model="reports_list.page" max-size="10"
36 36 class="pagination pagination-sm" boundary-links="true" direction-links="false"
37 37 ng-change="reports_list.paginationChange()"
38 38 ng-show="!reports_list.is_loading"></uib-pagination>
@@ -80,7 +80,7 b''
80 80
81 81
82 82 <div class="text-center">
83 <uib-pagination total-items="reports_list.itemCount" items-per-page="reports_list.itemsPerPage" ng-model="reports_list.searchParams.page" max-size="10"
83 <uib-pagination total-items="reports_list.itemCount" items-per-page="reports_list.itemsPerPage" ng-model="reports_list.page" max-size="10"
84 84 class="pagination pagination-sm" boundary-links="true" direction-links="false"
85 85 ng-change="reports_list.paginationChange()"
86 86 ng-show="!reports_list.is_loading"></uib-pagination>
@@ -34,7 +34,7 b''
34 34
35 35
36 36 <div class="text-center">
37 <uib-pagination total-items="reports_list.itemCount" items-per-page="reports_list.itemsPerPage" ng-model="reports_list.searchParams.page" max-size="10"
37 <uib-pagination total-items="reports_list.itemCount" items-per-page="reports_list.itemsPerPage" ng-model="reports_list.page" max-size="10"
38 38 class="pagination pagination-sm" boundary-links="true" direction-links="false"
39 39 ng-change="reports_list.paginationChange()"
40 40 ng-show="!reports_list.is_loading"></uib-pagination>
@@ -86,7 +86,7 b''
86 86 </div>
87 87
88 88 <div class="text-center">
89 <uib-pagination total-items="reports_list.itemCount" items-per-page="reports_list.itemsPerPage" ng-model="reports_list.searchParams.page" max-size="10"
89 <uib-pagination total-items="reports_list.itemCount" items-per-page="reports_list.itemsPerPage" ng-model="reports_list.page" max-size="10"
90 90 class="pagination pagination-sm" boundary-links="true" direction-links="false"
91 91 ng-change="reports_list.paginationChange()"
92 92 ng-show="!reports_list.is_loading"></uib-pagination>
General Comments 0
You need to be logged in to leave comments. Login now