From eed29ac266b168c6ce084f5bf44dd0680cf13d2d Mon Sep 17 00:00:00 2001 From: AhmedEldeeb50 Date: Tue, 16 Jun 2020 11:53:24 +0200 Subject: change template&mapping screen add "back to temmplate list" button fix mapping table Issue-ID: CCSDK-2323 Signed-off-by: AhmedEldeeb50 Change-Id: Ifdabb22e550c5b5f950c21b4c657589df980e459 --- .../imports-tab/imports-tab.component.ts | 2 +- .../scripts-tab/scripts-tab.component.ts | 2 +- .../templ-mapp-creation.component.html | 7 ++-- .../templ-mapp-creation.component.ts | 49 +++++++++++++--------- .../templ-mapp-listing.component.css | 20 +++++++++ .../templ-mapp-listing.component.html | 43 +++++++++++++++---- .../templ-mapp-listing.component.ts | 13 ++++++ .../template-mapping.component.html | 4 +- 8 files changed, 104 insertions(+), 36 deletions(-) (limited to 'cds-ui/designer-client') diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts index 9858fd580..e18923154 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts @@ -31,7 +31,7 @@ export class ImportsTabComponent implements OnInit { 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); console.log(fileEntry.name); diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.ts index a85ccf146..63a734726 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.ts @@ -35,7 +35,7 @@ export class ScriptsTabComponent implements OnInit { 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); console.log(fileEntry.name); 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 @@
-
Create Template
+
Create Template
+
@@ -116,7 +117,7 @@
- +
@@ -164,7 +165,7 @@
Required
-
+
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 { 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 054b5686e..f330b2f83 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 @@ -1,3 +1,23 @@ .template-mapping-list { cursor: pointer; +} + +a.accordion-delete i { + color: red; +} + +a.accordion-delete i:hover { + color: #007bff; + cursor: pointer; + transition-duration: .5s; + /* for Safari & Chrome */ + -webkit-transition-duration: .5s; +} + +a.accordion-delete { + margin-top: 0; +} + +.template-mapping-list p{ + display: contents; } \ 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 6ae5c1122..3a7b0225e 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 @@ -4,11 +4,11 @@
-
+
- @@ -16,20 +16,21 @@
- +
+ + + \ 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 338c8f7cd..2e4d8c6e3 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 @@ -21,6 +21,7 @@ export class TemplMappListingComponent implements OnInit { isCreate = true; currentFile: string; edit = false; + fileToDelete: any = {}; constructor( private packageCreationStore: PackageCreationStore, @@ -122,5 +123,17 @@ export class TemplMappListingComponent implements OnInit { getValue(file: string) { return this.templateAndMappingMap.get(file); } + initDelete(file) { + console.log(file); + this.fileToDelete = file; + } + condifrmDelete() { + console.log(this.templateAndMappingMap); + this.templateAndMappingMap.delete(this.fileToDelete); + if (this.templateAndMappingMap.size <= 0) { + this.openCreationView(); + } + + } } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.html index 80df7c637..f4f305ee9 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.html @@ -1,5 +1,5 @@ -
- +
-- cgit 1.2.3-korg