diff --git a/static/directives/old-image-security-view.html b/static/directives/old-image-security-view.html new file mode 100644 index 000000000..6676f76db --- /dev/null +++ b/static/directives/old-image-security-view.html @@ -0,0 +1,116 @@ +
+ +
+
+
+
+ +

Image Security

+
+
This image has not been indexed yet
+
+ Please try again in a few minutes. +
+
+ +
+
This image could not be indexed
+
+ Our security scanner was unable to index this image. +
+
+ +
+
This image contains no recognized security vulnerabilities
+
+ Quay currently indexes Debian, Red Hat and Ubuntu based images. +
+
+ +
+ + + + + + + + + + + + + + +
VulnerabilityPriorityIntroduced byDescription
{{ vulnerability.name }} + + {{ vulnerability.feature.name }} {{ vulnerability.feature.version }}{{ vulnerability.description }}
+ +
+
No matching vulnerabilities found
+
+ Please adjust your filter above. +
+
+
+
+ + +
+
+ + +
+
+
+ +

Image Packages

+
+
This image has not been indexed yet
+
+ Please try again in a few minutes. +
+
+ +
+
This image could not be indexed
+
+ Our security scanner was unable to index this image. +
+
+ + + + + + + + + + + + + +
Package NamePackage VersionPackage OS
{{ feature.name }}{{ feature.version }}{{ feature.namespace }}
+ +
+
No matching packages found
+
+ Please adjust your filter above. +
+
+
+
+
\ No newline at end of file diff --git a/static/js/app.js b/static/js/app.js index f80c7826f..a7798c7e1 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -163,6 +163,9 @@ quayApp.config(['$routeProvider', '$locationProvider', 'pages', function($routeP // Confirm Invite .route('/confirminvite', 'confirm-invite') + // Experiments + .route('/__exp/newseclayout', 'exp-new-sec-layout') + // Default: Redirect to the landing page .otherwise({redirectTo: '/'}); }]); diff --git a/static/js/directives/ui/old-image-security-view.js b/static/js/directives/ui/old-image-security-view.js new file mode 100644 index 000000000..218c5f466 --- /dev/null +++ b/static/js/directives/ui/old-image-security-view.js @@ -0,0 +1,84 @@ +/** + * Old image security view until formally released. + */ +angular.module('quay').directive('oldImageSecurityView', function () { + var directiveDefinitionObject = { + priority: 0, + templateUrl: '/static/directives/old-image-security-view.html', + replace: false, + transclude: true, + restrict: 'C', + scope: { + 'repository': '=repository', + 'image': '=image', + 'isEnabled': '=isEnabled', + 'view': '@view' + }, + controller: function($scope, $element, Config, ApiService, Features, VulnerabilityService, ImageMetadataService) { + var loadImageSecurity = function() { + if (!Features.SECURITY_SCANNER || $scope.securityResource) { return; } + + $scope.VulnerabilityLevels = VulnerabilityService.getLevels(); + $scope.options = { + 'vulnFilter': '', + 'packageFilter': '' + }; + + var params = { + 'repository': $scope.repository.namespace + '/' + $scope.repository.name, + 'imageid': $scope.image.id, + 'vulnerabilities': true, + }; + + $scope.securityResource = ApiService.getRepoImageSecurityAsResource(params).get(function(resp) { + $scope.securityStatus = resp.status; + $scope.securityFeatures = []; + $scope.securityVulnerabilities = []; + + if (resp.data && resp.data.Layer && resp.data.Layer.Features) { + resp.data.Layer.Features.forEach(function(feature) { + feature_obj = { + 'name': feature.Name, + 'namespace': feature.Namespace, + 'version': feature.Version, + 'addedBy': feature.AddedBy, + } + feature_vulnerabilities = [] + + if (feature.Vulnerabilities) { + feature.Vulnerabilities.forEach(function(vuln) { + vuln_obj = { + 'name': vuln.Name, + 'namespace': vuln.Namespace, + 'description': vuln.Description, + 'link': vuln.Link, + 'severity': vuln.Severity, + 'metadata': vuln.Metadata, + 'feature': jQuery.extend({}, feature_obj), + 'fixedBy': vuln.FixedBy, + 'index': VulnerabilityService.LEVELS[vuln['Severity']]['index'], + } + + feature_vulnerabilities.push(vuln_obj) + $scope.securityVulnerabilities.push(vuln_obj); + }); + } + + feature_obj['vulnerabilities'] = feature_vulnerabilities + $scope.securityFeatures.push(feature_obj); + }); + } + + return resp; + }); + }; + + $scope.$watch('isEnabled', function(isEnabled) { + if ($scope.isEnabled && $scope.repository && $scope.image) { + loadImageSecurity(); + } + }); + } + }; + return directiveDefinitionObject; +}); \ No newline at end of file diff --git a/static/js/pages/exp-new-sec-layout.js b/static/js/pages/exp-new-sec-layout.js new file mode 100644 index 000000000..3df719060 --- /dev/null +++ b/static/js/pages/exp-new-sec-layout.js @@ -0,0 +1,19 @@ +(function() { + /** + * Experiment enable page: New layout + */ + angular.module('quayPages').config(['pages', function(pages) { + pages.create('exp-new-sec-layout', 'exp-new-sec-layout.html', ExpCtrl, { + 'newLayout': true + }); + }]); + + function ExpCtrl($scope, CookieService) { + $scope.isEnabled = CookieService.get('quay.exp-new-sec-layout') == 'true'; + + $scope.setEnabled = function(value) { + $scope.isEnabled = value; + CookieService.putPermanent('quay.exp-new-sec-layout', value.toString()); + }; + } +}()); \ No newline at end of file diff --git a/static/js/pages/image-view.js b/static/js/pages/image-view.js index 5db5f31d5..c09e9f31f 100644 --- a/static/js/pages/image-view.js +++ b/static/js/pages/image-view.js @@ -10,13 +10,15 @@ }) }]); - function ImageViewCtrl($scope, $routeParams, $rootScope, $timeout, ApiService, ImageMetadataService, Features) { + function ImageViewCtrl($scope, $routeParams, $rootScope, $timeout, ApiService, ImageMetadataService, Features, CookieService) { var namespace = $routeParams.namespace; var name = $routeParams.name; var imageid = $routeParams.image; $scope.imageSecurityCounter = 0; $scope.imagePackageCounter = 0; + $scope.newUIExperiment = CookieService.get('quay.exp-new-sec-layout') == 'true'; + $scope.options = { 'vulnFilter': '' }; diff --git a/static/partials/exp-new-sec-layout.html b/static/partials/exp-new-sec-layout.html new file mode 100644 index 000000000..4d19deeb2 --- /dev/null +++ b/static/partials/exp-new-sec-layout.html @@ -0,0 +1,10 @@ +
+
+ + Experiment: New Security Scanner Layout +
+
+ + +
+
\ No newline at end of file diff --git a/static/partials/image-view.html b/static/partials/image-view.html index 47b99cd4e..2feaf53dc 100644 --- a/static/partials/image-view.html +++ b/static/partials/image-view.html @@ -44,12 +44,16 @@
-
+
+ +
-
+
+ +