Skip to content

Commit 32df8cc

Browse files
authored
Merge pull request #147 from 0x41head/angular-ui
Added Features
2 parents d121765 + 8efd1c7 commit 32df8cc

File tree

10 files changed

+122
-17
lines changed

10 files changed

+122
-17
lines changed

src/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { MappingComponent } from './component/mapping/mapping.component';
1919
import { ReadmeToHtmlComponent } from './component/readme-to-html/readme-to-html.component';
2020
import { UsageComponent } from './component/usage/usage.component';
2121
import { AboutUsComponent } from './component/about-us/about-us.component';
22-
import { DependencyGraphComponent } from './dependency-graph/dependency-graph.component';
22+
import { DependencyGraphComponent } from './component/dependency-graph/dependency-graph.component';
2323

2424

2525
@NgModule({

src/app/dependency-graph/dependency-graph.component.css renamed to src/app/component/dependency-graph/dependency-graph.component.css

File renamed without changes.

src/app/dependency-graph/dependency-graph.component.html renamed to src/app/component/dependency-graph/dependency-graph.component.html

File renamed without changes.

src/app/dependency-graph/dependency-graph.component.spec.ts renamed to src/app/component/dependency-graph/dependency-graph.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
import { HttpClient, HttpHandler } from '@angular/common/http';
33
import { ComponentFixture, TestBed } from '@angular/core/testing';
4-
import { ymlService } from '../service/yaml-parser/yaml-parser.service';
4+
import { ymlService } from '../../service/yaml-parser/yaml-parser.service';
55
import { DependencyGraphComponent } from './dependency-graph.component';
66

77
describe('DependencyGraphComponent', () => {

src/app/dependency-graph/dependency-graph.component.ts renamed to src/app/component/dependency-graph/dependency-graph.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, OnInit, Input } from '@angular/core';
22
import * as d3 from 'd3'
3-
import { ymlService } from '../service/yaml-parser/yaml-parser.service';
3+
import { ymlService } from 'src/app/service/yaml-parser/yaml-parser.service';
44

55
export interface graphNodes{
66
id:string

src/app/component/mapping/mapping.component.html

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,29 @@
106106
<th>Dimension</th>
107107
<th>Sub Dimension</th>
108108
<th>Activity</th>
109+
<th>Description</th>
110+
<th>Risk</th>
111+
<th>Measure</th>
112+
<th>Knowledge</th>
113+
<th>Resources</th>
114+
<th>Time</th>
115+
<th>Usefulness</th>
116+
<th>Depends On</th>
109117
<th>SAMM</th>
110118
<th>ISO</th>
111119
</tr>
112-
<tr *ngFor="let item of performedMappingDataSortedByISO">
120+
<tr *ngFor="let item of allMappingDataSortedByISO">
113121
<td>{{item.dimension}}</td>
114122
<td>{{item.subDimension}}</td>
115123
<td>{{item.taskName}}</td>
124+
<td>{{item.description}}</td>
125+
<td>{{item.risk}}</td>
126+
<td>{{item.measure}}</td>
127+
<td>{{item.knowledge}}</td>
128+
<td>{{item.resources}}</td>
129+
<td>{{item.time}}</td>
130+
<td>{{item.usefulness}}</td>
131+
<td>{{item.dependsOn}}</td>
116132
<td>{{item.samm2}}</td>
117133
<td>{{item.ISO}}</td>
118134
</tr>

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

Lines changed: 80 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, OnInit } from '@angular/core';
22
import { ymlService } from '../../service/yaml-parser/yaml-parser.service';
33
import { MatTableDataSource } from '@angular/material/table';
4-
import {COMMA, ENTER, T} from '@angular/cdk/keycodes';
4+
import {COMMA, ENTER } from '@angular/cdk/keycodes';
55
import {ElementRef, ViewChild} from '@angular/core';
66
import {FormControl} from '@angular/forms';
77
import {MatAutocompleteSelectedEvent} from '@angular/material/autocomplete';
@@ -31,6 +31,14 @@ export interface MappingElementSortedByISO {
3131
subDimension: string;
3232
taskName: string;
3333
samm2:string[];
34+
description:string;
35+
risk:string;
36+
measure:string;
37+
knowledge:string;
38+
resources:string;
39+
time:string;
40+
usefulness:string;
41+
dependsOn:string[]
3442
}
3543

3644

@@ -63,6 +71,10 @@ export class MappingComponent implements OnInit {
6371
allDimensionNames:string[]=[];
6472
temporaryMappingElement:any
6573

74+
//labels
75+
knowledgeLabels: string[]=[]
76+
generalLabels: string[]=[]
77+
6678
separatorKeysCodes: number[] = [ENTER, COMMA];
6779
FilterCtrl = new FormControl('');
6880
SortCtrl = new FormControl('');
@@ -80,6 +92,14 @@ export class MappingComponent implements OnInit {
8092
}
8193

8294
ngOnInit(): void {
95+
//gets value from meta folder
96+
this.yaml.setURI('./assets/YAML/meta.yaml');
97+
// Function sets label data
98+
this.yaml.getJson().subscribe((data) => {
99+
//console.log(data)
100+
this.knowledgeLabels=data['strings']['en']['KnowledgeLabels']
101+
this.generalLabels=data['strings']['en']['labels']
102+
})
83103
//gets value from generated folder
84104
this.yaml.setURI('./assets/YAML/generated/generated.yaml');
85105
// Function sets data
@@ -157,7 +177,59 @@ export class MappingComponent implements OnInit {
157177
setValueandAppendToDatasetandSortbyISO(dim:string,subDim:string,task:string){
158178
var ISOArray:string[]=this.YamlObject[dim][subDim][task]['references']['iso27001-2017']
159179
var SAMMArray:string[]=this.YamlObject[dim][subDim][task]['references']['samm2']
160-
this.temporaryMappingElement={"dimension":dim,"subDimension":subDim,"taskName":task,"ISO":"","samm2":SAMMArray}
180+
try{
181+
var CurrentDescription:string=this.YamlObject[dim][subDim][task]['description']
182+
}
183+
catch{
184+
var CurrentDescription:string=""
185+
}
186+
try{
187+
var CurrentRisk:string=this.YamlObject[dim][subDim][task]['risk']
188+
}
189+
catch{
190+
var CurrentRisk:string=""
191+
}
192+
try{
193+
var CurrentMeasure:string=this.YamlObject[dim][subDim][task]['measure']
194+
}
195+
catch{
196+
var CurrentMeasure:string=""
197+
}
198+
try{
199+
var CurrentKnowledge:string=this.knowledgeLabels[this.YamlObject[dim][subDim][task]['difficultyOfImplementation']['knowledge']]
200+
201+
}
202+
catch{
203+
var CurrentKnowledge:string=""
204+
}
205+
try{
206+
207+
var CurrentTime:string=this.generalLabels[this.YamlObject[dim][subDim][task]['difficultyOfImplementation']['time']]
208+
}
209+
catch{
210+
var CurrentTime:string=""
211+
}
212+
try{
213+
var CurrentResources:string=this.generalLabels[this.YamlObject[dim][subDim][task]['difficultyOfImplementation']['resources']]
214+
}
215+
catch{
216+
var CurrentResources:string=""
217+
}
218+
try{
219+
var CurrentUsefulness:string=this.generalLabels[this.YamlObject[dim][subDim][task]['usefulness']]
220+
}
221+
catch{
222+
var CurrentUsefulness:string=""
223+
}
224+
try{
225+
var CurrentDependsOn:string[]=this.YamlObject[dim][subDim][task]['dependsOn']
226+
}
227+
catch{
228+
var CurrentDependsOn:string[]=[]
229+
}
230+
this.temporaryMappingElement={"dimension":dim,"subDimension":subDim,"taskName":task,"ISO":"","samm2":SAMMArray,
231+
description:CurrentDescription,risk:CurrentRisk,measure:CurrentMeasure,knowledge:CurrentKnowledge,time:CurrentTime,
232+
resources:CurrentResources,usefulness:CurrentUsefulness,dependsOn:CurrentDependsOn}
161233
if(ISOArray.length==0){
162234
this.allMappingDataSortedByISO.push(this.temporaryMappingElement)
163235
if(this.YamlObject[dim][subDim][task]['isImplemented']){
@@ -313,14 +385,15 @@ export class MappingComponent implements OnInit {
313385

314386
exportToExcel(){
315387
/* passing the table id */
316-
let element = document.getElementById("excel-table");
317-
const ws: XLSX.WorkSheet =XLSX.utils.table_to_sheet(element);
388+
//let element = document.getElementById("excel-table");
389+
//const ws: XLSX.WorkSheet =XLSX.utils.table_to_sheet(element);
318390

319391
/* generate workbook and add the worksheet */
320-
const wb: XLSX.WorkBook = XLSX.utils.book_new();
321-
XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
392+
//const wb: XLSX.WorkBook = XLSX.utils.book_new();
393+
//XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
322394

323395
/* save to file */
324-
XLSX.writeFile(wb, "Planned-Activities-Sorted-By-ISO.xlsx");
396+
//XLSX.writeFile(wb, "Planned-Activities-Sorted-By-ISO.xlsx");
397+
console.log(this.allMappingDataSortedByISO)
325398
}
326399
}

src/app/component/sidenav-buttons/sidenav-buttons.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Component, OnInit } from '@angular/core';
77
})
88
export class SidenavButtonsComponent implements OnInit {
99
Options: string[] = ['Matrix', 'Home','Implementation Levels','Mappings','Usage','About Us'];
10-
Icons: string[] = ['bar_chart','home','home','home','home','home'];
10+
Icons: string[] = ['table_chart','home','pie_chart','timeline','info','people'];
1111
Routing: string[]=['/','/home','/circular-heatmap','/mapping','/usage','/about']
1212
constructor() { }
1313

src/app/component/task-description/task-description.component.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,16 @@ <h1>{{currentTask.dimension}} -> {{currentTask.subDimension}}: {{currentTask.tas
4444
</mat-panel-title>
4545
</mat-expansion-panel-header>
4646
<p>Knowledge: {{this.KnowledgeLabels[this.currentTask.knowledge]}} </p>
47-
<p>Time: {{this.TimeAndResourceLabels[this.currentTask.knowledge]}} </p>
48-
<p>Resources: {{this.TimeAndResourceLabels[this.currentTask.knowledge]}}</p>
47+
<p>Time: {{this.GeneralLabels[this.currentTask.time]}} </p>
48+
<p>Resources: {{this.GeneralLabels[this.currentTask.resources]}}</p>
49+
</mat-expansion-panel>
50+
<mat-expansion-panel *ngIf="currentTask.usefulness!=-1">
51+
<mat-expansion-panel-header>
52+
<mat-panel-title>
53+
<b>Usefulness</b>
54+
</mat-panel-title>
55+
</mat-expansion-panel-header>
56+
<p>{{this.GeneralLabels[this.currentTask.usefulness]}} </p>
4957
</mat-expansion-panel>
5058
<mat-expansion-panel>
5159
<mat-expansion-panel-header>

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface taskDescription {
2727
time:number
2828
dependsOn:string[]
2929
implementation:implementation[]
30+
usefulness:number
3031
}
3132

3233
@Component({
@@ -38,10 +39,10 @@ export class TaskDescriptionComponent implements OnInit {
3839

3940
currentTask: taskDescription={dimension:'',subDimension:'',level:'',taskName:'',description:'',risk:'',
4041
measure:'',implementatonGuide:'',samm:[''],iso:[''],knowledge:-1,resources:-1,
41-
time:-1,dependsOn:[], implementation:[]}
42+
time:-1,dependsOn:[], implementation:[],usefulness:-1}
4243

4344
YamlObject:any;
44-
TimeAndResourceLabels:string[]=[];
45+
GeneralLabels:string[]=[];
4546
KnowledgeLabels:string[]=[];
4647
rowIndex:number=0;
4748
markdown:md = md()
@@ -62,7 +63,7 @@ export class TaskDescriptionComponent implements OnInit {
6263
// Function sets label data
6364
this.yaml.getJson().subscribe((data) => {
6465
this.YamlObject = data;
65-
this.TimeAndResourceLabels=this.YamlObject['strings']['en']['labels']
66+
this.GeneralLabels=this.YamlObject['strings']['en']['labels']
6667
this.KnowledgeLabels=this.YamlObject['strings']['en']['KnowledgeLabels']
6768
})
6869
//gets value from generated folder
@@ -81,6 +82,13 @@ export class TaskDescriptionComponent implements OnInit {
8182
catch{
8283
console.log('Meta does not exist')
8384
}
85+
try{
86+
data['usefulness']
87+
this.currentTask.usefulness=this.defineIntegerValues(data['usefulness'],-1)
88+
}
89+
catch{
90+
console.log('Meta does not exist')
91+
}
8492
try{
8593
data['difficultyOfImplementation']
8694
this.currentTask.knowledge=this.defineIntegerValues(data['difficultyOfImplementation']['knowledge'],-1)

0 commit comments

Comments
 (0)