Merge pull request #3024 from coreos-inc/manageable-robots

Manageable robots epic
This commit is contained in:
josephschorr 2018-03-21 18:50:17 -04:00 committed by GitHub
commit 6c43b7ff0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 411 additions and 131 deletions

View file

@ -36,6 +36,14 @@
Choose a name to inform your teammates
about this {{ entityTitle }}. Must match {{ entityNameRegex }}.
</div>
<div ng-show="allowEntityDescription" style="margin-top: 20px;">
<label>Provide an optional description for your new {{ entityTitle }}:</label>
<input type="text" class="form-control" ng-model="entityDescription" max-length="255">
<div class="help-text">
Enter a description to provide extran information to your teammates about this {{ entityTitle }}.
</div>
</div>
</form>
</div> <!-- /.modal-body -->
<div class="modal-footer" ng-show="view == 'setperms'">

View file

@ -3,7 +3,8 @@
<div class="create-entity-dialog" info="info" entity-title="robot account"
entity-kind="robot"
entity-icon="ci-robot" entity-name-regex="{{ ROBOT_PATTERN }}"
entity-create-requested="createRobot(name, callback)"
allow-entity-description="true"
entity-create-requested="createRobot(name, description, callback)"
entity-create-completed="robotFinished(entity)"></div>
</div>
</div>

View file

@ -36,10 +36,17 @@
<td ng-class="TableService.tablePredicateClass('name', options.predicate, options.reverse)">
<a ng-click="TableService.orderBy('name', options)">Robot Account Name</a>
</td>
<td>Description</td>
<td ng-if="organization" ng-class="TableService.tablePredicateClass('teams_string', options.predicate, options.reverse)">
<a ng-click="TableService.orderBy('teams_string', options)">Teams</a>
</td>
<td>Repositories</td>
<td ng-class="TableService.tablePredicateClass('created_datetime', options.predicate, options.reverse)">
<a ng-click="TableService.orderBy('created_datetime', options)">Created</a>
</td>
<td ng-class="TableService.tablePredicateClass('last_accessed_datetime', options.predicate, options.reverse)">
<a ng-click="TableService.orderBy('last_accessed_datetime', options)">Last Accessed</a>
</td>
<td class="options-col"></td>
</thead>
@ -50,6 +57,10 @@
<span class="prefix" bo-text="getPrefix(robotInfo.name) + '+'"></span><span bo-text="getShortenedName(robotInfo.name)"></span>
</a>
</td>
<td>
<span class="empty" bo-if="!robotInfo.description">(None)</span>
<span bo-if="robotInfo.description">{{ ::robotInfo.description }}</span>
</td>
<td bo-if="organization">
<span class="empty" bo-if="robotInfo.teams.length == 0">
No teams
@ -78,6 +89,12 @@
</a>
</span>
</td>
<td>
<time-ago datetime="robotInfo.created"></time-ago>
</td>
<td>
<time-ago datetime="robotInfo.last_accessed"></time-ago>
</td>
<td class="options-col">
<span class="cor-options-menu">
<span class="cor-option" option-click="showRobot(robotInfo)">

View file

@ -15,6 +15,7 @@ angular.module('quay').directive('createEntityDialog', function () {
'entityTitle': '@entityTitle',
'entityIcon': '@entityIcon',
'entityNameRegex': '@entityNameRegex',
'allowEntityDescription': '@allowEntityDescription',
'entityCreateRequested': '&entityCreateRequested',
'entityCreateCompleted': '&entityCreateCompleted'
@ -41,6 +42,7 @@ angular.module('quay').directive('createEntityDialog', function () {
$scope.show = function() {
$scope.entityName = null;
$scope.entityDescription = null;
$scope.entity = null;
$scope.entityForPermissions = null;
$scope.creating = false;
@ -67,6 +69,7 @@ angular.module('quay').directive('createEntityDialog', function () {
$scope.view = 'creating';
$scope.entityCreateRequested({
'name': $scope.entityName,
'description': $scope.entityDescription,
'callback': entityCreateCallback
});
};

View file

@ -19,7 +19,7 @@ angular.module('quay').directive('createRobotDialog', function () {
$scope.robotCreated({'robot': robot});
};
$scope.createRobot = function(name, callback) {
$scope.createRobot = function(name, description, callback) {
var organization = $scope.info.namespace;
if (!UserService.isOrganization(organization)) {
organization = null;
@ -29,11 +29,15 @@ angular.module('quay').directive('createRobotDialog', function () {
'robot_shortname': name
};
var data = {
'description': description
};
var errorDisplay = ApiService.errorDisplay('Cannot create robot account', function() {
callback(null);
});
ApiService.createRobot(organization, null, params).then(function(resp) {
ApiService.createRobot(organization, data, params).then(function(resp) {
callback(resp);
}, errorDisplay);
};

View file

@ -39,6 +39,9 @@ angular.module('quay').directive('robotsManager', function () {
robot['teams_string'] = robot.teams.map(function(team) {
return team['name'] || '';
}).join(',');
robot['created_datetime'] = robot.created ? TableService.getReversedTimestamp(robot.created) : null;
robot['last_accessed_datetime'] = robot.last_accessed ? TableService.getReversedTimestamp(robot.last_accessed) : null;
});
$scope.orderedRobots = TableService.buildOrderedItems(robots, $scope.options,