Skip to content

Commit ce7123f

Browse files
committed
Rewritten Severity Progress Bar
Signed-off-by: Sekwah <[email protected]>
1 parent 39d493b commit ce7123f

File tree

4 files changed

+21
-23
lines changed

4 files changed

+21
-23
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ yarn-error.log*
2323
*.njsproj
2424
*.sln
2525
*.sw*
26+
27+
# Generates as part of serve
28+
src/version.json

src/assets/scss/_custom.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
.severity-unassigned {
2525
color: $severity-unassigned;
2626
}
27+
// Fixes the width for the bootstrap progress bar in tables
28+
.table-progress {
29+
width: 100%;
30+
}
2731
.severity-critical-bg, .bg-severity-critical, .bg-CRITICAL {
2832
background: $severity-critical none;
2933
}
Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
<template>
22
<span v-if="vulnerabilities === 0" class="progress">
3-
<div class="progress-bar" style="width: 100%">0</div>
3+
<b-progress class="table-progress" :max="'0'" show-value>
4+
<b-progress-bar class="table-progress" value="0"></b-progress-bar>
5+
</b-progress>
46
</span>
57
<span v-else class="progress">
6-
<div v-if="critical > 0" class="progress-bar severity-critical-bg" v-bind:style="criticalWidth">{{critical}}</div>
7-
<div v-if="high > 0" class="progress-bar severity-high-bg" v-bind:style="highWidth">{{high}}</div>
8-
<div v-if="medium > 0" class="progress-bar severity-medium-bg" v-bind:style="mediumWidth">{{medium}}</div>
9-
<div v-if="low > 0" class="progress-bar severity-low-bg" v-bind:style="lowWidth">{{low}}</div>
10-
<div v-if="unassigned > 0" class="progress-bar severity-unassigned-bg" v-bind:style="unassignedWidth">{{unassigned}}</div>
8+
<b-progress class="table-progress" :max="vulnerabilities" show-value>
9+
<b-progress-bar :value="critical" class="severity-critical-bg"></b-progress-bar>
10+
<b-progress-bar :value="high" class="severity-high-bg"></b-progress-bar>
11+
<b-progress-bar :value="medium" class="severity-medium-bg"></b-progress-bar>
12+
<b-progress-bar :value="low" class="severity-low-bg"></b-progress-bar>
13+
<b-progress-bar :value="unassigned" class="severity-unassigned-bg"></b-progress-bar>
14+
</b-progress>
1115
</span>
1216
</template>
1317

@@ -20,23 +24,6 @@
2024
medium: Number,
2125
low: Number,
2226
unassigned: Number
23-
},
24-
computed: {
25-
criticalWidth: function () {
26-
return "width:" + (100 * this.critical) / this.vulnerabilities + "%";
27-
},
28-
highWidth: function () {
29-
return "width:" + (100 * this.high) / this.vulnerabilities + "%";
30-
},
31-
mediumWidth: function () {
32-
return "width:" + (100 * this.medium) / this.vulnerabilities + "%";
33-
},
34-
lowWidth: function () {
35-
return "width:" + (100 * this.low) / this.vulnerabilities + "%";
36-
},
37-
unassignedWidth: function () {
38-
return "width:" + (100 * this.unassigned) / this.vulnerabilities + "%";
39-
}
4027
}
4128
}
4229
</script>

src/views/portfolio/projects/ProjectList.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@
117117
align: "center",
118118
sortable: true
119119
},
120+
{
121+
title: this.$t('message.policy_violations'),
122+
field: "metrics.policyViolationsTotal"
123+
},
120124
{
121125
title: this.$t('message.vulnerabilities'),
122126
field: "metrics",

0 commit comments

Comments
 (0)