Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into refactor/portfolio-…
Browse files Browse the repository at this point in the history
…statistics
  • Loading branch information
setchy committed Jan 28, 2024
2 parents 00088b6 + bd4467a commit 38711e6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 139 deletions.
22 changes: 20 additions & 2 deletions src/assets/scss/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,39 @@ html {
}
.severity-critical, .status-failed {
color: $severity-critical;
.progress-bar {
background-color: $severity-critical;
}
}
.severity-high {
color:$severity-high;
.progress-bar {
background-color: $severity-high;
}
}
.severity-medium, .status-warning {
color: $severity-medium;
.progress-bar {
background-color: $severity-medium;
}
}
.severity-low, .status-passed {
color: $severity-low;
.progress-bar {
background-color: $severity-low;
}
}
.severity-info {
.severity-info, .status-info {
color: $severity-info;
.progress-bar {
background-color: $severity-info;
}
}
.severity-unassigned {
color: $severity-unassigned;
.progress-bar {
background-color: $severity-unassigned;
}
}
// Fixes the width for the bootstrap progress bar in tables
.table-progress {
Expand Down Expand Up @@ -469,4 +487,4 @@ td a.detail-icon {
.keep-together {
display: inline;
white-space: nowrap;
}
}
12 changes: 6 additions & 6 deletions src/shared/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,17 +410,17 @@ $common.valueWithDefault = function valueWithDefault(variable, defaultValue) {
* function will return a percentage rounded to the tenth decimal place.
*/
$common.calcProgressPercent = function calcProgressPercent(total, completed) {
if (total > 0) {
if (completed >= total) {
// In something has already been completed (e.g. suppressed) and the completed value
// is greater than the total, return 100%
return 100;
} else if (total > 0) {
if (completed === 0) {
return 0;
} else {
let percentage = (completed / total) * 100;
return Math.round(percentage);
return Math.round(percentage * 10) / 10;
}
} else if (completed > total) {
// In something has already been completed (e.g. suppressed) and the completed value
// is greater than the total, return 100%
return 100;
}
return 0; // the absence of work does not imply progress.
};
Expand Down
58 changes: 14 additions & 44 deletions src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@
<b-col class="mb-sm-2 mb-0">
<div class="text-muted">{{ $t('message.vulnerable_projects') }}</div>
<strong>{{vulnerableProjects}} ({{vulnerableProjectPercent}}%)</strong>
<b-progress height={} class="progress-xs mt-2" :precision="1" variant="success" v-bind:value="vulnerableProjectPercent"></b-progress>
<b-progress height={} class="progress-xs mt-2 status-passed" :precision="1" v-bind:value="vulnerableProjectPercent"></b-progress>
</b-col>
<b-col class="mb-sm-2 mb-0 d-md-down-none">
<div class="text-muted">{{ $t('message.violations_audited') }}</div>
<strong>{{auditedViolations}} ({{auditedViolationsPercent}}%)</strong>
<b-progress height={} class="progress-xs mt-2" :precision="1" variant="info" v-bind:value="auditedViolationsPercent"></b-progress>
<b-progress height={} class="progress-xs mt-2 status-info" :precision="1" v-bind:value="auditedViolationsPercent"></b-progress>
</b-col>
<b-col class="mb-sm-2 mb-0">
<div class="text-muted">{{ $t('message.vulnerable_components') }}</div>
<strong>{{vulnerableComponents}} ({{vulnerableComponentPercent}}%)</strong>
<b-progress height={} class="progress-xs mt-2" :precision="1" variant="warning" v-bind:value="vulnerableComponentPercent"></b-progress>
<b-progress height={} class="progress-xs mt-2 status-warning" :precision="1" v-bind:value="vulnerableComponentPercent"></b-progress>
</b-col>
<b-col class="mb-sm-2 mb-0">
<div class="text-muted">{{ $t('message.findings_audited') }}</div>
<strong>{{auditedFindings}} ({{auditedFindingPercent}}%)</strong>
<b-progress height={} class="progress-xs mt-2" :precision="1" variant="danger" v-bind:value="auditedFindingPercent"></b-progress>
<b-progress height={} class="progress-xs mt-2 status-failed" :precision="1" v-bind:value="auditedFindingPercent"></b-progress>
</b-col>
</b-row>
</div>
Expand All @@ -53,49 +53,19 @@
<div slot="footer">
<b-row class="text-center">
<b-col class="mb-sm-2 mb-0 d-md-down-none">
<div class="text-muted">
{{ $t("policy_violation.fails") }}
</div>
<strong
>{{ failViolations }} ({{ failViolationsPercent }}%)</strong
>
<b-progress
height="{}"
class="progress-xs mt-2"
:precision="1"
variant="danger"
v-bind:value="failViolationsPercent"
></b-progress>
<div class="text-muted">{{ $t("policy_violation.fails") }}</div>
<strong>{{ failViolations }} ({{ failViolationsPercent }}%)</strong>
<b-progress height="{}" class="progress-xs mt-2 status-failed" :precision="1" v-bind:value="failViolationsPercent"></b-progress>
</b-col>
<b-col class="mb-sm-2 mb-0">
<div class="text-muted">
{{ $t("policy_violation.warns") }}
</div>
<strong
>{{ warnViolations }} ({{ warnViolationsPercent }}%)</strong
>
<b-progress
height="{}"
class="progress-xs mt-2"
:precision="1"
variant="warning"
v-bind:value="warnViolationsPercent"
></b-progress>
<div class="text-muted">{{ $t("policy_violation.warns") }}</div>
<strong>{{ warnViolations }} ({{ warnViolationsPercent }}%)</strong>
<b-progress height="{}" class="progress-xs mt-2 status-warning" :precision="1" v-bind:value="warnViolationsPercent"></b-progress>
</b-col>
<b-col class="mb-sm-2 mb-0">
<div class="text-muted">
{{ $t("policy_violation.infos") }}
</div>
<strong
>{{ infoViolations }} ({{ infoViolationsPercent }}%)</strong
>
<b-progress
height="{}"
class="progress-xs mt-2"
:precision="1"
variant="info"
v-bind:value="infoViolationsPercent"
></b-progress>
<div class="text-muted">{{ $t("policy_violation.infos") }}</div>
<strong>{{ infoViolations }} ({{ infoViolationsPercent }}%)</strong>
<b-progress height="{}" class="progress-xs mt-2 status-info" :precision="1" v-bind:value="infoViolationsPercent"></b-progress>
</b-col>
</b-row>
</div>
Expand Down Expand Up @@ -187,7 +157,7 @@
</Callout>
</b-col>
<b-col sm="6">
<Callout variant="info">
<Callout variant="warning">
<small class="text-muted">{{ $t('message.suppressed') }}</small><br>
<strong class="h4">{{suppressed}}</strong>
</Callout>
Expand Down
87 changes: 0 additions & 87 deletions src/views/dashboard/WidgetPolicyViolations.vue

This file was deleted.

0 comments on commit 38711e6

Please sign in to comment.