@@ -38,7 +38,8 @@ export interface MappingElementSortedByISO {
3838 resources :string ;
3939 time :string ;
4040 usefulness :string ;
41- dependsOn :string [ ]
41+ dependsOn :string [ ] ;
42+ implementation :any ;
4243}
4344
4445
@@ -177,59 +178,28 @@ export class MappingComponent implements OnInit {
177178 setValueandAppendToDatasetandSortbyISO ( dim :string , subDim :string , task :string ) {
178179 var ISOArray :string [ ] = this . YamlObject [ dim ] [ subDim ] [ task ] [ 'references' ] [ 'iso27001-2017' ]
179180 var SAMMArray :string [ ] = this . YamlObject [ dim ] [ subDim ] [ task ] [ 'references' ] [ 'samm2' ]
181+ var CurrentDescription :string = this . YamlObject [ dim ] [ subDim ] [ task ] [ 'description' ]
182+ var CurrentRisk :string = this . YamlObject [ dim ] [ subDim ] [ task ] [ 'risk' ]
183+ var CurrentMeasure :string = this . YamlObject [ dim ] [ subDim ] [ task ] [ 'measure' ]
184+ var CurrentKnowledge :string = this . knowledgeLabels [ this . YamlObject [ dim ] [ subDim ] [ task ] [ 'difficultyOfImplementation' ] [ 'knowledge' ] ]
185+ var CurrentTime :string = this . generalLabels [ this . YamlObject [ dim ] [ subDim ] [ task ] [ 'difficultyOfImplementation' ] [ 'time' ] ]
186+ var CurrentResources :string = this . generalLabels [ this . YamlObject [ dim ] [ subDim ] [ task ] [ 'difficultyOfImplementation' ] [ 'resources' ] ]
187+ var CurrentUsefulness :string = this . generalLabels [ this . YamlObject [ dim ] [ subDim ] [ task ] [ 'usefulness' ] ]
188+ var CurrentDependsOn :string [ ] = this . YamlObject [ dim ] [ subDim ] [ task ] [ 'dependsOn' ]
180189 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' ]
190+ var CurrentImplementation :any = JSON . stringify ( this . YamlObject [ dim ] [ subDim ] [ task ] [ 'implementation' ] )
191+ if ( CurrentImplementation . length == 2 ) {
192+ CurrentImplementation = ""
193+ }
226194 }
227195 catch {
228- var CurrentDependsOn : string [ ] = [ ]
196+ CurrentImplementation = ""
229197 }
198+
199+
230200 this . temporaryMappingElement = { "dimension" :dim , "subDimension" :subDim , "taskName" :task , "ISO" :"" , "samm2" :SAMMArray ,
231201 description :CurrentDescription , risk :CurrentRisk , measure :CurrentMeasure , knowledge :CurrentKnowledge , time :CurrentTime ,
232- resources :CurrentResources , usefulness :CurrentUsefulness , dependsOn :CurrentDependsOn }
202+ resources :CurrentResources , usefulness :CurrentUsefulness , dependsOn :CurrentDependsOn , implementation : CurrentImplementation }
233203 if ( ISOArray . length == 0 ) {
234204 this . allMappingDataSortedByISO . push ( this . temporaryMappingElement )
235205 if ( this . YamlObject [ dim ] [ subDim ] [ task ] [ 'isImplemented' ] ) {
@@ -385,15 +355,15 @@ export class MappingComponent implements OnInit {
385355
386356 exportToExcel ( ) {
387357 /* passing the table id */
388- // let element = document.getElementById("excel-table");
389- // const ws: XLSX.WorkSheet =XLSX.utils.table_to_sheet(element);
358+ let element = document . getElementById ( "excel-table" ) ;
359+ const ws : XLSX . WorkSheet = XLSX . utils . table_to_sheet ( element ) ;
390360
391361 /* generate workbook and add the worksheet */
392- // const wb: XLSX.WorkBook = XLSX.utils.book_new();
393- // XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
362+ const wb : XLSX . WorkBook = XLSX . utils . book_new ( ) ;
363+ XLSX . utils . book_append_sheet ( wb , ws , "Sheet1" ) ;
394364
395365 /* save to file */
396- // XLSX.writeFile(wb, "Planned-Activities-Sorted-By-ISO.xlsx");
397- console . log ( this . allMappingDataSortedByISO )
366+ XLSX . writeFile ( wb , "Planned-Activities-Sorted-By-ISO.xlsx" ) ;
367+ // console.log(this.allMappingDataSortedByISO)
398368 }
399369}
0 commit comments