Fix template&mapping in view/create
Issue-ID: CCSDK-2450
Signed-off-by: AhmedEldeeb50 <ahmed.eldeeb.ext@orange.com>
Change-Id: If84fba1cb7835cd3338767f9546bce0544d3dd1c
diff --git a/cds-ui/designer-client/angular.json b/cds-ui/designer-client/angular.json
index e503c15..3be0e65 100644
--- a/cds-ui/designer-client/angular.json
+++ b/cds-ui/designer-client/angular.json
@@ -82,8 +82,8 @@
},
{
"type": "anyComponentStyle",
- "maximumWarning": "6kb",
- "maximumError": "10kb"
+ "maximumWarning": "16kb",
+ "maximumError": "20kb"
}
]
}
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 cdc73f1..e1b0f83 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,12 +1,12 @@
<div class="row template-mapping-action">
<div class="col">
<h6 [hidden]="edit" class="create-title">Create Template</h6>
- <button (click)="closeCreationForm()" [hidden]="!edit" class="btn btn-outline-secondary"><i
+ <button (click)="openListView()" [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 data-toggle="modal" [hidden]="!edit" (click)="initDelete()" data-target="#templateDeletionModal2"
+ <button data-toggle="modal" [hidden]="!edit" data-target="#templateDeletionModal2"
class="btn btn-outline-danger" title="Delete Template">Delete</button>
@@ -301,4 +301,4 @@
</div>
</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-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 f6bae06..af7acc2 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
@@ -18,11 +18,11 @@
styleUrls: ['./templ-mapp-creation.component.css']
})
export class TemplMappCreationComponent implements OnInit, OnDestroy {
- @Output() showListViewParent = new EventEmitter<any>();
- @Output() openList = new EventEmitter<any>();
+ @Output() showListView = new EventEmitter<any>();
+ @Output() showCreationView = new EventEmitter<any>();
public uploadedFiles: FileSystemFileEntry[] = [];
- private fileNames: Set<string> = new Set();
- private jsonConvert = new JsonConvert();
+ fileNames: Set<string> = new Set();
+ jsonConvert = new JsonConvert();
public files: NgxFileDropEntry[] = [];
fileName: any;
templateInfo = new TemplateInfo();
@@ -179,8 +179,6 @@
this.uploadedFiles.splice(index, 1);
}
- initDelete(file) {
- }
confirmDelete() {
// Delete from templates
this.sharedService.deleteFromList(this.fileName);
@@ -191,7 +189,7 @@
this.packageCreationStore.state.templates.files.size > 0 ||
this.packageCreationStore.state.mapping.files.size > 0
) {
- this.closeCreationForm();
+ this.openListView();
}
}
@@ -267,11 +265,13 @@
}
openListView() {
- this.showListViewParent.emit('tell parent to open create views');
+ console.log('open List view');
+ this.showListView.emit('tell parent to open create views');
}
- closeCreationForm() {
- this.openList.emit('close create form and open list');
+ openCreationView() {
+ console.log('close creation view');
+ this.showCreationView.emit('close create form and open list');
}
getMappingTableFromTemplate(e) {
@@ -337,7 +337,7 @@
// }
this.fileName = '';
this.toastr.success('File is created', 'success');
- this.closeCreationForm();
+ this.openListView();
} else {
console.log('this file already exist');
this.toastr.error('File name already exist', 'Error');
@@ -351,6 +351,7 @@
selectSource(dict, e) {
const source = e.target.value;
let keyDepend = null;
+ this.dependancies.set(dict.name, null);
try {
keyDepend = dict.definition.sources[source].properties['key-dependencies'] || null;
} catch (e) { }
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 e49b25a..3e37798 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 (click)="createNewTemplate()" class="create-template-mapping-button">
<i class="fa fa-plus"></i> <span>Create Template</span>
</a>
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 c790422..26740f3 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
@@ -13,11 +13,11 @@
styleUrls: ['./templ-mapp-listing.component.css']
})
export class TemplMappListingComponent implements OnInit {
- @Output() showCreationViewParentNotification = new EventEmitter<any>();
- @Output() showFullView = new EventEmitter<any>();
- private templateAndMappingMap = new Map<string, TemplateAndMapping>();
- private templates: Template;
- private mapping: Mapping;
+ @Output() showCreationView = new EventEmitter<any>();
+ @Output() showListView = new EventEmitter<any>();
+ templateAndMappingMap = new Map<string, TemplateAndMapping>();
+ templates: Template;
+ mapping: Mapping;
isCreate = true;
currentFile: string;
edit = false;
@@ -40,6 +40,11 @@
}
this.packageCreationStore.state$.subscribe(cba => {
+ if (this.packageCreationStore.state.mapping.files.size > 0 || this.packageCreationStore.state.templates.files.size > 0) {
+ this.openListView();
+ } else {
+ this.openCreationView();
+ }
if (cba.templates) {
this.templates = cba.templates;
this.mapping = cba.mapping;
@@ -58,7 +63,6 @@
const isFromTemplate = false;
this.setIsMappingOrTemplate(key, templateAndMapping, isFromTemplate);
});
- console.log('hello there ');
console.log(this.templateAndMappingMap);
}
this.deleteFromList();
@@ -83,6 +87,7 @@
console.log('response from actionList');
console.log(res);
if (res) {
+ console.log('xccccccccccvvvvvv');
this.templateAndMappingMap.delete(res);
if (this.templateAndMappingMap.size <= 0) {
this.openCreationView();
@@ -91,14 +96,17 @@
});
}
- openCreationView() {
- this.showCreationViewParentNotification.emit('tell parent to open create views');
- console.log('disable edit mode');
+ createNewTemplate() {
+ this.openCreationView();
this.sharedService.disableEdit();
-
}
- FullView() {
- this.showFullView.emit('show full view');
+ openCreationView() {
+ this.showCreationView.emit('tell parent to open create views');
+ console.log('disable edit mode');
+ }
+ openListView() {
+ console.log('open list view');
+ this.showListView.emit('show full view');
}
setSourceCodeEditor(key: string) {
@@ -125,7 +133,7 @@
templateInfo.type += 'mapping';
}
this.templateStore.changeTemplateInfo(templateInfo);
- this.FullView();
+ this.openCreationView();
this.sharedService.enableEdit();
});
}
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 f4f305e..48a5033 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,10 +1,9 @@
<div [hidden]="listView">
- <app-templ-mapp-listing [hidden]="!creationView" (showCreationViewParentNotification)="openCreationView($event)"
- (showFullView)="openListView($event)">
+ <app-templ-mapp-listing (showCreationView)="openCreationView()" (showListView)="openListView()">
</app-templ-mapp-listing>
</div>
<div [hidden]="creationView">
- <app-templ-mapp-creation (showListViewParent)="openListView($event)" (openList)="closeCreationView()">
+ <app-templ-mapp-creation (showListView)="openListView()" (showCreationView)="openCreationView()">
</app-templ-mapp-creation>
</div>
\ No newline at end of file
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.ts
index af6ced0..470cf27 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.ts
@@ -27,9 +27,6 @@
this.listView = false;
console.log('URL contains Id');
this.sharedService.enableEdit();
- if (this.pakcageStore.state.mapping.files.size > 0 || this.pakcageStore.state.templates.files.size > 0) {
- this.openListView();
- }
} else {
console.log('Create mode');
this.pakcageStore.clear();
@@ -37,18 +34,16 @@
}
}
openCreationView() {
+ console.log('open creation view');
this.creationView = false;
this.listView = true;
}
openListView() {
- this.listView = false;
- this.creationView = false;
- }
-
- closeCreationView() {
+ console.log('open list view');
this.creationView = true;
this.listView = false;
+
}
}