Skip to content

Commit

Permalink
Fix report title lookup
Browse files Browse the repository at this point in the history
Also added SSG IT page inclusion based on Sector.
  • Loading branch information
randywoods1 committed Jan 2, 2025
1 parent db843e6 commit 79fdf3d
Show file tree
Hide file tree
Showing 20 changed files with 124 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,15 @@ private List<Series> InitializeSeries()
}


// INFORMATION TECHNOLOGY (IT)
var itSectors = new List<int>() { 13, 28 };
if ((itSectors.Contains(demographics?.SectorId ?? -1))
|| itSectors.Contains(ddSector?.IntValue ?? -1))
{
return 20;
}


return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { Title } from '@angular/platform-browser';
import { ConfigService } from '../../../services/config.service';
import { MaturityService } from '../../../services/maturity.service';
import { QuestionsService } from '../../../services/questions.service';
import { TranslocoService } from '@jsverse/transloco';

@Component({
selector: 'app-cmmc2-comments-marked',
Expand All @@ -45,13 +46,18 @@ export class Cmmc2CommentsMarkedComponent implements OnInit {
public configSvc: ConfigService,
private titleService: Title,
private maturitySvc: MaturityService,
public questionsSvc: QuestionsService
public questionsSvc: QuestionsService,
public tSvc: TranslocoService
) { }

ngOnInit() {
this.tSvc.selectTranslate('comments and marked for review', {}, { scope: 'reports' })
.subscribe(title =>
this.titleService.setTitle(title + ' - ' + this.configSvc.behaviors.defaultTitle));

this.loading = true;
this.keyToCategory = this.maturitySvc.keyToCategory;
this.titleService.setTitle("CMMC 2.0 Comments and Marked for Review - " + this.configSvc.behaviors.defaultTitle);


this.maturitySvc.getCmmcReportData().subscribe(
(r: any) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Component, Input } from '@angular/core';
import { AssessmentService } from '../../../services/assessment.service';
import { MaturityService } from '../../../services/maturity.service';
import { TranslocoService } from '@jsverse/transloco';
import { TypescriptDefaultsService } from '@ngstack/code-editor';
import { Title } from '@angular/platform-browser';
import { ConfigService } from '../../../services/config.service';

@Component({
selector: 'app-cmmc2-scorecard-report',
Expand All @@ -18,18 +22,26 @@ export class Cmmc2ScorecardReportComponent {

targetLevel: number;

/**
*
*/
/**
*
*/
constructor(
public assessSvc: AssessmentService,
public maturitySvc: MaturityService
public maturitySvc: MaturityService,
public tSvc: TranslocoService,
public titleService: Title,
public configSvc: ConfigService
) { }

/**
*
*/
ngOnInit(): void {
this.tSvc.selectTranslate('scorecard report', {}, { scope: 'reports' })
.subscribe(title => {
this.titleService.setTitle(title + ' - ' + this.configSvc.behaviors.defaultTitle)
});

this.maturitySvc.getCmmcReportData().subscribe((r: any) => {
const info = r.reportData.information;
this.assessmentDate = info.assessment_Date;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import Chart from 'chart.js/auto';
import { ChartService } from '../../../services/chart.service';
import { MaturityService } from '../../../services/maturity.service';
import { ConfigService } from '../../../services/config.service';
import { TranslocoService } from '@jsverse/transloco';


@Component({
Expand Down Expand Up @@ -62,7 +63,8 @@ export class ExecutiveCMMC2Component implements OnInit, AfterViewInit {
public chartSvc: ChartService,
private maturitySvc: MaturityService,
private titleService: Title,
public configSvc: ConfigService
public configSvc: ConfigService,
public tSvc: TranslocoService
) {

}
Expand All @@ -71,7 +73,10 @@ export class ExecutiveCMMC2Component implements OnInit, AfterViewInit {
*
*/
ngOnInit() {
this.titleService.setTitle("Executive Summary - " + this.configSvc.behaviors.defaultTitle);

this.tSvc.selectTranslate('executive summary', {}, { scope: 'reports' })
.subscribe(title =>
this.titleService.setTitle(title + ' - ' + this.configSvc.behaviors.defaultTitle));

this.targetLevel = 0;
this.reportSvc.getReport('executivematurity').subscribe(
Expand Down
11 changes: 5 additions & 6 deletions CSETWebNg/src/app/reports/commentsmfr/commentsmfr.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import { TranslocoService } from '@jsverse/transloco';
styleUrls: ['../reports.scss', '../acet-reports.scss']
})
export class CommentsMfrComponent implements OnInit {
translationTabTitle: any;
response: any = null;
remarks: string;

Expand Down Expand Up @@ -66,11 +65,11 @@ export class CommentsMfrComponent implements OnInit {
*/
ngOnInit(): void {
this.loading = true;
this.translationTabTitle = this.tSvc.selectTranslate('reports.core.rra.cmfr.report title')
.subscribe(value =>
this.titleService.setTitle(this.tSvc.translate('reports.core.rra.cmfr.report title') + ' - ' + this.configSvc.behaviors.defaultTitle));

this.tSvc.selectTranslate('comments and marked for review', {}, { scope: 'reports' })
.subscribe(title =>
this.titleService.setTitle(title + ' - ' + this.configSvc.behaviors.defaultTitle));


this.maturitySvc.getCommentsMarked().subscribe(
(r: any) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ export class CpgDeficiencyComponent implements OnInit {
ngOnInit(): void {
this.loading = true;

this.titleSvc.setTitle(this.tSvc.translate('reports.core.cpg.deficiency.cpg deficiency') + " - " + this.configSvc.behaviors.defaultTitle);
this.tSvc.selectTranslate('core.cpg.deficiency.cpg deficiency', {}, {scope: 'reports'})
.subscribe(title => {
this.titleSvc.setTitle(title + ' - ' + this.configSvc.behaviors.defaultTitle)
});

// make sure that the assessSvc has the assessment loaded so that we can determine any SSG model applicable
this.assessSvc.getAssessmentDetail().subscribe((assessmentDetail: any) => {
Expand Down
10 changes: 4 additions & 6 deletions CSETWebNg/src/app/reports/cpg/cpg-report/cpg-report.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ import { TranslocoService } from '@jsverse/transloco';
styleUrls: ['./cpg-report.component.scss', '../../reports.scss']
})
export class CpgReportComponent implements OnInit {
translationTabTitle: any;

loading = false;

assessmentName: string;
assessmentDate: string;
assessorName: string;
Expand Down Expand Up @@ -66,9 +64,9 @@ export class CpgReportComponent implements OnInit {
*
*/
ngOnInit(): void {
this.translationTabTitle = this.tSvc.selectTranslate('reports.core.cpg.report.cpg report')
.subscribe(value =>
this.titleSvc.setTitle(this.tSvc.translate('reports.core.cpg.report.cpg report') + ' - ' + this.configSvc.behaviors.defaultTitle));
this.tSvc.selectTranslate('core.cpg.report.cpg report', {}, { scope: 'reports' })
.subscribe(title =>
this.titleSvc.setTitle(title + ' - ' + this.configSvc.behaviors.defaultTitle));

this.assessSvc.getAssessmentDetail().subscribe((assessmentDetail: any) => {
this.assessmentName = assessmentDetail.assessmentName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export class ExecutiveSummaryComponent implements OnInit {
chartStandardsSummary: Chart;
//canvasStandardResultsByCategory: Chart;
responseResultsByCategory: any;
translationSub: any;

// Charts for Components
componentCount = 0;
Expand All @@ -69,17 +68,16 @@ export class ExecutiveSummaryComponent implements OnInit {
public acetSvc: ACETService,
private assessmentSvc: AssessmentService,
public configSvc: ConfigService,
public tSvc: TranslocoService,
private translocoService: TranslocoService
public tSvc: TranslocoService,
) { }

ngOnInit() {

this.titleService.setTitle("Executive Summary - " + this.configSvc.behaviors.defaultTitle);

this.translationSub = this.translocoService.selectTranslate('')
.subscribe(value =>
this.titleService.setTitle(this.tSvc.translate('reports.core.executive summary.report title') + ' - ' + this.configSvc.behaviors.defaultTitle));
this.tSvc.selectTranslate('core.executive summary.report title', {}, { scope: 'reports' })
.subscribe(title =>
this.titleService.setTitle(title + ' - ' + this.configSvc.behaviors.defaultTitle));

this.reportSvc.getReport('executive').subscribe(
(r: any) => {
Expand Down Expand Up @@ -121,9 +119,4 @@ export class ExecutiveSummaryComponent implements OnInit {
usesRAC() {
return !!this.responseResultsByCategory?.dataSets.find(e => e.label === 'RAC');
}

ngOnDestroy() {
this.translationSub.unsubscribe()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export class PhysicalSummaryComponent implements OnInit, AfterViewInit {
) { }

ngOnInit() {
this.translationSub = this.tSvc.selectTranslate('reports.core.physical summary.report title')
.subscribe(value =>
this.titleService.setTitle(this.tSvc.translate('reports.core.physical summary.report title') + ' - ' + this.configSvc.behaviors.defaultTitle));
this.tSvc.selectTranslate('core.physical summary.report title', {}, { scope: 'reports' })
.subscribe(title =>
this.titleService.setTitle(title + ' - ' + this.configSvc.behaviors.defaultTitle));

this.reportSvc.getReport('physicalsummary').subscribe(
(r: any) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ import { TranslocoService } from '@jsverse/transloco';
styleUrls: ['../../reports.scss', '../../acet-reports.scss']
})
export class RraDeficiencyComponent implements OnInit {
translationTabTitle: any;

response: any;

loading: boolean = false;
Expand All @@ -65,9 +63,9 @@ export class RraDeficiencyComponent implements OnInit {
ngOnInit() {
this.loading = true;

this.translationTabTitle = this.tSvc.selectTranslate('reports.core.rra.rra deficiency report')
.subscribe(value =>
this.titleService.setTitle(this.tSvc.translate('reports.core.rra.rra deficiency report') + ' - ' + this.configSvc.behaviors.defaultTitle));
this.tSvc.selectTranslate('core.rra.rra deficiency report', {}, {scope: 'reports'})
.subscribe(title =>
this.titleService.setTitle(title + ' - ' + this.configSvc.behaviors.defaultTitle));


this.maturitySvc.getMaturityDeficiency("RRA").subscribe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import { TranslocoService } from '@jsverse/transloco';
})
export class RraReportComponent implements OnInit {
response: any;
translationTabTitle: any;

overallScoreDisplay: string;
standardBasedScore: number;
Expand Down Expand Up @@ -131,9 +130,9 @@ export class RraReportComponent implements OnInit {
error => console.log('Main RRA report load Error: ' + (<Error>error).message)
);

this.translationTabTitle = this.tSvc.selectTranslate('reports.core.rra.tab title')
.subscribe(value =>
this.titleService.setTitle(this.tSvc.translate('reports.core.rra.tab title') + ' - ' + this.configSvc.behaviors.defaultTitle));
this.tSvc.selectTranslate('core.rra.tab title', {}, { scope: 'reports' })
.subscribe(title =>
this.titleService.setTitle(title + ' - ' + this.configSvc.behaviors.defaultTitle));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import { Title } from '@angular/platform-browser';
})

export class SdOwnerCommentsMfrComponent {
translationTabTitle: any;
response: any = null;
remarks: string;
loading: boolean = false;
Expand All @@ -59,9 +58,9 @@ export class SdOwnerCommentsMfrComponent {
ngOnInit(): void {
this.loading = true;

this.translationTabTitle = this.tSvc.selectTranslate('reports.core.rra.cmfr.report title')
.subscribe(value =>
this.titleService.setTitle(this.tSvc.translate('reports.core.rra.cmfr.report title') + ' - ' + this.configSvc.behaviors.defaultTitle));
this.tSvc.selectTranslate('core.rra.cmfr.report title', {}, {scope: 'reports'})
.subscribe(title =>
this.titleService.setTitle(title + ' - ' + this.configSvc.behaviors.defaultTitle));


this.maturitySvc.getCommentsMarked().subscribe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,16 @@ export class SecurityplanComponent implements OnInit {
private assessmentSvc: AssessmentService,
private sanitizer: DomSanitizer,
public tSvc: TranslocoService,
private translocoService: TranslocoService
) { }

/**
*
*/
ngOnInit() {

this.translationSub = this.translocoService.selectTranslate('reports.core.security plan.report title')
.subscribe(value =>
this.titleService.setTitle(this.tSvc.translate('reports.core.security plan.report title') + ' - ' + this.configSvc.behaviors.defaultTitle));
this.tSvc.selectTranslate('core.security plan.report title', {}, { scope: 'reports' })
.subscribe(title => {
this.titleService.setTitle(title + ' - ' + this.configSvc.behaviors.defaultTitle)
});

this.reportSvc.getReport('securityplan').subscribe(
(r: any) => {
Expand Down
11 changes: 3 additions & 8 deletions CSETWebNg/src/app/reports/site-detail/site-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import { TranslocoService } from '@jsverse/transloco';
styleUrls: ['../reports.scss']
})
export class SiteDetailComponent implements OnInit {
translationSub: any;
response: any = null;
chartStandardsSummary: Chart;
responseResultsByCategory: any;
Expand Down Expand Up @@ -81,9 +80,9 @@ export class SiteDetailComponent implements OnInit {
) { }

ngOnInit() {
this.translationSub = this.tSvc.selectTranslate('reports.core.site detail report.report title')
.subscribe(value =>
this.titleService.setTitle(this.tSvc.translate('reports.core.site detail report.report title') + ' - ' + this.configSvc.behaviors.defaultTitle));
this.tSvc.selectTranslate('core.site detail report.report title', {}, {scope: 'reports'})
.subscribe(title =>
this.titleService.setTitle(title + ' - ' + this.configSvc.behaviors.defaultTitle));

this.reportSvc.getReport('detail').subscribe(
(r: any) => {
Expand Down Expand Up @@ -223,8 +222,4 @@ export class SiteDetailComponent implements OnInit {
usesRAC() {
return !!this.responseResultsByCategory?.dataSets.find(e => e.label === 'RAC');
}

ngOnDestroy() {
this.translationSub.unsubscribe()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ export class SiteSummaryComponent implements OnInit, AfterViewInit {
) { }

ngOnInit() {
this.translationSub = this.tSvc.selectTranslate('reports.core.site summary.report title')
.subscribe(value =>
this.titleService.setTitle(this.tSvc.translate('reports.core.site summary.report title') + ' - ' + this.configSvc.behaviors.defaultTitle));
this.tSvc.selectTranslate('core.site summary.report title', {}, {scope: 'reports'})
.subscribe(title =>
this.titleService.setTitle(title + ' - ' + this.configSvc.behaviors.defaultTitle));

this.isCmmc = this.maturitySvc.maturityModelIsCMMC();
this.reportSvc.getReport('sitesummary').subscribe(
Expand Down
9 changes: 9 additions & 0 deletions CSETWebNg/src/app/services/ssg.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export class SsgService {
return 'chemical';
}

if ([13, 28].includes(s)) {
return 'it';
}

return 'other';
}

Expand All @@ -71,6 +75,11 @@ export class SsgService {
if ([1, 19].includes(s)) {
return 18; // chemical
}


if ([13, 28].includes(s)) {
return 20; // I.T.
}
return null;
}

Expand Down
1 change: 1 addition & 0 deletions CSETWebNg/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@
"answer buttons": "Answer Buttons",
"ssg": {
"chemical": "Chemical Sector Goals",
"it": "Information Technology Goals",
"other": "Other Sector Goals"
}
},
Expand Down
Loading

0 comments on commit 79fdf3d

Please sign in to comment.