diff options
author | Ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com> | 2021-01-11 14:10:35 +0200 |
---|---|---|
committer | Ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com> | 2021-01-11 14:10:35 +0200 |
commit | 006cede8158bb1b3579805b6492df8b050aa83be (patch) | |
tree | fed7e59645e73d2fa235dbbdae7dd48aeeb01194 /cds-ui/designer-client/src | |
parent | 0f6d8229cff178d1eca82f8cff0c678fafbb1e9c (diff) |
Enable user to create new resource dictionary with json
Issue-ID: CCSDK-3078
Signed-off-by: Ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com>
Change-Id: I2136eb5b2cec1e9db4c7124af9f09046ff5c15f0
Diffstat (limited to 'cds-ui/designer-client/src')
10 files changed, 98 insertions, 67 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.module.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.module.ts index 0a433646d..47ed05063 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.module.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.module.ts @@ -96,7 +96,7 @@ import { CollapseModule } from 'ngx-bootstrap/collapse'; masterLoaderId: 'master', overlayBorderRadius: '0', overlayColor: 'rgba(40, 40, 40, 0.8)', - pbColor: 'red', + pbColor: '#63bdba', pbDirection: 'ltr', pbThickness: 3, hasProgressBar: true, diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/metaData.model.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/metaData.model.ts index 609b066e2..26420882c 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/metaData.model.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/metaData.model.ts @@ -20,13 +20,14 @@ export class MetaData { public name: string; - public tags: string; public dataType: string; public description: string; public entrySchema: string; public updatedBy: string; + public tags: string; + public required: string; + public createdDate: string; public libraryInstance: string; - public required: string; public derivedFrom: string; } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-creation.service.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-creation.service.ts index df90e6cd1..445be2015 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-creation.service.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-creation.service.ts @@ -32,6 +32,9 @@ export class DictionaryCreationService { getSources() { return this.api.get(ResourceDictionaryURLs.getSources); -} + } + save(metadata) { + return this.api.post(ResourceDictionaryURLs.saveResourceDictionary, { ...metadata }); + } } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-creation.store.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-creation.store.ts index 20cec7448..5734d4050 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-creation.store.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-creation.store.ts @@ -29,11 +29,14 @@ import { SourcesStore } from './sources-template/sources.store'; providedIn: 'root' }) export class DictionaryCreationStore extends Store<ResourceDictionary> { - constructor(private dictionaryCreationService: DictionaryCreationService, private sourcesStore: SourcesStore) { + constructor( + private dictionaryCreationService: DictionaryCreationService, + private sourcesStore: SourcesStore + ) { super(new ResourceDictionary()); } - - changeMetaData(metaDataObject: MetaData) { + // changeMetaData(metaDataObject: MetaData) { + changeMetaData(metaDataObject: any) { console.log(metaDataObject); this.setState({ ...this.state, @@ -43,7 +46,7 @@ export class DictionaryCreationStore extends Store<ResourceDictionary> { getSources() { this.sourcesStore.state$.subscribe(data => { - console.log(data); + console.log(data); }); } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-editor/dictionary-editor.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-editor/dictionary-editor.component.html index 93d7df7d1..c0cb818eb 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-editor/dictionary-editor.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-editor/dictionary-editor.component.html @@ -17,6 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */--> -<ace-editor [(text)]="text" [mode]="'javascript'" [autoUpdateContent]="true" -[durationBeforeCallback]="1000" (textChanged)="textChanged($event)" [theme]="'tomorrow_night_bright'" #editor style="height:500px;"> -</ace-editor> +<ace-editor [(text)]="text" [mode]="'json'" [autoUpdateContent]="true" [durationBeforeCallback]="1000" + (textChanged)="textChanged($event)" [theme]="'tomorrow_night_bright'" #editor style="height:500px;"> +</ace-editor>
\ No newline at end of file diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-editor/dictionary-editor.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-editor/dictionary-editor.component.ts index 157a5aa25..63725a228 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-editor/dictionary-editor.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-editor/dictionary-editor.component.ts @@ -18,6 +18,8 @@ * ============LICENSE_END========================================================= */ import { Component, OnInit } from '@angular/core'; +import { DictionaryCreationService } from '../dictionary-creation.service'; +import { DictionaryCreationStore } from '../dictionary-creation.store'; @Component({ selector: 'app-dictionary-editor', @@ -26,14 +28,18 @@ import { Component, OnInit } from '@angular/core'; }) export class DictionaryEditorComponent implements OnInit { text = ''; - constructor() { + constructor( + private dictionaryStore: DictionaryCreationStore, + private dictionaryService: DictionaryCreationService + ) { } ngOnInit() { } textChanged(event) { - console.log(event); + console.log(JSON.parse(event)); + this.dictionaryStore.changeMetaData(JSON.parse(event)); } } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-metadata/dictionary-metadata.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-metadata/dictionary-metadata.component.ts index aa975f87a..caeac83f1 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-metadata/dictionary-metadata.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/dictionary-metadata/dictionary-metadata.component.ts @@ -73,6 +73,7 @@ export class DictionaryMetadataComponent implements OnInit { } saveMetaDataToStore() { - this.dictionaryCreationStore.changeMetaData(this.metaDataTab); + console.log(this.metaDataTab); + // this.dictionaryCreationStore.changeMetaData(this.metaDataTab); } } 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 bf183216d..637c87d7a 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 @@ -33,12 +33,12 @@ </div> </header> <div class="container-fluid body-container"> - <div class="container card creat-card col-11"> - <div class="single-line-model customKeyTitle"> - <h5 class="label-name w-100 "> - Dictionary Name - </h5> - <!-- <label class="label-name"></label> --> + <div class="container card creat-card col-11"> + <div class="single-line-model customKeyTitle"> + <h5 class="label-name w-100 "> + Dictionary Name + </h5> + <!-- <label class="label-name"></label> --> <span>Last modified {{createDate}} by me</span> </div> </div> @@ -46,7 +46,7 @@ <div class="container-fluid body-container"> <div class="container"> <div class="creat-action-container"> - <a class="action-button" (click)="saveDictionaryToStore()"> + <a class="action-button" (click)="createDictionary()"> <i class="icon-save-sm" aria-hidden="true"></i> <span>Save</span> </a> @@ -69,54 +69,55 @@ <div class="nav nav-tabs ed" id="nav-tab" role="tablist"> <a class="nav-item nav-link active" id="nav-metadata-tab" data-toggle="tab" href="#nav-metadata" role="tab" aria-controls="nav-metadata" aria-selected="false" - autofocus #nameit (focusout)="test()">METADATA</a> - <a class="edit-button" id="nav-editor-tab" data-toggle="tab" href="#nav-editor" - role="tab" aria-controls="nav-editor" aria-selected="false">EDITOR MODE</a> + autofocus #nameit (focusout)="saveDictionaryToStore()">METADATA</a> + <a class="edit-button" id="nav-editor-tab" data-toggle="tab" href="#nav-editor" role="tab" + aria-controls="nav-editor" aria-selected="false">EDITOR MODE</a> - </div> - </div> + </div> + </div> </nav> - <div> - <div class="row mt-4"> - <div class="col"> - <div class="tab-content" id="nav-tabContent"> - <div class="tab-pane fade show active" id="nav-metadata" role="tabpanel" - aria-labelledby="nav-metadata-tab"> - <app-dictionary-metadata></app-dictionary-metadata> - <nav class="row"> - <!--Nav Tabs--> - <div class="col"> - <div class="nav nav-tabs " id="nav-tab" role="tablist"> - <a class="nav-item nav-link active" id="nav-source-tab" data-toggle="tab" - href="#nav-source" role="tab" aria-controls="nav-source" aria-selected="false" - >SOURCES</a> + <div> + <div class="row mt-4"> + <div class="col"> + <div class="tab-content" id="nav-tabContent"> + <div class="tab-pane fade show active" id="nav-metadata" role="tabpanel" + aria-labelledby="nav-metadata-tab"> + <app-dictionary-metadata></app-dictionary-metadata> + <nav class="row"> + <!--Nav Tabs--> + <div class="col"> + <div class="nav nav-tabs " id="nav-tab" role="tablist"> + <a class="nav-item nav-link active" id="nav-source-tab" + data-toggle="tab" href="#nav-source" role="tab" + aria-controls="nav-source" aria-selected="false">SOURCES</a> + </div> </div> - </div> - </nav> - <div class="row mt-4"> - <div class="col"> - <div class="tab-content" id="nav-tabContent"> - <div class="tab-pane fade show active" id="nav-source" role="tabpanel" - aria-labelledby="nav-source-tab"> - <app-sources-template></app-sources-template> + </nav> + <div class="row mt-4"> + <div class="col"> + <div class="tab-content" id="nav-tabContent"> + <div class="tab-pane fade show active" id="nav-source" role="tabpanel" + aria-labelledby="nav-source-tab"> + <app-sources-template></app-sources-template> + </div> </div> </div> </div> </div> - </div> - <div class="tab-pane fade col-11" id="nav-editor" role="tabpanel" - aria-labelledby="nav-editor-tab"> - <div class="card creat-card"> - <div class="editor-container"> - <app-dictionary-editor></app-dictionary-editor> - </div></div> + <div class="tab-pane fade col-11" id="nav-editor" role="tabpanel" + aria-labelledby="nav-editor-tab"> + <div class="card creat-card"> + <div class="editor-container"> + <app-dictionary-editor></app-dictionary-editor> + </div> + </div> + </div> </div> </div> </div> - </div> - + + </div> </div> </div> - </div> -</div>
\ No newline at end of file + </div>
\ No newline at end of file diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/resource-dictionary-creation.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/resource-dictionary-creation.component.ts index e32db8a37..c40679718 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/resource-dictionary-creation.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-creation/resource-dictionary-creation.component.ts @@ -24,6 +24,7 @@ import { DictionaryModel } from '../model/dictionary.model'; import { Definition } from '../model/definition.model'; import { DictionaryMetadataComponent } from './dictionary-metadata/dictionary-metadata.component'; import { SourcesTemplateComponent } from './sources-template/sources-template.component'; +import { DictionaryCreationService } from './dictionary-creation.service'; @Component({ selector: 'app-resource-dictionary-creation', @@ -32,7 +33,11 @@ import { SourcesTemplateComponent } from './sources-template/sources-template.co }) export class ResourceDictionaryCreationComponent implements OnInit { - constructor(private router: Router, private dictionaryCreationStore: DictionaryCreationStore) { + constructor( + private router: Router, + private dictionaryCreationStore: DictionaryCreationStore, + private dictionaryService: DictionaryCreationService + ) { } modes: object[] = [ @@ -59,15 +64,26 @@ export class ResourceDictionaryCreationComponent implements OnInit { } saveDictionaryToStore() { - this.dictionaryCreationStore.getSources(); - this.dictionaryCreationStore.state$.subscribe(dd => { - console.log(dd); - }); + // console.log('00000000000'); + // this.dictionaryCreationStore.getSources(); + // this.dictionaryCreationStore.state$.subscribe(dd => { + // console.log(dd); + // }); } - test() { + createDictionary() { + console.log('-----'); this.metadataTabComponent.saveMetaDataToStore(); - this.sourcesTemplateComponent.saveSorcesDataToStore(); + this.dictionaryCreationStore.state$.subscribe(res => { + console.log('---------------------------------------'); + console.log(res); + this.dictionaryService.save(res.metaData).subscribe(data => { + + }, err => { + + }); + }); + // this.sourcesTemplateComponent.saveSorcesDataToStore(); } goBackToDashBorad() { diff --git a/cds-ui/designer-client/src/styles.css b/cds-ui/designer-client/src/styles.css index 5d797203a..88c6159f1 100644 --- a/cds-ui/designer-client/src/styles.css +++ b/cds-ui/designer-client/src/styles.css @@ -3014,7 +3014,7 @@ animation: glowing 1500ms infinite; /* -------- ace editor style -------- */ .editor-container{ height: 55vh !important; - overflow: scroll; + /* overflow: scroll; */ } .ace_print-margin{ left: 100% !important; |