From eb5cebbcdfedcee75d3452b52096049b245da671 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 5 Apr 2017 13:27:36 -0400 Subject: [PATCH] Have tag operations dialog reflect time machine configuration If a tag deletion is going to remove images, but those images are not going to be removed immediately, we need to message that Fixes https://www.pivotaltracker.com/story/show/143063199 --- endpoints/api/repository.py | 1 + static/directives/tag-operations-dialog.html | 2 +- static/js/directives/ui/tag-operations-dialog.js | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/endpoints/api/repository.py b/endpoints/api/repository.py index 37f22b856..6fb661e72 100644 --- a/endpoints/api/repository.py +++ b/endpoints/api/repository.py @@ -379,6 +379,7 @@ class Repository(RepositoryParamResource): 'is_starred': is_starred, 'status_token': repo.badge_token if not is_public else '', 'trust_enabled': bool(features.SIGNING) and repo.trust_enabled, + 'tag_expiration_s': repo.namespace_user.removed_tag_expiration_s, } if stats is not None: diff --git a/static/directives/tag-operations-dialog.html b/static/directives/tag-operations-dialog.html index dcce8f971..9c294ad82 100644 --- a/static/directives/tag-operations-dialog.html +++ b/static/directives/tag-operations-dialog.html @@ -122,7 +122,7 @@
- The following images and any other images not referenced by a tag will be deleted: + The following images and any other images not referenced by a tag will be deletedunavailable and deleted in {{ getFormattedTimespan(repository.tag_expiration_s) }}:
diff --git a/static/js/directives/ui/tag-operations-dialog.js b/static/js/directives/ui/tag-operations-dialog.js index 4001334e4..8d88de4ad 100644 --- a/static/js/directives/ui/tag-operations-dialog.js +++ b/static/js/directives/ui/tag-operations-dialog.js @@ -153,6 +153,13 @@ angular.module('quay').directive('tagOperationsDialog', function () { }, errorHandler); }; + $scope.getFormattedTimespan = function(seconds) { + if (!seconds) { + return null; + } + return moment.duration(seconds, "seconds").humanize(); + }; + $scope.editLabels = function(info, callback) { var actions = []; var existingMutableLabels = {};