This commit is contained in:
Steven Zou 2017-07-14 18:54:49 +08:00
parent 4e33bd9e46
commit de6300a3b2
5 changed files with 31 additions and 24 deletions

View File

@ -76,8 +76,13 @@ export class ResultTipComponent implements OnInit {
let m: number = this.totalPackages; let m: number = this.totalPackages;
if (m === 0) { if (m === 0) {
//If no packages recognized, then show green bar
if (severity === VulnerabilitySeverity.NONE) {
return MAX_TIP_WIDTH + 'px';
} else {
return 0 + 'px'; return 0 + 'px';
} }
}
switch (severity) { switch (severity) {
case VulnerabilitySeverity.HIGH: case VulnerabilitySeverity.HIGH:
@ -93,7 +98,9 @@ export class ResultTipComponent implements OnInit {
n = this.unknownCount; n = this.unknownCount;
break; break;
case VulnerabilitySeverity.NONE: case VulnerabilitySeverity.NONE:
n = this.noneCount; //Show all the left as green bar
n = m - (this.highCount + this.mediumCount + this.lowCount + this.unknownCount);
if (n < 0) { n = 0; }
break; break;
default: default:
n = 0; n = 0;
@ -101,7 +108,7 @@ export class ResultTipComponent implements OnInit {
} }
let width: number = Math.round((n / m) * MAX_TIP_WIDTH); let width: number = Math.round((n / m) * MAX_TIP_WIDTH);
if (width < MIN_TIP_WIDTH) { if (width > 0 && width < MIN_TIP_WIDTH) {
width = MIN_TIP_WIDTH; width = MIN_TIP_WIDTH;
} }

View File

@ -13,23 +13,23 @@ export const TIP_COMPONENT_HTML: string = `
<div class="bar-summary bar-tooltip-fon"> <div class="bar-summary bar-tooltip-fon">
<div *ngIf="hasHigh" class="bar-summary-item"> <div *ngIf="hasHigh" class="bar-summary-item">
<clr-icon shape="exclamation-circle" class="is-error" size="24"></clr-icon> <clr-icon shape="exclamation-circle" class="is-error" size="24"></clr-icon>
<span>{{highCount}} {{packageText(highCount) | translate }} {{'VULNERABILITY.SEVERITY.HIGH' | translate }} {{ highSuffix | translate }}</span> <span>{{highCount}} {{packageText(highCount) | translate }} {{'VULNERABILITY.SEVERITY.HIGH' | translate }}</span>
</div> </div>
<div *ngIf="hasMedium" class="bar-summary-item"> <div *ngIf="hasMedium" class="bar-summary-item">
<clr-icon *ngIf="hasMedium" shape="exclamation-triangle" class="is-warning" size="24"></clr-icon> <clr-icon *ngIf="hasMedium" shape="exclamation-triangle" class="is-warning" size="20"></clr-icon>
<span>{{mediumCount}} {{packageText(mediumCount) | translate }} {{'VULNERABILITY.SEVERITY.MEDIUM' | translate }} {{ mediumSuffix | translate }}</span> <span>{{mediumCount}} {{packageText(mediumCount) | translate }} {{'VULNERABILITY.SEVERITY.MEDIUM' | translate }}</span>
</div> </div>
<div *ngIf="hasLow" class="bar-summary-item"> <div *ngIf="hasLow" class="bar-summary-item">
<clr-icon shape="info-circle" class="is-info" size="24"></clr-icon> <clr-icon shape="info-circle" class="is-info" size="24"></clr-icon>
<span>{{lowCount}} {{packageText(lowCount) | translate }} {{'VULNERABILITY.SEVERITY.LOW' | translate }} {{ lowSuffix | translate }}</span> <span>{{lowCount}} {{packageText(lowCount) | translate }} {{'VULNERABILITY.SEVERITY.LOW' | translate }}</span>
</div> </div>
<div *ngIf="hasUnknown" class="bar-summary-item"> <div *ngIf="hasUnknown" class="bar-summary-item">
<clr-icon shape="help" size="24"></clr-icon> <clr-icon shape="help" size="24"></clr-icon>
<span>{{unknownCount}} {{packageText(unknownCount) | translate }} {{'VULNERABILITY.SEVERITY.UNKNOWN' | translate }} {{ unknownSuffix | translate }}</span> <span>{{unknownCount}} {{packageText(unknownCount) | translate }} {{'VULNERABILITY.SEVERITY.UNKNOWN' | translate }}</span>
</div> </div>
<div *ngIf="hasNone" class="bar-summary-item"> <div *ngIf="hasNone" class="bar-summary-item">
<clr-icon shape="check-circle" class="is-success" size="24"></clr-icon> <clr-icon shape="check-circle" class="is-success" size="24"></clr-icon>
<span>{{noneCount}} {{packageText(noneCount) | translate }} {{'VULNERABILITY.SEVERITY.NONE' | translate }} {{ noneSuffix | translate }}</span> <span>{{noneCount}} {{packageText(noneCount) | translate }} {{'VULNERABILITY.SEVERITY.NONE' | translate }}</span>
</div> </div>
</div> </div>
<div> <div>

View File

@ -31,7 +31,7 @@
"clarity-icons": "^0.9.8", "clarity-icons": "^0.9.8",
"clarity-ui": "^0.9.8", "clarity-ui": "^0.9.8",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"harbor-ui": "0.2.85", "harbor-ui": "0.2.87",
"intl": "^1.2.5", "intl": "^1.2.5",
"mutationobserver-shim": "^0.3.2", "mutationobserver-shim": "^0.3.2",
"ngx-cookie": "^1.0.0", "ngx-cookie": "^1.0.0",

View File

@ -480,15 +480,15 @@
}, },
"CHART": { "CHART": {
"SCANNING_TIME": "Scan completed", "SCANNING_TIME": "Scan completed",
"TOOLTIPS_TITLE": "This tag has {{totalVulnerability}} packages with vulnerabilities across all {{totalPackages}} packages." "TOOLTIPS_TITLE": "This tag has {{totalVulnerability}} package(s) with vulnerabilities across all {{totalPackages}} package(s)."
}, },
"SEVERITY": { "SEVERITY": {
"HIGH": "High level", "HIGH": "high",
"MEDIUM": "Medium level", "MEDIUM": "medium",
"LOW": "Low level", "LOW": "low",
"NEGLIGIBLE": "Negligible", "NEGLIGIBLE": "negligible",
"UNKNOWN": "Unknown", "UNKNOWN": "unknown",
"NONE": "None" "NONE": "none"
}, },
"SINGULAR": "Vulnerability", "SINGULAR": "Vulnerability",
"PLURAL": "Vulnerabilities", "PLURAL": "Vulnerabilities",

View File

@ -479,15 +479,15 @@
}, },
"CHART": { "CHART": {
"SCANNING_TIME": "Scan completed", "SCANNING_TIME": "Scan completed",
"TOOLTIPS_TITLE": "This tag has {{totalVulnerability}} packages with vulnerabilities across all {{totalPackages}} packages." "TOOLTIPS_TITLE": "This tag has {{totalVulnerability}} package(s) with vulnerabilities across all {{totalPackages}} package(s)."
}, },
"SEVERITY": { "SEVERITY": {
"HIGH": "High level", "HIGH": "high",
"MEDIUM": "Medium level", "MEDIUM": "medium",
"LOW": "Low level", "LOW": "low",
"NEGLIGIBLE": "Negligible", "NEGLIGIBLE": "negligible",
"UNKNOWN": "Unknown", "UNKNOWN": "unknown",
"NONE": "None" "NONE": "none"
}, },
"SINGULAR": "Vulnerability", "SINGULAR": "Vulnerability",
"PLURAL": "Vulnerabilities", "PLURAL": "Vulnerabilities",