Implement new vulnerabilities and packages tabs.
Fixes https://github.com/coreos-inc/design/issues/268
This commit is contained in:
parent
c7904db30d
commit
ae9140caae
16 changed files with 1547 additions and 171 deletions
|
@ -24,5 +24,34 @@ angular.module('quay').factory('ImageMetadataService', ['UtilService', function(
|
|||
return UtilService.textToSafeHtml(metadataService.getFormattedCommand(image));
|
||||
};
|
||||
|
||||
metadataService.getImageCommand = function(image, imageId) {
|
||||
if (!image.__imageMap) {
|
||||
image.__imageMap = {};
|
||||
for (var i = 0; i < image.history.length; ++i) {
|
||||
var cimage = image.history[i];
|
||||
image.__imageMap[cimage.id] = cimage;
|
||||
}
|
||||
}
|
||||
|
||||
return getDockerfileCommand(image.__imageMap[imageId].command);
|
||||
};
|
||||
|
||||
var getDockerfileCommand = function(command) {
|
||||
if (!command) { return ''; }
|
||||
|
||||
// ["/bin/sh", "-c", "#(nop) RUN foo"]
|
||||
var commandPrefix = '#(nop)'
|
||||
|
||||
if (command.length != 3) { return ''; }
|
||||
if (command[0] != '/bin/sh' || command[1] != '-c') { return ''; }
|
||||
|
||||
var cmd = command[2];
|
||||
if (cmd.substring(0, commandPrefix.length) != commandPrefix) {
|
||||
return 'RUN ' + cmd;
|
||||
}
|
||||
|
||||
return command[2].substr(commandPrefix.length + 1);
|
||||
};
|
||||
|
||||
return metadataService;
|
||||
}]);
|
Reference in a new issue