diff options
author | 2020-01-30 14:07:25 +0000 | |
---|---|---|
committer | 2020-01-30 14:07:25 +0000 | |
commit | 23f898a96f7e8b3ecb0817abc61612bdc3d2e9aa (patch) | |
tree | fc3118a1cfbfcd5d29f5923914e8e488f16be7b2 /cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts | |
parent | da25e1649c9a10f998c8dde068641d7601a3f00a (diff) | |
parent | f2e85fa8183c684322f1f8a34ea9ed4d1f33b169 (diff) |
Merge "package creation store preparation"
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts')
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts index aa44cdf7c..cdf8cf38b 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts @@ -24,6 +24,7 @@ import {FilesContent, FolderNodeElement, MetaDataFile, MetaDataTabModel} from '. // import {saveAs} from 'file-saver/dist/FileSaver'; import * as JSZip from 'jszip'; import {PackageCreationStore} from './package-creation.store'; +import {Definition} from './mapping-models/CBAPacakge.model'; @Component({ selector: 'app-package-creation', @@ -39,6 +40,7 @@ export class PackageCreationComponent implements OnInit { private folder: FolderNodeElement = new FolderNodeElement(); private zipFile: JSZip = new JSZip(); private filesData: any = []; + private definition: Definition = new Definition(); constructor(private packageCreationStore: PackageCreationStore) { } @@ -50,28 +52,31 @@ export class PackageCreationComponent implements OnInit { saveBluePrint() { this.packageCreationStore.state$.subscribe( cbaPackage => { + console.log(cbaPackage); this.metaDataTab = cbaPackage.metaData; this.setModeType(this.metaDataTab); this.setEntryPoint(this.metaDataTab); - this.addToscaMetaDataFile(this.metaDataTab); + this.definition = cbaPackage.definitions; + this.definition.metaDataTab = cbaPackage.metaData; + this.createDefinitionsFolder(this.definition); // const vlbDefinition: VlbDefinition = new VlbDefinition(); // this.fillVLBDefinition(vlbDefinition, this.metaDataTab); this.filesData.push(this.folder.TREE_DATA); - console.log(FilesContent.getMapOfFilesNamesAndContent()); this.saveBluePrintToDataBase(); }); } - addToscaMetaDataFile(metaDataTab: MetaDataTabModel) { - const filename = 'TOSCA.meta'; - FilesContent.putData(filename, MetaDataFile.getObjectInstance(this.metaDataTab)); + private addToscaMetaDataFile(metaDataTab: MetaDataTabModel) { + const filename = 'TOSCA-Metadata/TOSCA.meta'; + FilesContent.putData(filename, MetaDataFile.getValueOfMetaData(metaDataTab)); } +// TODO use enumerator private setModeType(metaDataTab: MetaDataTabModel) { if (metaDataTab.mode.startsWith('Scripting')) { metaDataTab.mode = 'KOTLIN_SCRIPT'; @@ -82,6 +87,14 @@ export class PackageCreationComponent implements OnInit { } } + private setEntryPoint(metaDataTab: MetaDataTabModel) { + if (metaDataTab.mode.startsWith('DEFAULT')) { + metaDataTab.entryFileName = 'Definitions/vLB_CDS.json'; + } else { + metaDataTab.entryFileName = ''; + } + } + saveBluePrintToDataBase() { this.create(); this.zipFile.generateAsync({type: 'blob'}) @@ -93,7 +106,6 @@ export class PackageCreationComponent implements OnInit { create() { this.folder.TREE_DATA.forEach((path) => { - const name = path.name; if (path.children) { this.zipFile.folder(name); @@ -110,15 +122,29 @@ export class PackageCreationComponent implements OnInit { }); } - private setEntryPoint(metaDataTab: MetaDataTabModel) { - if (metaDataTab.mode.startsWith('DEFAULT')) { - metaDataTab.entryFileName = 'Definitions/vLB_CDS.json'; - } else { - metaDataTab.entryFileName = ''; - } + private createDefinitionsFolder(definition: Definition) { + this.definition.imports.forEach((key, value) => { + FilesContent.putData(key, value); + }); + /*const filenameEntry = 'vLB_CDS.json'; + const vlbDefinition: VlbDefinition = new VlbDefinition(); + const metadata: MetaDataTabModel = new MetaDataTabModel(); - } + metadata.templateAuthor = ' lldkslds'; + metadata.templateName = ' lldkslds'; + metadata.templateTags = ' lldkslds'; + metadata.templateVersion = ' lldkslds'; + metadata['author-email'] = ' lldkslds'; + metadata['user-groups'] = ' lldkslds'; + vlbDefinition.metadata = metadata; + vlbDefinition.imports = [{ + file: 'Definitions/data_types.json' + }]; + + const value = this.packageCreationUtils.transformToJson(vlbDefinition); + FilesContent.putData(filenameEntry, value);*/ + } } |