From 0923429c15660d6244b9fecd7ef7ef2877cba5c1 Mon Sep 17 00:00:00 2001 From: Ahmedeldeeb50 Date: Sun, 24 Jan 2021 13:30:30 +0200 Subject: enable user to add sources to the Dictionary Issue-ID: CCSDK-3083 Signed-off-by: Ahmedeldeeb50 Change-Id: Ia8365cbad47d40849a65162829cee1c812bf433b --- .../dictionary-metadata.component.html | 13 ++- .../resource-dictionary-creation.component.html | 2 +- .../sources-template.component.html | 77 ++++--------- .../sources-template/sources-template.component.ts | 120 ++++++++++++++++----- 4 files changed, 122 insertions(+), 90 deletions(-) (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary') diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-metadata/dictionary-metadata.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-metadata/dictionary-metadata.component.html index 943707e6e..b60bc328a 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-metadata/dictionary-metadata.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-metadata/dictionary-metadata.component.html @@ -21,7 +21,7 @@
- +
- +
- +
Seprate tags with comma or space
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/resource-dictionary-creation.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/resource-dictionary-creation.component.html index 26857e600..00d6e31d3 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/resource-dictionary-creation.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/resource-dictionary-creation.component.html @@ -115,7 +115,7 @@ autofocus #nameit (focusout)="saveDictionaryToStore()">METADATA SOURCES - EDITOR MODE
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/sources-template/sources-template.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/sources-template/sources-template.component.html index 14a0b6668..3eddaa79a 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/sources-template/sources-template.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/sources-template/sources-template.component.html @@ -32,18 +32,20 @@ (change)="onChange(item, $event.target.checked)"> {{item.name}} -->
- - + +
-
+
- +
@@ -54,71 +56,30 @@
Sources List
-
+

-

-
-
- Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf - moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. - Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda - shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea - proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim - aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. -
-
-
-
-
-

- -

-
-
+
- Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf - moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. - Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda - shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea - proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim - aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. -
-
-
-
-
-

- -

-
-
-
- Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf - moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. - Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda - shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea - proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim - aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. + +
+
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/sources-template/sources-template.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/sources-template/sources-template.component.ts index 1a950163e..25b81994a 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/sources-template/sources-template.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/sources-template/sources-template.component.ts @@ -34,16 +34,19 @@ export class SourcesTemplateComponent implements OnInit { lang = 'json'; sources = {}; option = []; - sourcesOptions = []; textValue: any; selectItem: boolean; - ddSource = []; + // ddSource = []; checked: boolean; searchText = ''; text = ''; selectedArray = []; metaDataTab: MetaData = new MetaData(); + tempSources = new Map(); + toDeleteSource = new Map(); + sourcesOptions = new Map(); + constructor( private sourcesStore: SourcesStore, private dictionaryCreationService: DictionaryCreationService, @@ -58,9 +61,9 @@ export class SourcesTemplateComponent implements OnInit { // console.log(sources); this.sources = sources[0]; // this.sources = { - // "input": "source-input", "rest": "source-rest", "default":"source-default", "capability": "source-capability", - // "sdnc": "source-rest", "vault-data": "source-rest", "processor-db": "source-db", "aai-data": "source-rest", - // "script": "source-capability" + // "input": "source-input", "rest": "source-rest", "default": "source-default", "capability": "source-capability", + // "sdnc": "source-rest", "vault-data": "source-rest", "processor-db": "source-db", "aai-data": "source-rest", + // "script": "source-capability" // }; for (const key in this.sources) { if (key) { @@ -95,9 +98,13 @@ export class SourcesTemplateComponent implements OnInit { } saveSorcesDataToStore() { - console.log(this.ddSource); + const ddSource = []; + for (const key of this.sourcesOptions.keys()) { + ddSource.push(this.sourcesOptions.get(key)); + } + console.log(ddSource); this.metaDataTab.sources = {}; - for (const obj of this.ddSource) { + for (const obj of ddSource) { this.metaDataTab.sources = { ...this.metaDataTab.sources, ...obj }; } // this.metaDataTab.sources = { ...this.ddSource } @@ -105,39 +112,104 @@ export class SourcesTemplateComponent implements OnInit { this.dictionaryCreationStore.changeMetaData(this.metaDataTab); } - drop(event: CdkDragDrop) { - console.log('-------------'); - // console.log(event); + setTempSources(event, item) { + console.log(event.target.checked); + if (event.target.checked) { + this.tempSources.set(item.name, item); + } else { + this.tempSources.delete(item.name); + } + console.log(this.tempSources); + } - if (event.previousContainer === event.container) { - moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); + selectAll() { + if (this.tempSources.size === 0) { + for (const option of this.option) { + if (!this.sourcesOptions.has(option.name)) { + this.tempSources.set(option.name, option); + } + } } else { - transferArrayItem(event.previousContainer.data, - event.container.data, - event.previousIndex, - event.currentIndex); + this.tempSources = new Map(); } + } - console.log(this.sourcesOptions); - console.log(this.sources); + setToDeleteSources(event, item) { + console.log(event.target.checked); + if (event.target.checked) { + this.toDeleteSource.set(item.key, item); + } else { + this.toDeleteSource.delete(item.key); + } - this.ddSource = []; + } - const originalSources = this.sourcesOptions; - for (const key of originalSources) { + addSources() { + // this.tempSources + const originalSources = this.tempSources; + for (const key of originalSources.keys()) { /* tslint:disable:no-string-literal */ - this.ddSource.push({ - [key.name]: { - type: key.value, + this.sourcesOptions.set(key, { + [key]: { + type: originalSources.get(key).value, properties: {} } }); } + console.log(this.sourcesOptions); + this.tempSources.clear(); + this.saveSorcesDataToStore(); + } + + deleteSource() { + console.log(this.toDeleteSource); + for (const key of this.toDeleteSource.keys()) { + console.log(key); + this.sourcesOptions.delete(key); + } + this.toDeleteSource = new Map(); this.saveSorcesDataToStore(); } + // drop(event: CdkDragDrop) { + // console.log('-------------'); + // // console.log(event); + + // if (event.previousContainer === event.container) { + // moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); + // } else { + // transferArrayItem(event.previousContainer.data, + // event.container.data, + // event.previousIndex, + // event.currentIndex); + // } + + // console.log(this.sourcesOptions); + // console.log(this.sources); + + // this.ddSource = []; + + // const originalSources = this.sourcesOptions; + // for (const key of originalSources) { + // /* tslint:disable:no-string-literal */ + // this.ddSource.push({ + // [key.name]: { + // type: key.value, + // properties: {} + // } + // }); + + // } + + // this.saveSorcesDataToStore(); + // } + + getMapKey(map) { + return Object.assign({}, map.keys()); + } + searchDictionary(event: any) { this.searchQuery = event.target.value; this.searchQuery = this.searchQuery.trim(); -- cgit 1.2.3-korg