diff options
author | ShaabanEltanany <shaaban.eltanany.ext@orange.com> | 2020-07-15 23:50:43 +0200 |
---|---|---|
committer | ShaabanEltanany <shaaban.eltanany.ext@orange.com> | 2020-07-16 10:37:27 +0200 |
commit | f6c51a61086e2bf892f41c912ae1e08e55d878f8 (patch) | |
tree | b3634c01414584f00de1e996686a46310f7c383d /cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation | |
parent | 0882e287bbb6aee4543f7659b1f9d001a1b01a1a (diff) |
starting manual enrichment functionality
Issue-ID: CCSDK-2542
Signed-off-by: ShaabanEltanany <shaaban.eltanany.ext@orange.com>
Change-Id: I3ce3e7aa5deb131b958cef0ca424e4d92fd7913c
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation')
4 files changed, 45 insertions, 12 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/DesignerCreationMode.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/DesignerCreationMode.ts index 184ccf9ef..58307005c 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/DesignerCreationMode.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/DesignerCreationMode.ts @@ -77,6 +77,9 @@ export class DesignerCreationMode extends PackageCreationModes { if (cbaPackage.definitions.dslDefinition.content) { vlbDefinition.dsl_definitions = JSON.parse(cbaPackage.definitions.dslDefinition.content); } + if (cbaPackage.templateTopology.content) { + vlbDefinition.topology_template = JSON.parse(cbaPackage.templateTopology.content); + } console.log(vlbDefinition); const value = packageCreationUtils.transformToJson(vlbDefinition); FilesContent.putData(filenameEntry, value); diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/CBAPacakge.model.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/CBAPacakge.model.ts index a37339d90..e34b5491b 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/CBAPacakge.model.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/CBAPacakge.model.ts @@ -1,6 +1,5 @@ import {MetaDataTabModel} from './metadata/MetaDataTab.model'; - - +import {TemplateTopology} from './definitions/VlbDefinition'; export class Definition { @@ -94,6 +93,7 @@ export class CBAPackage { public scripts: Scripts; public templates: Template; public mapping: Mapping; + public templateTopology: TemplateTopology; constructor() { @@ -102,6 +102,7 @@ export class CBAPackage { this.metaData = new MetaDataTabModel(); this.templates = new Template(); this.mapping = new Mapping(); + this.templateTopology = new TemplateTopology(); } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts index 818577a59..952fea3ca 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts @@ -41,6 +41,10 @@ export class PackageCreationService { return this.api.post(BlueprintURLs.save, body, {responseType: 'text'}); } + private enrichBlueprint(body: any | null, options?: any): Observable<any> { + return this.api.post(BlueprintURLs.enrich, body, {responseType: 'text'}); + } + async checkBluePrintNameAndVersion(name: string, version: string): Promise<boolean> { return await this.packagesListService.checkBluePrintIfItExists(name, version) .then(bluePrintModelsResult => bluePrintModelsResult != null && bluePrintModelsResult.length > 0); @@ -51,11 +55,19 @@ export class PackageCreationService { } savePackage(blob) { + const formData = this.getFormData(blob); + return this.saveBlueprint(formData); + } + enrichPackage(blob) { + const formData = this.getFormData(blob); + return this.enrichBlueprint(formData); + } + + private getFormData(blob) { const formData = new FormData(); formData.append('file', blob); - return this.saveBlueprint(formData); - + return formData; } getTemplateAndMapping(variables: string[]): Observable<ResourceDictionary[]> { diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.store.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.store.ts index 55e715654..f64e361d4 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.store.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.store.ts @@ -19,16 +19,17 @@ limitations under the License. ============LICENSE_END============================================ */ -import { Injectable } from '@angular/core'; +import {Injectable} from '@angular/core'; -import { Store } from '../../../../common/core/stores/Store'; +import {Store} from '../../../../common/core/stores/Store'; -import { CBAPackage, DslDefinition } from './mapping-models/CBAPacakge.model'; -import { PackageCreationService } from './package-creation.service'; -import { MetaDataTabModel } from './mapping-models/metadata/MetaDataTab.model'; -import { Observable } from 'rxjs'; -import { ResourceDictionary } from './mapping-models/ResourceDictionary.model'; -import { BluePrintDetailModel } from '../model/BluePrint.detail.model'; +import {CBAPackage, DslDefinition} from './mapping-models/CBAPacakge.model'; +import {PackageCreationService} from './package-creation.service'; +import {MetaDataTabModel} from './mapping-models/metadata/MetaDataTab.model'; +import {Observable} from 'rxjs'; +import {ResourceDictionary} from './mapping-models/ResourceDictionary.model'; +import {BluePrintDetailModel} from '../model/BluePrint.detail.model'; +import {TemplateTopology} from './mapping-models/definitions/VlbDefinition'; @Injectable({ @@ -59,6 +60,7 @@ export class PackageCreationStore extends Store<CBAPackage> { istemplateExist(): boolean { return this.state.templates.files.size > 0 && this.state.mapping.files.size > 0; } + changeDslDefinition(dslDefinition: DslDefinition) { this.setState({ @@ -100,6 +102,10 @@ export class PackageCreationStore extends Store<CBAPackage> { return this.packageCreationService.savePackage(blob); } + enrichBluePrint(blob): Observable<any> { + return this.packageCreationService.enrichPackage(blob); + } + addTemplate(filePath: string, fileContent: string) { this.setState({ ...this.state, @@ -121,4 +127,15 @@ export class PackageCreationStore extends Store<CBAPackage> { clear() { this.setState(new CBAPackage()); } + + setEntryDefinition(data: string) { + console.log('setting manual enrichment '); + } + + addTopologyTemplate(templateTopology: TemplateTopology) { + this.setState({ + ...this.state, + templateTopology + }); + } } |