aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfranciscovila <javier.paradela.vila@est.tech>2022-11-01 14:21:27 +0000
committerAndr� Schmid <andre.schmid@est.tech>2022-11-17 11:09:02 +0000
commit1913ab4377e68b1215d4422fc0448c023211d739 (patch)
tree0f04d7845c02312822597cc8bd8aa4c571eaa325
parent9eaadef100656d575d8cdeb92e0179dae9ac4828 (diff)
Issues with 'range' data type detected
Fix issues with range data type Issue-ID: SDC-4243 Signed-off-by: franciscovila <javier.paradela.vila@est.tech> Change-Id: Ie93f8c38b766d78f890dbe2b854a096bb8546fe8
-rw-r--r--catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml3
-rw-r--r--catalog-be/src/main/resources/import/tosca/models/init/acm/tosca/data-types/dataTypes.yml2
-rw-r--r--catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/tosca/data-types/dataTypes.yml3
-rw-r--r--catalog-be/src/main/resources/import/tosca/models/upgrade/acm/tosca/data-types/dataTypes.yml2
-rw-r--r--catalog-be/src/main/resources/import/tosca/models/upgrade/etsi-SOL001-v2.5.1/tosca/data-types/dataTypes.yml3
-rw-r--r--catalog-ui/src/app/models/properties-inputs/property-be-model.ts6
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.html13
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.ts42
-rw-r--r--catalog-ui/src/app/utils/constants.ts3
9 files changed, 72 insertions, 5 deletions
diff --git a/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml b/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml
index eab51368fe..5ff50bfcad 100644
--- a/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml
+++ b/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml
@@ -16,6 +16,9 @@ boolean:
float:
derived_from: tosca.datatypes.Root
+range:
+ derived_from: tosca.datatypes.Root
+
list:
derived_from: tosca.datatypes.Root
diff --git a/catalog-be/src/main/resources/import/tosca/models/init/acm/tosca/data-types/dataTypes.yml b/catalog-be/src/main/resources/import/tosca/models/init/acm/tosca/data-types/dataTypes.yml
index ad496c5737..b879179697 100644
--- a/catalog-be/src/main/resources/import/tosca/models/init/acm/tosca/data-types/dataTypes.yml
+++ b/catalog-be/src/main/resources/import/tosca/models/init/acm/tosca/data-types/dataTypes.yml
@@ -10,6 +10,8 @@ boolean:
derived_from: tosca.datatypes.Root
float:
derived_from: tosca.datatypes.Root
+range:
+ derived_from: tosca.datatypes.Root
list:
derived_from: tosca.datatypes.Root
map:
diff --git a/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/tosca/data-types/dataTypes.yml b/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/tosca/data-types/dataTypes.yml
index 16de248a43..fa5e0e1e16 100644
--- a/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/tosca/data-types/dataTypes.yml
+++ b/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/tosca/data-types/dataTypes.yml
@@ -16,6 +16,9 @@ boolean:
float:
derived_from: tosca.datatypes.Root
+range:
+ derived_from: tosca.datatypes.Root
+
list:
derived_from: tosca.datatypes.Root
diff --git a/catalog-be/src/main/resources/import/tosca/models/upgrade/acm/tosca/data-types/dataTypes.yml b/catalog-be/src/main/resources/import/tosca/models/upgrade/acm/tosca/data-types/dataTypes.yml
index ad496c5737..b879179697 100644
--- a/catalog-be/src/main/resources/import/tosca/models/upgrade/acm/tosca/data-types/dataTypes.yml
+++ b/catalog-be/src/main/resources/import/tosca/models/upgrade/acm/tosca/data-types/dataTypes.yml
@@ -10,6 +10,8 @@ boolean:
derived_from: tosca.datatypes.Root
float:
derived_from: tosca.datatypes.Root
+range:
+ derived_from: tosca.datatypes.Root
list:
derived_from: tosca.datatypes.Root
map:
diff --git a/catalog-be/src/main/resources/import/tosca/models/upgrade/etsi-SOL001-v2.5.1/tosca/data-types/dataTypes.yml b/catalog-be/src/main/resources/import/tosca/models/upgrade/etsi-SOL001-v2.5.1/tosca/data-types/dataTypes.yml
index 16de248a43..fa5e0e1e16 100644
--- a/catalog-be/src/main/resources/import/tosca/models/upgrade/etsi-SOL001-v2.5.1/tosca/data-types/dataTypes.yml
+++ b/catalog-be/src/main/resources/import/tosca/models/upgrade/etsi-SOL001-v2.5.1/tosca/data-types/dataTypes.yml
@@ -16,6 +16,9 @@ boolean:
float:
derived_from: tosca.datatypes.Root
+range:
+ derived_from: tosca.datatypes.Root
+
list:
derived_from: tosca.datatypes.Root
diff --git a/catalog-ui/src/app/models/properties-inputs/property-be-model.ts b/catalog-ui/src/app/models/properties-inputs/property-be-model.ts
index b8cccdd213..b4c1c2fce7 100644
--- a/catalog-ui/src/app/models/properties-inputs/property-be-model.ts
+++ b/catalog-ui/src/app/models/properties-inputs/property-be-model.ts
@@ -33,7 +33,8 @@ export enum DerivedPropertyType {
SIMPLE,
LIST,
MAP,
- COMPLEX
+ COMPLEX,
+ RANGE
}
export class PropertyPolicyDetail {
policyId: string;
@@ -140,6 +141,9 @@ export class PropertyBEModel {
if (this.type === PROPERTY_TYPES.LIST) {
return DerivedPropertyType.LIST;
}
+ if (this.type === PROPERTY_TYPES.RANGE) {
+ return DerivedPropertyType.RANGE;
+ }
if (this.type === PROPERTY_TYPES.MAP) {
return DerivedPropertyType.MAP;
}
diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.html b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.html
index fce8e7ea4f..1e0804eb04 100644
--- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.html
+++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.html
@@ -76,6 +76,19 @@
</li>
</ul>
</ng-container>
+ <ng-container *ngIf="isTypeRange(type.name)">
+ <ul *ngIf="isExpanded">
+ <ng-container *ngFor="let value1 of [0, 1]; index as i">
+ <li class="input-value">
+ <ng-container *ngIf="isViewOnly">
+ {{valueObjRef[i]}}
+ </ng-container>
+ <input type="text" *ngIf="!isViewOnly"
+ [(ngModel)]="valueObjRef[i]" (ngModelChange)="onListValueChange()" />
+ </li>
+ </ng-container>
+ </ul>
+ </ng-container>
<ng-container *ngIf="isTypeComplex(type.name)" >
<ul *ngIf="isExpanded">
<ng-container *ngFor="let property of this.type.properties">
diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.ts b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.ts
index 4612ca6d60..88ff8deec6 100644
--- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.ts
+++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.ts
@@ -85,7 +85,7 @@ export class InputListItemComponent implements OnInit {
if (this.valueObjRef[property.name] == undefined) {
if (this.isTypeComplex(property.type) || this.isTypeMap(property.type)) {
this.valueObjRef[property.name] = {};
- } else if (this.isTypeList(property.type)) {
+ } else if (this.isTypeList(property.type) || this.isTypeRange(property.type)) {
this.valueObjRef[property.name] = [];
} else {
this.valueObjRef[property.name] = null;
@@ -100,13 +100,49 @@ export class InputListItemComponent implements OnInit {
return DerivedPropertyType.LIST;
} else if (typeName === PROPERTY_TYPES.MAP) {
return DerivedPropertyType.MAP;
+ } else if (typeName === PROPERTY_TYPES.RANGE) {
+ return DerivedPropertyType.RANGE;
} else {
return DerivedPropertyType.COMPLEX;
}
}
+ isTypeWithoutProperties(typeName: string): boolean {
+ if (this.dataTypeMap.get(typeName) === undefined) {
+ return true;
+ }
+ return this.dataTypeMap.get(typeName).properties === undefined ||
+ this.dataTypeMap.get(typeName).properties.length == 0;
+ }
+
+ isTypeDerivedFromSimple(typeName: string): boolean {
+ if (typeName === undefined) {
+ return false;
+ }
+ if (this.dataTypeMap.get(typeName) !== undefined) {
+ if (this.isTypeRange(typeName)) {
+ return false;
+ }
+ if (this.dataTypeMap.get(typeName).derivedFromName == PROPERTY_DATA.ROOT_DATA_TYPE) {
+ return false;
+ } else if (PROPERTY_DATA.SIMPLE_TYPES.indexOf(this.dataTypeMap.get(typeName).derivedFromName) > -1) {
+ return true;
+ } else {
+ return this.isTypeDerivedFromSimple(this.dataTypeMap.get(typeName).derivedFromName);
+ }
+ }
+ return true;
+ }
+
isTypeSimple(typeName: string): boolean {
- return this.getType(typeName) == DerivedPropertyType.SIMPLE;
+ if (this.getType(typeName) == DerivedPropertyType.SIMPLE) {
+ return true;
+ }
+ return this.isTypeDerivedFromSimple(typeName) && (this.isTypeWithoutProperties(typeName));
+ }
+
+ isTypeRange(typeName: string): boolean {
+ return this.getType(typeName) == DerivedPropertyType.RANGE;
}
isTypeList(typeName: string): boolean {
@@ -118,7 +154,7 @@ export class InputListItemComponent implements OnInit {
}
isTypeComplex(typeName: string): boolean {
- return !this.isTypeSimple(typeName) && !this.isTypeList(typeName) && !this.isTypeMap(typeName);
+ return !this.isTypeSimple(typeName) && !this.isTypeList(typeName) && !this.isTypeMap(typeName) && !this.isTypeRange(typeName);
}
expandAndCollapse() {
diff --git a/catalog-ui/src/app/utils/constants.ts b/catalog-ui/src/app/utils/constants.ts
index 0de83d257e..9d11f54db9 100644
--- a/catalog-ui/src/app/utils/constants.ts
+++ b/catalog-ui/src/app/utils/constants.ts
@@ -137,6 +137,7 @@ export class PROPERTY_TYPES {
public static FLOAT = 'float';
public static BOOLEAN = 'boolean';
public static JSON = 'json';
+ public static RANGE = 'range';
public static MAP = 'map';
public static LIST = 'list';
public static SCALAR = 'scalar-unit';
@@ -152,7 +153,7 @@ export class SOURCES {
}
export class PROPERTY_DATA {
- public static TYPES = [PROPERTY_TYPES.STRING, PROPERTY_TYPES.INTEGER, PROPERTY_TYPES.TIMESTAMP, PROPERTY_TYPES.FLOAT, PROPERTY_TYPES.BOOLEAN, PROPERTY_TYPES.JSON, PROPERTY_TYPES.SCALAR, PROPERTY_TYPES.SCALAR_FREQUENCY, PROPERTY_TYPES.SCALAR_SIZE, PROPERTY_TYPES.SCALAR_TIME, PROPERTY_TYPES.LIST, PROPERTY_TYPES.MAP];
+ public static TYPES = [PROPERTY_TYPES.STRING, PROPERTY_TYPES.INTEGER, PROPERTY_TYPES.TIMESTAMP, PROPERTY_TYPES.FLOAT, PROPERTY_TYPES.BOOLEAN, PROPERTY_TYPES.JSON, PROPERTY_TYPES.SCALAR, PROPERTY_TYPES.SCALAR_FREQUENCY, PROPERTY_TYPES.SCALAR_SIZE, PROPERTY_TYPES.SCALAR_TIME, PROPERTY_TYPES.LIST, PROPERTY_TYPES.MAP, PROPERTY_TYPES.RANGE];
public static SIMPLE_TYPES = [PROPERTY_TYPES.STRING, PROPERTY_TYPES.INTEGER, PROPERTY_TYPES.TIMESTAMP, PROPERTY_TYPES.FLOAT, PROPERTY_TYPES.BOOLEAN, PROPERTY_TYPES.JSON, PROPERTY_TYPES.SCALAR, PROPERTY_TYPES.SCALAR_FREQUENCY, PROPERTY_TYPES.SCALAR_SIZE, PROPERTY_TYPES.SCALAR_TIME];
public static SIMPLE_TYPES_COMPARABLE = [PROPERTY_TYPES.STRING, PROPERTY_TYPES.INTEGER, PROPERTY_TYPES.FLOAT];
public static SCALAR_TYPES = [PROPERTY_TYPES.SCALAR, PROPERTY_TYPES.SCALAR_FREQUENCY, PROPERTY_TYPES.SCALAR_SIZE, PROPERTY_TYPES.SCALAR_TIME];