summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages
diff options
context:
space:
mode:
authorimamSidero <imam.hussain@est.tech>2023-07-07 16:16:49 +0100
committerMichael Morris <michael.morris@est.tech>2023-07-19 13:29:38 +0000
commit3e63e2cdd6630dde5ecac3710bcb932d76d411da (patch)
tree759f60afa4d9c17c3432f3ea755f996b93a900dc /catalog-ui/src/app/ng2/pages
parent85e3cda38a1767ade1724ea18842a50772170a25 (diff)
Provide tosca function capability to list/map of complex type fields in composition view
Tosca function capability is provided to list/map entries of complex type fields in composition view Issue-ID: SDC-4562 Signed-off-by: Imam hussain <imam.hussain@est.tech> Change-Id: I38355f5ab399e1504ad433037d0d547fe07e9bfa
Diffstat (limited to 'catalog-ui/src/app/ng2/pages')
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/properties-tab/properties-tab.component.ts3
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts11
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts4
3 files changed, 15 insertions, 3 deletions
diff --git a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/properties-tab/properties-tab.component.ts b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/properties-tab/properties-tab.component.ts
index d25daf2865..ec804f3d11 100644
--- a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/properties-tab/properties-tab.component.ts
+++ b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/properties-tab/properties-tab.component.ts
@@ -12,6 +12,7 @@ import {
InputsGroup,
InputModel
} from 'app/models';
+import {DataTypesService} from "app/services";
import {ToscaGetFunctionType} from "app/models/tosca-get-function-type";
import { CompositionService } from 'app/ng2/pages/composition/composition.service';
import { WorkspaceService } from 'app/ng2/pages/workspace/workspace.service';
@@ -52,6 +53,7 @@ export class PropertiesTabComponent implements OnInit {
constructor(private store: Store,
private workspaceService: WorkspaceService,
+ private DataTypesService:DataTypesService,
private compositionService: CompositionService,
private modalsHandler: ModalsHandler,
private topologyTemplateService: TopologyTemplateService,
@@ -63,6 +65,7 @@ export class PropertiesTabComponent implements OnInit {
ngOnInit() {
this.metadata = this.workspaceService.metadata;
+ this.DataTypesService.loadDataTypesCache(this.workspaceService.metadata.model);
this.isComponentInstanceSelected = this.componentType === SelectedComponentType.COMPONENT_INSTANCE;
this.getComponentInstancesPropertiesAndAttributes();
}
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 29290805af..2bfbab7a34 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
@@ -52,6 +52,7 @@ export class ToscaFunctionComponent implements OnInit, OnChanges {
@Input() allowClear: boolean = true;
@Input() compositionMap: boolean = false;
@Input() compositionMapKey: string = "";
+ @Input() complexListKey: string = null;
@Output() onValidFunction: EventEmitter<ToscaGetFunction> = new EventEmitter<ToscaGetFunction>();
@Output() onValidityChange: EventEmitter<ToscaFunctionValidationEvent> = new EventEmitter<ToscaFunctionValidationEvent>();
@@ -108,7 +109,15 @@ export class ToscaFunctionComponent implements OnInit, OnChanges {
private initToscaFunction(): void {
if (this.compositionMap && this.property.subPropertyToscaFunctions) {
let keyToFind = [this.compositionMapKey];
- let subPropertyToscaFunction = this.property.subPropertyToscaFunctions.find(subPropertyToscaFunction => this.areEqual(subPropertyToscaFunction.subPropertyPath, keyToFind));
+ if (this.complexListKey != null) {
+ keyToFind = [this.complexListKey,this.compositionMapKey];
+ }
+ let subPropertyToscaFunction;
+ this.property.subPropertyToscaFunctions.forEach(subToscaFunction => {
+ if (subToscaFunction.subPropertyPath.toString() == keyToFind.toString()) {
+ subPropertyToscaFunction = subToscaFunction;
+ }
+ });
if (subPropertyToscaFunction){
this.toscaFunction = subPropertyToscaFunction.toscaFunction;
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 1fe467736d..5f5c2b60ee 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
@@ -329,7 +329,7 @@ export class ToscaGetFunctionComponent implements OnInit, OnChanges {
if (this.isSubProperty()){
if ((this.property instanceof PropertyDeclareAPIModel && (<PropertyDeclareAPIModel> this.property).input instanceof DerivedFEProperty)
|| this.compositionMap) {
- if(this.isComplexType(this.property.schemaType) && !this.compositionMap){
+ if(this.isComplexType(this.property.schemaType)){
let mapChildProp : DerivedFEProperty = (<DerivedFEProperty> (<PropertyDeclareAPIModel> this.property).input);
let propertySchemaType = mapChildProp.type;
if (this.property.type == PROPERTY_TYPES.MAP || propertySchemaType == PROPERTY_TYPES.MAP) {
@@ -487,7 +487,7 @@ export class ToscaGetFunctionComponent implements OnInit, OnChanges {
if ((this.property instanceof PropertyDeclareAPIModel && (<PropertyDeclareAPIModel> this.property).input instanceof DerivedFEProperty) || this.compositionMap) {
let childObject : DerivedFEProperty = (<DerivedFEProperty>(<PropertyDeclareAPIModel> this.property).input);
let childSchemaType = (this.property != null && this.property.schemaType != null) ? this.property.schemaType : childObject.type;
- if(this.isComplexType(childSchemaType) && !this.compositionMap){
+ if(this.isComplexType(childSchemaType)){
if (childObject.type == PROPERTY_TYPES.MAP && childObject.isChildOfListOrMap) {
return validPropertyType === PROPERTY_TYPES.STRING;
}