aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui
diff options
context:
space:
mode:
authorahmedeldeeb50 <ahmed.eldeeb.ext@orange.com>2020-02-18 14:13:29 +0200
committerKAPIL SINGAL <ks220y@att.com>2020-02-18 20:40:20 +0000
commit369ede4108a770ceb9639c6009f732ebce9be836 (patch)
tree86ca8780befbb8c9f6e1a01f7753d96c5d34d908 /cds-ui
parentec47175357058d256e625bf120d152dbd49b54be (diff)
Adding DSL-Definition to vlb.json file.
Fixing HashMap key and value conflict Issue-ID: CCSDK-2066 Signed-off-by: ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com> Change-Id: I781f1ffc47a4ce22eeef9651aaff1dad4bf6fcc3
Diffstat (limited to 'cds-ui')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/DesignerCreationMode.ts25
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/PackageCreationModes.ts12
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/definitions/VlbDefinition.ts20
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts22
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.utils.ts2
5 files changed, 45 insertions, 36 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 41b81eea3..b44e844be 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,8 +1,8 @@
-import {PackageCreationModes} from './PackageCreationModes';
-import {CBAPackage, Scripts} from '../mapping-models/CBAPacakge.model';
-import {FilesContent} from '../mapping-models/metadata/MetaDataTab.model';
-import {Import, Metadata, VlbDefinition} from '../mapping-models/definitions/VlbDefinition';
-import {PackageCreationUtils} from '../package-creation.utils';
+import { PackageCreationModes } from './PackageCreationModes';
+import { CBAPackage, Scripts } from '../mapping-models/CBAPacakge.model';
+import { FilesContent } from '../mapping-models/metadata/MetaDataTab.model';
+import { Import, Metadata, VlbDefinition } from '../mapping-models/definitions/VlbDefinition';
+import { PackageCreationUtils } from '../package-creation.utils';
export class DesignerCreationMode extends PackageCreationModes {
@@ -18,13 +18,13 @@ export class DesignerCreationMode extends PackageCreationModes {
}
private addScriptsFolder(scripts: Scripts) {
- scripts.files.forEach((key, value) => {
+ scripts.files.forEach((value, key) => {
FilesContent.putData(key, value);
});
}
private createDefinitionsFolder(cbaPackage: CBAPackage, packageCreationUtils: PackageCreationUtils) {
- cbaPackage.definitions.imports.forEach((key, valueOfFile) => {
+ cbaPackage.definitions.imports.forEach((valueOfFile, key) => {
FilesContent.putData(key, valueOfFile);
});
@@ -38,16 +38,21 @@ export class DesignerCreationMode extends PackageCreationModes {
metadata.template_version = cbaPackage.metaData.version;
metadata['author-email'] = 'shaaban.eltanany.ext@orange.com';
metadata['user-groups'] = 'test';
- cbaPackage.definitions.metaDataTab.mapOfCustomKey.forEach((key, customKeyValue) => {
+ cbaPackage.definitions.metaDataTab.mapOfCustomKey.forEach((customKeyValue, key) => {
metadata[key] = customKeyValue;
});
vlbDefinition.metadata = metadata;
const files: Import[] = [];
- cbaPackage.definitions.imports.forEach((key, valueOfFile) => {
- files.push({file: valueOfFile});
+ cbaPackage.definitions.imports.forEach((valueOfFile, key) => {
+ files.push({ file: valueOfFile });
});
console.log(vlbDefinition);
vlbDefinition.imports = files;
+ console.log(cbaPackage.definitions.dslDefinition.content);
+ if (cbaPackage.definitions.dslDefinition.content) {
+ vlbDefinition.dsl_definitions = JSON.parse(cbaPackage.definitions.dslDefinition.content);
+ }
+ console.log(vlbDefinition);
const value = packageCreationUtils.transformToJson(vlbDefinition);
FilesContent.putData(filenameEntry, value);
console.log('hello there');
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/PackageCreationModes.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/PackageCreationModes.ts
index 400304aab..2d234958c 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/PackageCreationModes.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/PackageCreationModes.ts
@@ -1,7 +1,7 @@
-import {CBAPackage} from '../mapping-models/CBAPacakge.model';
-import {ModeType} from '../mapping-models/ModeType';
-import {FilesContent, MetaDataTabModel} from '../mapping-models/metadata/MetaDataTab.model';
-import {PackageCreationUtils} from '../package-creation.utils';
+import { CBAPackage } from '../mapping-models/CBAPacakge.model';
+import { ModeType } from '../mapping-models/ModeType';
+import { FilesContent, MetaDataTabModel } from '../mapping-models/metadata/MetaDataTab.model';
+import { PackageCreationUtils } from '../package-creation.utils';
export abstract class PackageCreationModes {
@@ -44,11 +44,11 @@ export abstract class PackageCreationModes {
protected addToscaMetaDataFile(metaDataTab: MetaDataTabModel) {
const filename = 'TOSCA-Metadata/TOSCA.meta';
- FilesContent.putData(this.getValueOfMetaData(metaDataTab), filename);
+ FilesContent.putData(filename, this.getValueOfMetaData(metaDataTab));
}
- abstract execute(cbaPackage: CBAPackage, packageCreationUtils: PackageCreationUtils) ;
+ abstract execute(cbaPackage: CBAPackage, packageCreationUtils: PackageCreationUtils);
}
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/VlbDefinition.ts
index 2d5e520ee..c4f3ee8bd 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/VlbDefinition.ts
@@ -1,4 +1,4 @@
-import {Any, JsonObject, JsonProperty} from 'json2typescript';
+import { Any, JsonObject, JsonProperty } from 'json2typescript';
@JsonObject
@@ -8,29 +8,35 @@ export class VlbDefinition {
tosca_definitions_version: string;
metadata: Metadata;
imports: Import[];
- // dsl_definitions: DSLDefinitions;
+ // tslint:disable-next-line: variable-name
+ dsl_definitions: DslContent;
// topology_template: TopologyTemplate;
}
+@JsonObject('dsl_definitions')
+export class DslContent {
+
+}
+
@JsonObject('metadata')
export class Metadata {
@JsonProperty('template_author')
- // tslint:disable-next-line:variable-name
+ // tslint:disable-next-line:variable-name
template_author: string;
'author-email': string;
'user-groups': string;
@JsonProperty('template_name')
- // tslint:disable-next-line:variable-name
+ // tslint:disable-next-line:variable-name
template_name: string;
@JsonProperty('template_version')
- // tslint:disable-next-line:variable-name
+ // tslint:disable-next-line:variable-name
template_version: string;
@JsonProperty('template_tag')
- // tslint:disable-next-line:variable-name
+ // tslint:disable-next-line:variable-name
template_tags: string;
@JsonProperty('dictionary_group')
- // tslint:disable-next-line:variable-name
+ // tslint:disable-next-line:variable-name
dictionary_group: string;
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 c15a5dd4f..58c04e83e 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
@@ -19,15 +19,15 @@ limitations under the License.
============LICENSE_END============================================
*/
-import {Component, OnInit} from '@angular/core';
-import {FilesContent, FolderNodeElement, MetaDataTabModel} from './mapping-models/metadata/MetaDataTab.model';
+import { Component, OnInit } from '@angular/core';
+import { FilesContent, FolderNodeElement, MetaDataTabModel } from './mapping-models/metadata/MetaDataTab.model';
import * as JSZip from 'jszip';
-import {PackageCreationStore} from './package-creation.store';
-import {Definition} from './mapping-models/CBAPacakge.model';
-import {PackageCreationModes} from './creationModes/PackageCreationModes';
-import {PackageCreationBuilder} from './creationModes/PackageCreationBuilder';
-import {PackageCreationUtils} from './package-creation.utils';
+import { PackageCreationStore } from './package-creation.store';
+import { Definition } from './mapping-models/CBAPacakge.model';
+import { PackageCreationModes } from './creationModes/PackageCreationModes';
+import { PackageCreationBuilder } from './creationModes/PackageCreationBuilder';
+import { PackageCreationUtils } from './package-creation.utils';
@Component({
@@ -38,8 +38,8 @@ import {PackageCreationUtils} from './package-creation.utils';
export class PackageCreationComponent implements OnInit {
counter = 0;
modes: object[] = [
- {name: 'Designer Mode', style: 'mode-icon icon-designer-mode'},
- {name: 'Scripting Mode', style: 'mode-icon icon-scripting-mode'}];
+ { 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();
@@ -76,7 +76,7 @@ export class PackageCreationComponent implements OnInit {
saveBluePrintToDataBase() {
this.create();
- this.zipFile.generateAsync({type: 'blob'})
+ this.zipFile.generateAsync({ type: 'blob' })
.then(blob => {
this.packageCreationStore.saveBluePrint(blob);
});
@@ -84,7 +84,7 @@ export class PackageCreationComponent implements OnInit {
create() {
- FilesContent.getMapOfFilesNamesAndContent().forEach((key, value) => {
+ FilesContent.getMapOfFilesNamesAndContent().forEach((value, key) => {
this.zipFile.folder(key.split('/')[0]);
this.zipFile.file(key, value);
});
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.utils.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.utils.ts
index 4bccb3dd5..81a0ac181 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.utils.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.utils.ts
@@ -21,8 +21,6 @@ limitations under the License.
import {JsonPipe} from '@angular/common';
import {Injectable} from '@angular/core';
-import {JsonConvert} from 'json2typescript';
-
@Injectable({
providedIn: 'root'