diff options
author | 2020-10-14 09:24:16 +0000 | |
---|---|---|
committer | 2020-10-14 09:24:16 +0000 | |
commit | 0ec9be0908403dba346df1192c9fcb90eba3be81 (patch) | |
tree | 2997887c78cb3df26d1b884d68a4aae4f97379b0 /cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts | |
parent | 92a362446eda504dc1f3e42d0cb957ac51c3f1db (diff) | |
parent | 9d65645ccef6cf6893f3ac2128a90c35c721575b (diff) |
Merge "add optional attributes."
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.ts | 31 |
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)); } } } |