Support project name in project detail URLs

This commit adds support for navigating to a URL like

    https://storyboard.openstack.org/#!/project/openstack-infra/storyboard

in order to go to the StoryBoard project view. There are some
caveats, for a project named `list` or `search` this will not
work correctly.

Change-Id: Ia6b90e630c57b46abbe925706679efc5c6afcb27
Story: 52
Story: 107
Task: 67
Task: 165
This commit is contained in:
Adam Coldrick 2018-02-27 12:00:53 +00:00 committed by Monty Taylor
parent 52cbe7c07b
commit 055b8bb708
2 changed files with 11 additions and 3 deletions

View File

@ -34,8 +34,16 @@ angular.module('sb.projects').controller('ProjectDetailController',
// Parse the ID
var id = $stateParams.hasOwnProperty('id') ?
parseInt($stateParams.id, 10) :
null;
$stateParams.id : null;
if (!isNaN(id)) {
id = parseInt(id, 10);
}
if (id === null) {
$state.go('sb.index');
return;
}
/**
* UI flag for when we're initially loading the view.

View File

@ -44,7 +44,7 @@ angular.module('sb.projects',
controller: 'ProjectListController'
})
.state('sb.project.detail', {
url: '/{id:[0-9]+}',
url: '/{id:any}',
templateUrl: 'app/projects/template/detail.html',
controller: 'ProjectDetailController'
});