refactor(images): relocate tag/digest replacement

pull/1988/head
Anthony Lapenna 7 years ago
parent 23b0d6f1dc
commit d3a26a4ade

@ -4,7 +4,17 @@ function ImageViewModel(data) {
this.Repository = data.Repository; this.Repository = data.Repository;
this.Created = data.Created; this.Created = data.Created;
this.Checked = false; this.Checked = false;
this.RepoTags = data.RepoTags; this.RepoTags = data.RepoTags;
if (!this.RepoTags && data.RepoDigests) {
this.RepoTags = [];
for (var i = 0; i < data.RepoDigests.length; i++) {
var digest = data.RepoDigests[i];
var repository = digest.substring(0, digest.indexOf('@'));
this.RepoTags.push(repository + ':<none>');
}
}
this.VirtualSize = data.VirtualSize; this.VirtualSize = data.VirtualSize;
this.ContainerCount = data.ContainerCount; this.ContainerCount = data.ContainerCount;

@ -20,17 +20,6 @@ angular.module('portainer.docker')
return deferred.promise; return deferred.promise;
}; };
function replaceEmptyTagsWhenPossible(item) {
if (!item.RepoTags && item.RepoDigests) {
item.RepoTags = [];
for (var iDigest = 0; iDigest < item.RepoDigests.length; iDigest++) {
var digest = item.RepoDigests[iDigest];
var repository = digest.substring(0, digest.indexOf('@'));
item.RepoTags.push(repository + ':<none>');
}
}
}
service.images = function(withUsage) { service.images = function(withUsage) {
var deferred = $q.defer(); var deferred = $q.defer();
@ -49,7 +38,6 @@ angular.module('portainer.docker')
item.ContainerCount++; item.ContainerCount++;
} }
} }
replaceEmptyTagsWhenPossible(item);
return new ImageViewModel(item); return new ImageViewModel(item);
}); });

Loading…
Cancel
Save