- Add model functions for working with prototypes
- Add API calls for working with prototypes - Get UI for prototypes working (minus add)
This commit is contained in:
parent
330051f7d9
commit
e17c3590a7
9 changed files with 329 additions and 1 deletions
|
@ -2256,6 +2256,16 @@ p.editable:hover i {
|
|||
color: steelblue;
|
||||
}
|
||||
|
||||
.prototype-manager-element thead th {
|
||||
padding: 4px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.prototype-manager-element td {
|
||||
padding: 10px !important;
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
.org-list h2 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
|
59
static/directives/prototype-manager.html
Normal file
59
static/directives/prototype-manager.html
Normal file
|
@ -0,0 +1,59 @@
|
|||
<div class="prototype-manager-element">
|
||||
<div class="quay-spinner" ng-show="loading"></div>
|
||||
|
||||
<div class="container" ng-show="!loading">
|
||||
<div class="alert alert-info">
|
||||
Default permissions provide a means of specifying <span class="context-tooltip" title="By default, all repositories have the creating user added as an 'Admin'" bs-tooltip="tooltip.title">additional</span> permissions that should be granted automatically to a repository based on the user or robot creating the repository.
|
||||
</div>
|
||||
|
||||
<div class="side-controls">
|
||||
<button class="btn btn-success">
|
||||
<i class="fa fa-plus"></i>
|
||||
New Default Permission
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th>
|
||||
<span class="context-tooltip" title="The user that is creating the repository"
|
||||
bs-tooltip="tooltip.title" data-container="body">
|
||||
Creating User/Robot
|
||||
</span>
|
||||
</th>
|
||||
<th>
|
||||
<span class="context-tooltip" title="The user or team that is being granted the permission"
|
||||
bs-tooltip="tooltip.title" data-container="body">
|
||||
Delegated User/Team
|
||||
</span>
|
||||
</th>
|
||||
<th>Permission</th>
|
||||
<th style="width: 150px"></th>
|
||||
</thead>
|
||||
|
||||
<tr ng-repeat="prototype in prototypes">
|
||||
<td>
|
||||
<span class="entity-reference" orgname="organization.name" name="prototype.activating_user.name"
|
||||
isrobot="prototype.activating_user.is_robot"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="entity-reference" orgname="organization.name"
|
||||
name="prototype.delegate.kind == 'team' ? null :prototype.delegate.name"
|
||||
team="prototype.delegate.kind == 'team' ? prototype.delegate.name : null"
|
||||
isrobot="prototype.delegate.is_robot"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="role-group" current-role="prototype.role" role-changed="setRole(role, prototype)" roles="roles"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="delete-ui" tabindex="0">
|
||||
<span class="delete-ui-button" ng-click="deletePrototype(prototype)"><button class="btn btn-danger">Delete</button></span>
|
||||
<i class="fa fa-times" bs-tooltip="tooltip.title" data-placement="right" title="Delete Permission"></i>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
|
@ -1479,6 +1479,97 @@ quayApp.directive('robotsManager', function () {
|
|||
});
|
||||
|
||||
|
||||
quayApp.directive('prototypeManager', function () {
|
||||
var directiveDefinitionObject = {
|
||||
priority: 0,
|
||||
templateUrl: '/static/directives/prototype-manager.html',
|
||||
replace: false,
|
||||
transclude: false,
|
||||
restrict: 'C',
|
||||
scope: {
|
||||
'organization': '=organization'
|
||||
},
|
||||
controller: function($scope, $element, ApiService) {
|
||||
$scope.loading = false;
|
||||
|
||||
$scope.roles = [
|
||||
{ 'id': 'read', 'title': 'Read', 'kind': 'success' },
|
||||
{ 'id': 'write', 'title': 'Write', 'kind': 'success' },
|
||||
{ 'id': 'admin', 'title': 'Admin', 'kind': 'primary' }
|
||||
];
|
||||
|
||||
$scope.setRole = function(role, prototype) {
|
||||
var params = {
|
||||
'orgname': $scope.organization.name,
|
||||
'prototypeid': prototype.id
|
||||
};
|
||||
|
||||
var data = {
|
||||
'id': prototype.id,
|
||||
'role': role
|
||||
};
|
||||
|
||||
ApiService.updateOrganizationPrototypePermission(data, params).then(function(resp) {
|
||||
prototype.role = role;
|
||||
}, function(resp) {
|
||||
bootbox.dialog({
|
||||
"message": resp.data ? resp.data : 'The permission could not be modified',
|
||||
"title": "Cannot modify permission",
|
||||
"buttons": {
|
||||
"close": {
|
||||
"label": "Close",
|
||||
"className": "btn-primary"
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.deletePrototype = function(prototype) {
|
||||
$scope.loading = true;
|
||||
|
||||
var params = {
|
||||
'orgname': $scope.organization.name,
|
||||
'prototypeid': prototype.id
|
||||
};
|
||||
|
||||
ApiService.deleteOrganizationPrototypePermission(null, params).then(function(resp) {
|
||||
$scope.prototypes.splice($scope.prototypes.indexOf(prototype), 1);
|
||||
$scope.loading = false;
|
||||
}, function(resp) {
|
||||
bootbox.dialog({
|
||||
"message": resp.data ? resp.data : 'The permission could not be deleted',
|
||||
"title": "Cannot delete permission",
|
||||
"buttons": {
|
||||
"close": {
|
||||
"label": "Close",
|
||||
"className": "btn-primary"
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
var update = function() {
|
||||
if (!$scope.organization) { return; }
|
||||
if ($scope.loading) { return; }
|
||||
|
||||
var params = {'orgname': $scope.organization.name};
|
||||
|
||||
$scope.loading = true;
|
||||
ApiService.getOrganizationPrototypePermissions(null, params).then(function(resp) {
|
||||
$scope.prototypes = resp.prototypes;
|
||||
$scope.loading = false;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$watch('organization', update);
|
||||
}
|
||||
};
|
||||
return directiveDefinitionObject;
|
||||
});
|
||||
|
||||
|
||||
quayApp.directive('popupInputButton', function () {
|
||||
var directiveDefinitionObject = {
|
||||
priority: 0,
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<li><a href="javascript:void(0)" data-toggle="tab" data-target="#logs" ng-click="loadLogs()">Usage Logs</a></li>
|
||||
<li><a href="javascript:void(0)" data-toggle="tab" data-target="#members" ng-click="loadMembers()">Members</a></li>
|
||||
<li><a href="javascript:void(0)" data-toggle="tab" data-target="#robots">Robot Accounts</a></li>
|
||||
<li><a href="javascript:void(0)" data-toggle="tab" data-target="#prototypes">Default Permissions</a></li>
|
||||
<li ng-show="hasPaidPlan"><a href="javascript:void(0)" data-toggle="tab" data-target="#billingoptions">Billing</a></li>
|
||||
<li ng-show="hasPaidPlan"><a href="javascript:void(0)" data-toggle="tab" data-target="#billing" ng-click="loadInvoices()">Billing History</a></li>
|
||||
</ul>
|
||||
|
@ -49,6 +50,11 @@
|
|||
<div class="robots-manager" organization="organization"></div>
|
||||
</div>
|
||||
|
||||
<!-- Prototypes tab -->
|
||||
<div id="prototypes" class="tab-pane">
|
||||
<div class="prototype-manager" organization="organization"></div>
|
||||
</div>
|
||||
|
||||
<!-- Logs tab -->
|
||||
<div id="logs" class="tab-pane">
|
||||
<div class="logs-view" organization="organization" visible="logsShown"></div>
|
||||
|
|
Reference in a new issue