Skip to content

Commit b9da55b

Browse files
committed
chore: change formatting
1 parent 4cce6d6 commit b9da55b

2 files changed

Lines changed: 112 additions & 105 deletions

File tree

src/app/component/mapping/mapping.component.ts

Lines changed: 106 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -385,116 +385,118 @@ export class MappingComponent implements OnInit {
385385
//console.log(this.temp)
386386
}
387387

388-
//Sets dataSource value sorted by ISO 27001:2022
389-
setValueandAppendToDatasetandSortbyISO22(
390-
dim: string,
391-
subDim: string,
392-
task: string
393-
) {
394-
var ISOArray: string[] =
395-
this.YamlObject[dim][subDim][task]['references']['iso27001-2017'];
396-
var ISO22Array: string[] =
397-
this.YamlObject[dim][subDim][task]['references']['iso27001-2022'];
398-
var SAMMArray: string[] =
399-
this.YamlObject[dim][subDim][task]['references']['samm2'];
400-
var CurrentDescription: string =
401-
this.YamlObject[dim][subDim][task]['description'];
402-
var CurrentRisk: string = this.YamlObject[dim][subDim][task]['risk'];
403-
var CurrentMeasure: string = this.YamlObject[dim][subDim][task]['measure'];
404-
var CurrentKnowledge: string =
405-
this.knowledgeLabels[
406-
this.YamlObject[dim][subDim][task]['difficultyOfImplementation'][
407-
'knowledge'
408-
]
409-
];
410-
var CurrentTime: string =
411-
this.generalLabels[
412-
this.YamlObject[dim][subDim][task]['difficultyOfImplementation']['time']
413-
];
414-
var CurrentResources: string =
415-
this.generalLabels[
416-
this.YamlObject[dim][subDim][task]['difficultyOfImplementation'][
417-
'resources'
418-
]
419-
];
420-
var CurrentUsefulness: string =
421-
this.generalLabels[this.YamlObject[dim][subDim][task]['usefulness']];
422-
423-
var CurrentEvidence: string =
424-
this.YamlObject[dim][subDim][task]['evidence'];
425-
426-
var CurrentComments: string =
427-
this.YamlObject[dim][subDim][task]['comments'];
428-
429-
var CurrentAssessment: string =
430-
this.YamlObject[dim][subDim][task]['assessment'];
431-
432-
var CurrentDependsOn: string[] =
433-
this.YamlObject[dim][subDim][task]['dependsOn'];
434-
try {
435-
var CurrentImplementation: any = JSON.stringify(
436-
this.YamlObject[dim][subDim][task]['implementation']
437-
);
438-
if (CurrentImplementation.length == 2) {
439-
CurrentImplementation = '';
440-
}
441-
} catch {
388+
//Sets dataSource value sorted by ISO 27001:2022
389+
setValueandAppendToDatasetandSortbyISO22(
390+
dim: string,
391+
subDim: string,
392+
task: string
393+
) {
394+
var ISOArray: string[] =
395+
this.YamlObject[dim][subDim][task]['references']['iso27001-2017'];
396+
var ISO22Array: string[] =
397+
this.YamlObject[dim][subDim][task]['references']['iso27001-2022'];
398+
var SAMMArray: string[] =
399+
this.YamlObject[dim][subDim][task]['references']['samm2'];
400+
var CurrentDescription: string =
401+
this.YamlObject[dim][subDim][task]['description'];
402+
var CurrentRisk: string = this.YamlObject[dim][subDim][task]['risk'];
403+
var CurrentMeasure: string = this.YamlObject[dim][subDim][task]['measure'];
404+
var CurrentKnowledge: string =
405+
this.knowledgeLabels[
406+
this.YamlObject[dim][subDim][task]['difficultyOfImplementation'][
407+
'knowledge'
408+
]
409+
];
410+
var CurrentTime: string =
411+
this.generalLabels[
412+
this.YamlObject[dim][subDim][task]['difficultyOfImplementation']['time']
413+
];
414+
var CurrentResources: string =
415+
this.generalLabels[
416+
this.YamlObject[dim][subDim][task]['difficultyOfImplementation'][
417+
'resources'
418+
]
419+
];
420+
var CurrentUsefulness: string =
421+
this.generalLabels[this.YamlObject[dim][subDim][task]['usefulness']];
422+
423+
var CurrentEvidence: string =
424+
this.YamlObject[dim][subDim][task]['evidence'];
425+
426+
var CurrentComments: string =
427+
this.YamlObject[dim][subDim][task]['comments'];
428+
429+
var CurrentAssessment: string =
430+
this.YamlObject[dim][subDim][task]['assessment'];
431+
432+
var CurrentDependsOn: string[] =
433+
this.YamlObject[dim][subDim][task]['dependsOn'];
434+
try {
435+
var CurrentImplementation: any = JSON.stringify(
436+
this.YamlObject[dim][subDim][task]['implementation']
437+
);
438+
if (CurrentImplementation.length == 2) {
442439
CurrentImplementation = '';
443440
}
444-
445-
this.temporaryMappingElement = {
446-
dimension: dim,
447-
subDimension: subDim,
448-
taskName: task,
449-
ISO: ISOArray,
450-
ISO22: '',
451-
samm2: SAMMArray,
452-
description: CurrentDescription,
453-
risk: CurrentRisk,
454-
measure: CurrentMeasure,
455-
knowledge: CurrentKnowledge,
456-
time: CurrentTime,
457-
resources: CurrentResources,
458-
usefulness: CurrentUsefulness,
459-
dependsOn: CurrentDependsOn,
460-
implementation: CurrentImplementation,
461-
evidence: CurrentEvidence,
462-
comments: CurrentComments,
463-
assessment: CurrentAssessment,
464-
};
465-
if (ISO22Array.length == 0) {
466-
this.allMappingDataSortedByISO22.push(this.temporaryMappingElement);
467-
if (this.YamlObject[dim][subDim][task]['isImplemented']) {
468-
this.performedMappingDataSortedByISO22.push(this.temporaryMappingElement);
469-
} else {
470-
this.plannedMappingDataSortedByISO22.push(this.temporaryMappingElement);
471-
}
472-
}
473-
for (var i = 0; i < ISO22Array.length; i++) {
474-
const newTempElement = JSON.parse(
475-
JSON.stringify(this.temporaryMappingElement)
441+
} catch {
442+
CurrentImplementation = '';
443+
}
444+
445+
this.temporaryMappingElement = {
446+
dimension: dim,
447+
subDimension: subDim,
448+
taskName: task,
449+
ISO: ISOArray,
450+
ISO22: '',
451+
samm2: SAMMArray,
452+
description: CurrentDescription,
453+
risk: CurrentRisk,
454+
measure: CurrentMeasure,
455+
knowledge: CurrentKnowledge,
456+
time: CurrentTime,
457+
resources: CurrentResources,
458+
usefulness: CurrentUsefulness,
459+
dependsOn: CurrentDependsOn,
460+
implementation: CurrentImplementation,
461+
evidence: CurrentEvidence,
462+
comments: CurrentComments,
463+
assessment: CurrentAssessment,
464+
};
465+
if (ISO22Array.length == 0) {
466+
this.allMappingDataSortedByISO22.push(this.temporaryMappingElement);
467+
if (this.YamlObject[dim][subDim][task]['isImplemented']) {
468+
this.performedMappingDataSortedByISO22.push(
469+
this.temporaryMappingElement
476470
);
477-
newTempElement['ISO22'] = ISO22Array[i];
478-
//console.log(newTempElement);
479-
this.allMappingDataSortedByISO22.push(newTempElement);
480-
if (this.YamlObject[dim][subDim][task]['isImplemented']) {
481-
this.performedMappingDataSortedByISO22.push(newTempElement);
482-
} else {
483-
this.plannedMappingDataSortedByISO22.push(newTempElement);
484-
}
471+
} else {
472+
this.plannedMappingDataSortedByISO22.push(this.temporaryMappingElement);
485473
}
486-
//sorting by descending order
487-
this.allMappingDataSortedByISO22.sort(
488-
(first, second) => 0 - (first['ISO22'] > second['ISO22'] ? 1 : -1)
489-
);
490-
this.performedMappingDataSortedByISO22.sort(
491-
(first, second) => 0 - (first['ISO22'] > second['ISO22'] ? 1 : -1)
492-
);
493-
this.plannedMappingDataSortedByISO22.sort(
494-
(first, second) => 0 - (first['ISO22'] > second['ISO22'] ? 1 : -1)
474+
}
475+
for (var i = 0; i < ISO22Array.length; i++) {
476+
const newTempElement = JSON.parse(
477+
JSON.stringify(this.temporaryMappingElement)
495478
);
496-
//console.log(this.temp)
479+
newTempElement['ISO22'] = ISO22Array[i];
480+
//console.log(newTempElement);
481+
this.allMappingDataSortedByISO22.push(newTempElement);
482+
if (this.YamlObject[dim][subDim][task]['isImplemented']) {
483+
this.performedMappingDataSortedByISO22.push(newTempElement);
484+
} else {
485+
this.plannedMappingDataSortedByISO22.push(newTempElement);
486+
}
497487
}
488+
//sorting by descending order
489+
this.allMappingDataSortedByISO22.sort(
490+
(first, second) => 0 - (first['ISO22'] > second['ISO22'] ? 1 : -1)
491+
);
492+
this.performedMappingDataSortedByISO22.sort(
493+
(first, second) => 0 - (first['ISO22'] > second['ISO22'] ? 1 : -1)
494+
);
495+
this.plannedMappingDataSortedByISO22.sort(
496+
(first, second) => 0 - (first['ISO22'] > second['ISO22'] ? 1 : -1)
497+
);
498+
//console.log(this.temp)
499+
}
498500

499501
// remove filter chip
500502
removeChip(chip: string): void {

src/app/component/task-description/task-description.component.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,12 @@ describe('TaskDescriptionComponent', () => {
126126
const HTMLElement: HTMLElement = fixture.nativeElement;
127127
const contentDisplayedinParagraphTag = HTMLElement.querySelectorAll('p')!;
128128
expect(contentDisplayedinParagraphTag[9].textContent).toContain(
129-
component.SAMMVersion + testSAMM[0] + component.ISOVersion + testISO[0] + component.ISO22Version + testISO22[0]
129+
component.SAMMVersion +
130+
testSAMM[0] +
131+
component.ISOVersion +
132+
testISO[0] +
133+
component.ISO22Version +
134+
testISO22[0]
130135
);
131136
});
132137
});

0 commit comments

Comments
 (0)