diff options
author | 2020-06-16 11:53:24 +0200 | |
---|---|---|
committer | 2020-06-16 11:53:24 +0200 | |
commit | eed29ac266b168c6ce084f5bf44dd0680cf13d2d (patch) | |
tree | 34b1f12a32df86984390b3294530af26b43d0db7 /cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation | |
parent | 2fa007d45d0e9e6f38f56d7eb25ee5936f2b3c1d (diff) |
change template&mapping screen
add "back to temmplate list" button
fix mapping table
Issue-ID: CCSDK-2323
Signed-off-by: AhmedEldeeb50 <ahmed.eldeeb.ext@orange.com>
Change-Id: Ifdabb22e550c5b5f950c21b4c657589df980e459
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation')
2 files changed, 33 insertions, 23 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 164f0ac73..fdf10e0a9 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 @@ -1,7 +1,8 @@ <div class="row template-mapping-action"> <div class="col"> - <h6 class="create-title">Create Template</h6> + <h6 [hidden]="edit" class="create-title">Create Template</h6> + <button (click)="closeCreationForm()" [hidden]="!edit" class="btn btn-outline-secondary"><i class="fa fa-chevron-left mr-2"></i>Template List</button> </div> <div class="col text-right"> <button (click)="cancel()" [disabled]="fileName?.length <=0" class="btn btn-outline-secondary">Cancel</button> @@ -116,7 +117,7 @@ </div> </div> <div id="mapping-table" [hidden]="resourceDictionaryRes?.length == 0" class="mx-4 my-2"> - <table datatable [dtOptions]="dtOptions" [dtTrigger]="dtTrigger" class="row-border hover"> + <table datatable [dtOptions]="initDtOptions" [dtTrigger]="dtTrigger" class="row-border hover"> <thead> <tr> <th>Required</th> @@ -164,7 +165,7 @@ </table> </div> - <div id="mapping-table" [hidden]="mappingRes?.length == 0" class="mx-4 my-2"> + <div id="mapping-table-res" [hidden]="mappingRes?.length == 0" class="mx-4 my-2"> <table datatable [dtOptions]="dtOptions" [dtTrigger]="resTableDtTrigger" class="row-border hover"> <thead> <tr> 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 5129b38d9..7b777696f 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 @@ -28,6 +28,7 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy { templateInfo = new TemplateInfo(); variables: string[] = []; dtOptions: DataTables.Settings = {}; + initDtOptions: DataTables.Settings = {}; // We use this trigger because fetching the list of persons can be quite long, // thus we ensure the data is fetched before rendering dtTrigger = new Subject(); @@ -62,7 +63,6 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy { console.log('URL contains Id'); this.sharedService.enableEdit(); } - this.templateStore.state$.subscribe(templateInfo => { // init Template&mapping vars console.log('Oninit'); @@ -108,12 +108,18 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy { } }); - this.dtOptions = { + this.initDtOptions = { pagingType: 'full_numbers', pageLength: 25, destroy: true, retrieve: true, }; + this.dtOptions = { + pagingType: 'full_numbers', + pageLength: 25, + // destroy: true, + // retrieve: true, + }; } getFileExtension() { @@ -164,7 +170,7 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy { this.files = files; for (const droppedFile of files) { // Is it a file? & Not added before - if (droppedFile.fileEntry.isFile && !this.fileNames.has(droppedFile.fileEntry.name)) { + if (droppedFile.fileEntry.isFile) { const fileEntry = droppedFile.fileEntry as FileSystemFileEntry; this.uploadedFiles.push(fileEntry); this.fileNames.add(fileEntry.name); @@ -191,6 +197,7 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy { this.variables = fileReader.result.toString().split(','); console.log(this.variables); this.getMappingTableFromTemplate(null); + }; fileReader.readAsText(file); }); @@ -285,7 +292,7 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy { this.mappingRes = []; this.currentMapping = {}; this.currentTemplate = {}; - this.closeCreationForm(); + // this.closeCreationForm(); } saveToStore() { if (this.fileName) { @@ -304,11 +311,11 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy { this.resourceDictionaryRes = []; } // Save Template to store - if (this.templateFileContent) { - this.packageCreationStore.addTemplate('Templates/' + this.fileName + '-template' + this.getFileExtension(), - this.templateFileContent); - this.templateFileContent = ''; - } + // if (this.templateFileContent) { + this.packageCreationStore.addTemplate('Templates/' + this.fileName + '-template' + this.getFileExtension(), + this.templateFileContent); + this.templateFileContent = ''; + // } this.fileName = ''; this.toastr.success('File is created', 'success'); this.closeCreationForm(); @@ -350,17 +357,19 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy { } rerender(): void { - if (this.dtElement.dtInstance) { - console.log('rerender'); - this.dtElement.dtInstance.then((dtInstance: DataTables.Api) => { - dtInstance.destroy(); - this.dtElement.dtOptions = this.dtOptions; - this.dtElement.dtTrigger.next(); - dtInstance.draw(); - }); - } else { - this.dtTrigger.next(); - } + this.dtTrigger.next(); + + // if (this.dtElement.dtInstance) { + // console.log('rerender'); + // this.dtElement.dtInstance.then((dtInstance: DataTables.Api) => { + // dtInstance.destroy(); + // this.dtElement.dtOptions = this.dtOptions; + // this.dtElement.dtTrigger.next(); + // dtInstance.draw(); + // }); + // } else { + // this.dtTrigger.next(); + // } } ngOnDestroy(): void { |