Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Commit

Permalink
Bug 1057303 - Modified default behavior to not filter results when th…
Browse files Browse the repository at this point in the history
…e buildername href is middle/right/clicked
  • Loading branch information
jeads committed Sep 4, 2014
1 parent aebb7bd commit 5cbcbed
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 9 deletions.
26 changes: 26 additions & 0 deletions webapp/app/js/directives/main.js
Expand Up @@ -64,6 +64,32 @@ treeherder.directive('preventDefaultOnLeftClick', [
}
}
]);
treeherder.directive('thFilterByBuildername', [
'thJobFilters',
function(thJobFilters){
return {
restrict: 'A',
link: function(scope, element, attrs){
element.on('click', function(event){

// Only execute the in page search if the
// user does a left click
if(event.which === 1){

thJobFilters.setSearchQuery(scope.buildbotJobname || "");

// Need to tell angular to run the digest cycle
// to process the new values in
// thJobFilters.searchQuery
if(!scope.$$phase){
scope.$apply();
}
}
});
}
}
}
]);

treeherder.directive('thNotificationBox', [
'thNotify',
Expand Down
10 changes: 8 additions & 2 deletions webapp/app/js/services/jobfilters.js
Expand Up @@ -683,6 +683,7 @@ treeherder.factory('thJobFilters', [
};

var setSearchQuery = function(queryStr){

if(typeof queryStr === "string"){
searchQueryStr = queryStr;

Expand All @@ -691,6 +692,7 @@ treeherder.factory('thJobFilters', [
}else{
searchQuery = queryStr.replace(/ +(?= )/g, ' ').toLowerCase().split(' ');
}

}
};

Expand Down Expand Up @@ -722,14 +724,18 @@ treeherder.factory('thJobFilters', [
toggleInProgress: toggleInProgress,
toggleSkipExclusionProfiles: toggleSkipExclusionProfiles,

getSearchQuery: getSearchQuery,
setSearchQuery: setSearchQuery,

// CONSTANTS
isClassified: "isClassified",
resultStatus: "resultStatus",
matchType: matchType,
fieldChoices: fieldChoices,

getSearchQuery: getSearchQuery,
setSearchQuery: setSearchQuery
searchQuery: searchQuery,
searchQueryStr: searchQueryStr

};

return api;
Expand Down
8 changes: 2 additions & 6 deletions webapp/app/plugins/controller.js
Expand Up @@ -2,13 +2,13 @@

treeherder.controller('PluginCtrl', [
'$scope', '$rootScope', '$location', 'thUrl', 'ThJobClassificationModel',
'thClassificationTypes', 'ThJobModel', 'thJobFilters', 'thEvents', 'dateFilter',
'thClassificationTypes', 'ThJobModel', 'thEvents', 'dateFilter',
'numberFilter', 'ThBugJobMapModel', 'thResultStatus', 'thSocket',
'ThResultSetModel', 'ThLog', '$q', 'thPinboard', 'ThJobArtifactModel',
'thBuildApi', 'thNotify', 'ThJobLogUrlModel',
function PluginCtrl(
$scope, $rootScope, $location, thUrl, ThJobClassificationModel,
thClassificationTypes, ThJobModel, thJobFilters, thEvents, dateFilter,
thClassificationTypes, ThJobModel, thEvents, dateFilter,
numberFilter, ThBugJobMapModel, thResultStatus, thSocket,
ThResultSetModel, ThLog, $q, thPinboard, ThJobArtifactModel,
thBuildApi, thNotify, ThJobLogUrlModel) {
Expand Down Expand Up @@ -249,10 +249,6 @@ treeherder.controller('PluginCtrl', [
}
};

$scope.filterByBuildername = function(buildername){
thJobFilters.setSearchQuery(buildername);
};

$scope.pinboard_service = thPinboard;

var updateClassification = function(classification){
Expand Down
2 changes: 1 addition & 1 deletion webapp/app/plugins/pluginpanel.html
Expand Up @@ -96,7 +96,7 @@
</li>
</ul>
<ul>
<li><h6><a href="{{ buildbotJobnameHref }}" ng-click="filterByBuildername(buildbotJobname);" target="_blank" prevent-default-on-left-click>{{ buildbotJobname }}</a></h6></li>
<li><h6><a href="{{ buildbotJobnameHref }}" target="_blank" prevent-default-on-left-click th-filter-by-buildername>{{ buildbotJobname }}</a></h6></li>
<li class="small">
<label>Machine name:</label>
<a title="Open Buildbot Slave Health Report" target="_blank"
Expand Down

0 comments on commit 5cbcbed

Please sign in to comment.