Bug 1046229 - Handle invalid values for 'revision' in the URL

This commit is contained in:
gbrmachado 2015-08-04 22:45:04 +01:00
Родитель 6e23720771
Коммит 0226e2528c
2 изменённых файлов: 20 добавлений и 10 удалений

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

@ -4,11 +4,11 @@ treeherderApp.controller('JobsCtrl', [
'$scope', '$http', '$rootScope', '$routeParams', 'ThLog',
'thUrl', 'ThRepositoryModel', 'thDefaultRepo',
'ThResultSetStore', 'thResultStatusList', '$location', 'thEvents',
'ThJobModel',
'ThJobModel', 'thNotify',
function JobsCtrl(
$scope, $http, $rootScope, $routeParams, ThLog,
thUrl, ThRepositoryModel, thDefaultRepo,
ThResultSetStore, thResultStatusList, $location, thEvents, ThJobModel) {
ThResultSetStore, thResultStatusList, $location, thEvents, ThJobModel, thNotify) {
var $log = new ThLog(this.constructor.name);
@ -67,7 +67,11 @@ treeherderApp.controller('JobsCtrl', [
}
};
if(ThResultSetStore.isNotLoaded($scope.repoName)){
if ($location.search().revision === 'undefined') {
thNotify.send("Invalid value for revision parameter.", 'danger');
}
if (ThResultSetStore.isNotLoaded($scope.repoName)) {
// get our first set of resultsets
ThResultSetStore.fetchResultSets(
$scope.repoName,
@ -232,4 +236,3 @@ treeherderApp.controller('ResultSetCtrl', [
});
}
]);

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

@ -55,12 +55,19 @@
!isLoadingJobs && locationHasSearchParam('revision') && currentRepo.url"
class="result-set-body unknown-message-body">
<span ng-init="revision=getSearchParamValue('revision')">
<span>Waiting for a push with revision <strong>{{revision}}</strong></span>
<a href="{{currentRepo.getPushLogHref(revision)}}"
target="_blank"
title="open revision {{revision}} on {{currentRepo.url}}">(view pushlog)</a>
<span class="fa fa-spinner fa-pulse th-spinner"></span>
<div>If the push exists, it will appear in a few minutes once it has been processed.</div>
<span ng-if="revision !=== 'undefined'">
<span>Waiting for a push with revision <strong>{{revision}}</strong></span>
<a href="{{currentRepo.getPushLogHref(revision)}}"
target="_blank"
title="open revision {{revision}} on {{currentRepo.url}}">(view pushlog)</a>
<span class="fa fa-spinner fa-pulse th-spinner"></span>
<div>If the push exists, it will appear in a few minutes once it has been processed.</div>
</span>
<span ng-if="revision ==='undefined'">
<span>This is an invalid revision parameter. Please change it, or click
<a ng-click="changeRepo(repoName)" href="{{::repoName.URL}}">here</a> to reload the latest revisions from {{repoName}}.
</span>
</span>
</span>
</div>