From fee72225cf1f8d786da8f28ef23ed906b6a1f5bc Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Mon, 21 Sep 2015 16:14:37 -0400 Subject: [PATCH] Add a threshold for considering moves of tags Fixes #516 --- static/js/directives/ui/repo-tag-history.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/static/js/directives/ui/repo-tag-history.js b/static/js/directives/ui/repo-tag-history.js index c6ba6120d..0fbffab5b 100644 --- a/static/js/directives/ui/repo-tag-history.js +++ b/static/js/directives/ui/repo-tag-history.js @@ -17,6 +17,9 @@ angular.module('quay').directive('repoTagHistory', function () { $scope.tagHistoryData = null; $scope.tagHistoryLeaves = {}; + // A delete followed by a create of a tag within this threshold is considered a move. + var MOVE_THRESHOLD = 2; + var loadTimeline = function() { if (!$scope.repository || !$scope.isEnabled) { return; } @@ -68,11 +71,11 @@ angular.module('quay').directive('repoTagHistory', function () { // If the tag has an end time, it was either deleted or moved. if (tag.end_ts) { - // If a future entry exists with a start time equal to the end time for this tag, + // If a future entry exists with a start time "equal" to the end time for this tag, // then the action was a move, rather than a delete and a create. var currentEntries = tagEntries[tagName]; var futureEntry = currentEntries.length > 0 ? currentEntries[currentEntries.length - 1] : {}; - if (futureEntry.start_ts == tag.end_ts) { + if (tag.end_ts - futureEntry.start_ts <= MOVE_THRESHOLD) { removeEntry(futureEntry); addEntry(futureEntry.reversion ? 'revert': 'move', tag.end_ts, futureEntry.docker_image_id, dockerImageId);