diff options
author | 2020-03-02 12:11:29 +0200 | |
---|---|---|
committer | 2020-03-02 14:23:11 +0200 | |
commit | 6edf1f95883e230bcddb7dfbcbafc6d7527a5ce7 (patch) | |
tree | 5bd429d618d6faa7d4d88bc6ab504e5303955e1f /cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing | |
parent | e3d773843a5672f7d9051c68d969b95f15a9033e (diff) |
Display Mapping result in view table.
Update Modals
Issue-ID: CCSDK-2065
Signed-off-by: Ahmed <ahmed.eldeeb.ext@orange.com>
Change-Id: Ifb0f2223cded8b54f13aa600186631f685cd6d02
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing')
3 files changed, 39 insertions, 16 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.css b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.css index e69de29bb..054b5686e 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.css +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.css @@ -0,0 +1,3 @@ +.template-mapping-list { + cursor: pointer; +}
\ No newline at end of file diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.html index 3ed055c5a..ab97159b6 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.html @@ -1,4 +1,4 @@ -<a (click)="openCreationView()" class="create-template-mapping-button"> +<a *ngIf="isCreate" (click)="openCreationView()" class="create-template-mapping-button"> <i class="fa fa-plus"></i> <span>Create</span> </a> @@ -21,8 +21,7 @@ <div class="row"> <!-- <div class="col-4" style="color:white" *ngFor="let file of templates.files | keyvalue; let mapIndex = index">--> <div class="col-4" style="color:white" *ngFor="let file of getKeys(templateAndMappingMap)"> - <a (click)="setSourceCodeEditor(file)" - class="template-mapping-list active">{{file}} + <a (click)="setSourceCodeEditor(file)" class="template-mapping-list active">{{file}} <span *ngIf="getValue(file).isMapping">Mapping</span> <span *ngIf="getValue(file).isTemplate">Template</span> </a> @@ -33,4 +32,4 @@ </div> </div> -</div> +</div>
\ No newline at end of file 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 d459dac67..372fbca03 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,8 +1,10 @@ -import {Component, EventEmitter, OnInit, Output} from '@angular/core'; -import {PackageCreationStore} from '../../package-creation.store'; -import {Mapping, Template} from '../../mapping-models/CBAPacakge.model'; -import {TemplateInfo, TemplateStore} from '../../template.store'; -import {TemplateAndMapping} from '../TemplateAndMapping'; +import { Component, EventEmitter, OnInit, Output } from '@angular/core'; +import { PackageCreationStore } from '../../package-creation.store'; +import { Mapping, Template } from '../../mapping-models/CBAPacakge.model'; +import { TemplateInfo, TemplateStore } from '../../template.store'; +import { TemplateAndMapping } from '../TemplateAndMapping'; +import { ActivatedRoute } from '@angular/router'; + @Component({ selector: 'app-templ-mapp-listing', @@ -14,11 +16,19 @@ export class TemplMappListingComponent implements OnInit { private templateAndMappingMap = new Map<string, TemplateAndMapping>(); private templates: Template; private mapping: Mapping; + isCreate = true; - constructor(private packageCreationStore: PackageCreationStore, private templateStore: TemplateStore) { + constructor( + private packageCreationStore: PackageCreationStore, + private templateStore: TemplateStore, + private route: ActivatedRoute + ) { } ngOnInit() { + if (this.route.snapshot.paramMap.has('id')) { + this.isCreate = false; + } this.packageCreationStore.state$.subscribe(cba => { if (cba.templates) { this.templates = cba.templates; @@ -62,16 +72,27 @@ export class TemplMappListingComponent implements OnInit { } setSourceCodeEditor(key: string) { - key = 'Templates/' + key + '-template.vtl'; + const templateKey = 'Templates/' + key + '-template.vtl'; this.packageCreationStore.state$.subscribe(cba => { - if (cba.templates) { - console.log(cba.templates); - console.log(key); - const fileContent = cba.templates.getValue(key.trim()); + console.log('cba ------'); + console.log(cba); + console.log(key); + console.log(this.templateAndMappingMap); + if (cba.templates && cba.templates.files.has(templateKey)) { + const fileContent = cba.templates.getValue(templateKey.trim()); console.log(fileContent); const templateInfo = new TemplateInfo(); templateInfo.fileContent = fileContent; - templateInfo.fileName = key; + templateInfo.fileName = templateKey; + this.templateStore.changeTemplateInfo(templateInfo); + } + const mappingKey = 'Templates/' + key + '-mapping.json'; + if (cba.mapping && cba.mapping.files.has(mappingKey)) { + const obj = JSON.parse(cba.mapping.getValue(mappingKey)); + const templateInfo = new TemplateInfo(); + templateInfo.mapping = obj; + templateInfo.fileName = mappingKey; + templateInfo.type = 'mapping'; this.templateStore.changeTemplateInfo(templateInfo); } }); |