summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row
diff options
context:
space:
mode:
authorArielk <Ariel.Kenan@amdocs.com>2019-04-21 16:07:44 +0300
committerAvi Gaffa <avi.gaffa@amdocs.com>2019-04-22 12:07:46 +0000
commitc21ba95e56f70ba9fbe0daa3ac4b413424b323eb (patch)
tree5158a77b0cc7d42c0c3f91ddf64473995494db6c /catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row
parentcaa3ce9b5538a7ff2e72ae4f1afe3e903ae09c8a (diff)
bug fixes to operation screen and External workflowartifact completion
Change-Id: I9d71385d6e29e1736a24f9d84581e465187e9f26 Issue-ID: SDC-2249 Signed-off-by: Arielk <Ariel.Kenan@amdocs.com>
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row')
-rw-r--r--catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.html4
-rw-r--r--catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts75
2 files changed, 57 insertions, 22 deletions
diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.html b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.html
index aa4277c004..3ac9328487 100644
--- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.html
+++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.html
@@ -39,7 +39,7 @@
<div class="cell field-property" *ngIf="isInputParam">
<select
- *ngIf="filteredInputProps.length || !isAssociateWorkflow"
+ *ngIf="filteredInputProps.length || operationOutputCats.length || !isAssociateWorkflow"
[(ngModel)]="param.inputId"
(change)="onChangeProperty($event)"
[ngClass]="{'disabled': readonly}"
@@ -60,7 +60,7 @@
</optgroup>
</select>
<span
- *ngIf="!filteredInputProps.length && isAssociateWorkflow"
+ *ngIf="!filteredInputProps.length && !operationOutputCats.length && isAssociateWorkflow"
class="no-properties-error">
{{ 'PARAM_NONE_OF_TYPE' | translate }}
</span>
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 1b51d721af..bdf1003a64 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 {OperationModel, OperationParameter, InputBEModel} from 'app/models';
+import {OperationModel, OperationParameter, InputBEModel, DataTypeModel} from 'app/models';
import {DropDownOption} from "../operation-creator.component";
import {DropdownValue} from "app/ng2/components/ui/form-components/dropdown/ui-element-dropdown.component";
@@ -38,12 +38,38 @@ export class ParamRowComponent {
constructor(private dataTypeService: DataTypeService) {}
ngOnInit() {
- this.propTypeEnum = _.uniq(
- _.map(
- this.getPrimitiveSubtypes(),
- prop => prop.type
- )
- );
+ if (this.isInputParam) {
+ this.propTypeEnum = _.uniq(
+ _.map(
+ _.concat(
+ this.getPrimitiveSubtypes(),
+ _.reduce(
+ this.operationOutputs,
+ (acc, op) => [...acc, ...op.outputs.listToscaDataDefinition],
+ [])
+ ),
+ prop => prop.type
+ )
+ );
+ } else {
+ const dataTypes: Array<DataTypeModel> = _.toArray(this.dataTypeService.getAllDataTypes());
+ this.propTypeEnum = _.concat(
+ _.map(
+ _.filter(
+ dataTypes,
+ type => this.isTypePrimitive(type.name)
+ ),
+ type => type.name
+ ).sort(),
+ _.map(
+ _.filter(
+ dataTypes,
+ type => !this.isTypePrimitive(type.name)
+ ),
+ type => type.name
+ ).sort()
+ );
+ }
this.onChangeType();
this.validityChanged();
@@ -54,6 +80,11 @@ export class ParamRowComponent {
}
onChangeType() {
+ if (!this.isInputParam) {
+ this.validityChanged();
+ return;
+ }
+
this.filteredInputProps = _.map(
_.filter(
this.getPrimitiveSubtypes(),
@@ -115,21 +146,25 @@ export class ParamRowComponent {
const dataTypes = this.dataTypeService.getAllDataTypes();
_.forEach(this.inputProps, prop => {
- const type = _.find(
+ const type:DataTypeModel = _.find(
_.toArray(dataTypes),
- (type: any) => type.name === prop.type
+ (type: DataTypeModel) => type.name === prop.type
);
flattenedProps.push(prop);
- if (type.properties) {
- _.forEach(type.properties, subType => {
- if (this.isTypePrimitive(subType.type)) {
- flattenedProps.push({
- type: subType.type,
- name: `${prop.name}.${subType.name}`,
- uniqueId: `${prop.uniqueId}.${subType.name}`
- });
- }
- });
+ if (!type) {
+ console.error('Could not find prop in dataTypes: ', prop);
+ } else {
+ if (type.properties) {
+ _.forEach(type.properties, subType => {
+ if (this.isTypePrimitive(subType.type)) {
+ flattenedProps.push({
+ type: subType.type,
+ name: `${prop.name}.${subType.name}`,
+ uniqueId: `${prop.uniqueId}.${subType.name}`
+ });
+ }
+ });
+ }
}
});
@@ -149,7 +184,7 @@ export class ParamRowComponent {
);
}
- isTypePrimitive(type): boolean {
+ isTypePrimitive(type: string): boolean {
return (
type === 'string' ||
type === 'integer' ||