summaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing
diff options
context:
space:
mode:
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.css3
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.html7
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts45
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);
}
});