Merge pull request #3461 from ninjadq/fix_scanning_bar_title

fix text of bar chart title
This commit is contained in:
Deng, Qian 2017-10-30 00:02:08 -05:00 committed by GitHub
commit 1840aefea9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 13 deletions

View File

@ -62,7 +62,6 @@ export class ResultTipComponent implements OnInit {
if (item.severity != VulnerabilitySeverity.NONE) { if (item.severity != VulnerabilitySeverity.NONE) {
this.packagesWithVul += item.count this.packagesWithVul += item.count
} }
switch (item.severity) { switch (item.severity) {
case VulnerabilitySeverity.UNKNOWN: case VulnerabilitySeverity.UNKNOWN:
this._unknownCount += item.count; this._unknownCount += item.count;
@ -86,18 +85,22 @@ export class ResultTipComponent implements OnInit {
} }
this.translate.get(this.packageText(this.totalPackages)).subscribe((p1: string) => { this.translate.get(this.packageText(this.totalPackages)).subscribe((p1: string) => {
this.translate.get(this.unitText(this.packagesWithVul)).subscribe((vul: string) => { this.translate.get(this.unitText(this.packagesWithVul)).subscribe((vul: string) => {
let messageKey: string = "VULNERABILITY.CHART.TOOLTIPS_TITLE_SINGULAR"; if (this.totalPackages === 0) {
if (this.packagesWithVul > 1) { this.translate.get('VULNERABILITY.CHART.TOOLTIPS_TITLE_ZERO').subscribe( (res: string) => {
messageKey = "VULNERABILITY.CHART.TOOLTIPS_TITLE"; this._tipTitle = res;
} });
this.translate.get(messageKey, } else {
{ let messageKey = 'VULNERABILITY.CHART.TOOLTIPS_TITLE_SINGULAR';
if (this.packagesWithVul > 1) {
messageKey = 'VULNERABILITY.CHART.TOOLTIPS_TITLE';
}
this.translate.get(messageKey, {
totalVulnerability: this.packagesWithVul, totalVulnerability: this.packagesWithVul,
totalPackages: this.totalPackages, totalPackages: this.totalPackages,
package: p1, package: p1,
vulnerability: vul vulnerability: vul
}) }).subscribe((res: string) => this._tipTitle = res);
.subscribe((res: string) => this._tipTitle = res); }
}); });
}); });
} }

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.4.91", "harbor-ui": "0.4.92",
"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

@ -510,7 +510,8 @@
"CHART": { "CHART": {
"SCANNING_TIME": "Scan completed time:", "SCANNING_TIME": "Scan completed time:",
"TOOLTIPS_TITLE": "{{totalVulnerability}} of {{totalPackages}} {{package}} have known {{vulnerability}}.", "TOOLTIPS_TITLE": "{{totalVulnerability}} of {{totalPackages}} {{package}} have known {{vulnerability}}.",
"TOOLTIPS_TITLE_SINGULAR": "{{totalVulnerability}} of {{totalPackages}} {{package}} has known {{vulnerability}}." "TOOLTIPS_TITLE_SINGULAR": "{{totalVulnerability}} of {{totalPackages}} {{package}} has known {{vulnerability}}.",
"TOOLTIPS_TITLE_ZERO": "No recognizable vulnerability package found"
}, },
"SEVERITY": { "SEVERITY": {
"HIGH": "high", "HIGH": "high",

View File

@ -509,7 +509,8 @@
"CHART": { "CHART": {
"SCANNING_TIME": "Scan completed time:", "SCANNING_TIME": "Scan completed time:",
"TOOLTIPS_TITLE": "{{totalVulnerability}} of {{totalPackages}} {{package}} have known {{vulnerability}}.", "TOOLTIPS_TITLE": "{{totalVulnerability}} of {{totalPackages}} {{package}} have known {{vulnerability}}.",
"TOOLTIPS_TITLE_SINGULAR": "{{totalVulnerability}} of {{totalPackages}} {{package}} has known {{vulnerability}}." "TOOLTIPS_TITLE_SINGULAR": "{{totalVulnerability}} of {{totalPackages}} {{package}} has known {{vulnerability}}.",
"TOOLTIPS_TITLE_ZERO": "No se encontró ningún paquete de vulnerabilidad reconocible"
}, },
"SEVERITY": { "SEVERITY": {
"HIGH": "high", "HIGH": "high",

View File

@ -510,7 +510,8 @@
"CHART": { "CHART": {
"SCANNING_TIME": "扫描完成时间:", "SCANNING_TIME": "扫描完成时间:",
"TOOLTIPS_TITLE": "{{totalPackages}}个{{package}}中的{{totalVulnerability}}个含有{{vulnerability}}.", "TOOLTIPS_TITLE": "{{totalPackages}}个{{package}}中的{{totalVulnerability}}个含有{{vulnerability}}.",
"TOOLTIPS_TITLE_SINGULAR": "{{totalPackages}}个{{package}}中的{{totalVulnerability}}个含有{{vulnerability}}." "TOOLTIPS_TITLE_SINGULAR": "{{totalPackages}}个{{package}}中的{{totalVulnerability}}个含有{{vulnerability}}.",
"TOOLTIPS_TITLE_ZERO": "没有发现可识别的漏洞包"
}, },
"SEVERITY": { "SEVERITY": {
"HIGH": "严重", "HIGH": "严重",