New create entity dialogs (team and robot)

Fixes https://github.com/coreos-inc/design/issues/230
This commit is contained in:
Joseph Schorr 2016-05-12 17:59:49 -04:00
parent 2274d6ff84
commit 4a543be7a7
31 changed files with 687 additions and 232 deletions

View file

@ -18,6 +18,8 @@ angular.module('quay').directive('entitySearch', function () {
scope: {
'namespace': '=namespace',
'placeholder': '=placeholder',
'forRepository': '=forRepository',
'skipPermissions': '=skipPermissions',
// Default: ['user', 'team', 'robot']
'allowedEntities': '=allowedEntities',
@ -41,7 +43,7 @@ angular.module('quay').directive('entitySearch', function () {
// True if the menu should pull right.
'pullRight': '@pullRight'
},
controller: function($rootScope, $scope, $element, Restangular, UserService, ApiService, UtilService, Config, CreateService) {
controller: function($rootScope, $scope, $element, Restangular, UserService, ApiService, UtilService, Config) {
$scope.lazyLoading = true;
$scope.teams = null;
@ -55,6 +57,8 @@ angular.module('quay').directive('entitySearch', function () {
$scope.includeOrgs = false;
$scope.currentEntityInternal = $scope.currentEntity;
$scope.createRobotInfo = null;
$scope.createTeamInfo = null;
$scope.Config = Config;
@ -91,18 +95,30 @@ angular.module('quay').directive('entitySearch', function () {
}
};
$scope.createTeam = function() {
CreateService.askCreateTeam($scope.namespace, function(created) {
$scope.setEntity(created.name, 'team', false, created.avatar);
$scope.teams[created.name] = created;
});
$scope.askCreateTeam = function() {
$scope.createTeamInfo = {
'namespace': $scope.namespace,
'repository': $scope.forRepository,
'skip_permissions': $scope.skipPermissions
};
};
$scope.createRobot = function() {
CreateService.askCreateRobot($scope.namespace, function(created) {
$scope.setEntity(created.name, 'user', true, created.avatar);
$scope.robots.push(created);
});
$scope.askCreateRobot = function() {
$scope.createRobotInfo = {
'namespace': $scope.namespace,
'repository': $scope.forRepository,
'skip_permissions': $scope.skipPermissions
};
};
$scope.handleTeamCreated = function(created) {
$scope.setEntity(created.name, 'team', false, created.avatar);
$scope.teams[created.name] = created;
};
$scope.handleRobotCreated = function(created) {
$scope.setEntity(created.name, 'user', true, created.avatar);
$scope.robots.push(created);
};
$scope.setEntity = function(name, kind, is_robot, avatar) {