diff options
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/composition')
7 files changed, 27 insertions, 1 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 6a5bd5a007..44db3b0d00 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 @@ -47,6 +47,7 @@ [property]="property" [allowClear]="false" [componentInstanceMap]="componentInstanceMap" + [customToscaFunctions]="customToscaFunctions" (onValidityChange)="onToscaFunctionValidityChange($event)"> </tosca-function> </div> @@ -54,6 +55,7 @@ <tosca-function [property]="property" [allowClear]="false" + [customToscaFunctions]="customToscaFunctions" (onValidityChange)="onToscaFunctionValidityChange($event)"> </tosca-function> </div> 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 145aad687c..103fc5c4f1 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 @@ -28,6 +28,7 @@ import {ToscaFunction} from '../../../../../../../models/tosca-function'; import {ToscaFunctionValidationEvent} from "../../../../../properties-assignment/tosca-function/tosca-function.component"; import {InstanceFeDetails} from "../../../../../../../models/instance-fe-details"; import {ToscaTypeHelper} from "app/utils/tosca-type-helper"; +import {CustomToscaFunction} from "../../../../../../../models/default-custom-functions"; @Component({ selector: 'app-input-list-item', @@ -51,6 +52,7 @@ export class InputListItemComponent implements OnInit { @Input() allowDeletion: boolean = false; @Input() toscaFunction: ToscaFunction; @Input() componentInstanceMap: Map<string, InstanceFeDetails> = new Map(); + @Input() customToscaFunctions: Array<CustomToscaFunction> = []; @Output('onValueChange') onValueChangeEvent: EventEmitter<any> = new EventEmitter<any>(); @Output('onDelete') onDeleteEvent: EventEmitter<string> = new EventEmitter<string>(); @Output('onChildListItemDelete') onChildListItemDeleteEvent: EventEmitter<number> = new EventEmitter<number>(); diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.html b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.html index 9a2d1f3936..d4b70f9be5 100644 --- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.html +++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.html @@ -36,6 +36,7 @@ [isViewOnly]="isViewOnly" [allowDeletion]="allowDeletion" [componentInstanceMap]="componentInstanceMap" + [customToscaFunctions]="customToscaFunctions" (onValueChange)="onValueChange($event)" (onDelete)="onDelete($event)"> </app-input-list-item> diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.spec.ts b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.spec.ts index c98f2bb9af..3230306e68 100644 --- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.spec.ts +++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.spec.ts @@ -28,6 +28,7 @@ import {DataTypeModel} from '../../../../../../models/data-types'; import {TranslateService} from '../../../../../shared/translator/translate.service'; import {ToscaFunction} from '../../../../../../models/tosca-function'; import {InstanceFeDetails} from "../../../../../../models/instance-fe-details"; +import {CustomToscaFunction} from "../../../../../../models/default-custom-functions"; @Component({selector: 'app-input-list-item', template: ''}) class InputListItemStubComponent { @@ -41,6 +42,7 @@ class InputListItemStubComponent { @Input() toscaFunction: ToscaFunction; @Input() showToscaFunctionOption: boolean; @Input() componentInstanceMap: Map<string, InstanceFeDetails> = null; + @Input() customToscaFunctions: Array<CustomToscaFunction> = []; } const translateServiceMock: Partial<TranslateService> = { diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.ts b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.ts index fa06c3eabc..208c0030f6 100644 --- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.ts +++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.ts @@ -25,6 +25,7 @@ import {DataTypeModel} from "../../../../../../models/data-types"; import {DerivedPropertyType} from "../../../../../../models/properties-inputs/property-be-model"; import {PROPERTY_DATA, PROPERTY_TYPES} from "../../../../../../utils/constants"; import {InstanceFeDetails} from "../../../../../../models/instance-fe-details"; +import {CustomToscaFunction} from "../../../../../../models/default-custom-functions"; @Component({ selector: 'input-list', @@ -51,6 +52,7 @@ export class InputListComponent { @Input() showToscaFunctionOption: boolean = false; @Input() allowDeletion: boolean = false; @Input() componentInstanceMap: Map<string, InstanceFeDetails> = new Map(); + @Input() customToscaFunctions: Array<CustomToscaFunction> = []; @Output('onInputsValidityChange') inputsValidityChangeEvent: EventEmitter<boolean> = new EventEmitter<boolean>(); @Output('onValueChange') inputValueChangeEvent: EventEmitter<InputOperationParameter> = new EventEmitter<InputOperationParameter>(); @Output('onDelete') inputDeleteEvent: EventEmitter<string> = new EventEmitter<string>(); diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.html b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.html index a3885747d3..8ab1b97cda 100644 --- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.html +++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.html @@ -115,6 +115,7 @@ [showToscaFunctionOption]="true" [componentInstanceMap]="componentInstanceMap" [allowDeletion]="false" + [customToscaFunctions]="customToscaFunctions" (onInputsValidityChange)="implementationPropsValidityChange($event)" (onValueChange)="onArtifactPropertyValueChange($event)" > diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.ts b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.ts index a1f72ac46e..ab9cad0a39 100644 --- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.ts +++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.ts @@ -34,6 +34,9 @@ import {DataTypeService} from "../../../../services/data-type.service"; import {Observable} from "rxjs/Observable"; import {DataTypeModel} from "../../../../../models/data-types"; import {InstanceFeDetails} from "../../../../../models/instance-fe-details"; +import {TopologyTemplateService} from "app/ng2/services/component-services/topology-template.service"; +import {CustomToscaFunction} from "../../../../../models/default-custom-functions"; +import {ToscaFunctionType} from "../../../../../models/tosca-function-type.enum"; @Component({ selector: 'operation-handler', @@ -83,11 +86,14 @@ export class InterfaceOperationHandlerComponent { artifactTypeProperties: Array<InputOperationParameter> = []; toscaArtifactTypes: Array<DropdownValue> = []; componentInstanceMap: Map<string, InstanceFeDetails>; + customToscaFunctions: Array<CustomToscaFunction>; enableAddArtifactImplementation: boolean; propertyValueValid: boolean = true; inputTypeOptions: any[]; - constructor(private dataTypeService: DataTypeService, private componentServiceNg2: ComponentServiceNg2) { + constructor(private dataTypeService: DataTypeService, + private componentServiceNg2: ComponentServiceNg2, + private topologyTemplateService: TopologyTemplateService) { } ngOnInit() { @@ -100,6 +106,7 @@ export class InterfaceOperationHandlerComponent { this.operationToUpdate.interfaceId = this.input.selectedInterface.uniqueId; this.operationToUpdate.interfaceType = this.input.selectedInterface.type; this.modelName = this.input.modelName; + this.initCustomToscaFunctions(); this.initInputs(); this.removeImplementationQuote(); this.loadInterfaceOperationImplementation(); @@ -128,6 +135,15 @@ export class InterfaceOperationHandlerComponent { this.loadInterfaceType(); } + private initCustomToscaFunctions() { + this.customToscaFunctions = []; + this.topologyTemplateService.getDefaultCustomFunction().toPromise().then((data) => { + for (let customFunction of data) { + this.customToscaFunctions.push(new CustomToscaFunction(customFunction)); + } + }); + } + private loadInterfaceType() { this.componentServiceNg2.getInterfaceTypesByModel(this.modelName) .subscribe(response => { |