From ffdf0a7265bf710e362dc54581129786246a0648 Mon Sep 17 00:00:00 2001 From: Jonathan French Date: Tue, 27 Jan 2015 17:18:27 -0500 Subject: [PATCH] Bug 1118253 - Deselect job when clicking any empty page area --- ui/css/treeherder.css | 4 ---- ui/index.html | 9 ++++++-- ui/js/controllers/main.js | 11 ++++++++++ ui/js/directives/clonejobs.js | 14 ------------ ui/js/directives/resultsets.js | 3 ++- ui/js/filters.js | 7 ++++-- ui/js/providers.js | 3 --- ui/partials/main/jobs.html | 26 ++++++++++++++--------- ui/partials/main/thActionButton.html | 13 ++++++++---- ui/partials/main/thResultCounts.html | 11 +++++----- ui/partials/main/thResultStatusCount.html | 10 +++++---- ui/plugins/controller.js | 5 ----- 12 files changed, 62 insertions(+), 54 deletions(-) diff --git a/ui/css/treeherder.css b/ui/css/treeherder.css index 2e250341b..c5d5d9e9b 100755 --- a/ui/css/treeherder.css +++ b/ui/css/treeherder.css @@ -23,10 +23,6 @@ a:visited { height: 100%; } -.getnext-footer { - margin-bottom: 0; -} - .pagination, .carousel, .panel-title a { cursor: pointer; } diff --git a/ui/index.html b/ui/index.html index b8dd6c1ba..77ba8f49d 100755 --- a/ui/index.html +++ b/ui/index.html @@ -21,7 +21,8 @@
-
+
@@ -116,6 +117,7 @@ {{revision}} {{name|initials}} @@ -130,7 +132,9 @@ diff --git a/ui/js/controllers/main.js b/ui/js/controllers/main.js index cd19a95a0..4e7d7c7c5 100644 --- a/ui/js/controllers/main.js +++ b/ui/js/controllers/main.js @@ -37,6 +37,17 @@ treeherder.controller('MainCtrl', [ ThResultSetStore.setSelectedJob($rootScope.repoName); }; + // Clear the job if it occurs in a particular area + $scope.clearJobOnClick = function(event) { + var element = event.target; + // Suppress for various UI elements so selection is preserved + var ignoreClear = element.hasAttribute("ignore-job-clear-on-click"); + + if (!ignoreClear) { + $scope.closeJob(); + } + }; + $scope.processKeyboardInput = function(ev){ // If the user is in an editable element or the user is pressing diff --git a/ui/js/directives/clonejobs.js b/ui/js/directives/clonejobs.js index 5457a8b16..f64bacd3c 100644 --- a/ui/js/directives/clonejobs.js +++ b/ui/js/directives/clonejobs.js @@ -174,15 +174,6 @@ treeherder.directive('thCloneJobs', [ }, 200); }; - var clearJobCb = function(ev, el, job) { - clearSelectJobStyles(); - - // Reset selected job to null to initialize nav position - ThResultSetStore.setSelectedJob($rootScope.repoName); - - $rootScope.$emit(thEvents.jobClear, job); - }; - var togglePinJobCb = function(ev, el, job){ $rootScope.$emit(thEvents.jobPin, job); }; @@ -309,11 +300,6 @@ treeherder.directive('thCloneJobs', [ ThResultSetStore.setSelectedJob($rootScope.repoName, el, job); - } else { - // If user didn't select a job or anchor clear the selected job - if (el.prop("tagName") !== "A") { - _.bind(clearJobCb, this, ev, el)(); - } } }; diff --git a/ui/js/directives/resultsets.js b/ui/js/directives/resultsets.js index 38ed4cc1d..c61c4ce30 100644 --- a/ui/js/directives/resultsets.js +++ b/ui/js/directives/resultsets.js @@ -132,7 +132,8 @@ treeherder.directive('thAuthor', function () { scope.authorEmail = email; }, template: '' + - '{{authorName}}' + '{{authorName}}' }; }); diff --git a/ui/js/filters.js b/ui/js/filters.js index 06c7c246d..532f4fc5b 100755 --- a/ui/js/filters.js +++ b/ui/js/filters.js @@ -42,15 +42,18 @@ treeherder.filter('linkifyBugs', function() { var str = input || ''; var bug_matches = /.*-- ([0-9]+)|.*bug-([0-9]+)|.*Bug ([0-9]+)/ig.exec(str); var pr_matches = /PR#([0-9]+)/i.exec(str); + var clear_attr = 'ignore-job-clear-on-click'; if (pr_matches) { var pr_url = "https://github.com/mozilla-b2g/gaia/pull/" + pr_matches[1]; - var pr_hyperlink = '' + pr_matches[1] + ''; + var pr_hyperlink = '' + + pr_matches[1] + ''; str = str.replace(pr_matches[1], pr_hyperlink); } if (bug_matches) { var bug_match = bug_matches[1] || bug_matches[2] || bug_matches[3]; var bug_url = "https://bugzilla.mozilla.org/show_bug.cgi?id=" + bug_match; - var bug_hyperlink = '' + bug_match + ''; + var bug_hyperlink = '' + + bug_match + ''; str = str.replace(bug_match, bug_hyperlink); } return str; diff --git a/ui/js/providers.js b/ui/js/providers.js index 04f774c4d..dc5ec8284 100644 --- a/ui/js/providers.js +++ b/ui/js/providers.js @@ -185,9 +185,6 @@ treeherder.provider('thEvents', function() { // fired (surprisingly) when a job is clicked jobClick: "job-click-EVT", - // fired on click outside a job element - jobClear: "job-clear-EVT", - // fired when the job details are loaded jobDetailLoaded: "job-detail-loaded-EVT", diff --git a/ui/partials/main/jobs.html b/ui/partials/main/jobs.html index 07317faab..0b24e9594 100755 --- a/ui/partials/main/jobs.html +++ b/ui/partials/main/jobs.html @@ -13,7 +13,8 @@ {{::resultsetDateStr}} - + title="open this resultset" + ignore-job-clear-on-click>{{::resultsetDateStr}} - @@ -21,8 +22,10 @@ - + @@ -31,18 +34,22 @@ tabindex="0" role="button" title="cancel all jobs in this resultset" ng-show="currentRepo.repository_group.name == 'try' || user.is_staff" + ignore-job-clear-on-click ng-click="cancelAllJobs(resultset.revision)"> - + - - {{::resultset.revision_count}} + title="show revisions" + ignore-job-clear-on-click + ng-click="toggleRevisions()"> + + + {{::resultset.revision_count}} >20 @@ -97,8 +104,7 @@
-