Skip to content

Commit

Permalink
Merge pull request #4284 from cisagov/cmmc-fix
Browse files Browse the repository at this point in the history
More CMMC cleanup, i18n
  • Loading branch information
jekuipers authored Dec 5, 2024
2 parents 04bea07 + 4fdf9df commit a30ab02
Show file tree
Hide file tree
Showing 29 changed files with 119 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class CmmcBusiness

private readonly int _level1Max = 15;
private readonly int _level2Max = 110;
private readonly int _level3Max = 24;


/// <summary>
Expand Down Expand Up @@ -72,18 +73,21 @@ public CmmcScores GetCmmcScores(int assessmentId)

// Level 1
response.Level1Score = GetScoreForLevel(assessmentId, 1);
response.Level1MaxScore = _level1Max;



// Level 2
var sprs = GetSPRSScore(assessmentId);
response.Level2Score = sprs.LevelScore;
response.Level2MaxScore = _level2Max;
response.Level2Active = (response.Level1Score == _level1Max);



// Level 3
response.Level3Score = GetScoreForLevel(assessmentId, 3);
response.Level3MaxScore = _level3Max;
response.Level3Active = (response.Level2Score == _level2Max);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ namespace CSETWebCore.Model.Maturity
public class CmmcScores
{
public int Level1Score { get; set; }
public int Level1MaxScore { get; set; }



public int Level2Score { get; set; }
public int Level2MaxScore { get; set; }

/// <summary>
/// Level 3 is only active if Level 1 is 100% compliant
Expand All @@ -22,6 +24,7 @@ public class CmmcScores


public int Level3Score { get; set; }
public int Level3MaxScore { get; set; }

/// <summary>
/// Level 3 is only active if Level 2 is 100% compliant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-------------------------->
<div class="white-panel oy-auto h-0 d-flex flex-column flex-11a">
<h3>Performance by Domain</h3>
<div class="white-panel oy-auto h-0 d-flex flex-column flex-11a" *transloco="let t">
<h3>{{t('titles.performance by domain')}}</h3>

<div>
<p>
The following chart shows the percentage of practices met for each
domain at target level {{targetLevel}}.
{{ t('cmmc.scoring.perf by domain desc', {targetLevel: targetLevel}) }}
</p>

<div *ngIf="loading">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
////////////////////////////////
import { AfterContentInit, Component, OnInit } from '@angular/core';
import { NavigationService } from '../../../../services/navigation/navigation.service';
import { Title } from '@angular/platform-browser';
import { MaturityService } from '../../../../services/maturity.service';
import { CmmcStyleService } from '../../../../services/cmmc-style.service';
import { ChartService } from '../../../../services/chart.service';
Expand All @@ -48,7 +47,6 @@ export class Cmmc2DomainResultsComponent implements OnInit, AfterContentInit {
constructor(
public navSvc: NavigationService,
public maturitySvc: MaturityService,
private titleService: Title,
public cmmcStyleSvc: CmmcStyleService,
public chartSvc: ChartService
) { }
Expand All @@ -63,7 +61,6 @@ export class Cmmc2DomainResultsComponent implements OnInit, AfterContentInit {
this.targetLevel = r.toString();
}
});

}

ngAfterContentInit(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-------------------------->
<div class="white-panel oy-auto h-0 d-flex flex-column flex-11a">
<h3>Performance by Level</h3>
<div class="white-panel oy-auto h-0 d-flex flex-column flex-11a" *transloco="let t">
<h3>{{t('titles.performance by level')}}</h3>

<div *ngIf="loading">
<div class="spinner-container" style="margin-left: auto; margin-right: auto;">
Expand All @@ -31,7 +31,7 @@ <h3>Performance by Level</h3>

<div>
<p>
This page shows the answer distribution by level.
{{t('cmmc.scoring.perf by level desc')}}
</p>
<div class="d-flex mb-4" [class.flex-row]="!layoutSvc.hp" [class.flex-column]="layoutSvc.hp"
*ngFor="let l of response">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export class Cmmc2LevelResultsComponent implements OnInit, AfterContentInit {
refreshChart() {
this.maturitySvc.getComplianceByLevel().subscribe((r: any) => {
this.response = r;
//this.response.reverse();

r.forEach(level => {
let g = level.answerDistribution.find(a => a.value == 'Y');
Expand All @@ -93,7 +92,7 @@ export class Cmmc2LevelResultsComponent implements OnInit, AfterContentInit {
});

setTimeout(() => {
level.chart = this.chartSvc.buildDoughnutChart('level' + level.levelValue, x);
level.chart = this.chartSvc.buildDoughnutChart('level' + level.levelValue, x, 'CMMC2F');
}, 10);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@
<div class="mb-5" *transloco="let t">
<h5>{{t('level.level 1')}}</h5>

<svg viewBox="0 0 800 130" [attr.width]="width" height="130" xmlns="http://www.w3.org/2000/svg"
<svg viewBox="0 0 800 120" [attr.width]="width" height="120" xmlns="http://www.w3.org/2000/svg"
style="background: #f0f0f0;" [class.disabled-svg]="!active">

<!-- Define scale values -->
<g class="grid" transform="translate(30, 40)">
<g class="grid" transform="translate(30, 30)">
<line x1="0" [attr.x2]="n(maxScore)" y1="60" y2="60" stroke="#aaa" />
<text [attr.x]="n(0)" y="80" font-size="10" text-anchor="middle">0</text>
<text [attr.x]="n(maxScore)" y="80" font-size="10" text-anchor="middle">{{maxScore}}</text>
</g>

<!-- Draw bar -->
<g class="bars" transform="translate(30, 30)">
<g class="bars" transform="translate(30, 20)">
<rect x="0" y="50" [attr.width]="n(score)" height="20" fill="#921285" [matTooltip]="score"></rect>
</g>

<!-- Axis line for current score -->
<g transform="translate(30, 0)">
<g transform="translate(30, -10)">
<line [attr.x1]="n(score)" [attr.x2]="n(score)" y1="55" y2="100" stroke="#aaa"></line>
<text [attr.x]="n(score)" y="50" font-size="10" text-anchor="middle">Score: {{score}}</text>
</g>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ export class Cmmc2Level1ScoreComponent {

width = 700;

maxScore: number = 15;


@Input()
score: number;

@Input()
maxScore: number;

@Input()
active = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
<h5>{{t('level.level 2')}}</h5>

<p *ngIf="!active">
{{t('cmmc.scoring.level2 inactive description')}}
{{t('cmmc.scoring.inactive description')}}
</p>

<svg viewBox="0 0 800 130" [attr.width]="width" height="130" xmlns="http://www.w3.org/2000/svg"
<svg viewBox="0 0 800 120" [attr.width]="width" height="120" xmlns="http://www.w3.org/2000/svg"
style="background: #f0f0f0;" [class.disabled-svg]="!active">
<!-- Define gradient -->
<defs>
Expand All @@ -39,7 +39,7 @@ <h5>{{t('level.level 2')}}</h5>
</defs>

<!-- Define scale values -->
<g class="grid" transform="translate(30, 40)">
<g class="grid" transform="translate(30, 30)">
<text [attr.x]="n(-203)" y="70" font-size="10" text-anchor="middle">-203</text>
<text [attr.x]="n(-100)" y="70" font-size="10" text-anchor="middle">-100</text>
<text [attr.x]="n(0)" y="70" font-size="10" text-anchor="middle">0</text>
Expand All @@ -48,15 +48,15 @@ <h5>{{t('level.level 2')}}</h5>
</g>

<!-- Draw bar -->
<g class="bars" transform="translate(30, 30)">
<g class="bars" transform="translate(30, 20)">
<rect x="0" y="40" [attr.width]="width" height="20" fill="url(#barGradient)" [matTooltip]="'SPRS: ' + score" *ngIf="active">
</rect>
<rect x="0" y="40" [attr.width]="width" height="20" fill="white" stroke="#aaa" [matTooltip]="'SPRS: ' + score" *ngIf="!active">
</rect>
</g>

<!-- Axis line for current score -->
<g transform="translate(30, 0)">
<g transform="translate(30, -10)">
<line [attr.x1]="n(score)" [attr.x2]="n(score)" y1="45" y2="90" stroke="#aaa"></line>
<text [attr.x]="n(score)" y="40" font-size="10" text-anchor="middle">Score: {{score}}</text>
</g>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,27 @@
<h5>{{t('level.level 3')}}</h5>

<p *ngIf="!active">
{{t('cmmc.scoring.level2 inactive description')}}
{{t('cmmc.scoring.inactive description')}}
</p>

<svg viewBox="0 0 800 130" [attr.width]="width" height="130" xmlns="http://www.w3.org/2000/svg"
<svg viewBox="0 0 800 120" [attr.width]="width" height="120" xmlns="http://www.w3.org/2000/svg"
style="background: #f0f0f0;" [class.disabled-svg]="!active">

<!-- Define scale values -->
<g class="grid" transform="translate(30, 40)">
<g class="grid" transform="translate(30, 30)">
<line x1="0" [attr.x2]="n(maxScore)" y1="60" y2="60" stroke="#aaa" />
<text [attr.x]="n(0)" y="80" font-size="10" text-anchor="middle">0</text>
<text [attr.x]="n(maxScore)" y="80" font-size="10" text-anchor="middle">{{maxScore}}</text>
</g>

<!-- Draw bar -->
<g class="bars" transform="translate(30, 30)">
<g class="bars" transform="translate(30, 20)">
<rect x="0" y="50" [attr.width]="n(score)" height="20" fill="#034b61" [matTooltip]="score" *ngIf="active"></rect>
<rect x="0" y="50" [attr.width]="n(score)" height="20" fill="white" stroke="#aaa" [matTooltip]="score" *ngIf="!active"></rect>
</g>

<!-- Axis line for current score -->
<g transform="translate(30, 0)">
<g transform="translate(30, -10)">
<line [attr.x1]="n(score)" [attr.x2]="n(score)" y1="55" y2="100" stroke="#aaa"></line>
<text [attr.x]="n(score)" y="50" font-size="10" text-anchor="middle">Score: {{score}}</text>
</g>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ import { Component, Input } from '@angular/core';
export class Cmmc2Level3ScoreComponent {

width = 700;

maxScore: number = 35;


@Input()
score: number;

@Input()
maxScore: number;

@Input()
active = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-------------------------->
<div class="white-panel oy-auto h-0 d-flex flex-column flex-11a">
<h3>Performance by Level</h3>
<div class="white-panel oy-auto h-0 d-flex flex-column flex-11a" *transloco="let t">
<h3>{{t('titles.performance by level')}}</h3>

<div *ngIf="loading">
<div class="spinner-container" style="margin-left: auto; margin-right: auto;">
Expand All @@ -31,7 +31,7 @@ <h3>Performance by Level</h3>

<div>
<p>
This page shows the answer distribution by level.
{{t('cmmc.scoring.perf by level desc')}}
</p>
<div class="d-flex flex-row" *ngFor="let l of response">
<!-- pie charts for compliance at each level -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,26 @@ <h3>{{t('titles.cmmc scoring')}}</h3>
</div>

<p>
{{t('cmmc.scoring.score charts description')}}
{{t('cmmc.scoring.score charts description 1')}}
</p>
<p>
{{t('cmmc.scoring.score charts description 2')}}
</p>
<p>
{{t('cmmc.scoring.score charts description 3')}}
</p>

<div *ngIf="!loading">

<app-cmmc2-level1-score [score]="scores?.level1Score"></app-cmmc2-level1-score>
<app-cmmc2-level1-score [score]="scores?.level1Score"
[maxScore]="scores?.level1MaxScore"></app-cmmc2-level1-score>

<app-cmmc2-level2-score [score]="scores?.level2Score" [active]="scores?.level2Active"
*ngIf="assessSvc.assessment.maturityModel.maturityTargetLevel >= 2">
<app-cmmc2-level2-score [score]="scores?.level2Score" [maxScore]="scores?.level2MaxScore"
[active]="scores?.level2Active" *ngIf="assessSvc.assessment.maturityModel.maturityTargetLevel >= 2">
</app-cmmc2-level2-score>

<app-cmmc2-level3-score [score]="scores?.level3Score" [active]="scores?.level3Active"
*ngIf="assessSvc.assessment.maturityModel.maturityTargetLevel >= 3">
<app-cmmc2-level3-score [score]="scores?.level3Score" [maxScore]="scores?.level3MaxScore"
[active]="scores?.level3Active" *ngIf="assessSvc.assessment.maturityModel.maturityTargetLevel >= 3">
</app-cmmc2-level3-score>

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-------------------------->
<table class="table table-td-p2" [class.fs-smaller]="layoutSvc.hp" *transloco="let t">
<table class="table table-td-p2 table-td-small" [class.fs-smaller]="layoutSvc.hp" *transloco="let t">
<tr>
<th>{{t('cmmc.scoring.practice')}}</th>
<th></th>
<th>
{{ layoutSvc.hp ? t('cmmc.scoring.response-abbr') : t('cmmc.scoring.response-long') }}
{{ layoutSvc.hp ? t('cmmc.scoring.answer-abbr') : t('cmmc.scoring.answer-long') }}
</th>
<th>
{{ layoutSvc.hp ? t('cmmc.scoring.deduct-abbr') : t('cmmc.scoring.deduct-long') }}
Expand All @@ -34,7 +34,7 @@

<ng-template ngFor let-d [ngForOf]="response?.domains">
<tr>
<td colspan="4" class="h5">
<td colspan="4" class="h5" style="font-size: .9em;">
<div style="border-top: 1px solid #555; border-bottom: 1px solid #555;">
{{d.domainName}}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,10 @@ table.assessment-summary th {
padding: .5rem !important;
}

.table.table-td-small th, .table.table-td-small td {
font-size: .875em;
}

// force transparent
.table>:not(caption)>*>* {
background-color: transparent !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,10 @@ table.assessment-summary th {
padding: .5rem !important;
}

.table.table-td-small th, .table.table-td-small td {
font-size: .875em;
}

// force transparent
.table>:not(caption)>*>* {
background-color: transparent !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,10 @@ table.assessment-summary th {
padding: .5rem !important;
}

.table.table-td-small th, .table.table-td-small td {
font-size: .875em;
}

// force transparent
.table>:not(caption)>*>* {
background-color: transparent !important;
Expand Down
4 changes: 4 additions & 0 deletions CSETWebNg/src/app/layout/iod-layout/iod-layout.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,10 @@ table.assessment-summary th {
padding: .5rem !important;
}

.table.table-td-small th, .table.table-td-small td {
font-size: .875em;
}

// force transparent
.table>:not(caption)>*>* {
background-color: transparent !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,10 @@ table.assessment-summary th {
padding: .5rem !important;
}

.table.table-td-small th, .table.table-td-small td {
font-size: .875em;
}

// force transparent
.table>:not(caption)>*>* {
background-color: transparent !important;
Expand Down
Loading

0 comments on commit a30ab02

Please sign in to comment.