Skip to content

Commit

Permalink
feat(violations): add current fail, warn, info metrics to footer
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Setch <[email protected]>
  • Loading branch information
setchy committed Jan 27, 2024
1 parent 151c4b3 commit 51310bf
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,55 @@
</b-col>
</b-row>
<chart-policy-violations ref="chartPolicyViolations" chartId="chartPolicyViolations" class="chart-wrapper" style="height:200px;margin-top:40px;" :height="200"></chart-policy-violations>
<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="info"
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>
</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="danger"
v-bind:value="infoViolationsPercent"
></b-progress>
</b-col>
</b-row>
</div>
</b-card>
</b-col>
<b-col sm="6">
Expand Down Expand Up @@ -177,6 +226,12 @@
totalViolations: 0,
auditedViolations: 0,
auditedViolationsPercent: 0,
failViolations: 0,
failViolationsPercent: 0,
warnViolations: 0,
warnViolationsPercent: 0,
infoViolations: 0,
infoViolationsPercent: 0,
vulnerabilities: 0,
suppressed: 0,
Expand Down Expand Up @@ -204,6 +259,12 @@
this.totalViolations = common.valueWithDefault(metric.policyViolationsTotal, "0");
this.auditedViolations = common.valueWithDefault(metric.policyViolationsAudited, "0");
this.auditedViolationsPercent = common.calcProgressPercent(this.totalViolations, this.auditedViolations);
this.failViolations = common.valueWithDefault(metric.policyViolationsFail, "0");
this.failViolationsPercent = common.calcProgressPercent(this.totalViolations, this.failViolations);
this.warnViolations = common.valueWithDefault(metric.policyViolationsWarn, "0");
this.warnViolationsPercent = common.calcProgressPercent(this.totalViolations, this.warnViolations);
this.infoViolations = common.valueWithDefault(metric.policyViolationsInfo, "0");
this.infoViolationsPercent = common.calcProgressPercent(this.totalViolations, this.infoViolations);
this.vulnerabilities = common.valueWithDefault(metric.vulnerabilities, "0");
this.suppressed = common.valueWithDefault(metric.suppressed, "0");
Expand Down

0 comments on commit 51310bf

Please sign in to comment.