Add a history view to the tags page. Next step will add the ability to revert back in time
This commit is contained in:
parent
703f48f194
commit
f8c80f7d11
10 changed files with 492 additions and 13 deletions
16
initdb.py
16
initdb.py
|
@ -57,7 +57,7 @@ def __gen_image_uuid(repo, image_num):
|
|||
|
||||
|
||||
global_image_num = [0]
|
||||
def __create_subtree(repo, structure, creator_username, parent):
|
||||
def __create_subtree(repo, structure, creator_username, parent, tag_map):
|
||||
num_nodes, subtrees, last_node_tags = structure
|
||||
|
||||
# create the nodes
|
||||
|
@ -102,12 +102,18 @@ def __create_subtree(repo, structure, creator_username, parent):
|
|||
tag = model.create_or_update_tag(repo.namespace_user.username, repo.name, tag_name,
|
||||
new_image.docker_image_id)
|
||||
|
||||
tag_map[tag_name] = tag
|
||||
|
||||
for tag_name in last_node_tags:
|
||||
if tag_name[0] == '#':
|
||||
tag.lifetime_end_ts = get_epoch_timestamp() - 1
|
||||
tag = tag_map[tag_name]
|
||||
tag.name = tag_name[1:]
|
||||
tag.lifetime_end_ts = tag_map[tag_name[1:]].lifetime_start_ts
|
||||
tag.lifetime_start_ts = tag.lifetime_end_ts - 10
|
||||
tag.save()
|
||||
|
||||
for subtree in subtrees:
|
||||
__create_subtree(repo, subtree, creator_username, new_image)
|
||||
__create_subtree(repo, subtree, creator_username, new_image, tag_map)
|
||||
|
||||
|
||||
def __generate_repository(user, name, description, is_public, permissions,
|
||||
|
@ -127,9 +133,9 @@ def __generate_repository(user, name, description, is_public, permissions,
|
|||
|
||||
if isinstance(structure, list):
|
||||
for s in structure:
|
||||
__create_subtree(repo, s, user.username, None)
|
||||
__create_subtree(repo, s, user.username, None, {})
|
||||
else:
|
||||
__create_subtree(repo, structure, user.username, None)
|
||||
__create_subtree(repo, structure, user.username, None, {})
|
||||
|
||||
return repo
|
||||
|
||||
|
|
Reference in a new issue