From 65037ac5e17036b03e212b6efaf831682d03bff1 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 4 Mar 2016 18:07:44 -0500 Subject: [PATCH] Fix handling of non-features from Clair and other small UI fixes --- static/css/core-ui.css | 7 +++++ static/css/quay.css | 10 ++++++ static/directives/image-feature-view.html | 15 ++++++++- .../directives/image-vulnerability-view.html | 31 +++++++++++++++---- .../directives/repo-view/repo-panel-tags.html | 16 ++++++++-- .../directives/repo-view/repo-panel-tags.js | 4 +++ static/js/directives/ui/image-feature-view.js | 18 +++++++---- static/js/services/image-metadata-service.js | 11 ++++++- 8 files changed, 95 insertions(+), 17 deletions(-) diff --git a/static/css/core-ui.css b/static/css/core-ui.css index a9a260b47..5e53ca3ad 100644 --- a/static/css/core-ui.css +++ b/static/css/core-ui.css @@ -1243,6 +1243,13 @@ a:focus { border-bottom: none !important; } +.empty-icon { + color: #ddd; + font-size: 46px; + margin-bottom: 20px; + text-align: center; +} + .empty-primary-msg { font-size: 18px; margin-bottom: 10px; diff --git a/static/css/quay.css b/static/css/quay.css index b26b8ab2b..95a712b52 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -4136,3 +4136,13 @@ i.rocket-icon { color: #888; } +.nvtooltip h3 { + margin: 0; + padding: 4px 14px; + line-height: 18px; + font-weight: normal; + background-color: transparent !important; + text-align: center; + font-size: 16px !important; + border: none !important; +} diff --git a/static/directives/image-feature-view.html b/static/directives/image-feature-view.html index b23c06589..01254b724 100644 --- a/static/directives/image-feature-view.html +++ b/static/directives/image-feature-view.html @@ -15,8 +15,21 @@ + +
+
+
+ +
+
Image is not supported by Quay Security Scanner
+
+ This image has an operating system or package manager unsupported by Quay Security Scanner. +
+
+
+ -
+
diff --git a/static/directives/image-vulnerability-view.html b/static/directives/image-vulnerability-view.html index 321289018..5fb0bd44e 100644 --- a/static/directives/image-vulnerability-view.html +++ b/static/directives/image-vulnerability-view.html @@ -11,12 +11,25 @@
This image could not be indexed
- Our security scanner was unable to index this image. + Quay security scanner was unable to index this image.
- -
+ +
+
+
+ +
+
Image is not supported by Quay Security Scanner
+
+ This image has an operating system or package manager unsupported by Quay Security Scanner. +
+
+
+ + +
@@ -37,13 +50,13 @@
-
  • Quay Security Scanner has detected no vulnerabilities in this image.
  • + Quay Security Scanner has detected no vulnerabilities in this image.
    - + Showing {{ orderedVulnerabilities.entries.length }} of {{ securityVulnerabilities.length }} Vulnerabilities @@ -55,7 +68,13 @@

    Image Vulnerabilities

    - +
    +
    No vulnerabilities found.
    +
    Quay Security Scanner has detected no vulnerabilities in this image.
    +
    + +
    diff --git a/static/directives/repo-view/repo-panel-tags.html b/static/directives/repo-view/repo-panel-tags.html index b582f0521..d2719842c 100644 --- a/static/directives/repo-view/repo-panel-tags.html +++ b/static/directives/repo-view/repo-panel-tags.html @@ -143,12 +143,22 @@ data-title="The image for this tag could not be scanned for vulnerabilities" bs-tooltip> - Unrecognized OS + Unable to scan image - + + + + Unsupported + + + diff --git a/static/js/directives/repo-view/repo-panel-tags.js b/static/js/directives/repo-view/repo-panel-tags.js index 21e061826..baf169dcd 100644 --- a/static/js/directives/repo-view/repo-panel-tags.js +++ b/static/js/directives/repo-view/repo-panel-tags.js @@ -171,8 +171,11 @@ angular.module('quay').directive('repoPanelTags', function () { 'index': 100000 }; + var hasFeatures = false; if (resp.data && resp.data.Layer && resp.data.Layer.Features) { resp.data.Layer.Features.forEach(function(feature) { + hasFeatures = true; + if (feature.Vulnerabilities) { feature.Vulnerabilities.forEach(function(vuln) { if (VulnerabilityService.LEVELS[vuln.Severity].index == 0) { @@ -197,6 +200,7 @@ angular.module('quay').directive('repoPanelTags', function () { } imageData.hasVulnerabilities = !!vulnerabilities.length; + imageData.hasFeatures = hasFeatures; imageData.vulnerabilities = vulnerabilities; imageData.highestVulnerability = highest; } diff --git a/static/js/directives/ui/image-feature-view.js b/static/js/directives/ui/image-feature-view.js index f0b02a6cd..6f6abdeda 100644 --- a/static/js/directives/ui/image-feature-view.js +++ b/static/js/directives/ui/image-feature-view.js @@ -132,7 +132,11 @@ angular.module('quay').directive('imageFeatureView', function () { if (data && data.Layer && data.Layer.Features) { data.Layer.Features.forEach(function(feature) { - var imageId = feature.AddedBy.split('.')[0]; + var imageId = null; + if (feature.AddedBy) { + imageId = feature.AddedBy.split('.')[0]; + } + feature_obj = { 'name': feature.Name, 'namespace': feature.Namespace, @@ -268,11 +272,13 @@ angular.module('quay').directive('imageFeatureView', function () { }); } - $scope.featureBreakdown.push({ - 'label': 'None', - 'value': greenCount, - 'color': '#2FC98E' - }); + if (greenCount > 0) { + $scope.featureBreakdown.push({ + 'label': 'None', + 'value': greenCount, + 'color': '#2FC98E' + }); + } buildOrderedFeatures(); }; diff --git a/static/js/services/image-metadata-service.js b/static/js/services/image-metadata-service.js index e3bf18706..d5178e2bc 100644 --- a/static/js/services/image-metadata-service.js +++ b/static/js/services/image-metadata-service.js @@ -25,6 +25,10 @@ angular.module('quay').factory('ImageMetadataService', ['UtilService', function( }; metadataService.getImageCommand = function(image, imageId) { + if (!image) { + return null; + } + if (!image.__imageMap) { image.__imageMap = {}; for (var i = 0; i < image.history.length; ++i) { @@ -33,7 +37,12 @@ angular.module('quay').factory('ImageMetadataService', ['UtilService', function( } } - return getDockerfileCommand(image.__imageMap[imageId].command); + var found = image.__imageMap[imageId]; + if (!found) { + return null; + } + + return getDockerfileCommand(found.command); }; var getDockerfileCommand = function(command) {