summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-06-18 14:18:12 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-26 09:27:33 +0100
commit4013784b450a2965d16324ffd501c353da5f11e0 (patch)
tree4d25f784ad76326a8a438caa53026dfa2b981a95 /bitbake/lib
parentd21e1749c867b72ab7a9e40262a201f8efbc7668 (diff)
downloadpoky-4013784b450a2965d16324ffd501c353da5f11e0.tar.gz
bitbake: toaster: table.js fix filter visual indicator and interaction
- Fix the id of the filter modal dialog. - Fix the visual indicator toggle button - Add check to see if the number of items to filter on is !=0 if it is then don't allow applying this filter. (Bitbake rev: a73f08c79077b6ded0c08ea7d36032f4568d12e3) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/table.js59
1 files changed, 44 insertions, 15 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/table.js b/bitbake/lib/toaster/toastergui/static/js/table.js
index 1072c7588d..d06a3f539a 100644
--- a/bitbake/lib/toaster/toastergui/static/js/table.js
+++ b/bitbake/lib/toaster/toastergui/static/js/table.js
@@ -261,23 +261,14 @@ function tableInit(ctx){
261 var filterBtn = $('<a href="#" role="button" class="pull-right btn btn-mini" data-toggle="modal"><i class="icon-filter filtered"></i></a>'); 261 var filterBtn = $('<a href="#" role="button" class="pull-right btn btn-mini" data-toggle="modal"><i class="icon-filter filtered"></i></a>');
262 262
263 filterBtn.data('filter-name', col.filter_name); 263 filterBtn.data('filter-name', col.filter_name);
264 filterBtn.prop('id', col.filter_name);
264 filterBtn.click(filterOpenClicked); 265 filterBtn.click(filterOpenClicked);
265 266
266 /* If we're currently being filtered setup the visial indicator */ 267 /* If we're currently being filtered setup the visial indicator */
267 if (tableParams.filter && 268 if (tableParams.filter &&
268 tableParams.filter.match('^'+col.filter_name)) { 269 tableParams.filter.match('^'+col.filter_name)) {
269 270
270 filterBtn.addClass("btn-primary"); 271 filterBtnActive(filterBtn, true);
271
272 filterBtn.tooltip({
273 html: true,
274 title: '<button class="btn btn-small btn-primary" onClick=\'$("#clear-filter-btn").click();\'>Clear filter</button>',
275 placement: 'bottom',
276 delay: {
277 hide: 1500,
278 show: 400,
279 },
280 });
281 } 272 }
282 header.append(filterBtn); 273 header.append(filterBtn);
283 } 274 }
@@ -310,6 +301,26 @@ function tableInit(ctx){
310 tableChromeDone = true; 301 tableChromeDone = true;
311 } 302 }
312 303
304 /* Toggles the active state of the filter button */
305 function filterBtnActive(filterBtn, active){
306 if (active) {
307 filterBtn.addClass("btn-primary");
308
309 filterBtn.tooltip({
310 html: true,
311 title: '<button class="btn btn-small btn-primary" onClick=\'$("#clear-filter-btn-'+ ctx.tableName +'").click();\'>Clear filter</button>',
312 placement: 'bottom',
313 delay: {
314 hide: 1500,
315 show: 400,
316 },
317 });
318 } else {
319 filterBtn.removeClass("btn-primary");
320 filterBtn.tooltip('destroy');
321 }
322 }
323
313 /* Display or hide table columns based on the cookie preference or defaults */ 324 /* Display or hide table columns based on the cookie preference or defaults */
314 function loadColumnsPreference(){ 325 function loadColumnsPreference(){
315 var cookie_data = $.cookie("cols"); 326 var cookie_data = $.cookie("cols");
@@ -427,6 +438,10 @@ function tableInit(ctx){
427 438
428 var radioInput = action.children("input"); 439 var radioInput = action.children("input");
429 440
441 if (Number(filterAction.count) == 0){
442 radioInput.attr("disabled", "disabled");
443 }
444
430 action.children(".filter-title").text(actionTitle); 445 action.children(".filter-title").text(actionTitle);
431 446
432 radioInput.val(filterName + ':' + filterAction.name); 447 radioInput.val(filterName + ':' + filterAction.name);
@@ -475,7 +490,13 @@ function tableInit(ctx){
475 490
476 tableParams.page = 1; 491 tableParams.page = 1;
477 tableParams.search = searchTerm; 492 tableParams.search = searchTerm;
478 tableParams.filter = null; 493
494 /* If a filter was active we remove it */
495 if (tableParams.filter) {
496 var filterBtn = $("#" + tableParams.filter.split(":")[0]);
497 filterBtnActive(filterBtn, false);
498 tableParams.filter = null;
499 }
479 500
480 loadData(tableParams); 501 loadData(tableParams);
481 502
@@ -504,6 +525,9 @@ function tableInit(ctx){
504 }); 525 });
505 526
506 $("#clear-filter-btn-"+ctx.tableName).click(function(){ 527 $("#clear-filter-btn-"+ctx.tableName).click(function(){
528 var filterBtn = $("#" + tableParams.filter.split(":")[0]);
529 filterBtnActive(filterBtn, false);
530
507 tableParams.filter = null; 531 tableParams.filter = null;
508 loadData(tableParams); 532 loadData(tableParams);
509 }); 533 });
@@ -513,13 +537,18 @@ function tableInit(ctx){
513 537
514 tableParams.filter = $(this).find("input[type='radio']:checked").val(); 538 tableParams.filter = $(this).find("input[type='radio']:checked").val();
515 539
540 var filterBtn = $("#" + tableParams.filter.split(":")[0]);
541
516 /* All === remove filter */ 542 /* All === remove filter */
517 if (tableParams.filter.match(":all$")) 543 if (tableParams.filter.match(":all$")) {
518 tableParams.filter = null; 544 tableParams.filter = null;
545 filterBtnActive(filterBtn, false);
546 } else {
547 filterBtnActive(filterBtn, true);
548 }
519 549
520 loadData(tableParams); 550 loadData(tableParams);
521 551
522 552 $(this).parent().modal('hide');
523 $('#filter-modal').modal('hide');
524 }); 553 });
525} 554}