summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/view-models
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/view-models')
-rw-r--r--catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts13
-rw-r--r--catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html1
2 files changed, 14 insertions, 0 deletions
diff --git a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts
index 4b41e7ab25..39f008a688 100644
--- a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts
+++ b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts
@@ -34,6 +34,8 @@ import {TopologyTemplateService} from "app/ng2/services/component-services/topol
import {InstanceFeDetails} from "../../../../models/instance-fe-details";
import {ToscaGetFunction} from "../../../../models/tosca-get-function";
import {ToscaFunctionValidationEvent} from "../../../../ng2/pages/properties-assignment/tosca-function/tosca-function.component";
+import {CustomToscaFunction} from "../../../../models/default-custom-functions";
+import {ToscaFunctionType} from "../../../../models/tosca-function-type.enum";
export interface IEditPropertyModel {
property:PropertyModel;
@@ -56,6 +58,7 @@ interface IPropertyFormViewModelScope extends ng.IScope {
commentValidationPattern:RegExp;
editPropertyModel: IEditPropertyModel;
componentInstanceMap: Map<string, InstanceFeDetails>;
+ customToscaFunctions: Array<CustomToscaFunction>;
modalInstanceProperty:ng.ui.bootstrap.IModalServiceInstance;
currentPropertyIndex:number;
isLastProperty:boolean;
@@ -228,6 +231,15 @@ export class PropertyFormViewModel {
}
}
+ private initCustomToscaFunctions() {
+ this.$scope.customToscaFunctions = [];
+ this.topologyTemplateService.getDefaultCustomFunction().toPromise().then((data) => {
+ for (let customFunction of data) {
+ this.$scope.customToscaFunctions.push(new CustomToscaFunction(customFunction));
+ }
+ });
+ }
+
private initEmptyComplexValue(type: string): any {
switch (type) {
case PROPERTY_TYPES.MAP:
@@ -308,6 +320,7 @@ export class PropertyFormViewModel {
this.initResource();
this.initForNotSimpleType();
this.initComponentInstanceMap();
+ this.initCustomToscaFunctions();
this.$scope.validateJson = (json:string):boolean => {
if (!json) {
diff --git a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html
index b717d7a147..d0c3cc6f95 100644
--- a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html
+++ b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html
@@ -154,6 +154,7 @@
<div data-ng-if="editPropertyModel.hasGetFunctionValue">
<tosca-function [property]="editPropertyModel.property"
[component-instance-map]="componentInstanceMap"
+ [custom-tosca-functions]="customToscaFunctions"
[allow-clear]="false"
(on-valid-function)="onGetFunctionValidFunction($event)"
(on-validity-change)="onToscaFunctionValidityChange($event)"