Skip to content

Commit 6869a56

Browse files
Add UUID to all guideline items for creating a unique key for each.
Sorting guideline statistics table throws an error if multiple equivalent entries are in the column selected as the key. By introducing a uuid in the table, a unique identifier is present by which the table can be indexed and sorting can happen without the issue.
1 parent 22fac1b commit 6869a56

3 files changed

Lines changed: 37 additions & 14 deletions

File tree

web/server/vue-cli/package-lock.json

Lines changed: 24 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/server/vue-cli/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
},
2828
"dependencies": {
2929
"@mdi/font": "^6.5.95",
30-
"codechecker-api": "file:../../api/js/codechecker-api-node/dist/codechecker-api-6.66.0.tgz",
3130
"chart.js": "^2.9.4",
3231
"chartjs-plugin-datalabels": "^0.7.0",
32+
"codechecker-api": "file:../../api/js/codechecker-api-node/dist/codechecker-api-6.66.0.tgz",
3333
"codemirror": "^5.65.0",
3434
"date-fns": "^2.28.0",
3535
"js-cookie": "^3.0.1",
@@ -38,10 +38,11 @@
3838
"marked": "^4.0.10",
3939
"semver": "^5.7.1",
4040
"splitpanes": "^2.3.8",
41+
"uuid": "^13.0.0",
4142
"vue": "^2.6.14",
4243
"vue-chartjs": "^3.5.1",
4344
"vue-router": "^3.5.3",
44-
"vuetify": "^2.6.10",
45+
"vuetify": "^2.7.2",
4546
"vuex": "^3.6.2"
4647
},
4748
"devDependencies": {

web/server/vue-cli/src/components/Statistics/Guideline/GuidelineStatisticsTable.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<template>
22
<base-statistics-table
33
:headers="tableHeaders"
4-
:items="items"
4+
:items="itemsWithUuid"
55
:loading="loading"
66
:mobile-breakpoint="1000"
77
:item-class="getRowClass"
88
loading-text="Loading guideline statistics..."
99
no-data-text="No guideline statistics available"
10-
item-key="guidelineRule"
10+
item-key="uuid"
1111
sort-by="checkers.severity"
1212
sort-desc
1313
@enabled-click="enabledClick"
@@ -16,6 +16,7 @@
1616

1717
<script>
1818
import { BaseStatisticsTable } from "@/components/Statistics";
19+
import { v4 as uuidv4 } from "uuid";
1920
2021
export default {
2122
name: "GuidelineStatisticsTable",
@@ -84,6 +85,13 @@ export default {
8485
8586
return true;
8687
});
88+
},
89+
90+
itemsWithUuid() {
91+
return this.items.map(item => ({
92+
...item,
93+
uuid: item.uuid || uuidv4()
94+
}));
8795
}
8896
},
8997

0 commit comments

Comments
 (0)