From 0b9e18a1daf6fb6e4fc106f25af87ad12a2b1025 Mon Sep 17 00:00:00 2001 From: stephenhughes89 Date: Wed, 8 May 2019 13:06:24 -0400 Subject: [PATCH] Adds missing violation type --- .../strategies/open-source-violations-graph-strategy.ts | 2 +- .../strategies/open-source-violations-preview-strategy.ts | 6 +++++- .../open-source-violations-primary-metric-strategy.ts | 2 +- .../open-source-violations-segmentation-strategy.ts | 7 ++++--- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/exec-ui/src/app/modules/metrics/modules/metrics/open-source-violations/strategies/open-source-violations-graph-strategy.ts b/exec-ui/src/app/modules/metrics/modules/metrics/open-source-violations/strategies/open-source-violations-graph-strategy.ts index ca85530..b767778 100644 --- a/exec-ui/src/app/modules/metrics/modules/metrics/open-source-violations/strategies/open-source-violations-graph-strategy.ts +++ b/exec-ui/src/app/modules/metrics/modules/metrics/open-source-violations/strategies/open-source-violations-graph-strategy.ts @@ -26,7 +26,7 @@ export class OpenSourceViolationsGraphStrategy extends GraphStrategyBase { } protected count(seriesElement: MetricTimeSeriesElement): number { - const validSet = new Set(['High', 'Medium', 'Low']); + const validSet = new Set(['Critical', 'High', 'Medium', 'Low']); return seriesElement.counts .reduce((sum, item) => validSet.has(item.label['severity']) ? sum + item.value : sum, 0); } diff --git a/exec-ui/src/app/modules/metrics/modules/metrics/open-source-violations/strategies/open-source-violations-preview-strategy.ts b/exec-ui/src/app/modules/metrics/modules/metrics/open-source-violations/strategies/open-source-violations-preview-strategy.ts index ee0a51e..107d9f0 100644 --- a/exec-ui/src/app/modules/metrics/modules/metrics/open-source-violations/strategies/open-source-violations-preview-strategy.ts +++ b/exec-ui/src/app/modules/metrics/modules/metrics/open-source-violations/strategies/open-source-violations-preview-strategy.ts @@ -41,7 +41,11 @@ export class OpenSourceViolationsPreviewStrategy extends PreviewStrategyBase { return runningSums.set(count.label['severity'], newCount); }, new Map()); - if (sums.get('High')) { + if (sums.get('Critical')) { + return [{name: 'Critical', value: sums.get('Critical').toLocaleString()}]; + } + + if (sums.get('High')) { return [{name: 'High', value: sums.get('High').toLocaleString()}]; } diff --git a/exec-ui/src/app/modules/metrics/modules/metrics/open-source-violations/strategies/open-source-violations-primary-metric-strategy.ts b/exec-ui/src/app/modules/metrics/modules/metrics/open-source-violations/strategies/open-source-violations-primary-metric-strategy.ts index 523beee..309d37c 100644 --- a/exec-ui/src/app/modules/metrics/modules/metrics/open-source-violations/strategies/open-source-violations-primary-metric-strategy.ts +++ b/exec-ui/src/app/modules/metrics/modules/metrics/open-source-violations/strategies/open-source-violations-primary-metric-strategy.ts @@ -7,7 +7,7 @@ import {OpenSourceViolationsConfiguration} from '../open-source-violations.confi @Injectable() export class OpenSourceViolationsPrimaryMetricStrategy extends PrimaryMetricStrategyBase { parse(counts: Count[]): MetricValueModel { - const validSet = new Set(['High', 'Medium', 'Low']); + const validSet = new Set(['Critical', 'High', 'Medium', 'Low']); return { name: OpenSourceViolationsConfiguration.buildingBlockLabel, diff --git a/exec-ui/src/app/modules/metrics/modules/metrics/open-source-violations/strategies/open-source-violations-segmentation-strategy.ts b/exec-ui/src/app/modules/metrics/modules/metrics/open-source-violations/strategies/open-source-violations-segmentation-strategy.ts index 27fd195..58cb5c4 100644 --- a/exec-ui/src/app/modules/metrics/modules/metrics/open-source-violations/strategies/open-source-violations-segmentation-strategy.ts +++ b/exec-ui/src/app/modules/metrics/modules/metrics/open-source-violations/strategies/open-source-violations-segmentation-strategy.ts @@ -12,9 +12,10 @@ export class OpenSourceViolationsSegmentationStrategy implements Strategy