diff options
author | 2020-01-30 13:52:44 +0200 | |
---|---|---|
committer | 2020-01-30 13:52:44 +0200 | |
commit | f2e85fa8183c684322f1f8a34ea9ed4d1f33b169 (patch) | |
tree | 9926717f007177b0bac7b9d84f8cff9b8ddc25f3 /cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab | |
parent | c9b0f84a5812459aabdf59c00265dec09d771182 (diff) |
package creation store preparation
Issue-ID: CCSDK-2050
Signed-off-by: shaaban Altanany <shaaban.eltanany.ext@orange.com>
Change-Id: Ie4dcf26a138ef5237e42eb0284269006da89d5a5
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab')
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts | 100 |
1 files changed, 2 insertions, 98 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts index 894716711..710ca924a 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts @@ -1,9 +1,6 @@ import {Component, OnInit} from '@angular/core'; import {PackageCreationService} from '../package-creation.service'; -import {PackageCreationUtils} from '../package-creation.utils'; -import {Router} from '@angular/router'; -import {FilesContent, FolderNodeElement, MetaDataFile, MetaDataTabModel} from '../mapping-models/metadata/MetaDataTab.model'; -import * as JSZip from 'jszip'; +import {MetaDataTabModel} from '../mapping-models/metadata/MetaDataTab.model'; import {PackageCreationStore} from '../package-creation.store'; @@ -19,14 +16,9 @@ export class MetadataTabComponent implements OnInit { {name: 'Designer Mode', style: 'mode-icon icon-designer-mode'}, {name: 'Scripting Mode', style: 'mode-icon icon-scripting-mode'}]; private metaDataTab: MetaDataTabModel = new MetaDataTabModel(); - - private folder: FolderNodeElement = new FolderNodeElement(); - private zipFile: JSZip = new JSZip(); - private filesData: any = []; private errorMessage: string; - constructor(private packageCreationService: PackageCreationService, private packageCreationUtils: PackageCreationUtils, - private router: Router, private packageCreationStore: PackageCreationStore) { + constructor(private packageCreationService: PackageCreationService, private packageCreationStore: PackageCreationStore) { } @@ -34,94 +26,6 @@ export class MetadataTabComponent implements OnInit { this.packageCreationStore.changeMetaData(this.metaDataTab); } - saveMetaData() { - this.setModeType(this.metaDataTab); - this.setEntryPoint(this.metaDataTab); - - this.addToscaMetaDataFile(this.metaDataTab); - - // const vlbDefinition: VlbDefinition = new VlbDefinition(); - // this.fillVLBDefinition(vlbDefinition, this.metaDataTab); - - this.filesData.push(this.folder.TREE_DATA); - this.saveBluePrint(); - this.packageCreationService.refreshPackages(); - this.router.navigate(['/packages']); - - } - - addToscaMetaDataFile(metaDataTab: MetaDataTabModel) { - const filename = 'TOSCA.meta'; - FilesContent.putData(filename, MetaDataFile.getObjectInstance(this.metaDataTab)); - } - - private setModeType(metaDataTab: MetaDataTabModel) { - if (metaDataTab.mode.startsWith('Scripting')) { - metaDataTab.mode = 'KOTLIN_SCRIPT'; - } else if (metaDataTab.mode.startsWith('Designer')) { - metaDataTab.mode = 'DEFAULT'; - } else { - metaDataTab.mode = 'GENERIC_SCRIPT'; - } - } - - saveBluePrint() { - this.create(); - this.zipFile.generateAsync({type: 'blob'}) - .then(blob => { - this.packageCreationService.savePackage(blob); - - }); - } - - - create() { - this.folder.TREE_DATA.forEach((path) => { - - const name = path.name; - if (path.children) { - this.zipFile.folder(name); - path.children.forEach(children => { - const name2 = children.name; - if (FilesContent.getMapOfFilesNamesAndContent().has(name2)) { - this.zipFile.file(name + '/' + name2, FilesContent.getMapOfFilesNamesAndContent().get(name2)); - } else { - } - - }); - - } - }); - } - - private setEntryPoint(metaDataTab: MetaDataTabModel) { - if (metaDataTab.mode.startsWith('DEFAULT')) { - metaDataTab.entryFileName = 'Definitions/vLB_CDS.json'; - } else { - metaDataTab.entryFileName = ''; - } - - - } - - /* private fillVLBDefinition(vlbDefinition: VlbDefinition, metaDataTab: MetaDataTabModel) { - - const metadata: Metadata = new Metadata(); - metadata.template_author = 'Shaaban'; - metadata.template_name = metaDataTab.templateName; - metadata.template_tags = metaDataTab.tags; - - metadata.dictionary_group = 'default'; - metadata.template_version = metaDataTab.version; - metadata['author-email'] = 'shaaban.altanany.ext@orange.com'; - metadata['user-groups'] = 'ADMIN'; - vlbDefinition.tosca_definitions_version = metaDataTab.version; - vlbDefinition.metadata = metadata; - const value = this.packageCreationUtils.transformToJson(vlbDefinition); - console.log(value); - FilesContent.putData('vLB_CDS.json', value); - }*/ - validatePackageNameAndVersion() { if (this.metaDataTab.name && this.metaDataTab.version) { this.packageCreationService.checkBluePrintNameAndVersion(this.metaDataTab.name, this.metaDataTab.version).then(element => { |