diff options
author | 2018-11-22 13:37:31 +0530 | |
---|---|---|
committer | 2018-11-23 12:48:21 +0530 | |
commit | b734ea21ac7be393c59cf9976f0e5ddeaf27d568 (patch) | |
tree | dde5d205c378ac748bcecdf7f17f5a41567156fe /catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts | |
parent | abbd5cf62a0bdd6a22b9bea0cf589e42da0be229 (diff) |
Service Workflow changes
Service workflow change with few bug fixes
Change-Id: Ice2376565bf46fb8d86fb6062654ec54bb2daa43
Issue-ID: SDC-1937
Signed-off-by: siddharth0905 <siddharth.singh4@amdocs.com>
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts')
-rw-r--r-- | catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts | 58 |
1 files changed, 52 insertions, 6 deletions
diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts index 8844cf65bb..de795eb8f4 100644 --- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts +++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts @@ -1,6 +1,6 @@ import {Component, Input} from '@angular/core'; import {DataTypeService} from "app/ng2/services/data-type.service"; -import {OperationParameter} from 'app/models'; +import {OperationParameter, InputBEModel} from 'app/models'; import {DropdownValue} from "app/ng2/components/ui/form-components/dropdown/ui-element-dropdown.component"; @Component({ @@ -11,8 +11,7 @@ import {DropdownValue} from "app/ng2/components/ui/form-components/dropdown/ui-e export class ParamRowComponent { @Input() param: OperationParameter; - @Input() inputProps: Array<DropdownValue>; - @Input() propTypes: { [key: string]: string }; + @Input() inputProps: Array<InputBEModel>; @Input() onRemoveParam: Function; @Input() isAssociateWorkflow: boolean; @Input() readonly: boolean; @@ -21,14 +20,61 @@ export class ParamRowComponent { propTypeEnum: Array<String> = []; filteredInputProps: Array<DropdownValue> = []; + constructor(private dataTypeService: DataTypeService) {} + ngOnInit() { - this.propTypeEnum = _.uniq(_.toArray(this.propTypes)); + this.propTypeEnum = _.uniq( + _.map( + this.getPrimitiveSubtypes(), + prop => prop.type + ) + ); + console.log(this.dataTypeService.getAllDataTypes()); this.onChangeType(); } onChangeType() { - this.filteredInputProps = _.filter(this.inputProps, prop => { - return this.propTypes[prop.value] === this.param.type; + this.filteredInputProps = _.map( + _.filter( + this.getPrimitiveSubtypes(), + prop => prop.type === this.param.type + ), + prop => new DropdownValue(prop.uniqueId, prop.name) + ); + } + + getPrimitiveSubtypes(): Array<InputBEModel> { + const flattenedProps: Array<any> = []; + const dataTypes = this.dataTypeService.getAllDataTypes(); + _.forEach(this.inputProps, prop => { + const type = _.find( + _.toArray(dataTypes), + (type: any) => type.name === prop.type + ); + if (!type.properties) { + flattenedProps.push(prop); + } else { + _.forEach(type.properties, subType => { + if (this.isTypePrimitive(subType.type)) { + flattenedProps.push({ + type: subType.type, + name: `${prop.name}.${subType.name}`, + uniqueId: `${prop.uniqueId}.${subType.name}` + }); + } + }); + } }); + + return flattenedProps; + } + + isTypePrimitive(type): boolean { + return ( + type === 'string' || + type === 'integer' || + type === 'float' || + type === 'boolean' + ); } } |