Skip to content

Commit 0cd03e4

Browse files
authored
Merge pull request #121 from 0x41head/angular-ui
Completed YAML parsing for task description section
2 parents f990664 + b58ce06 commit 0cd03e4

3 files changed

Lines changed: 141 additions & 67 deletions

File tree

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

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -57,45 +57,10 @@ <h1>{{currentTask.dimension}} -> {{currentTask.subDimension}}: Building and test
5757
</mat-expansion-panel-header>
5858
<p>
5959
<mat-accordion multi="true">
60-
<mat-expansion-panel>
61-
<mat-expansion-panel-header>
62-
<mat-panel-title>
63-
<b>CI/CD tools</b>
64-
</mat-panel-title>
65-
</mat-expansion-panel-header>
66-
<p>
67-
<mat-accordion multi="true">
68-
<mat-expansion-panel>
69-
<mat-expansion-panel-header>
70-
<mat-panel-title>
71-
<b>Tags</b>
72-
</mat-panel-title>
73-
</mat-expansion-panel-header>
74-
<p>ci-cd</p>
75-
</mat-expansion-panel>
76-
<mat-expansion-panel>
77-
<mat-expansion-panel-header>
78-
<mat-panel-title>
79-
<b>URL</b>
80-
</mat-panel-title>
81-
</mat-expansion-panel-header>
82-
<p>https://martinfowler.com/articles/continuousIntegration.html</p>
83-
</mat-expansion-panel>
84-
<mat-expansion-panel>
85-
<mat-expansion-panel-header>
86-
<mat-panel-title>
87-
<b>Description</b>
88-
</mat-panel-title>
89-
</mat-expansion-panel-header>
90-
<p>CI/CD tools such as jenkins, gitlab-ci or github-actions </p>
91-
</mat-expansion-panel>
92-
</mat-accordion>
93-
</p>
94-
</mat-expansion-panel>
95-
<mat-expansion-panel>
60+
<mat-expansion-panel *ngFor="let implement of this.currentTask.implementation">
9661
<mat-expansion-panel-header>
9762
<mat-panel-title>
98-
<b>Container technologies and orchestration like Docker, Kubernetes</b>
63+
<b [innerHTML]="implement['name']"></b>
9964
</mat-panel-title>
10065
</mat-expansion-panel-header>
10166
<p>
@@ -106,20 +71,25 @@ <h1>{{currentTask.dimension}} -> {{currentTask.subDimension}}: Building and test
10671
<b>Tags</b>
10772
</mat-panel-title>
10873
</mat-expansion-panel-header>
74+
<ul *ngFor="let tag of implement['tags']">
75+
<li [innerHTML]="tag"></li>
76+
</ul>
10977
</mat-expansion-panel>
11078
<mat-expansion-panel>
11179
<mat-expansion-panel-header>
11280
<mat-panel-title>
11381
<b>URL</b>
11482
</mat-panel-title>
11583
</mat-expansion-panel-header>
84+
<p [innerHTML]="implement['url']"></p>
11685
</mat-expansion-panel>
11786
<mat-expansion-panel>
11887
<mat-expansion-panel-header>
11988
<mat-panel-title>
12089
<b>Description</b>
12190
</mat-panel-title>
12291
</mat-expansion-panel-header>
92+
<p [innerHTML]="implement['description']"></p>
12393
</mat-expansion-panel>
12494
</mat-accordion>
12595
</p>

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

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ import { ActivatedRoute } from '@angular/router';
44
import { ymlService } from '../../service/yaml-parser/yaml-parser.service';
55
import * as md from 'markdown-it';
66

7+
8+
export interface implementation{
9+
name:string
10+
tags:string[]
11+
url:string
12+
description:string
13+
}
714
export interface taskDescription {
815
dimension:string
916
subDimension:string
@@ -19,6 +26,7 @@ export interface taskDescription {
1926
resources:number
2027
time:number
2128
dependsOn:string[]
29+
implementation:implementation[]
2230
}
2331

2432
@Component({
@@ -30,7 +38,7 @@ export class TaskDescriptionComponent implements OnInit {
3038

3139
currentTask: taskDescription={dimension:'',subDimension:'',level:'',taskIndex:-1,description:'',risk:[],
3240
measure:'',implementatonGuide:'',samm:[''],iso:[''],knowledge:-1,resources:-1,
33-
time:-1,dependsOn:[]}
41+
time:-1,dependsOn:[], implementation:[]}
3442

3543
YamlObject:any;
3644

@@ -98,8 +106,9 @@ export class TaskDescriptionComponent implements OnInit {
98106
}
99107

100108
this.currentTask.dependsOn=this.defineStringArrayValues(data['dependsOn'],[])
101-
102-
//console.log(this.measure)
109+
110+
this.currentTask.implementation=this.defineImplementationObject(data['implementation'])
111+
103112

104113
})
105114
}
@@ -130,7 +139,20 @@ export class TaskDescriptionComponent implements OnInit {
130139
return valueOfDataIfUndefined
131140
}
132141
}
133-
142+
defineImplementationObject(dataToCheck:implementation[]):implementation[]{
143+
var dataToReturn:implementation[]=[]
144+
for (var data in dataToCheck){
145+
var temp:implementation={name:'',url:'',tags:[],description:''}
146+
temp["name"]=this.defineStringValues(dataToCheck[data]["name"],'')
147+
temp["url"]=this.defineStringValues(dataToCheck[data]["url"],'')
148+
temp["description"]=this.defineStringValues(dataToCheck[data]["description"],'')
149+
temp["tags"]=this.defineStringArrayValues(dataToCheck[data]["tags"],[])
150+
//console.log(temp)
151+
dataToReturn.push(temp)
152+
}
153+
//console.log(dataToReturn)
154+
return dataToReturn
155+
}
134156

135157
// Expand all function
136158
openall(): void{

src/assets/YAML/generated/sample.yaml

Lines changed: 108 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ dimension:
1818
resources: 2
1919
time: 2
2020
implementation:
21-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/ci-cd-tools
21+
- name: CI/CD tools # string
22+
tags:
23+
- ci-cd # string
24+
url: https://martinfowler.com/articles/continuousIntegration.html # url
25+
description: CI/CD tools such as jenkins, gitlab-ci or github-actions
26+
- name: Container technologies and orchestration like Docker, Kubernetes # string
2227
level: 1
2328
description: '## Benefits:
2429
@@ -56,8 +61,12 @@ dimension:
5661
resources: 2
5762
time: 3
5863
implementation:
59-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/ci-cd-tools
60-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/container-technologi
64+
- name: CI/CD tools # string
65+
tags:
66+
- ci-cd # string
67+
url: https://martinfowler.com/articles/continuousIntegration.html # url
68+
description: CI/CD tools such as jenkins, gitlab-ci or github-actions
69+
- name: Container technologies and orchestration like Docker, Kubernetes # string
6170
level: 1
6271
measure: A well defined build process lowers the possibility of errors during
6372
the build process.
@@ -84,8 +93,12 @@ dimension:
8493
resources: 2
8594
time: 2
8695
implementation:
87-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/ci-cd-tools
88-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/container-technologi
96+
- name: CI/CD tools # string
97+
tags:
98+
- ci-cd # string
99+
url: https://martinfowler.com/articles/continuousIntegration.html # url
100+
description: CI/CD tools such as jenkins, gitlab-ci or github-actions
101+
- name: Container technologies and orchestration like Docker, Kubernetes # string
89102
level: 2
90103
measure: Each step during within the build and testing phase is performed in
91104
a separate virtual environments, which is destroyed afterward.
@@ -113,10 +126,12 @@ dimension:
113126
resources: 2
114127
time: 2
115128
implementation:
116-
- Container technology automatically creates a hash for images, which can be
117-
used.
118-
- Immutable images are an other way, e.g. by using a registry, which doesn't
119-
allow overriding of images.
129+
- name: CI/CD tools # string
130+
tags:
131+
- ci-cd # string
132+
url: https://martinfowler.com/articles/continuousIntegration.html # url
133+
description: CI/CD tools such as jenkins, gitlab-ci or github-actions
134+
- name: Container technologies and orchestration like Docker, Kubernetes # string
120135
level: 2
121136
measure: Pinning of artifacts ensure that changes are performed only when intended.
122137
name: Pinning of artifacts
@@ -136,7 +151,13 @@ dimension:
136151
knowledge: 2
137152
resources: 3
138153
time: 2
139-
implementation: []
154+
implementation:
155+
- name: CI/CD tools # string
156+
tags:
157+
- ci-cd # string
158+
url: https://martinfowler.com/articles/continuousIntegration.html # url
159+
description: CI/CD tools such as jenkins, gitlab-ci or github-actions
160+
- name: Container technologies and orchestration like Docker, Kubernetes # string
140161
iso27001-2017:
141162
- '8.1'
142163
- '8.2'
@@ -154,7 +175,14 @@ dimension:
154175
knowledge: 2
155176
resources: 2
156177
time: 2
157-
implementation: []
178+
implementation:
179+
- name: CI/CD tools # string
180+
tags:
181+
- ci-cd # string
182+
url: https://martinfowler.com/articles/continuousIntegration.html # url
183+
description: # markdown
184+
CI/CD tools such as jenkins, gitlab-ci or github-actions
185+
- name: Container technologies and orchestration like Docker, Kubernetes # string
158186
level: 3
159187
measure: Digitally signing commits helps to prevent unauthorized manipulation
160188
of source code.
@@ -175,8 +203,12 @@ dimension:
175203
resources: 2
176204
time: 2
177205
implementation:
178-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/docker-content-trust
179-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/in-toto
206+
- name: CI/CD tools # string
207+
tags:
208+
- ci-cd # string
209+
url: https://martinfowler.com/articles/continuousIntegration.html # url
210+
description: CI/CD tools such as jenkins, gitlab-ci or github-actions
211+
- name: Container technologies and orchestration like Docker, Kubernetes # string
180212
level: 3
181213
measure: Digitally signing artifacts for all steps during the build and especially
182214
docker images, helps to ensure their integrity.
@@ -202,8 +234,12 @@ dimension:
202234
resources: 1
203235
time: 2
204236
implementation:
205-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/ci-cd-tools
206-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/docker
237+
- name: CI/CD tools # string
238+
tags:
239+
- ci-cd # string
240+
url: https://martinfowler.com/articles/continuousIntegration.html # url
241+
description: CI/CD tools such as jenkins, gitlab-ci or github-actions
242+
- name: Container technologies and orchestration like Docker, Kubernetes # string
207243
level: 1
208244
measure: A defined deployment process significantly lowers the likelihood of
209245
errors during the deployment phase.
@@ -223,7 +259,13 @@ dimension:
223259
knowledge: 2
224260
resources: 1
225261
time: 2
226-
implementation: []
262+
implementation:
263+
- name: CI/CD tools # string
264+
tags:
265+
- ci-cd # string
266+
url: https://martinfowler.com/articles/continuousIntegration.html # url
267+
description: CI/CD tools such as jenkins, gitlab-ci or github-actions
268+
- name: Container technologies and orchestration like Docker, Kubernetes # string
227269
level: 2
228270
measure: 'Configuration parameters are set for each environment not in the source
229271
code.
@@ -252,7 +294,12 @@ dimension:
252294
resources: 1
253295
time: 1
254296
implementation:
255-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/kubernetes-admission
297+
- name: CI/CD tools # string
298+
tags:
299+
- ci-cd # string
300+
url: https://martinfowler.com/articles/continuousIntegration.html # url
301+
description: CI/CD tools such as jenkins, gitlab-ci or github-actions
302+
- name: Container technologies and orchestration like Docker, Kubernetes # string
256303
iso27001-2017:
257304
- 15.1.1
258305
- 15.1.2
@@ -294,9 +341,12 @@ dimension:
294341
resources: 2
295342
time: 2
296343
implementation:
297-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/docker
298-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/webserver
299-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/rolling-update
344+
- name: CI/CD tools # string
345+
tags:
346+
- ci-cd # string
347+
url: https://martinfowler.com/articles/continuousIntegration.html # url
348+
description: CI/CD tools such as jenkins, gitlab-ci or github-actions
349+
- name: Container technologies and orchestration like Docker, Kubernetes # string
300350
iso27001-2017:
301351
- 12.5.1
302352
- 14.2.2
@@ -316,7 +366,12 @@ dimension:
316366
resources: 1
317367
time: 2
318368
implementation:
319-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/docker
369+
- name: CI/CD tools # string
370+
tags:
371+
- ci-cd # string
372+
url: https://martinfowler.com/articles/continuousIntegration.html # url
373+
description: CI/CD tools such as jenkins, gitlab-ci or github-actions
374+
- name: Container technologies and orchestration like Docker, Kubernetes # string
320375
iso27001-2017:
321376
- 14.3.1
322377
- 14.2.8
@@ -337,7 +392,13 @@ dimension:
337392
knowledge: 2
338393
resources: 1
339394
time: 2
340-
implementation: ''
395+
implementation:
396+
- name: CI/CD tools # string
397+
tags:
398+
- ci-cd # string
399+
url: https://martinfowler.com/articles/continuousIntegration.html # url
400+
description: CI/CD tools such as jenkins, gitlab-ci or github-actions
401+
- name: Container technologies and orchestration like Docker, Kubernetes # string
341402
level: 3
342403
measure: By using encryption, it is harder to read credentials , e.g. from the
343404
file system. Also, the usage of a credential management system can help protect
@@ -366,7 +427,12 @@ dimension:
366427
resources: 1
367428
time: 1
368429
implementation:
369-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/docker
430+
- name: CI/CD tools # string
431+
tags:
432+
- ci-cd # string
433+
url: https://martinfowler.com/articles/continuousIntegration.html # url
434+
description: CI/CD tools such as jenkins, gitlab-ci or github-actions
435+
- name: Container technologies and orchestration like Docker, Kubernetes # string
370436
iso27001-2017:
371437
- 14.3.1
372438
- 14.2.8
@@ -387,7 +453,13 @@ dimension:
387453
knowledge: 2
388454
resources: 3
389455
time: 2
390-
implementation: []
456+
implementation:
457+
- name: CI/CD tools # string
458+
tags:
459+
- ci-cd # string
460+
url: https://martinfowler.com/articles/continuousIntegration.html # url
461+
description: CI/CD tools such as jenkins, gitlab-ci or github-actions
462+
- name: Container technologies and orchestration like Docker, Kubernetes # string
391463
iso27001-2017:
392464
- '8.1'
393465
- '8.2'
@@ -410,7 +482,12 @@ dimension:
410482
resources: 3
411483
time: 2
412484
implementation:
413-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/dependencyTrack
485+
- name: CI/CD tools # string
486+
tags:
487+
- ci-cd # string
488+
url: https://martinfowler.com/articles/continuousIntegration.html # url
489+
description: CI/CD tools such as jenkins, gitlab-ci or github-actions
490+
- name: Container technologies and orchestration like Docker, Kubernetes # string
414491
iso27001-2017:
415492
- '8.1'
416493
- '8.2'
@@ -433,7 +510,12 @@ dimension:
433510
resources: 1
434511
time: 2
435512
implementation:
436-
- $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/blue-green-deploymen
513+
- name: CI/CD tools # string
514+
tags:
515+
- ci-cd # string
516+
url: https://martinfowler.com/articles/continuousIntegration.html # url
517+
description: CI/CD tools such as jenkins, gitlab-ci or github-actions
518+
- name: Container technologies and orchestration like Docker, Kubernetes # string
437519
level: 4
438520
measure: By having multiple production environments, a deployment can be performant
439521
on the first environment to spot possible defects before it is deployment

0 commit comments

Comments
 (0)