Make the frontend agnostic to why a trigger can be run manually
This commit is contained in:
parent
b979f99964
commit
3f2447d831
4 changed files with 6 additions and 7 deletions
|
@ -76,7 +76,7 @@ def trigger_view(trigger, can_read=False, can_admin=False, for_build=False):
|
||||||
'repository_url': repo_url if can_read else None,
|
'repository_url': repo_url if can_read else None,
|
||||||
|
|
||||||
'config': build_trigger.config if can_admin else {},
|
'config': build_trigger.config if can_admin else {},
|
||||||
'is_connected_user': is_connected_user,
|
'can_invoke': is_connected_user,
|
||||||
}
|
}
|
||||||
|
|
||||||
if not for_build and can_admin and trigger.pull_robot:
|
if not for_build and can_admin and trigger.pull_robot:
|
||||||
|
|
|
@ -40,8 +40,8 @@
|
||||||
<tr ng-repeat="trigger in triggers">
|
<tr ng-repeat="trigger in triggers">
|
||||||
<td><span class="trigger-description" trigger="trigger"></span></td>
|
<td><span class="trigger-description" trigger="trigger"></span></td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-primary" ng-click="runTriggerNow(trigger)" ng-if="trigger.is_connected_user">Run Trigger</button>
|
<button class="btn btn-primary" ng-click="runTriggerNow(trigger)" ng-if="trigger.can_invoke">Run Trigger</button>
|
||||||
<span class="empty" ng-if="!trigger.is_connected_user">You cannot start triggers created by another user</span>
|
<span class="empty" ng-if="!trigger.can_invoke">You do not have permission to run this trigger</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -147,7 +147,7 @@
|
||||||
<i class="fa fa-unlock-alt"></i> View Credentials
|
<i class="fa fa-unlock-alt"></i> View Credentials
|
||||||
</span>
|
</span>
|
||||||
<span class="cor-option" option-click="askRunTrigger(trigger)"
|
<span class="cor-option" option-click="askRunTrigger(trigger)"
|
||||||
ng-class="trigger.is_connected_user ? '' : 'disabled'">
|
ng-class="trigger.can_invoke ? '' : 'disabled'">
|
||||||
<i class="fa fa-chevron-right"></i> Run Trigger Now
|
<i class="fa fa-chevron-right"></i> Run Trigger Now
|
||||||
</span>
|
</span>
|
||||||
<span class="cor-option" option-click="askDeleteTrigger(trigger)">
|
<span class="cor-option" option-click="askDeleteTrigger(trigger)">
|
||||||
|
|
|
@ -199,9 +199,8 @@ angular.module('quay').directive('repoPanelBuilds', function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.askRunTrigger = function(trigger) {
|
$scope.askRunTrigger = function(trigger) {
|
||||||
if (!trigger.is_connected_user) {
|
if (!trigger.can_invoke) {
|
||||||
bootbox.alert('For security reasons, only the user that created this trigger can ' +
|
bootbox.alert('You do not have permission to manually invoke this trigger');
|
||||||
'manually invoke this trigger');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue