From 9d65645ccef6cf6893f3ac2128a90c35c721575b Mon Sep 17 00:00:00 2001 From: Ahmedeldeeb50 Date: Wed, 14 Oct 2020 00:07:35 +0200 Subject: add optional attributes. Issue-ID: CCSDK-2900 Signed-off-by: Ahmedeldeeb50 Change-Id: I13ce862a0e91213b2734e4fa52a460f018692eb7 --- cds-ui/designer-client/package.json | 8 ++--- .../functions-attribute.component.html | 40 +++++++++------------- .../functions-attribute.component.ts | 31 +++++++++-------- .../templ-mapp-creation.component.html | 6 ++-- .../templ-mapp-listing.component.ts | 9 +++++ 5 files changed, 49 insertions(+), 45 deletions(-) (limited to 'cds-ui') diff --git a/cds-ui/designer-client/package.json b/cds-ui/designer-client/package.json index 096e96eb9..28e48098a 100644 --- a/cds-ui/designer-client/package.json +++ b/cds-ui/designer-client/package.json @@ -25,14 +25,14 @@ "@angular/router": "~8.2.9", "@ng-bootstrap/ng-bootstrap": "^5.1.1", "angular-animations": "0.0.10", - "angular-datatables": "^9.0.1", + "angular-datatables": "^9.0.2", "angular-font-awesome": "^3.1.2", "angular-material-expansion-panel": "^0.7.2", "backbone": "^1.4.0", "bootstrap": "^4.3.1", "dagre": "^0.8.5", - "datatables.net": "^1.10.20", - "datatables.net-dt": "^1.10.20", + "datatables.net": "^1.10.21", + "datatables.net-dt": "^1.10.21", "file-saver": "^2.0.2", "font-awesome": "^4.7.0", "graphlib": "^2.1.8", @@ -82,4 +82,4 @@ "tslint": "~5.15.0", "typescript": "~3.5.3" } -} +} \ No newline at end of file diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.html index 91386fd66..115bf6d54 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.html @@ -48,7 +48,7 @@
-
+
-
+
-
@@ -119,19 +120,10 @@ Optional Attributes
@@ -144,10 +136,10 @@
-
+
- +
@@ -156,7 +148,7 @@
- +

@@ -172,8 +164,8 @@ diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts index 2572651b5..4eee1f30c 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts @@ -20,10 +20,10 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { templateAndMappingMap = new Map(); selectedTemplates = new Map(); fileToDelete: string; - requiredInputs = []; - requiredOutputs = []; - OptionalInputs = []; - optionalOutputs = []; + requiredInputs = new Map(); + requiredOutputs = new Map(); + OptionalInputs = new Map(); + optionalOutputs = new Map(); artifactPrefix = false; constructor( @@ -88,6 +88,10 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { } addTemplates() { } + addToInputs(optionalInput) { + this.requiredInputs.set(optionalInput, this.OptionalInputs.get(optionalInput)); + this.OptionalInputs.delete(optionalInput); + } setTemplate(file: string) { if (this.selectedTemplates.has(file)) { @@ -98,11 +102,11 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { console.log(this.selectedTemplates); } - getKeys(templateAndMappingMap: Map) { - return Array.from(templateAndMappingMap.keys()); + getKeys(map: Map) { + return Array.from(map.keys()); } - getValue(file: string) { - return this.templateAndMappingMap.get(file); + getValue(file: string, map: Map) { + return map.get(file); } getObjectKey(object) { @@ -135,24 +139,21 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { const fields = interfaces[nodeName]['operations']['process'][type]; for (const [key, value] of Object.entries(fields)) { - const object = {}; - object[key] = value; - if (key === 'artifact-prefix-names') { this.artifactPrefix = true; } else if (value['required']) { console.log('This field is required = ' + key); if (type === 'inputs') { - this.requiredInputs.push(Object.assign({}, object)); + this.requiredInputs.set(key, Object.assign({}, value)); } else { - this.requiredOutputs.push(Object.assign({}, object)); + this.requiredOutputs.set(key, Object.assign({}, value)); } } else { console.log('This field is Optional ' + key); if (type === 'inputs') { - this.OptionalInputs.push(Object.assign({}, object)); + this.OptionalInputs.set(key, Object.assign({}, value)); } else { - this.optionalOutputs.push(Object.assign({}, object)); + this.optionalOutputs.set(key, Object.assign({}, value)); } } } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html index de97a4679..6dc120728 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html @@ -146,7 +146,8 @@ ({{resourceDictionaryRes.length}} attributes in total)

- +
@@ -230,7 +231,8 @@ --> -
+
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts index 3a05bcfc5..591553cea 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts @@ -174,6 +174,7 @@ export class TemplMappListingComponent implements OnInit, OnDestroy { initDelete(file) { console.log(file); const templateKey = 'Templates/' + file + '-template'; + const mappingKey = 'Templates/' + file + '-mapping.json'; // tslint:disable-next-line: forin for (const templateType in TemplateType) { const fileName = templateKey + '.' + TemplateType[templateType]; @@ -182,11 +183,19 @@ export class TemplMappListingComponent implements OnInit, OnDestroy { break; } } + if (this.fileToDelete.length <= 0) { + // tslint:disable-next-line: forin + if (this.packageCreationStore.state.mapping.files.has(mappingKey)) { + this.fileToDelete = mappingKey; + } + + } } condifrmDelete() { const fullName = this.fileToDelete.split('/')[1]; + console.log(this.fileToDelete + ' -- ' + fullName); const file = fullName.substr(0, fullName.lastIndexOf('-')); const ext = fullName.substr(fullName.lastIndexOf('.') + 1); this.templateAndMappingMap.delete(file); -- cgit 1.2.3-korg