Skip to content

Commit ba32c52

Browse files
rushk014xingzhang-suse
authored andcommitted
fix(vulnerabilities): Simulate data fetch to fix SortableTable checkbox selection
1 parent 2f2b48b commit ba32c52

File tree

3 files changed

+28
-21
lines changed

3 files changed

+28
-21
lines changed

pkg/sbombastic-image-vulnerability-scanner/components/common/ScoreBadge.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
name: 'scoreBadge',
1111
props: {
1212
score:{
13-
type: Number,
14-
default: 0
13+
type: String,
14+
default: ''
1515
},
1616
scoreType: {
1717
type: String,
18-
default: ""
18+
default: ''
1919
}
2020
},
2121
computed: {

pkg/sbombastic-image-vulnerability-scanner/formatters/ImpactedCell.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
props: {
2121
value: {
22-
type: String,
22+
type: Number,
2323
required: true
2424
},
2525
row: {

pkg/sbombastic-image-vulnerability-scanner/pages/c/_cluster/sbombastic-image-vulnerability-scanner/Vulnerabilities.vue

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@
1414
:has-advanced-filtering="false"
1515
:namespaced="false"
1616
:row-actions="false"
17+
:table-actions="true"
1718
:force-update-live-and-delayed="0"
1819
:use-query-params-for-simple-filtering="true"
1920
:rows="vulnerabilities"
2021
:headers="VULNERABILITIES_TABLE"
22+
:key-field="'id'"
23+
@selection="onSelectionChange"
2124
/>
2225
</div>
2326
</div>
@@ -40,25 +43,29 @@
4043
data() {
4144
return {
4245
VULNERABILITIES_TABLE,
43-
severityDistribution,
44-
cves,
46+
severityDistribution: null,
47+
topSevereVulnerabilities: [],
48+
vulnerabilities: [],
49+
selectedRows: [],
4550
};
4651
},
47-
computed: {
48-
totalVulnerabilities() {
49-
return Object.values(this.severityDistribution).reduce((sum, value) => sum + value, 0);
50-
},
51-
vulnerabilities() {
52-
return this.cves.map(vul => ({
53-
...vul,
54-
spec: {
55-
...vul.spec,
56-
totalImages: this.totalVulnerabilities
57-
}
58-
}));
59-
},
60-
topSevereVulnerabilities() {
61-
return this.vulnerabilities.sort((a, b) => Number(b.spec.scoreV3) - Number(a.spec.scoreV3)).slice(0, 5);
52+
async fetch() {
53+
// await this.$store.dispatch('sbombastic-image-vulnerability-scanner/load');
54+
this.severityDistribution = severityDistribution;
55+
const totalVulnerabilities = Object.values(this.severityDistribution).reduce((sum, value) => sum + value, 0);
56+
this.vulnerabilities = cves.map(vul => ({
57+
...vul,
58+
spec: {
59+
...vul.spec,
60+
totalImages: totalVulnerabilities
61+
}
62+
}));
63+
this.topSevereVulnerabilities = this.vulnerabilities.sort((a, b) => Number(b.spec.scoreV3) - Number(a.spec.scoreV3)).slice(0, 5);
64+
65+
},
66+
methods: {
67+
onSelectionChange(selected) {
68+
this.selectedRows = selected || [];
6269
},
6370
},
6471
}

0 commit comments

Comments
 (0)