summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2
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 /catalog-ui/src/app/ng2
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
Diffstat (limited to 'catalog-ui/src/app/ng2')
-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
2 files changed, 52 insertions, 3 deletions
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() {