From 52b486dbf3525fe0e3a8230d423ebbac63bc4b49 Mon Sep 17 00:00:00 2001 From: Cameron Dawson Date: Mon, 22 Sep 2014 14:45:20 -0700 Subject: [PATCH] bug 1067854 - hide empty failure text when loading --- .../app/plugins/failure_summary/controller.js | 42 +++++++------------ webapp/app/plugins/failure_summary/main.html | 4 +- 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/webapp/app/plugins/failure_summary/controller.js b/webapp/app/plugins/failure_summary/controller.js index 353d8686..afb2972f 100644 --- a/webapp/app/plugins/failure_summary/controller.js +++ b/webapp/app/plugins/failure_summary/controller.js @@ -11,7 +11,7 @@ treeherder.controller('BugsPluginCtrl', [ var timeout_promise = null; var bug_limit = 20; - + $scope.tabs = thTabs.tabs; // update function triggered by the plugins controller thTabs.tabs.failureSummary.update = function(){ @@ -44,31 +44,21 @@ treeherder.controller('BugsPluginCtrl', [ suggestion.bugs = {"open_recent":[], "all_others":[]}; } - if(suggestion.bugs.open_recent.length > bug_limit){ - suggestion.bugs.too_many_open_recent = true; - }else{ - suggestion.bugs.too_many_open_recent = false; - } - - if(suggestion.bugs.all_others.length > bug_limit){ - suggestion.bugs.too_many_all_others = true; - }else{ - suggestion.bugs.too_many_all_others = false; - } + suggestion.bugs.too_many_open_recent = ( + suggestion.bugs.open_recent.length > bug_limit + ); + suggestion.bugs.too_many_all_others = ( + suggestion.bugs.all_others.length > bug_limit + ); + suggestion.open_recent_hidden = ( + suggestion.bugs.too_many_open_recent || + suggestion.bugs.open_recent.length === 0 + ); - if(suggestion.bugs.too_many_open_recent - || suggestion.bugs.open_recent.length == 0){ - suggestion.open_recent_hidden = true; - }else{ - suggestion.open_recent_hidden = false; - } - - if(suggestion.bugs.too_many_all_others - || suggestion.bugs.all_others.length == 0){ - suggestion.all_others_hidden = true; - }else{ - suggestion.all_others_hidden = false; - } + suggestion.all_others_hidden = ( + suggestion.bugs.too_many_all_others || + suggestion.bugs.all_others.length === 0 + ); suggestions.push(suggestion); }); @@ -79,6 +69,6 @@ treeherder.controller('BugsPluginCtrl', [ thTabs.tabs.failureSummary.is_loading = false; }); } - } + }; } ]); diff --git a/webapp/app/plugins/failure_summary/main.html b/webapp/app/plugins/failure_summary/main.html index 6cd8b6dc..632b613c 100644 --- a/webapp/app/plugins/failure_summary/main.html +++ b/webapp/app/plugins/failure_summary/main.html @@ -54,13 +54,13 @@ >Exceeded max bug suggestions -
  • +
  • Failure summary is empty
  • -
    +