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

@ -13,15 +13,14 @@ angular.module('quay').directive('robotsManager', function () {
'user': '=user',
'isEnabled': '=isEnabled'
},
controller: function($scope, $element, ApiService, $routeParams, $location, CreateService,
Config, $rootScope) {
$scope.ROBOT_PATTERN = ROBOT_PATTERN;
controller: function($scope, $element, ApiService, $routeParams, $location, Config, $rootScope) {
$scope.robots = null;
$scope.loading = false;
$scope.Config = Config;
$scope.feedback = null;
$scope.robotDisplayInfo = null;
$scope.createRobotInfo = null;
// Listen for route changes and update the tabs accordingly.
var locationListener = $rootScope.$on('$routeUpdate', function(){
@ -96,22 +95,10 @@ angular.module('quay').directive('robotsManager', function () {
return name.substr(0, plus);
};
$scope.createRobot = function(name) {
if (!name) { return; }
CreateService.createRobotAccount(ApiService, !!$scope.organization, $scope.organization ? $scope.organization.name : '', name,
function(created) {
created.teams = [];
created.repositories = [];
$scope.robots.push(created);
$scope.feedback = {
'kind': 'success',
'message': 'Robot account {robot} was created',
'data': {
'robot': name
}
};
});
$scope.askCreateRobot = function() {
$scope.createRobotInfo = {
'namespace': $scope.organization ? $scope.organization.name : $scope.user.username
};
};
$scope.deleteRobot = function(info) {
@ -131,7 +118,6 @@ angular.module('quay').directive('robotsManager', function () {
}, ApiService.errorDisplay('Cannot delete robot account'));
};
$scope.askDeleteRobot = function(info) {
bootbox.confirm('Are you sure you want to delete robot ' + info.name + '?', function(resp) {
if (resp) {
@ -140,6 +126,10 @@ angular.module('quay').directive('robotsManager', function () {
});
};
$scope.robotCreated = function() {
update();
};
var update = function() {
if (!$scope.user && !$scope.organization) { return; }
if ($scope.loading || !$scope.isEnabled) { return; }