Bug 1256751 - Make ctrl-click toggle pinning, not just pinning always (#1603) r=camd

* Bug 1256751 - Make ctrl-click toggle pinning, not just pinning always

* Update thShortcutTable for the new toggle action
This commit is contained in:
KWierso 2016-06-29 01:21:16 +01:00 коммит произвёл GitHub
Родитель 9721185907
Коммит de914a1cd2
5 изменённых файлов: 28 добавлений и 3 удалений

Просмотреть файл

@ -217,7 +217,7 @@ treeherder.directive('thCloneJobs', [
};
var togglePinJobCb = function(ev, el, job){
$rootScope.$emit(thEvents.jobPin, job);
$rootScope.$emit(thEvents.toggleJobPin, job);
};
var filterWithRunnable = function(job) {

Просмотреть файл

@ -165,9 +165,12 @@ treeherder.provider('thEvents', function() {
// fired when the job details are loaded
jobDetailLoaded: "job-detail-loaded-EVT",
// fired with a selected job on ctrl/cmd-click or spacebar
// fired with a selected job on spacebar
jobPin: "job-pin-EVT",
// fired with a selected job on ctrl/cmd-click
toggleJobPin: "job-togglepin-EVT",
// fired with a selected job on 'r'
jobRetrigger: "job-retrigger-EVT",

Просмотреть файл

@ -50,6 +50,14 @@ treeherder.factory('thPinboard', [
};
var api = {
toggleJobPin: function(job) {
if(pinnedJobs[job.id]) {
api.unPinJob(job.id);
} else {
api.pinJob(job);
}
},
pinJob: function(job) {
if (api.spaceRemaining() > 0) {
pinnedJobs[job.id] = job;

Просмотреть файл

@ -34,7 +34,7 @@
<tr><td class="kbd">l</td>
<td>Open the logviewer for the selected job</td></tr>
<tr><td><span class="kbd">ctrl</span> or <span class="kbd">cmd</span></td>
<td>Add job to the pinboard during click selection</td></tr>
<td>Toggle pinning a job during click selection</td></tr>
<tr><td class="kbd">spacebar</td>
<td>Add a selected job to the pinboard</td></tr>
<tr><td class="kbd">b</td>

Просмотреть файл

@ -7,6 +7,13 @@ treeherder.controller('PinboardCtrl', [
var $log = new ThLog(this.constructor.name);
$rootScope.$on(thEvents.toggleJobPin, function(event, job) {
$scope.toggleJobPin(job);
if(!$scope.$$phase){
$scope.$digest();
}
});
$rootScope.$on(thEvents.jobPin, function(event, job) {
$scope.pinJob(job);
if(!$scope.$$phase){
@ -31,6 +38,13 @@ treeherder.controller('PinboardCtrl', [
}
});
$scope.toggleJobPin = function(job) {
thPinboard.toggleJobPin(job);
if (!$scope.selectedJob) {
$scope.viewJob(job);
}
};
$scope.pinJob = function(job) {
thPinboard.pinJob(job);
if (!$scope.selectedJob) {