Add error message if security scan not found
This change ensures that the user gets an error message (and not a blank tab) if the security scan information could not be successfully loaded Fixes https://www.pivotaltracker.com/story/show/136072509
This commit is contained in:
parent
2a6632cff4
commit
b83784f1e1
7 changed files with 59 additions and 9 deletions
|
@ -21,6 +21,7 @@ angular.module('quay').directive('imageFeatureView', function () {
|
|||
};
|
||||
|
||||
$scope.TableService = TableService;
|
||||
$scope.loading = false;
|
||||
|
||||
var buildOrderedFeatures = function() {
|
||||
if (!$scope.featuresInfo) {
|
||||
|
@ -64,17 +65,20 @@ angular.module('quay').directive('imageFeatureView', function () {
|
|||
};
|
||||
|
||||
var loadImageVulnerabilities = function() {
|
||||
if ($scope.securityResource) {
|
||||
if ($scope.loading) {
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.securityResource = VulnerabilityService.loadImageVulnerabilitiesAsResource($scope.repository, $scope.image.id, function(resp) {
|
||||
$scope.loading = true;
|
||||
VulnerabilityService.loadImageVulnerabilities($scope.repository, $scope.image.id, function(resp) {
|
||||
$scope.securityStatus = resp.status;
|
||||
$scope.featuresInfo = VulnerabilityService.buildFeaturesInfo($scope.image, resp);
|
||||
|
||||
buildOrderedFeatures();
|
||||
buildChart();
|
||||
return resp;
|
||||
}, function() {
|
||||
$scope.securityStatus = 'error';
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ angular.module('quay').directive('imageVulnerabilityView', function () {
|
|||
};
|
||||
|
||||
$scope.TableService = TableService;
|
||||
$scope.loading = false;
|
||||
|
||||
$scope.toggleDetails = function(vuln) {
|
||||
vuln.expanded = !vuln.expanded;
|
||||
|
@ -100,17 +101,20 @@ angular.module('quay').directive('imageVulnerabilityView', function () {
|
|||
};
|
||||
|
||||
var loadImageVulnerabilities = function() {
|
||||
if ($scope.securityResource) {
|
||||
if ($scope.loading) {
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.securityResource = VulnerabilityService.loadImageVulnerabilitiesAsResource($scope.repository, $scope.image.id, function(resp) {
|
||||
$scope.loading = true;
|
||||
VulnerabilityService.loadImageVulnerabilities($scope.repository, $scope.image.id, function(resp) {
|
||||
$scope.securityStatus = resp.status;
|
||||
$scope.vulnerabilitiesInfo = VulnerabilityService.buildVulnerabilitiesInfo($scope.image, resp);
|
||||
|
||||
buildOrderedVulnerabilities();
|
||||
buildChart();
|
||||
return resp;
|
||||
}, function() {
|
||||
$scope.securityStatus = 'error';
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Reference in a new issue