diff --git a/static/css/quay.css b/static/css/quay.css index 5fed775e0..e8334d2ce 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -1408,10 +1408,14 @@ p.editable:hover i { margin-left: 10px; } -.org-view .team-listing .btn-group { +.org-view .team-listing .control-col { margin-top: 20px; } +.org-view .team-listing .delete-col button { + padding: 4px; +} + .org-view .team-listing i { margin-right: 10px; } diff --git a/static/directives/role-group.html b/static/directives/role-group.html new file mode 100644 index 000000000..f3b53ad43 --- /dev/null +++ b/static/directives/role-group.html @@ -0,0 +1,5 @@ +
+ +
diff --git a/static/js/app.js b/static/js/app.js index ca32342a3..88b315eaf 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -436,6 +436,34 @@ quayApp.directive('entitySearch', function () { }); +quayApp.directive('roleGroup', function () { + var directiveDefinitionObject = { + priority: 0, + templateUrl: '/static/directives/role-group.html', + replace: false, + transclude: false, + restrict: 'C', + scope: { + 'roles': '=roles', + 'currentRole': '=currentRole', + 'roleChanged': '&roleChanged' + }, + controller: function($scope, $element) { + $scope.setRole = function(role) { + $scope.currentRole = role; + if ($scope.roleChanged) { + if ($scope.changeParams) { + $scope.changeParams(); + } + $scope.roleChanged({'role': role}); + } + }; + } + }; + return directiveDefinitionObject; +}); + + quayApp.directive('namespaceSelector', function () { var directiveDefinitionObject = { priority: 0, diff --git a/static/js/controllers.js b/static/js/controllers.js index eb51f18f1..ec7f3e6e7 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -536,7 +536,13 @@ function RepoAdminCtrl($scope, Restangular, $routeParams, $rootScope) { }); }; - $scope.setRole = function(entityName, role, kind) { + $scope.roles = [ + { 'id': 'read', 'title': 'Read', 'kind': 'success' }, + { 'id': 'write', 'title': 'Write', 'kind': 'success' }, + { 'id': 'admin', 'title': 'Admin', 'kind': 'primary' } + ]; + + $scope.setRole = function(role, entityName, kind) { var permission = $scope.permissions[kind][entityName]; var currentRole = permission.role; permission.role = role; @@ -544,7 +550,7 @@ function RepoAdminCtrl($scope, Restangular, $routeParams, $rootScope) { var permissionPut = Restangular.one(getRestUrl('repository', namespace, name, 'permissions', kind, entityName)); permissionPut.customPUT(permission).then(function() {}, function(result) { if (result.status == 409) { - permission.role = currentRole; + $scope.permissions[kind][entityName] = currentRole; $('#onlyadminModal').modal({}); } else { $('#cannotchangeModal').modal({}); @@ -1098,7 +1104,13 @@ function OrgViewCtrl($rootScope, $scope, Restangular, $routeParams) { }); }; - $scope.setRole = function(teamname, role) { + $scope.teamRoles = [ + { 'id': 'member', 'title': 'Member', 'kind': 'default' }, + { 'id': 'creator', 'title': 'Creator', 'kind': 'success' }, + { 'id': 'admin', 'title': 'Admin', 'kind': 'primary' } + ]; + + $scope.setRole = function(role, teamname) { $scope.organization.teams[teamname].role = role; var updateTeam = Restangular.one(getRestUrl('organization', orgname, 'team', teamname)); @@ -1109,6 +1121,26 @@ function OrgViewCtrl($rootScope, $scope, Restangular, $routeParams) { }); }; + $scope.askDeleteTeam = function(teamname) { + $scope.currentDeleteTeam = teamname; + $('#confirmdeleteModal').modal({}); + }; + + $scope.deleteTeam = function() { + $('#confirmdeleteModal').modal('hide'); + if (!$scope.currentDeleteTeam) { return; } + + var teamname = $scope.currentDeleteTeam; + var deleteAction = Restangular.one(getRestUrl('organization', orgname, 'team', teamname)); + deleteAction.customDELETE().then(function() { + delete $scope.organization.teams[teamname]; + $scope.currentDeleteTeam = null; + }, function() { + $('#cannotchangeModal').modal({}); + $scope.currentDeleteTeam = null; + }); + }; + loadOrganization(); } diff --git a/static/partials/org-view.html b/static/partials/org-view.html index 4221210da..cdf74e14d 100644 --- a/static/partials/org-view.html +++ b/static/partials/org-view.html @@ -9,9 +9,9 @@
-
-
-
+
+
+
Team Permissions @@ -20,7 +20,7 @@
-
+
@@ -34,10 +34,12 @@
-
- - - +
+ +
+ +
+
@@ -60,3 +62,23 @@
+ + + + diff --git a/static/partials/repo-admin.html b/static/partials/repo-admin.html index a3d6d052d..e796df800 100644 --- a/static/partials/repo-admin.html +++ b/static/partials/repo-admin.html @@ -42,11 +42,7 @@ {{name}} -
- - - -
+ @@ -64,9 +60,7 @@
- - - +