diff options
author | 2020-10-22 11:32:41 +0200 | |
---|---|---|
committer | 2020-10-22 17:58:50 +0000 | |
commit | cf1e08373c11c19ef6acf6f1390225c6e9ccf4eb (patch) | |
tree | d46f0ab2f9d2decf1631702f71a7da8b4f76063a /cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes | |
parent | b88ab26ba1890190956c2c003660152027ebcdac (diff) |
adding support for plans and requirements of importing package
Issue-ID: CCSDK-2930
Signed-off-by: ShaabanEltanany <shaaban.eltanany.ext@orange.com>
Change-Id: I495054a8cf24ea44251e6600a8fe8ada88ead61b
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes')
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/DesignerCreationMode.ts | 36 |
1 files changed, 25 insertions, 11 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 d6e15ed09..b8929819e 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 @@ -1,7 +1,7 @@ import {PackageCreationModes} from './PackageCreationModes'; -import {CBAPackage, Scripts} from '../mapping-models/CBAPacakge.model'; +import {CBAPackage, Plans, Requirements, Scripts} from '../mapping-models/CBAPacakge.model'; import {FilesContent} from '../mapping-models/metadata/MetaDataTab.model'; -import {Import, Metadata, VlbDefinition} from '../mapping-models/definitions/VlbDefinition'; +import {CBADefinition, Import, Metadata} from '../mapping-models/definitions/CBADefinition'; import {PackageCreationUtils} from '../package-creation.utils'; @@ -17,6 +17,8 @@ export class DesignerCreationMode extends PackageCreationModes { this.createDefinitionsFolder(cbaPackage, packageCreationUtils); this.addScriptsFolder(cbaPackage.scripts); this.addTemplateFolder(cbaPackage); + this.addPlansFolder(cbaPackage.plans); + this.addRequirementsFolder(cbaPackage.requirements); } private addScriptsFolder(scripts: Scripts) { @@ -25,6 +27,18 @@ export class DesignerCreationMode extends PackageCreationModes { }); } + private addRequirementsFolder(requirements: Requirements) { + requirements.files.forEach((value, key) => { + FilesContent.putData(key, value); + }); + } + + private addPlansFolder(plans: Plans) { + plans.files.forEach((value, key) => { + FilesContent.putData(key, value); + }); + } + private addTemplateFolder(cbaPackage: CBAPackage) { // Create Template Files Folder cbaPackage.templates.files.forEach((value, key) => { @@ -44,7 +58,7 @@ export class DesignerCreationMode extends PackageCreationModes { } const filenameEntry = 'Definitions/' + cbaPackage.metaData.name.trim() + '.json'; - const vlbDefinition: VlbDefinition = new VlbDefinition(); + const cbaDefinition: CBADefinition = new CBADefinition(); const metadata: Metadata = new Metadata(); metadata.template_author = 'Shaaban Ebrahim'; @@ -72,9 +86,9 @@ export class DesignerCreationMode extends PackageCreationModes { }); } metadata.template_tags = fullTags; - vlbDefinition.metadata = metadata; + cbaDefinition.metadata = metadata; const files: Import[] = []; - let insideVlbDefinition: VlbDefinition = null; + let insideVlbDefinition: CBADefinition = null; if (cbaPackage.definitions.imports && cbaPackage.definitions.imports.size > 0) { cbaPackage.definitions.imports.forEach((valueOfFile, key) => { if (!key.includes(cbaPackage.metaData.name)) { @@ -86,20 +100,20 @@ export class DesignerCreationMode extends PackageCreationModes { } }); } - vlbDefinition.imports = files; + cbaDefinition.imports = files; if (cbaPackage.definitions && cbaPackage.definitions.dslDefinition && cbaPackage.definitions.dslDefinition.content) { - vlbDefinition.dsl_definitions = JSON.parse(cbaPackage.definitions.dslDefinition.content); + cbaDefinition.dsl_definitions = JSON.parse(cbaPackage.definitions.dslDefinition.content); } - // vlbDefinition.imports = files; + // cbaDefinition.imports = files; if (cbaPackage.templateTopology && cbaPackage.templateTopology.content) { - vlbDefinition.topology_template = JSON.parse(cbaPackage.templateTopology.content); + cbaDefinition.topology_template = JSON.parse(cbaPackage.templateTopology.content); } else if (insideVlbDefinition && insideVlbDefinition.topology_template) { - vlbDefinition.topology_template = insideVlbDefinition.topology_template; + cbaDefinition.topology_template = insideVlbDefinition.topology_template; } - const value = packageCreationUtils.transformToJson(vlbDefinition); + const value = packageCreationUtils.transformToJson(cbaDefinition); FilesContent.putData(filenameEntry, value); console.log(FilesContent.getMapOfFilesNamesAndContent()); } |