From: Ahmedeldeeb50 Date: Wed, 14 Oct 2020 09:57:11 +0000 (+0200) Subject: make Template name & content as const to avoid unintented changes X-Git-Tag: 1.1.0~131^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F80%2F113880%2F1;p=ccsdk%2Fcds.git make Template name & content as const to avoid unintented changes Issue-ID: CCSDK-2323 Signed-off-by: Ahmedeldeeb50 Change-Id: I9dae9470f69cb108d458d3da10efde0f0e5e0ea6 --- 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 56ed0422a..3a8a94bf2 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 @@ -328,7 +328,7 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy { textChanges(code: any, fileName: string) { // this.packageCreationStore.addTemplate(fileName, code); - this.templateFileContent = code; + // this.templateFileContent = code; } public fileOver(event) { @@ -413,9 +413,11 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy { this.openListView(); } saveToStore() { - if (this.fileName) { + const filename = this.fileName; + if (filename) { // check file duplication console.log('----------- mode ' + this.edit); + const fileContent = this.templateFileContent; if ( (!(this.packageCreationStore.fileExist('Templates/' + this.fileName + '-mapping.json') || this.packageCreationStore.fileExist('Templates/' + this.fileName + '-template' + this.getFileExtension()))) @@ -430,8 +432,8 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy { } // Save Template to store // if (this.templateFileContent) { - this.packageCreationStore.addTemplate('Templates/' + this.fileName + '-template' + this.getFileExtension(), - this.templateFileContent); + this.packageCreationStore.addTemplate('Templates/' + filename + '-template' + this.getFileExtension(), + fileContent); this.templateFileContent = ''; // } this.fileName = '';