aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages
diff options
context:
space:
mode:
authorimamSidero <imam.hussain@est.tech>2023-01-11 18:13:25 +0000
committerMichael Morris <michael.morris@est.tech>2023-01-13 13:22:26 +0000
commita8d208b231237fc9f05f83c2b33fa207d58f1480 (patch)
treee58cac7c4a5e81e5fd042ed244539d4981947434 /catalog-ui/src/app/ng2/pages
parentaa92493c97b43075c18696d79f7d1bf62aa4805a (diff)
Provide tosca function as map primitive type entry values in composition view
Providing the capability to add tosca function as the primitive type entry values of map in composition view Issue-ID: SDC-4319 Signed-off-by: Imam hussain <imam.hussain@est.tech> Change-Id: I5cf67bc94ac5c72be6a962e07160329cd07d302c
Diffstat (limited to 'catalog-ui/src/app/ng2/pages')
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.html2
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts13
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.html2
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts16
4 files changed, 25 insertions, 8 deletions
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.html b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.html
index 8ee253e5dc..74a06baa53 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.html
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.html
@@ -34,6 +34,8 @@
<app-tosca-get-function [property]="property" [toscaGetFunction]="toscaFunction"
[componentInstanceMap]="componentInstanceMap"
[functionType]="toscaFunctionTypeForm.value"
+ [compositionMap]="compositionMap"
+ [compositionMapKey]="compositionMapKey"
(onValidityChange)="onGetFunctionValidityChange($event)"></app-tosca-get-function>
</div>
<div *ngIf="isYamlFunctionSelected()">
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 6b43cb014d..f697eed027 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
@@ -44,6 +44,8 @@ export class ToscaFunctionComponent implements OnInit, OnChanges {
@Input() property: PropertyBEModel;
@Input() componentInstanceMap: Map<string, InstanceFeDetails> = new Map<string, InstanceFeDetails>();
@Input() allowClear: boolean = true;
+ @Input() compositionMap: boolean = false;
+ @Input() compositionMapKey: string = "";
@Output() onValidFunction: EventEmitter<ToscaGetFunction> = new EventEmitter<ToscaGetFunction>();
@Output() onValidityChange: EventEmitter<ToscaFunctionValidationEvent> = new EventEmitter<ToscaFunctionValidationEvent>();
@@ -98,6 +100,17 @@ 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 (subPropertyToscaFunction){
+ this.toscaFunction = subPropertyToscaFunction.toscaFunction;
+ this.toscaFunctionForm.setValue(this.toscaFunction);
+ this.toscaFunctionTypeForm.setValue(this.toscaFunction.type);
+ }
+ return;
+ }
if (this.property instanceof PropertyDeclareAPIModel && this.property.subPropertyToscaFunctions && (<PropertyDeclareAPIModel> this.property).propertiesName){
let propertiesPath = (<PropertyDeclareAPIModel> this.property).propertiesName.split("#");
if (propertiesPath.length > 1){
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.html b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.html
index 6f19d5eff4..62cd697f8c 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.html
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.html
@@ -32,7 +32,7 @@
<option *ngFor="let value of propertyDropdownList" [ngValue]="value">{{value.propertyLabel}}</option>
</select>
</div>
- <div *ngIf="dropDownErrorMsg">{{dropDownErrorMsg}}</div>
+ <div *ngIf="dropDownErrorMsg" class="tosca-error">{{dropDownErrorMsg}}</div>
</form>
<loader [display]="isLoading" [size]="'medium'" [relative]="true"></loader>
</div>
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 84018fd546..9fdc8c19aa 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
@@ -45,6 +45,8 @@ export class ToscaGetFunctionComponent implements OnInit, OnChanges {
@Input() toscaGetFunction: ToscaGetFunction;
@Input() componentInstanceMap: Map<string, InstanceFeDetails> = new Map<string, InstanceFeDetails>();
@Input() functionType: ToscaGetFunctionType;
+ @Input() compositionMap: boolean;
+ @Input() compositionMapKey: string;
@Output() onValidFunction: EventEmitter<ToscaGetFunction> = new EventEmitter<ToscaGetFunction>();
@Output() onValidityChange: EventEmitter<ToscaGetFunctionValidationEvent> = new EventEmitter<ToscaGetFunctionValidationEvent>();
@@ -262,10 +264,10 @@ export class ToscaGetFunctionComponent implements OnInit, OnChanges {
private propertyTypeToString() {
if (this.isSubProperty()){
- if (this.typeHasSchema(this.property.type) && this.property instanceof PropertyDeclareAPIModel &&
- (<PropertyDeclareAPIModel> this.property).input instanceof DerivedFEProperty) {
- if(this.isComplexType(this.property.schemaType)){
- return this.property.input.type;
+ if ((this.typeHasSchema(this.property.type) && this.property instanceof PropertyDeclareAPIModel &&
+ (<PropertyDeclareAPIModel> this.property).input instanceof DerivedFEProperty) || this.compositionMap) {
+ if(this.isComplexType(this.property.schemaType) && !this.compositionMap){
+ return (<PropertyDeclareAPIModel> this.property).input.type;
}else{
return this.property.schema.property.type;
}
@@ -375,9 +377,9 @@ export class ToscaGetFunctionComponent implements OnInit, OnChanges {
private hasSameType(property: PropertyBEModel | AttributeBEModel): boolean {
if (this.typeHasSchema(this.property.type)) {
- if (this.property instanceof PropertyDeclareAPIModel && (<PropertyDeclareAPIModel> this.property).input instanceof DerivedFEProperty) {
- if(this.isComplexType(this.property.schemaType)){
- return property.type === this.property.input.type;
+ if ((this.property instanceof PropertyDeclareAPIModel && (<PropertyDeclareAPIModel> this.property).input instanceof DerivedFEProperty) || this.compositionMap) {
+ if(this.isComplexType(this.property.schemaType) && !this.compositionMap){
+ return property.type === (<PropertyDeclareAPIModel> this.property).input.type;
}else{
return property.type === this.property.schema.property.type;
}