This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/static/js/services/image-metadata-service.js

31 lines
704 B
JavaScript
Raw Normal View History

/**
* Helper service for returning information extracted from repository image metadata.
*/
angular.module('quay').factory('ImageMetadataService', [function() {
var metadataService = {};
metadataService.getImageCommand = function(image, imageId) {
if (!image) {
return null;
}
if (!image.__imageMap) {
image.__imageMap = {};
image.__imageMap[image.id] = image;
for (var i = 0; i < image.history.length; ++i) {
var cimage = image.history[i];
image.__imageMap[cimage.id] = cimage;
}
}
var found = image.__imageMap[imageId];
if (!found) {
return null;
}
return found.command;
};
return metadataService;
}]);