diff options
author | 2021-01-13 19:50:20 +0200 | |
---|---|---|
committer | 2021-01-13 19:50:20 +0200 | |
commit | 50b86c6a59e2a65c4a2ff5c97997bba21da6a98b (patch) | |
tree | 05ad055a9cef26ae37c8fb648ed1217c08004511 /cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/sources-template/sources-template.component.ts | |
parent | bb91b6eedec5d15ec4d9e473f27dd63592762cf9 (diff) |
enable 2-way binding between metadata and editor tabs
Issue-ID: CCSDK-3083
Signed-off-by: Ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com>
Change-Id: I9073e6c9a50e5d2ba34ab60666135cead718e059
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/sources-template/sources-template.component.ts')
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/sources-template/sources-template.component.ts | 36 |
1 files changed, 26 insertions, 10 deletions
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 1b70a17ef..bec8c4bf3 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 @@ -20,6 +20,7 @@ import { Component, OnInit } from '@angular/core'; import { CdkDragDrop, moveItemInArray, transferArrayItem } from '@angular/cdk/drag-drop'; import { SourcesStore } from './sources.store'; +import { DictionaryCreationService } from '../dictionary-creation.service'; @Component({ selector: 'app-sources-template', @@ -29,7 +30,7 @@ import { SourcesStore } from './sources.store'; export class SourcesTemplateComponent implements OnInit { private searchQuery = ''; lang = 'json'; - sources = []; + sources = {}; option = []; sourcesOptions = []; textValue: any; @@ -39,20 +40,32 @@ export class SourcesTemplateComponent implements OnInit { searchText = ''; text = ''; selectedArray = []; - constructor(private sourcesStore: SourcesStore) { - this.sourcesStore.state$.subscribe(sources => { - this.sources = sources.sources; + constructor( + private sourcesStore: SourcesStore, + private dictionaryCreationService: DictionaryCreationService + ) { + + } + + ngOnInit() { + // this.sourcesStore.getAllSources(); + this.dictionaryCreationService.getSources().subscribe(sources => { + // 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" + // }; for (const key in this.sources) { if (key) { - const sourceObj = { name: key, value: JSON.stringify(this.sources[key]) }; + console.log(key + ' - ' + this.sources[key]); + const sourceObj = { name: key, value: this.sources[key] }; this.option.push(sourceObj); } } - }); - } - ngOnInit() { - this.sourcesStore.getAllSources(); + }); } saveSorcesDataToStore() { @@ -60,6 +73,8 @@ export class SourcesTemplateComponent implements OnInit { } drop(event: CdkDragDrop<string[]>) { + console.log('-------------'); + console.log(event); this.ddSource = []; if (event.previousContainer === event.container) { moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); @@ -74,7 +89,8 @@ export class SourcesTemplateComponent implements OnInit { if (key2) { const originalSources = this.sourcesOptions; for (const key of originalSources) { - if (key.name === key2) { + /* tslint:disable:no-string-literal */ + if (key.name === key2['name']) { const obj = `{${key.name}: ${key.value}}`; this.ddSource.push(obj); } |