From 3c51e3770293a8b3ed454f87a7b75e624c26f941 Mon Sep 17 00:00:00 2001 From: AllForNothing Date: Fri, 27 Mar 2020 16:41:38 +0800 Subject: [PATCH] Modify UI for scanning result Signed-off-by: AllForNothing --- .../result-tip-histogram.component.html | 14 ++++++++++++-- .../result-tip-histogram.component.scss | 4 ++-- .../result-tip-histogram.component.ts | 6 +++++- src/portal/src/i18n/lang/en-us-lang.json | 1 + src/portal/src/i18n/lang/es-es-lang.json | 1 + src/portal/src/i18n/lang/fr-fr-lang.json | 1 + src/portal/src/i18n/lang/pt-br-lang.json | 1 + src/portal/src/i18n/lang/tr-tr-lang.json | 1 + src/portal/src/i18n/lang/zh-cn-lang.json | 1 + 9 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/portal/src/app/project/repository/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.html b/src/portal/src/app/project/repository/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.html index bfc677dd8..78fdf686d 100644 --- a/src/portal/src/app/project/repository/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.html +++ b/src/portal/src/app/project/repository/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.html @@ -1,4 +1,4 @@ -
+
@@ -75,10 +75,20 @@ {{'VULNERABILITY.CHART.SCANNING_TIME' | translate}} {{completeTimestamp | date:'short'}}
-
+ + + +
+ +
+ +
{{'VULNERABILITY.CHART.SCANNING_PERCENT' | translate}} {{completePercent}}
+
+ {{'VULNERABILITY.CHART.SCANNING_PERCENT_EXPLAIN' | translate}} +
diff --git a/src/portal/src/app/project/repository/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.scss b/src/portal/src/app/project/repository/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.scss index d06ac7803..216a30a05 100644 --- a/src/portal/src/app/project/repository/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.scss +++ b/src/portal/src/app/project/repository/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.scss @@ -212,8 +212,8 @@ hr { width: $thirty-pixel; } -.width-210 { - width: 210px; +.width-215 { + width: 215px; } .width-150 { diff --git a/src/portal/src/app/project/repository/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.ts b/src/portal/src/app/project/repository/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.ts index bbff36bc5..01d9c2f67 100644 --- a/src/portal/src/app/project/repository/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.ts +++ b/src/portal/src/app/project/repository/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.ts @@ -6,6 +6,7 @@ import { VULNERABILITY_SCAN_STATUS, VULNERABILITY_SEVERITY } from "../../../../. const MIN = 60; const MIN_STR = "min "; const SEC_STR = "sec"; +const SUCCESS_PCT: number = 100; const CLASS_MAP = { "CRITICAL": "level-critical", "HIGH": "level-high", @@ -150,7 +151,10 @@ export class ResultTipHistogramComponent implements OnInit { return 0; } public get completePercent(): string { - return this.vulnerabilitySummary ? `${this.vulnerabilitySummary.complete_percent}%` : '0%' + return this.vulnerabilitySummary ? `${this.vulnerabilitySummary.complete_percent}%` : '0%'; + } + isLimitedSuccess(): boolean { + return this.vulnerabilitySummary && this.vulnerabilitySummary.complete_percent < SUCCESS_PCT; } get completeTimestamp(): Date { return this.vulnerabilitySummary && this.vulnerabilitySummary.end_time ? this.vulnerabilitySummary.end_time : new Date(); diff --git a/src/portal/src/i18n/lang/en-us-lang.json b/src/portal/src/i18n/lang/en-us-lang.json index 635068bec..8d93a7df7 100644 --- a/src/portal/src/i18n/lang/en-us-lang.json +++ b/src/portal/src/i18n/lang/en-us-lang.json @@ -992,6 +992,7 @@ "CHART": { "SCANNING_TIME": "Scan completed time:", "SCANNING_PERCENT": "Scan completed percent:", + "SCANNING_PERCENT_EXPLAIN": "(Scan completed percentage is calculated as # of successfully scanned images / total number of images referenced within the image index not including the index file itself and the images that do not support being scanned.)", "TOOLTIPS_TITLE": "{{totalVulnerability}} of {{totalPackages}} {{package}} have known {{vulnerability}}.", "TOOLTIPS_TITLE_SINGULAR": "{{totalVulnerability}} of {{totalPackages}} {{package}} has known {{vulnerability}}.", "TOOLTIPS_TITLE_ZERO": "No recognizable vulnerability found" diff --git a/src/portal/src/i18n/lang/es-es-lang.json b/src/portal/src/i18n/lang/es-es-lang.json index d72c03634..9c266c514 100644 --- a/src/portal/src/i18n/lang/es-es-lang.json +++ b/src/portal/src/i18n/lang/es-es-lang.json @@ -991,6 +991,7 @@ "CHART": { "SCANNING_TIME": "Scan completed time:", "SCANNING_PERCENT": "Scan completed percent:", + "SCANNING_PERCENT_EXPLAIN": "(Scan completed percentage is calculated as # of successfully scanned images / total number of images referenced within the image index not including the index file itself and the images that do not support being scanned.)", "TOOLTIPS_TITLE": "{{totalVulnerability}} of {{totalPackages}} {{package}} have known {{vulnerability}}.", "TOOLTIPS_TITLE_SINGULAR": "{{totalVulnerability}} of {{totalPackages}} {{package}} has known {{vulnerability}}.", "TOOLTIPS_TITLE_ZERO": "No recognizable vulnerability found" diff --git a/src/portal/src/i18n/lang/fr-fr-lang.json b/src/portal/src/i18n/lang/fr-fr-lang.json index 9898a5098..771fe5083 100644 --- a/src/portal/src/i18n/lang/fr-fr-lang.json +++ b/src/portal/src/i18n/lang/fr-fr-lang.json @@ -964,6 +964,7 @@ "CHART": { "SCANNING_TIME": "Temps d'analyse complète :", "SCANNING_PERCENT": "Scan completed percent:", + "SCANNING_PERCENT_EXPLAIN": "(Scan completed percentage is calculated as # of successfully scanned images / total number of images referenced within the image index not including the index file itself and the images that do not support being scanned.)", "TOOLTIPS_TITLE": "{{totalVulnerability}} de {{totalPackages}} {{package}} ont des {{vulnerability}} connues.", "TOOLTIPS_TITLE_SINGULAR": "{{totalVulnerability}} de {{totalPackages}} {{package}} a des {{vulnerability}} connues.", "TOOLTIPS_TITLE_ZERO": "No recognizable vulnerability found" diff --git a/src/portal/src/i18n/lang/pt-br-lang.json b/src/portal/src/i18n/lang/pt-br-lang.json index 61dc1250c..32e30dcdb 100644 --- a/src/portal/src/i18n/lang/pt-br-lang.json +++ b/src/portal/src/i18n/lang/pt-br-lang.json @@ -987,6 +987,7 @@ "CHART": { "SCANNING_TIME": "Tempo de conclusão da análise:", "SCANNING_PERCENT": "Scan completed percent:", + "SCANNING_PERCENT_EXPLAIN": "(Scan completed percentage is calculated as # of successfully scanned images / total number of images referenced within the image index not including the index file itself and the images that do not support being scanned.)", "TOOLTIPS_TITLE": "{{totalVulnerability}} de {{totalPackages}} {{package}} possuem {{vulnerability}}.", "TOOLTIPS_TITLE_SINGULAR": "{{totalVulnerability}} de {{totalPackages}} {{package}} possuem {{vulnerability}}.", "TOOLTIPS_TITLE_ZERO": "No recognizable vulnerability found" diff --git a/src/portal/src/i18n/lang/tr-tr-lang.json b/src/portal/src/i18n/lang/tr-tr-lang.json index ba09d93dd..bc5db36ae 100644 --- a/src/portal/src/i18n/lang/tr-tr-lang.json +++ b/src/portal/src/i18n/lang/tr-tr-lang.json @@ -992,6 +992,7 @@ "CHART": { "SCANNING_TIME": "Tarama tamamlanma zamanı:", "SCANNING_PERCENT": "Scan completed percent:", + "SCANNING_PERCENT_EXPLAIN": "(Scan completed percentage is calculated as # of successfully scanned images / total number of images referenced within the image index not including the index file itself and the images that do not support being scanned.)", "TOOLTIPS_TITLE": "{{totalVulnerability}} 'nın {{totalPackages}} {{package}} bilinen {{vulnerability}}.", "TOOLTIPS_TITLE_SINGULAR": "{{totalVulnerability}} 'nın {{totalPackages}} {{package}} bilinen {{vulnerability}}.", "TOOLTIPS_TITLE_ZERO": "No recognizable vulnerability found" diff --git a/src/portal/src/i18n/lang/zh-cn-lang.json b/src/portal/src/i18n/lang/zh-cn-lang.json index 33fb9006b..7c42c4435 100644 --- a/src/portal/src/i18n/lang/zh-cn-lang.json +++ b/src/portal/src/i18n/lang/zh-cn-lang.json @@ -991,6 +991,7 @@ "CHART": { "SCANNING_TIME": "扫描完成时间:", "SCANNING_PERCENT": "扫描完成度:", + "SCANNING_PERCENT_EXPLAIN": "(扫描完成度是扫描成功的镜像数与总共需要扫描的镜像数的比值。总共需要的扫描的镜像不包含 Index 本身和不支持扫描的镜像。)", "TOOLTIPS_TITLE": "{{totalPackages}}个{{package}}中的{{totalVulnerability}}个含有{{vulnerability}}。", "TOOLTIPS_TITLE_SINGULAR": "{{totalPackages}}个{{package}}中的{{totalVulnerability}}个含有{{vulnerability}}。", "TOOLTIPS_TITLE_ZERO": "没有发现可识别的漏洞"