Skip to content

Commit 7c2017d

Browse files
NickChungSUSExingzhang-suse
authored andcommitted
Add VEX Management Overview component
1 parent 3cde643 commit 7c2017d

File tree

13 files changed

+659
-1
lines changed

13 files changed

+659
-1
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<template>
2+
<div class="badge" :class="statusClass">
3+
<div v-if="status" class="text">{{ t(`imageScanner.enum.status.${status.toLowerCase()}`) }}</div>
4+
</div>
5+
6+
</template>
7+
8+
<script>
9+
import { VEX_STATUS } from "@sbombastic-image-vulnerability-scanner/types";
10+
export default {
11+
name: 'VexStatusBadge',
12+
props: {
13+
status: {
14+
type: String,
15+
default: ''
16+
}
17+
},
18+
computed: {
19+
statusClass() {
20+
switch ((this.status || '').toLowerCase()) {
21+
case VEX_STATUS.ENABLED:
22+
return 'enabled';
23+
case VEX_STATUS.DISABLED:
24+
return 'disabled';
25+
default:
26+
return '';
27+
}
28+
}
29+
}
30+
};
31+
</script>
32+
33+
<style lang="scss" scoped>
34+
.badge {
35+
display: inline-block;
36+
padding: 1px 8px;
37+
align-items: center;
38+
border-radius: 30px;
39+
40+
&.enabled {
41+
background: #DEEFDC;
42+
color: #376930;
43+
}
44+
45+
&.disabled {
46+
background: #DE2136;
47+
color: #FFFFFF;
48+
}
49+
50+
.text {
51+
display: -webkit-box;
52+
-webkit-box-orient: vertical;
53+
-webkit-line-clamp: 1;
54+
line-clamp: 1;
55+
overflow: hidden;
56+
text-overflow: ellipsis;
57+
font-family: Lato;
58+
font-size: 12px;
59+
font-style: normal;
60+
font-weight: 400;
61+
line-height: 19px;
62+
}
63+
}
64+
</style>

pkg/sbombastic-image-vulnerability-scanner/config/sbombastic-image-vulnerability-scanner.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ export function init($plugin: IPlugin, store: any) {
3939
},
4040
});
4141

42+
virtualType({
43+
labelKey: 'imageScanner.vexManagement.title',
44+
name: PAGE.VEX_MANAGEMENT,
45+
namespaced: false,
46+
route: {
47+
name: `c-cluster-${PRODUCT_NAME}-${PAGE.VEX_MANAGEMENT}`,
48+
params: {
49+
product: PRODUCT_NAME
50+
},
51+
meta: { pkg: PRODUCT_NAME, product: PRODUCT_NAME }
52+
}
53+
});
54+
4255
virtualType({
4356
label: "Components Demo",
4457
name: "demo",
@@ -55,6 +68,8 @@ export function init($plugin: IPlugin, store: any) {
5568
basicType([
5669
PAGE.IMAGE_OVERVIEW,
5770
PAGE.VULNERABILITY_OVERVIEW,
71+
PAGE.VEX_MANAGEMENT,
72+
"demo"
5873
]);
5974

6075
basicType([RESOURCE.REGISTRY], 'Advanced');

pkg/sbombastic-image-vulnerability-scanner/config/table-headers.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,42 @@ export const REGISTRY_SCAN_HISTORY_TABLE = [
103103
sort: "errors",
104104
},
105105
];
106+
107+
export const VEX_MANAGEMENT_TABLE = [
108+
{
109+
name: "_status",
110+
labelKey: "imageScanner.vexManagement.table.headers.status",
111+
value: "_status",
112+
getValue: (row: any) => row._status,
113+
formatter: "VexStatusCellBadge",
114+
sort: "_status",
115+
},
116+
{
117+
name: "name",
118+
labelKey: "imageScanner.vexManagement.table.headers.name",
119+
value: "name",
120+
formatter: "VexNameLink",
121+
sort: "name",
122+
},
123+
{
124+
name: "uri",
125+
labelKey: "imageScanner.vexManagement.table.headers.uri",
126+
value: "uri",
127+
formatter: "UriExternalLink",
128+
sort: "uri",
129+
},
130+
{
131+
name: "createdBy",
132+
labelKey: "imageScanner.vexManagement.table.headers.createdBy",
133+
value: "createdBy",
134+
sort: "createdBy",
135+
},
136+
{
137+
name: "updated",
138+
labelKey: "imageScanner.vexManagement.table.headers.updated",
139+
value: "updated",
140+
getValue: (row: any) => row.updated,
141+
formatter: "VexDateFormatter",
142+
sort: "updated",
143+
}
144+
];
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<script>
2+
export default {
3+
name: 'UriExternalLink',
4+
props: {
5+
value: {
6+
type: String,
7+
required: true
8+
},
9+
row: {
10+
type: Object,
11+
default: () => ({})
12+
}
13+
}
14+
};
15+
</script>
16+
17+
<template>
18+
<a class="uri-link" :href="value" target="_blank" rel="noopener noreferrer">
19+
{{ value }}
20+
<i class="icon icon-external-link"></i>
21+
</a>
22+
</template>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<template>
2+
<span>{{ formattedDate }}</span>
3+
</template>
4+
5+
<script>
6+
export default {
7+
name: 'VexDateFormatter',
8+
props: {
9+
value: {
10+
type: [String, Date],
11+
required: true
12+
},
13+
row: {
14+
type: Object,
15+
default: () => ({})
16+
}
17+
},
18+
computed: {
19+
formattedDate() {
20+
const date = new Date(this.value);
21+
const options = {
22+
month: 'short',
23+
day: 'numeric',
24+
year: 'numeric',
25+
hour: 'numeric',
26+
minute: '2-digit',
27+
hour12: true
28+
};
29+
return date.toLocaleString('en-US', options);
30+
}
31+
}
32+
};
33+
</script>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<script>
2+
export default {
3+
name: 'VexNameLink',
4+
props: {
5+
value: {
6+
type: String,
7+
required: true
8+
},
9+
row: {
10+
type: Object,
11+
required: true
12+
}
13+
}
14+
};
15+
</script>
16+
17+
<template>
18+
<RouterLink :to="`/c/${$route.params.cluster}/imageScanner/vex_management/${row.id}`">{{ value }}</RouterLink>
19+
</template>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<script>
2+
import VexStatusBadge from "@sbombastic-image-vulnerability-scanner/components/common/VexStatusBadge.vue";
3+
export default {
4+
components: {
5+
VexStatusBadge,
6+
},
7+
props: {
8+
value: {
9+
type: String,
10+
required: true
11+
},
12+
},
13+
};
14+
</script>
15+
16+
<template>
17+
<VexStatusBadge :status="value.toLowerCase()" />
18+
</template>

pkg/sbombastic-image-vulnerability-scanner/l10n/en-us.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,27 @@ imageScanner:
8383
registry: Registry
8484
vulnerabilities:
8585
title: Vulnerabilities
86+
vexManagement:
87+
title: VEX management
88+
description: Configure the security scanner to use up-to-date VEX reports. This will prioritize remediation efforts, focusing on vulnerabilities that are confirmed to be exploitable and reducing the noise coming from false positives.
89+
button:
90+
create: Create
91+
buttons:
92+
enable: Enable
93+
disable: Disable
94+
delete: Delete
95+
actions:
96+
clone: Clone
97+
editConfig: Edit configuration
98+
editYaml: Edit YAML
99+
table:
100+
headers:
101+
status: Status
102+
name: Name
103+
uri: URI
104+
createdBy: Created by
105+
updated: Updated
106+
actions: Actions
86107
enum:
87108
cve:
88109
critical: Critical
@@ -96,6 +117,8 @@ imageScanner:
96117
inprogress: In progress
97118
complete: Complete
98119
failed: Failed
120+
enabled: Enabled
121+
disabled: Disabled
99122
prevScan:
100123
none: n/a
101124
scheduled: Scheduled

0 commit comments

Comments
 (0)