aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation
diff options
context:
space:
mode:
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html4
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.ts39
2 files changed, 37 insertions, 6 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html
index 4f9b2709a..8cdd9c560 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html
@@ -6,8 +6,8 @@
</label>
<div class="label-input">
- <input type="input" [(ngModel)]="fileName" placeholder="Template name" name="templateName" autofocus
- [autofocus]="true">
+ <input type="input" [disabled]="edit" [(ngModel)]="fileName" placeholder="Template name" name="templateName"
+ autofocus [autofocus]="true">
</div>
</div>
</div>
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.ts
index 4601880f8..5129b38d9 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.ts
@@ -9,6 +9,8 @@ import { Mapping, MappingAdapter } from '../../mapping-models/mappingAdapter.mod
import { PackageCreationUtils } from '../../package-creation.utils';
import { JsonConvert, Any } from 'json2typescript';
import { ToastrService } from 'ngx-toastr';
+import { Router, ActivatedRoute } from '@angular/router';
+import { SharedService } from '../shared-service';
@Component({
selector: 'app-templ-mapp-creation',
@@ -43,19 +45,27 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy {
mappingRes = [];
currentTemplate: any;
currentMapping: any;
+ edit = false;
constructor(
private packageCreationStore: PackageCreationStore,
private templateStore: TemplateStore,
private packageCreationUtils: PackageCreationUtils,
- private toastr: ToastrService
+ private toastr: ToastrService,
+ private router: ActivatedRoute,
+ private sharedService: SharedService
) {
}
ngOnInit() {
+ if (this.router.snapshot.paramMap.has('id')) {
+ console.log('URL contains Id');
+ this.sharedService.enableEdit();
+ }
+
this.templateStore.state$.subscribe(templateInfo => {
// init Template&mapping vars
- console.log('----------');
+ console.log('Oninit');
console.log(templateInfo);
this.templateInfo = templateInfo;
this.fileName = templateInfo.fileName.split('/')[1];
@@ -82,6 +92,22 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy {
});
+ this.sharedService.isEdit().subscribe(res => {
+ console.log('------------------------');
+ console.log(res);
+ this.edit = res;
+
+ if (!this.edit) {
+ console.log('remove ----');
+ this.currentMapping = {};
+ this.currentTemplate = {};
+ this.fileName = '';
+ this.templateFileContent = '';
+ this.resourceDictionaryRes = [];
+ this.mappingRes = [];
+ }
+ });
+
this.dtOptions = {
pagingType: 'full_numbers',
pageLength: 25,
@@ -259,12 +285,17 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy {
this.mappingRes = [];
this.currentMapping = {};
this.currentTemplate = {};
+ this.closeCreationForm();
}
saveToStore() {
if (this.fileName) {
// check file duplication
- if (!(this.packageCreationStore.fileExist('Templates/' + this.fileName + '-mapping.json')
- || this.packageCreationStore.fileExist('Templates/' + this.fileName + '-template' + this.getFileExtension()))) {
+ console.log('----------- mode ' + this.edit);
+ if (
+ (!(this.packageCreationStore.fileExist('Templates/' + this.fileName + '-mapping.json')
+ || this.packageCreationStore.fileExist('Templates/' + this.fileName + '-template' + this.getFileExtension())))
+ || this.edit
+ ) {
// Save Mapping to Store
if (this.resourceDictionaryRes && this.resourceDictionaryRes.length > 0) {
const mapArray = this.convertDictionaryToMap(this.resourceDictionaryRes);