Support Task ID in the "Jump to..." box

This commit adds a simple way to jump to the story containing a task
given just a task ID, by adding support the the "Jump to..." box to also
find tasks when provided with an ID.

Change-Id: Ibe3804f979e80b2a253ca22b224fdc434d0323e8
Story: 2002878
Task: 22840
This commit is contained in:
Adam Coldrick 2018-08-07 22:59:31 +01:00
parent 114b4e2ce3
commit e88967a2f4
1 changed files with 14 additions and 1 deletions

View File

@ -22,7 +22,7 @@ angular.module('storyboard').controller('HeaderController',
function ($q, $scope, $rootScope, $state, $modal, NewStoryService,
Session, SessionState, CurrentUser, Criteria, Notification,
Priority, Project, Story, ProjectGroup, NewWorklistService,
NewBoardService, SessionModalService, Severity) {
NewBoardService, SessionModalService, Severity, Task) {
'use strict';
function resolveCurrentUser() {
@ -155,6 +155,9 @@ angular.module('storyboard').controller('HeaderController',
case 'Story':
$state.go('sb.story.detail', {storyId: criteria.value});
break;
case 'Task':
$state.go('sb.task', {taskId: criteria.value});
break;
}
$scope.searchString = '';
@ -188,6 +191,7 @@ angular.module('storyboard').controller('HeaderController',
var getProjectGroupDeferred = $q.defer();
var getProjectDeferred = $q.defer();
var getStoryDeferred = $q.defer();
var getTaskDeferred = $q.defer();
headerGET = true;
ProjectGroup.get({id: searchString},
@ -214,11 +218,20 @@ angular.module('storyboard').controller('HeaderController',
}, function () {
getStoryDeferred.resolve(null);
});
Task.get({id: searchString},
function (result) {
getTaskDeferred.resolve(Criteria.create(
'Task', result.id, result.title
));
}, function () {
getTaskDeferred.resolve(null);
});
// If the search string is entirely numeric, do a GET.
searches.push(getProjectGroupDeferred.promise);
searches.push(getProjectDeferred.promise);
searches.push(getStoryDeferred.promise);
searches.push(getTaskDeferred.promise);
} else {
searches.push(ProjectGroup.criteriaResolver(searchString, 5));