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/properties-assignment.page.component.ts19
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts2
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts4
3 files changed, 18 insertions, 7 deletions
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 767acb41a7..2bf1b1076b 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
@@ -580,22 +580,33 @@ export class PropertiesAssignmentComponent {
private clearCheckedInstancePropertyValue() {
const checkedInstanceProperty: PropertyBEModel = this.buildCheckedInstanceProperty();
- let currentValue = checkedInstanceProperty.value;
+ const currentValue : any = checkedInstanceProperty.value;
checkedInstanceProperty.getInputValues = null;
checkedInstanceProperty.value = null;
checkedInstanceProperty.toscaFunction = null;
if (checkedInstanceProperty instanceof PropertyDeclareAPIModel && (<PropertyDeclareAPIModel>checkedInstanceProperty).propertiesName){
const propertiesNameArray = (<PropertyDeclareAPIModel>checkedInstanceProperty).propertiesName;
const parts = propertiesNameArray.split("#");
- const currentKey = checkedInstanceProperty.type === PROPERTY_TYPES.MAP ? (<DerivedFEProperty>checkedInstanceProperty.input).mapKey : null;
+ const currentKey = (checkedInstanceProperty.type == PROPERTY_TYPES.MAP || checkedInstanceProperty.type == PROPERTY_TYPES.LIST) ? (<DerivedFEProperty>checkedInstanceProperty.input).mapKey : null;
if (propertiesNameArray.length > 1){
const index = checkedInstanceProperty.subPropertyToscaFunctions.findIndex(existingSubPropertyToscaFunction => this.areEqual(existingSubPropertyToscaFunction.subPropertyPath, currentKey != null ? [currentKey] : parts.slice(1)));
checkedInstanceProperty.subPropertyToscaFunctions.splice(index, 1);
}
if(currentValue !== null && currentKey !== null){
let valueJson = JSON.parse(currentValue);
+ let tempValue = valueJson[currentKey];
delete valueJson[currentKey];
- checkedInstanceProperty.value = JSON.stringify(valueJson);
+ if (checkedInstanceProperty.type == PROPERTY_TYPES.LIST) {
+ let listValue = [];
+ valueJson.forEach(item => {
+ if (item != null && item != '' && item != tempValue) {
+ listValue.push(item);
+ }
+ });
+ checkedInstanceProperty.value = JSON.stringify(listValue);
+ } else {
+ checkedInstanceProperty.value = JSON.stringify(valueJson);
+ }
}
}
if (this.selectedInstanceData instanceof ComponentInstance) {
@@ -612,7 +623,7 @@ export class PropertiesAssignmentComponent {
if (checkedProperty instanceof PropertyDeclareAPIModel && (<PropertyDeclareAPIModel>checkedProperty).propertiesName){
const propertiesName = (<PropertyDeclareAPIModel>checkedProperty).propertiesName;
const parts = propertiesName.split("#");
- const currentKey = checkedProperty.type === PROPERTY_TYPES.MAP ? (<DerivedFEProperty>checkedProperty.input).mapKey : null;
+ const currentKey = (checkedProperty.type == PROPERTY_TYPES.MAP || checkedProperty.type == PROPERTY_TYPES.LIST) ? (<DerivedFEProperty>checkedProperty.input).mapKey : null;
if (checkedProperty.subPropertyToscaFunctions == null){
checkedProperty.subPropertyToscaFunctions = [];
}
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts
index bc73796672..0198dfd760 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts
@@ -101,7 +101,7 @@ export class ToscaFunctionComponent implements OnInit, OnChanges {
if (this.property instanceof PropertyDeclareAPIModel && this.property.subPropertyToscaFunctions && (<PropertyDeclareAPIModel> this.property).propertiesName){
let propertiesPath = (<PropertyDeclareAPIModel> this.property).propertiesName.split("#");
if (propertiesPath.length > 1){
- let keyToFind = this.property.type === PROPERTY_TYPES.MAP ? [(<DerivedFEProperty>this.property.input).mapKey] : propertiesPath.slice(1);
+ let keyToFind = (this.property.type == PROPERTY_TYPES.MAP || this.property.type == PROPERTY_TYPES.LIST) ? [(<DerivedFEProperty>this.property.input).mapKey] : propertiesPath.slice(1);
let subPropertyToscaFunction = this.property.subPropertyToscaFunctions.find(subPropertyToscaFunction => this.areEqual(subPropertyToscaFunction.subPropertyPath, keyToFind !== null ? keyToFind : propertiesPath.slice(1)));
if (subPropertyToscaFunction){
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts
index 0757e3d361..46541cf355 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts
@@ -261,7 +261,7 @@ export class ToscaGetFunctionComponent implements OnInit, OnChanges {
}
private propertyTypeToString() {
- if (this.isSubProperty() && this.property.type != PROPERTY_TYPES.MAP){
+ if (this.isSubProperty() && this.property.type != PROPERTY_TYPES.MAP && this.property.type != PROPERTY_TYPES.LIST){
return this.getType((<PropertyDeclareAPIModel>this.property).propertiesName.split("#").slice(1), this.property.type);
}
if (this.property.schemaType) {
@@ -367,7 +367,7 @@ export class ToscaGetFunctionComponent implements OnInit, OnChanges {
private hasSameType(property: PropertyBEModel | AttributeBEModel): boolean {
if (this.typeHasSchema(this.property.type)) {
- if(this.property.type === PROPERTY_TYPES.MAP && this.property instanceof PropertyDeclareAPIModel && (<PropertyDeclareAPIModel> this.property).input instanceof DerivedFEProperty){
+ if ((this.property.type === PROPERTY_TYPES.MAP || this.property.type === PROPERTY_TYPES.LIST) && this.property instanceof PropertyDeclareAPIModel && (<PropertyDeclareAPIModel> this.property).input instanceof DerivedFEProperty) {
return property.type === this.property.schema.property.type;
}
if (!property.schema || !property.schema.property) {