aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts
diff options
context:
space:
mode:
authorAhmedeldeeb50 <ahmed.eldeeb.ext@orange.com>2020-10-14 00:07:35 +0200
committerAhmedeldeeb50 <ahmed.eldeeb.ext@orange.com>2020-10-14 10:21:47 +0200
commit9d65645ccef6cf6893f3ac2128a90c35c721575b (patch)
tree2eb9fdf16d62d909eb98205e664a97a1e464f8d0 /cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts
parent1c9ca7b45163496af84fab3b7591c7353b69baa3 (diff)
add optional attributes.
Issue-ID: CCSDK-2900 Signed-off-by: Ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com> Change-Id: I13ce862a0e91213b2734e4fa52a460f018692eb7
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts31
1 files changed, 16 insertions, 15 deletions
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<string, TemplateAndMapping>();
selectedTemplates = new Map<string, TemplateAndMapping>();
fileToDelete: string;
- requiredInputs = [];
- requiredOutputs = [];
- OptionalInputs = [];
- optionalOutputs = [];
+ requiredInputs = new Map<string, {}>();
+ requiredOutputs = new Map<string, {}>();
+ OptionalInputs = new Map<string, {}>();
+ optionalOutputs = new Map<string, {}>();
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<string, TemplateAndMapping>) {
- return Array.from(templateAndMappingMap.keys());
+ getKeys(map: Map<string, any>) {
+ return Array.from(map.keys());
}
- getValue(file: string) {
- return this.templateAndMappingMap.get(file);
+ getValue(file: string, map: Map<string, any>) {
+ 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));
}
}
}