New create entity dialogs (team and robot)
Fixes https://github.com/coreos-inc/design/issues/230
This commit is contained in:
parent
2274d6ff84
commit
4a543be7a7
31 changed files with 687 additions and 232 deletions
43
static/js/directives/ui/create-robot-dialog.js
Normal file
43
static/js/directives/ui/create-robot-dialog.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* An element which displays a dialog for creating a robot account.
|
||||
*/
|
||||
angular.module('quay').directive('createRobotDialog', function () {
|
||||
var directiveDefinitionObject = {
|
||||
priority: 0,
|
||||
templateUrl: '/static/directives/create-robot-dialog.html',
|
||||
replace: false,
|
||||
transclude: true,
|
||||
restrict: 'C',
|
||||
scope: {
|
||||
'info': '=info',
|
||||
'robotCreated': '&robotCreated'
|
||||
},
|
||||
controller: function($scope, $element, ApiService, UserService) {
|
||||
$scope.ROBOT_PATTERN = ROBOT_PATTERN;
|
||||
|
||||
$scope.robotFinished = function(robot) {
|
||||
$scope.robotCreated({'robot': robot});
|
||||
};
|
||||
|
||||
$scope.createRobot = function(name, callback) {
|
||||
var organization = $scope.info.namespace;
|
||||
if (!UserService.isOrganization(organization)) {
|
||||
organization = null;
|
||||
}
|
||||
|
||||
var params = {
|
||||
'robot_shortname': name
|
||||
};
|
||||
|
||||
var errorDisplay = ApiService.errorDisplay('Cannot create robot account', function() {
|
||||
callback(null);
|
||||
});
|
||||
|
||||
ApiService.createRobot(organization, null, params).then(function(resp) {
|
||||
callback(resp);
|
||||
}, errorDisplay);
|
||||
};
|
||||
}
|
||||
};
|
||||
return directiveDefinitionObject;
|
||||
});
|
Reference in a new issue