Skip to content

Commit

Permalink
Wrong values shown for the columns of support_sbom and support_vulner…
Browse files Browse the repository at this point in the history
…ability in scanner list (#20308)

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

Signed-off-by: xuelichao <[email protected]>
  • Loading branch information
xuelichao authored Apr 22, 2024
1 parent d759429 commit e7fce62
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/de-de-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/en-us-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/es-es-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/fr-fr-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/ko-kr-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "기본으로 설정",
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/pt-br-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/tr-tr-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/zh-cn-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "设为默认",
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/zh-tw-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "設為預設",
Expand Down

0 comments on commit e7fce62

Please sign in to comment.