Wrong values shown for the columns of support_sbom and support_vulnerability in scanner list (#20308)

Fix wrong value shown for the columns of support_sbom and support_vulnerability in scanner list

Signed-off-by: xuelichao <xuel@vmware.com>
This commit is contained in:
Lichao Xue 2024-04-22 13:29:48 +08:00 committed by GitHub
parent d759429831
commit e7fce62723
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 58 additions and 30 deletions

View File

@ -180,12 +180,8 @@ export class ConfigurationScannerComponent implements OnInit, OnDestroy {
}
supportCapability(scanner: Scanner, capabilityType: string): boolean {
return scanner && scanner.metadata && capabilityType
? (
scanner?.metadata?.capabilities?.filter(
({ type }) => type === capabilityType
) ?? []
).length >= 1
return scanner && scanner.capabilities && capabilityType
? scanner?.capabilities?.[`support_${capabilityType}`] ?? false
: false;
}

View File

@ -19,21 +19,44 @@
<div class="clr-control-label">
{{ 'SCANNER.CAPABILITIES' | translate }}
</div>
<div class="ml-1">
<span>{{ 'SCANNER.CONSUMES_MIME_TYPES_COLON' | translate }}</span>
<span
class="ml-1"
[innerHTML]="
toString(scannerMetadata?.capabilities[0]?.consumes_mime_types)
"></span>
</div>
<div class="ml-1">
<span>{{ 'SCANNER.PRODUCTS_MIME_TYPES_COLON' | translate }}</span>
<span
class="ml-1"
[innerHTML]="
toString(scannerMetadata?.capabilities[0]?.produces_mime_types)
"></span>
<div
class="ml-1"
*ngFor="let item of scannerMetadata?.capabilities; let i = index">
{{ i }}:
<div class="ml-1">
<span>{{ 'SCANNER.CONSUMES_MIME_TYPES_COLON' | translate }}</span>
<span
class="ml-1"
[innerHTML]="
toString(
scannerMetadata?.capabilities[i]?.consumes_mime_types
)
"></span>
</div>
<div class="ml-1">
<span>{{ 'SCANNER.PRODUCTS_MIME_TYPES_COLON' | translate }}</span>
<span
class="ml-1"
[innerHTML]="
toString(
scannerMetadata?.capabilities[i]?.produces_mime_types
)
"></span>
</div>
<div class="ml-1" *ngIf="scannerMetadata?.capabilities[i]?.type">
<span>{{ 'SCANNER.CAPABILITIES_TYPE' | translate }}</span>
<span class="ml-1">
{{
(scannerMetadata?.capabilities[i]?.type === 'sbom'
? 'SCANNER.SBOM'
: scannerMetadata?.capabilities[i]?.type ===
'vulnerability'
? 'SCANNER.VULNERABILITY'
: scannerMetadata?.capabilities[i]?.type
) | translate
}}
</span>
</div>
</div>
<div class="clr-control-label">{{ 'SCANNER.PROPERTIES' | translate }}</div>
<div

View File

@ -1503,9 +1503,10 @@
"NAME_COLON": "Name:",
"VENDOR_COLON": "Hersteller:",
"VERSION_COLON": "Version:",
"CAPABILITIES": "Fähigkeiten",
"CAPABILITIES": "Fähigkeiten:",
"CONSUMES_MIME_TYPES_COLON": "Benötigt Mime Types:",
"PRODUCTS_MIME_TYPES_COLON": "Erzeugt Mime Types:",
"CAPABILITIES_TYPE": "Type:",
"PROPERTIES": "Eigenschaften",
"NEW_SCANNER": "NEUER SCANNER",
"SET_AS_DEFAULT": "ALS STANDARD SETZEN",

View File

@ -1504,9 +1504,10 @@
"NAME_COLON": "Name:",
"VENDOR_COLON": "Vendor:",
"VERSION_COLON": "Version:",
"CAPABILITIES": "Capabilities",
"CAPABILITIES": "Capabilities:",
"CONSUMES_MIME_TYPES_COLON": "Consumes Mime Types:",
"PRODUCTS_MIME_TYPES_COLON": "Produces Mime Types:",
"CAPABILITIES_TYPE": "Type:",
"PROPERTIES": "Properties",
"NEW_SCANNER": "NEW SCANNER",
"SET_AS_DEFAULT": "SET AS DEFAULT",

View File

@ -1500,9 +1500,10 @@
"NAME_COLON": "Name:",
"VENDOR_COLON": "Vendor:",
"VERSION_COLON": "Version:",
"CAPABILITIES": "Capabilities",
"CAPABILITIES": "Capabilities:",
"CONSUMES_MIME_TYPES_COLON": "Consumes Mime Types:",
"PRODUCTS_MIME_TYPES_COLON": "Produces Mime Types:",
"CAPABILITIES_TYPE": "Type:",
"PROPERTIES": "Properties",
"NEW_SCANNER": "NEW SCANNER",
"SET_AS_DEFAULT": "SET AS DEFAULT",

View File

@ -1501,9 +1501,10 @@
"NAME_COLON": "Nom :",
"VENDOR_COLON": "Vendeur :",
"VERSION_COLON": "Version :",
"CAPABILITIES": "Capacités",
"CAPABILITIES": "Capacités:",
"CONSUMES_MIME_TYPES_COLON": "Consomme les types Mime :",
"PRODUCTS_MIME_TYPES_COLON": "Produit les types Mime :",
"CAPABILITIES_TYPE": "Type:",
"PROPERTIES": "Propriétés",
"NEW_SCANNER": "Nouveau scanneur",
"SET_AS_DEFAULT": "PAR DEFAUT",

View File

@ -1497,9 +1497,10 @@
"NAME_COLON": "이름:",
"VENDOR_COLON": "Vendor:",
"VERSION_COLON": "버전:",
"CAPABILITIES": "기능",
"CAPABILITIES": "기능:",
"CONSUMES_MIME_TYPES_COLON": "Mime 유형 사용:",
"PRODUCTS_MIME_TYPES_COLON": "Mime 유형 제공:",
"CAPABILITIES_TYPE": "Type:",
"PROPERTIES": "속성",
"NEW_SCANNER": "새 스캐너",
"SET_AS_DEFAULT": "기본으로 설정",

View File

@ -1500,9 +1500,10 @@
"NAME_COLON": "Nome:",
"VENDOR_COLON": "Fornecedor:",
"VERSION_COLON": "Versão:",
"CAPABILITIES": "Habilidades",
"CAPABILITIES": "Habilidades:",
"CONSUMES_MIME_TYPES_COLON": "Consome estes Mime Types:",
"PRODUCTS_MIME_TYPES_COLON": "Produz estes Mime Types:",
"CAPABILITIES_TYPE": "Type:",
"PROPERTIES": "Propriedades",
"NEW_SCANNER": "NOVO EXAMINADOR",
"SET_AS_DEFAULT": "DEFINIR COMO PADRÃO",

View File

@ -1503,9 +1503,10 @@
"NAME_COLON": "Name:",
"VENDOR_COLON": "Vendor:",
"VERSION_COLON": "Version:",
"CAPABILITIES": "Capabilities",
"CAPABILITIES": "Capabilities:",
"CONSUMES_MIME_TYPES_COLON": "Consumes Mime Types:",
"PRODUCTS_MIME_TYPES_COLON": "Produces Mime Types:",
"CAPABILITIES_TYPE": "Type:",
"PROPERTIES": "Properties",
"NEW_SCANNER": "NEW SCANNER",
"SET_AS_DEFAULT": "SET AS DEFAULT",

View File

@ -1499,9 +1499,10 @@
"NAME_COLON": "Name:",
"VENDOR_COLON": "Vendor:",
"VERSION_COLON": "Version:",
"CAPABILITIES": "Capabilities",
"CAPABILITIES": "Capabilities:",
"CONSUMES_MIME_TYPES_COLON": "Consumes Mime Types:",
"PRODUCTS_MIME_TYPES_COLON": "Produces Mime Types:",
"CAPABILITIES_TYPE": "Type:",
"PROPERTIES": "Properties",
"NEW_SCANNER": "新建扫描器",
"SET_AS_DEFAULT": "设为默认",

View File

@ -1498,9 +1498,10 @@
"NAME_COLON": "名稱:",
"VENDOR_COLON": "供應商:",
"VERSION_COLON": "版本:",
"CAPABILITIES": "功能",
"CAPABILITIES": "功能:",
"CONSUMES_MIME_TYPES_COLON": "可處理的 MIME 類型:",
"PRODUCTS_MIME_TYPES_COLON": "產出的 MIME 類型:",
"CAPABILITIES_TYPE": "Type:",
"PROPERTIES": "屬性",
"NEW_SCANNER": "新增掃描器",
"SET_AS_DEFAULT": "設為預設",