New Quay Sec UI and fix some small bugs

Fixes #855
This commit is contained in:
Joseph Schorr 2015-11-11 15:52:30 -05:00
parent 744ad9e79b
commit 76ce63895f
13 changed files with 307 additions and 115 deletions

View file

@ -10,11 +10,16 @@
})
}]);
function ImageViewCtrl($scope, $routeParams, $rootScope, $timeout, ApiService, ImageMetadataService) {
function ImageViewCtrl($scope, $routeParams, $rootScope, $timeout, ApiService, ImageMetadataService, VulnerabilityService, Features) {
var namespace = $routeParams.namespace;
var name = $routeParams.name;
var imageid = $routeParams.image;
$scope.options = {
'vulnFilter': '',
'packageFilter': ''
};
var loadImage = function() {
var params = {
'repository': namespace + '/' + name,
@ -41,7 +46,7 @@
loadRepository();
$scope.downloadPackages = function() {
if ($scope.packagesResource) { return; }
if (!Features.SECURITY_SCANNER || $scope.packagesResource) { return; }
var params = {
'repository': namespace + '/' + name,
@ -53,6 +58,26 @@
});
};
$scope.loadImageVulnerabilities = function() {
if (!Features.SECURITY_SCANNER || $scope.vulnerabilitiesResource) { return; }
var params = {
'repository': namespace + '/' + name,
'imageid': imageid
};
$scope.vulnerabilitiesResource = ApiService.getRepoImageVulnerabilitiesAsResource(params).get(function(resp) {
$scope.vulerabilityInfo = resp;
$scope.vulnerabilities = [];
resp.data.Vulnerabilities.forEach(function(vuln) {
vuln_copy = jQuery.extend({}, vuln);
vuln_copy['index'] = VulnerabilityService.LEVELS[vuln['Priority']]['index'];
$scope.vulnerabilities.push(vuln_copy);
});
});
};
$scope.downloadChanges = function() {
if ($scope.changesResource) { return; }