summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/ng2/pages')
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.html8
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.ts35
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts4
3 files changed, 35 insertions, 12 deletions
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.html b/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.html
index e0804637c6..b61d25cb25 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.html
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.html
@@ -22,10 +22,10 @@
<form class="w-sdc-form">
<div class="i-sdc-form-item">
<label class="i-sdc-form-label required">Input Value</label>
- <select [(ngModel)]="selectInputValue" name="selectInputValue">
- <option *ngFor="let index of inputModel"
- [ngValue]="index">{{index.name}}</option>
- </select>
+ <select [(ngModel)]="selectInputValue" name="selectInputValue">
+ <option *ngFor="let input of inputs"
+ [ngValue]="input">{{input.name}}</option>
+ </select>
</div>
</form>
</div>
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.ts
index 64ebcaa540..0bdd028d93 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.ts
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.ts
@@ -18,10 +18,14 @@
*/
import {Component} from '@angular/core';
-import {InputBEModel, ComponentMetadata} from 'app/models';
+import {
+ ComponentMetadata, DataTypeModel, PropertyBEModel
+} from 'app/models';
import {TopologyTemplateService} from "../../../services/component-services/topology-template.service";
import {WorkspaceService} from "../../workspace/workspace.service";
import {PropertiesService} from "../../../services/properties.service";
+import {PROPERTY_DATA} from "../../../../utils/constants";
+import {DataTypeService} from "../../../services/data-type.service";
@Component({
selector: 'input-list',
@@ -32,16 +36,18 @@ import {PropertiesService} from "../../../services/properties.service";
export class InputListComponent {
selectInputValue;
- inputModel: Array<InputBEModel> = [];
isLoading: boolean;
propertyType: string;
+ inputs: Array<PropertyBEModel> = [];
+ private dataTypeProperties: Array<PropertyBEModel> = [];
private componentMetadata: ComponentMetadata;
constructor(private topologyTemplateService: TopologyTemplateService,
private workspaceService: WorkspaceService,
- private propertiesService: PropertiesService
- ) {}
+ private propertiesService: PropertiesService,
+ private dataTypeService: DataTypeService) {
+ }
ngOnInit() {
this.componentMetadata = this.workspaceService.metadata;
@@ -53,9 +59,11 @@ export class InputListComponent {
this.isLoading = true;
this.topologyTemplateService.getComponentInputsValues(this.componentMetadata.componentType, this.componentMetadata.uniqueId)
.subscribe((response) => {
- response.inputs.forEach((input: any) => {
- if (input.type === propertyType) {
- this.inputModel.push(input);
+ response.inputs.forEach((inputProperty: any) => {
+ if (propertyType === inputProperty.type) {
+ this.inputs.push(inputProperty);
+ } else if (PROPERTY_DATA.SIMPLE_TYPES.indexOf(inputProperty.type) === -1 && inputProperty.type !== propertyType) {
+ this.buildInputDataForComplexType(inputProperty, propertyType);
}
});
}, () => {
@@ -64,4 +72,17 @@ export class InputListComponent {
this.isLoading = false;
});
}
+
+ private buildInputDataForComplexType(inputProperty: PropertyBEModel, propertyType: string) {
+ let dataTypeFound: DataTypeModel = this.dataTypeService.getDataTypeByModelAndTypeName(this.componentMetadata.model, inputProperty.type);
+ if (dataTypeFound && dataTypeFound.properties) {
+ dataTypeFound.properties.forEach(dataTypeProperty => {
+ let inputData = inputProperty.name + "->" + dataTypeProperty.name;
+ dataTypeProperty.name = inputData;
+ if (this.dataTypeProperties.indexOf(dataTypeProperty) === -1 && dataTypeProperty.type === propertyType) {
+ this.inputs.push(dataTypeProperty);
+ }
+ });
+ }
+ }
}
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts
index 8e483ea5ef..09fd888755 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts
@@ -527,7 +527,9 @@ export class PropertiesAssignmentComponent {
propertyInputDetail.inputName = selectInputValue.name;
propertyInputDetail.inputType = selectInputValue.type;
property.getInputValues.push(propertyInputDetail);
- property.value = '{"get_input":"' + selectInputValue.name + '"}';
+ property.value = selectInputValue.name.indexOf("->") !== -1
+ ? '{"get_input":[' + selectInputValue.name.replace("->", ", ") + ']}'
+ : '{"get_input":"' + selectInputValue.name+ '"}' ;
property.toscaGetFunctionType = ToscaGetFunctionType.GET_INPUT;
this.updateInstancePropertiesWithInput(checkedProperties, selectedInstanceData);
modal.instance.close();