Make messaging around the connected user invoking builds better

This commit is contained in:
Joseph Schorr 2015-03-18 16:26:27 -04:00
parent 99c56b7f98
commit c1d58bdd6c
2 changed files with 11 additions and 2 deletions

View file

@ -137,7 +137,8 @@
</td>
<td>
<span class="cor-options-menu">
<span class="cor-option" option-click="askRunTrigger(trigger)">
<span class="cor-option" option-click="askRunTrigger(trigger)"
ng-class="trigger.connected_user == user.username ? '' : 'disabled'">
<i class="fa fa-chevron-right"></i> Run Trigger Now
</span>
<span class="cor-option" option-click="askDeleteTrigger(trigger)">

View file

@ -12,11 +12,13 @@ angular.module('quay').directive('repoPanelBuilds', function () {
'repository': '=repository',
'builds': '=builds'
},
controller: function($scope, $element, $filter, $routeParams, ApiService, TriggerService) {
controller: function($scope, $element, $filter, $routeParams, ApiService, TriggerService, UserService) {
var orderBy = $filter('orderBy');
$scope.TriggerService = TriggerService;
UserService.updateUserIn($scope);
$scope.options = {
'filter': 'recent',
'reverse': false,
@ -165,6 +167,12 @@ angular.module('quay').directive('repoPanelBuilds', function () {
};
$scope.askRunTrigger = function(trigger) {
if ($scope.user.username != trigger.connected_user) {
bootbox.alert('For security reasons, only user "' + trigger.connected_user +
'" can manually invoke this trigger');
return;
}
$scope.currentStartTrigger = trigger;
$scope.showTriggerStartDialogCounter++;
};