diff options
Diffstat (limited to 'cds-ui')
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts | 4 | ||||
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/DesignerCreationMode.ts | 36 | ||||
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/CBAPacakge.model.ts | 13 | ||||
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/definitions/CBADefinition.ts (renamed from cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/definitions/VlbDefinition.ts) | 2 | ||||
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation-extraction.service.ts | 18 | ||||
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.store.ts | 18 |
6 files changed, 72 insertions, 19 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts index a78fe4ed1..7ca429dff 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts @@ -6,7 +6,7 @@ import {FilesContent, FolderNodeElement} from '../package-creation/mapping-model import {MetadataTabComponent} from '../package-creation/metadata-tab/metadata-tab.component'; import * as JSZip from 'jszip'; import {ConfigurationDashboardService} from './configuration-dashboard.service'; -import {TemplateTopology, VlbDefinition} from '../package-creation/mapping-models/definitions/VlbDefinition'; +import {TemplateTopology, CBADefinition} from '../package-creation/mapping-models/definitions/CBADefinition'; import {CBAPackage} from '../package-creation/mapping-models/CBAPacakge.model'; import {PackageCreationUtils} from '../package-creation/package-creation.utils'; import {PackageCreationModes} from '../package-creation/creationModes/PackageCreationModes'; @@ -43,7 +43,7 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl id: any; currentBlob = new Blob(); - vlbDefinition: VlbDefinition = new VlbDefinition(); + vlbDefinition: CBADefinition = new CBADefinition(); isSaveEnabled = false; versionPattern = '^(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)$'; metadataClasses = 'nav-item nav-link active'; 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()); } 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 e34b5491b..c8c93cd14 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,5 +1,5 @@ import {MetaDataTabModel} from './metadata/MetaDataTab.model'; -import {TemplateTopology} from './definitions/VlbDefinition'; +import {TemplateTopology} from './definitions/CBADefinition'; export class Definition { @@ -65,6 +65,13 @@ export class Scripts { } } +export class Plans extends Base { + +} + +export class Requirements extends Base { +} + export class Template { public files: Map<string, string>; @@ -94,6 +101,8 @@ export class CBAPackage { public templates: Template; public mapping: Mapping; public templateTopology: TemplateTopology; + public plans: Plans; + public requirements: Requirements; constructor() { @@ -103,6 +112,8 @@ export class CBAPackage { this.templates = new Template(); this.mapping = new Mapping(); this.templateTopology = new TemplateTopology(); + this.plans = new Plans(); + this.requirements = new Requirements(); } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/definitions/VlbDefinition.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/definitions/CBADefinition.ts index 7a029fb3f..74681fb2c 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/definitions/VlbDefinition.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/definitions/CBADefinition.ts @@ -9,7 +9,7 @@ export class TemplateTopology { } @JsonObject -export class VlbDefinition { +export class CBADefinition { // tslint:disable-next-line:variable-name tosca_definitions_version: string; diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation-extraction.service.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation-extraction.service.ts index f44f68887..585c16929 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation-extraction.service.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation-extraction.service.ts @@ -1,6 +1,6 @@ import {Injectable, ViewChild} from '@angular/core'; import {MetaDataTabModel} from './mapping-models/metadata/MetaDataTab.model'; -import {TemplateTopology, VlbDefinition} from './mapping-models/definitions/VlbDefinition'; +import {CBADefinition, TemplateTopology} from './mapping-models/definitions/CBADefinition'; import {DslDefinition} from './mapping-models/CBAPacakge.model'; import {PackageCreationStore} from './package-creation.store'; import * as JSZip from 'jszip'; @@ -67,6 +67,10 @@ export class PackageCreationExtractionService { } else if (filename.includes('Definitions/')) { this.setImports(filename, fileData, packageName); + } else if (filename.includes('Plans/')) { + this.setPlans(filename, fileData); + } else if (filename.includes('Requirements/')) { + this.setRequirements(filename, fileData); } } }); @@ -78,11 +82,19 @@ export class PackageCreationExtractionService { this.packageCreationStore.addScripts(filename, fileData); } + public setPlans(filename: string, fileData: any) { + this.packageCreationStore.addPlans(filename, fileData); + } + + public setRequirements(filename: string, fileData: any) { + this.packageCreationStore.addRequirements(filename, fileData); + } + public setImports(filename: string, fileData: any, packageName: string) { console.log(filename); if (filename.includes('Definitions/' + packageName.trim() + '.json')) { - let definition = new VlbDefinition(); - definition = fileData as VlbDefinition; + let definition = new CBADefinition(); + definition = fileData as CBADefinition; definition = JSON.parse(fileData); const dslDefinition = new DslDefinition(); dslDefinition.content = this.packageCreationUtils.transformToJson(definition.dsl_definitions); 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 77867e55e..24a4d4735 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 @@ -25,7 +25,7 @@ import {Store} from '../../../../common/core/stores/Store'; import {CBAPackage, DslDefinition} from './mapping-models/CBAPacakge.model'; import {MetaDataTabModel} from './mapping-models/metadata/MetaDataTab.model'; -import {TemplateTopology} from './mapping-models/definitions/VlbDefinition'; +import {TemplateTopology} from './mapping-models/definitions/CBADefinition'; @Injectable({ @@ -82,6 +82,22 @@ export class PackageCreationStore extends Store<CBAPackage> { } + addPlans(name: string, content: string) { + this.setState({ + ...this.state, + plans: this.state.plans.setContent(name, content) + }); + + } + + addRequirements(name: string, content: string) { + this.setState({ + ...this.state, + requirements: this.state.requirements.setContent(name, content) + }); + + } + removeFileFromState(name: string) { this.state.scripts.files.delete(name); } |