Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add i18n for module name on maturity questions screen #4210

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export class AssessmentDemographicsComponent implements OnInit {
}

showCriticalService() {
const moduleBehavior = this.configSvc.config.moduleBehaviors.find(m => m.moduleName == this.assessSvc.assessment?.maturityModel?.modelName);
const moduleBehavior = this.configSvc.getModuleBehavior(this.assessSvc.assessment?.maturityModel?.modelName);
return (this.configSvc.behaviors.showCriticalService ?? true)
&& (moduleBehavior?.showCriticalServiceDemog ?? true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ <h5 for="DomainRemarks">Remarks - {{grouping.title}}</h5>

</ng-container>

<div *ngIf="isDomain() && grouping.visible" class="mb-5"></div>
<div *ngIf="isDomain() && isDomainVisible() && grouping.visible" class="mb-5"></div>
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { MaturityFilteringService } from '../../../services/filtering/maturity-f
import { MaturityService } from '../../../services/maturity.service';
import { NCUAService } from '../../../services/ncua.service';
import { QuestionsService } from '../../../services/questions.service';
import { ModuleBehavior } from '../../../models/module-config.model';


@Component({
Expand All @@ -40,6 +41,7 @@ export class GroupingBlockComponent implements OnInit {
@Input('grouping') grouping: QuestionGrouping;

modelId: number;
moduleBehavior: ModuleBehavior;

/**
*
Expand All @@ -59,6 +61,7 @@ export class GroupingBlockComponent implements OnInit {
*/
ngOnInit(): void {
this.modelId = this.maturityFilteringService.assesmentSvc.assessment.maturityModel.modelId;
this.moduleBehavior = this.configSvc.getModuleBehavior(this.modelId);
}

/**
Expand All @@ -83,28 +86,21 @@ export class GroupingBlockComponent implements OnInit {
}

/**
* Indicates if the domain label should be shown
* Indicates if the domain label headers should be shown.
* Invisible domains stay invisible.
* If the moduleBehavior.showDomainHeaders is not defined, it defaults to true.
*/
isDomainVisible(): boolean {
if (!this.isDomain()) {
return false;
}

// ACET domains are always visible
if (this.maturityFilteringService.assesmentSvc.assessment.maturityModel.modelName == 'ACET') {
return true;
}

if (this.maturityFilteringService.assesmentSvc.assessment.maturityModel.modelName == 'ISE') {
return false;
}

// hide invisible domains
if (!this.grouping.visible) {
return false;
}

return true;
return this.moduleBehavior.showDomainHeaders ?? true;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ <h3>{{ groupingTitle }}</h3>
<app-grouping-block [grouping]="g"></app-grouping-block>
</div>
</ng-template>

</div>

<app-nav-back-next *ngIf="isNcuaModel()" [page]="'maturity-questions-ncua'"></app-nav-back-next>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { TranslocoService } from '@jsverse/transloco';
import { DemographicService } from '../../../services/demographic.service';
import { DemographicIodService } from '../../../services/demographic-iod.service';
import { SsgService } from '../../../services/ssg.service';
import { ModuleBehavior } from '../../../models/module-config.model';

@Component({
selector: 'app-maturity-questions',
Expand All @@ -51,6 +52,7 @@ export class MaturityQuestionsComponent implements OnInit, AfterViewInit {

groupings: QuestionGrouping[] = [];
pageTitle: string = '';
moduleBehavior: ModuleBehavior;
modelId: number;
modelName: string = '';
groupingTitle: string = '';
Expand Down Expand Up @@ -185,21 +187,21 @@ export class MaturityQuestionsComponent implements OnInit, AfterViewInit {
obsGetQ.subscribe(
(response: MaturityQuestionResponse) => {
this.modelId = response.modelId;

this.moduleBehavior = this.configSvc.getModuleBehavior(this.modelId);


this.modelName = response.modelName;
this.questionsAlias = response.questionsAlias;
this.groupings = response.groupings;
this.assessSvc.assessment.maturityModel.maturityTargetLevel = response.maturityTargetLevel;

this.assessSvc.assessment.maturityModel.answerOptions = response.answerOptions;
this.filterSvc.answerOptions = response.answerOptions;
this.filterSvc.maturityModelId = response.modelId;
this.filterSvc.maturityModelName = response.modelName;

if (this.groupingId?.toLowerCase() == 'bonus') {
this.pageTitle = this.tSvc.translate(`titles.ssg.${this.ssgSvc.ssgSimpleSectorLabel()}`);
} else {
this.pageTitle = this.tSvc.translate('titles.' + this.questionsAlias.toLowerCase().trim()) + ' - ' + this.modelName;
}
this.displayTitle();


this.glossarySvc.glossaryEntries = response.glossary;
Expand Down Expand Up @@ -249,7 +251,7 @@ export class MaturityQuestionsComponent implements OnInit, AfterViewInit {
this.filterSvc.maturityModelId = response.modelId;

this.pageTitle = this.questionsAlias + ' - ' + this.modelName;
this.groupingTitle = response.title;

this.glossarySvc.glossaryEntries = response.glossary;

this.loaded = true;
Expand All @@ -268,6 +270,25 @@ export class MaturityQuestionsComponent implements OnInit, AfterViewInit {
});
}

/**
*
*/
displayTitle() {
// Bonus questions are for SSGs.
if (this.groupingId?.toLowerCase() == 'bonus') {
this.pageTitle = this.tSvc.translate(`titles.ssg.${this.ssgSvc.ssgSimpleSectorLabel()}`);
return;
}

let displayName = this.modelName;

if (this.moduleBehavior.displayNameKey != null) {
displayName = this.tSvc.translate(this.moduleBehavior.displayNameKey);
}

this.pageTitle = this.tSvc.translate('titles.' + this.questionsAlias.toLowerCase().trim()) + ' - ' + displayName;
}

/**
* Controls the mass expansion/collapse of all subcategories on the screen.
* @param mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class QuestionBlockMaturityComponent implements OnInit {
* hidden. Use config moduleBehavior to define this.
*/
showLevelIndicator(q): boolean {
const behavior = this.configSvc.config.moduleBehaviors.find(m => m.moduleName == this.assessSvc.assessment.maturityModel.modelName)
const behavior = this.configSvc.getModuleBehavior(this.assessSvc.assessment.maturityModel.modelName);
if (!!behavior) {
return behavior.showMaturityLevelBadge ?? true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
</div>


<div *ngIf="!seperateGuidanceFromApproach()">
<div *ngIf="!separateGuidanceFromApproach()">
<hr
*ngIf="!!tab?.requirementsData?.supplementalInfo && !!tab?.requirementsData?.examinationApproach">
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ export class QuestionExtrasComponent implements OnInit {
return result;
}

const behavior = this.configSvc.config.moduleBehaviors.find(m => m.moduleName == this.assessSvc.assessment.maturityModel?.modelName)
const behavior = this.configSvc.getModuleBehavior(this.assessSvc.assessment.maturityModel?.modelName);

if (mode == 'DETAIL') {
return behavior?.questionIcons?.showDetails ?? true;
Expand Down Expand Up @@ -748,7 +748,7 @@ export class QuestionExtrasComponent implements OnInit {
* @returns
*/
whichSupplementalIcon() {
const behavior = this.configSvc.config.moduleBehaviors.find(m => m.moduleName == this.assessSvc.assessment.maturityModel?.modelName);
const behavior = this.configSvc.getModuleBehavior(this.assessSvc.assessment.maturityModel?.modelName);
if (!!behavior && behavior.questionIcons?.guidanceIcon?.toLowerCase() == 'g') {
return "G";
} else {
Expand Down Expand Up @@ -812,8 +812,8 @@ export class QuestionExtrasComponent implements OnInit {
* independent from Examination Approach or not
* @returns
*/
seperateGuidanceFromApproach() {
const behavior = this.configSvc.config.moduleBehaviors.find(m => m.moduleName == this.assessSvc.assessment.maturityModel?.modelName);
separateGuidanceFromApproach() {
const behavior = this.configSvc.getModuleBehavior(this.assessSvc.assessment.maturityModel?.modelName);
return behavior?.independentSuppGuidance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class CpgSummaryComponent implements OnInit {
*/
ngOnInit(): void {
this.cpgSvc.getAnswerDistrib().subscribe((resp: any) => {
const cpgAnswerOptions = this.configSvc.config.moduleBehaviors.find(b => b.moduleName == 'CPG').answerOptions;
const cpgAnswerOptions = this.configSvc.getModuleBehavior('CPG').answerOptions;

resp.forEach(r => {
r.series.forEach(element => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2311,7 +2311,7 @@ ul.related-questions li {

.domain-group-heading {
margin-bottom: 1rem;
font-size: 2rem;
font-size: 1.8rem;
}

.capability-group-heading {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2337,7 +2337,7 @@ ul.related-questions li {

.domain-group-heading {
margin-bottom: 1rem;
font-size: 2rem;
font-size: 1.8rem;
}

.capability-group-heading {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2344,7 +2344,7 @@ ul.related-questions li {

.domain-group-heading {
margin-bottom: 1rem;
font-size: 2rem;
font-size: 1.8rem;
}

.capability-group-heading {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2340,7 +2340,7 @@ ul.related-questions li {

.domain-group-heading {
margin-bottom: 1rem;
font-size: 2rem;
font-size: 1.8rem;
}

.capability-group-heading {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2345,7 +2345,7 @@ ul.related-questions li {

.domain-group-heading {
margin-bottom: 1rem;
font-size: 2rem;
font-size: 1.8rem;
}

.capability-group-heading {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2340,7 +2340,7 @@ ul.related-questions li {

.domain-group-heading {
margin-bottom: 1rem;
font-size: 2rem;
font-size: 1.8rem;
}

.capability-group-heading {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2095,7 +2095,7 @@ ul.related-questions li {

.domain-group-heading {
margin-bottom: 1rem;
font-size: 2rem;
font-size: 1.8rem;
}

.capability-group-heading {
Expand Down
2 changes: 1 addition & 1 deletion CSETWebNg/src/app/layout/styles-base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2097,7 +2097,7 @@ ul.related-questions li {

.domain-group-heading {
margin-bottom: 1rem;
font-size: 2rem;
font-size: 1.8rem;
}

.capability-group-heading {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2292,7 +2292,7 @@ ul.related-questions li {

.domain-group-heading {
margin-bottom: 1rem;
font-size: 2rem;
font-size: 1.8rem;
}

.capability-group-heading {
Expand Down
Loading
Loading