Merge pull request #520 from coreos-inc/movefix
Add a threshold for considering moves of tags
This commit is contained in:
commit
e97f14e512
1 changed files with 5 additions and 2 deletions
|
@ -17,6 +17,9 @@ angular.module('quay').directive('repoTagHistory', function () {
|
||||||
$scope.tagHistoryData = null;
|
$scope.tagHistoryData = null;
|
||||||
$scope.tagHistoryLeaves = {};
|
$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() {
|
var loadTimeline = function() {
|
||||||
if (!$scope.repository || !$scope.isEnabled) { return; }
|
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 the tag has an end time, it was either deleted or moved.
|
||||||
if (tag.end_ts) {
|
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.
|
// then the action was a move, rather than a delete and a create.
|
||||||
var currentEntries = tagEntries[tagName];
|
var currentEntries = tagEntries[tagName];
|
||||||
var futureEntry = currentEntries.length > 0 ? currentEntries[currentEntries.length - 1] : {};
|
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);
|
removeEntry(futureEntry);
|
||||||
addEntry(futureEntry.reversion ? 'revert': 'move', tag.end_ts,
|
addEntry(futureEntry.reversion ? 'revert': 'move', tag.end_ts,
|
||||||
futureEntry.docker_image_id, dockerImageId);
|
futureEntry.docker_image_id, dockerImageId);
|
||||||
|
|
Reference in a new issue