diff options
author | 2020-02-26 10:05:02 +0200 | |
---|---|---|
committer | 2020-02-26 15:34:55 +0200 | |
commit | ac31d2159014a84de91b6c7baeb29adf90284c10 (patch) | |
tree | 318eec8bed0c51529d4d746dede6fb8e2737bc2b /cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts | |
parent | c99df5dd491c9f18044ec483e696739080e80950 (diff) |
add view feature and decompress zip file
-decompress package zip file
-getting content and file names
Issue-ID: CCSDK-2120
Signed-off-by: shaaban Altanany <shaaban.eltanany.ext@orange.com>
Change-Id: If930b257a9dd7b8e094958aad006ff3769810cb3
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts')
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts index 9a0cdcdac..46e67fc07 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts @@ -1,7 +1,8 @@ import {Component, EventEmitter, OnInit, Output} from '@angular/core'; import {PackageCreationStore} from '../../package-creation.store'; -import {Template} from '../../mapping-models/CBAPacakge.model'; +import {Mapping, Template} from '../../mapping-models/CBAPacakge.model'; import {TemplateInfo, TemplateStore} from '../../template.store'; +import {TemplateAndMapping} from '../TemplateAndMapping'; @Component({ selector: 'app-templ-mapp-listing', @@ -10,8 +11,9 @@ import {TemplateInfo, TemplateStore} from '../../template.store'; }) export class TemplMappListingComponent implements OnInit { @Output() showCreationViewParentNotification = new EventEmitter<any>(); + private templateAndMappingMap = new Map<string, TemplateAndMapping>(); private templates: Template; - private sourceCodeEditorContnet: string; + private mapping: Mapping; constructor(private packageCreationStore: PackageCreationStore, private templateStore: TemplateStore) { } @@ -20,10 +22,40 @@ export class TemplMappListingComponent implements OnInit { this.packageCreationStore.state$.subscribe(cba => { if (cba.templates) { this.templates = cba.templates; + this.mapping = cba.mapping; + let templateAndMapping; + this.templateAndMappingMap.clear(); + this.templates.files.forEach((value, key) => { + templateAndMapping = new TemplateAndMapping(); + templateAndMapping.isTemplate = true; + const isFromTemplate = true; + this.setIsMappingOrTemplate(key, templateAndMapping, isFromTemplate); + }); + this.mapping.files.forEach((value, key) => { + templateAndMapping = new TemplateAndMapping(); + templateAndMapping.isMapping = true; + const isFromTemplate = false; + this.setIsMappingOrTemplate(key, templateAndMapping, isFromTemplate); + }); + console.log('hello there '); + console.log(this.templateAndMappingMap); } }); } + private setIsMappingOrTemplate(key: string, templateAndMapping: TemplateAndMapping, isFromTemplate: boolean) { + const nameOfFile = key.split('/')[1].split('.')[0].split('-')[0]; + if (this.templateAndMappingMap.has(nameOfFile)) { + const templateAndMappingExisted = this.templateAndMappingMap.get(nameOfFile); + !isFromTemplate ? templateAndMappingExisted.isMapping = true : templateAndMappingExisted.isTemplate = true; + this.templateAndMappingMap.set(nameOfFile, templateAndMappingExisted); + } else { + + this.templateAndMappingMap.set(nameOfFile, templateAndMapping); + } + + } + openCreationView() { this.showCreationViewParentNotification.emit('tell parent to open create views'); } @@ -39,4 +71,13 @@ export class TemplMappListingComponent implements OnInit { } }); } + + getKeys(templateAndMappingMap: Map<string, TemplateAndMapping>) { + return Array.from(this.templateAndMappingMap.keys()); + } + + getValue(file: string) { + return this.templateAndMappingMap.get(file); + } + } |