Add creation date information to robots API and UI

Fixes https://jira.coreos.com/browse/QUAY-846
This commit is contained in:
Joseph Schorr 2018-03-09 13:55:19 -05:00
parent c4a6273e00
commit a693771345
5 changed files with 28 additions and 10 deletions

View file

@ -3,6 +3,8 @@ from collections import namedtuple
from six import add_metaclass
from endpoints.api import format_date
class Permission(namedtuple('Permission', ['repository_name', 'repository_visibility_name', 'role_name'])):
"""
@ -36,6 +38,7 @@ class RobotWithPermissions(
namedtuple('RobotWithPermissions', [
'name',
'password',
'created',
'teams',
'repository_names',
])):
@ -43,6 +46,7 @@ class RobotWithPermissions(
RobotWithPermissions is a list of robot entries.
:type name: string
:type password: string
:type created: datetime|None
:type teams: [Team]
:type repository_names: [string]
@ -52,6 +56,7 @@ class RobotWithPermissions(
return {
'name': self.name,
'token': self.password,
'created': format_date(self.created) if self.created is not None else None,
'teams': [team.to_dict() for team in self.teams],
'repositories': self.repository_names
}
@ -61,18 +66,21 @@ class Robot(
namedtuple('Robot', [
'name',
'password',
'created',
])):
"""
Robot represents a robot entity.
:type name: string
:type password: string
:type created: datetime|None
"""
def to_dict(self):
return {
'name': self.name,
'token': self.password
'token': self.password,
'created': format_date(self.created) if self.created is not None else None,
}