import {FilterConstraint} from "app/models/filter-constraint";
import {PropertyFilterConstraintUi} from "../../../../models/ui-models/property-filter-constraint-ui";
import {ConstraintOperatorType, FilterConstraintHelper} from "../../../../utils/filter-constraint-helper";
+import {CustomToscaFunction} from "../../../../models/default-custom-functions";
export enum SourceType {
STATIC = 'static',
properties: string = ToscaFilterConstraintType.PROPERTIES;
private componentInstancesConstraints: FilterConstraint[] = [];
isEditable: boolean;
+ customToscaFunctions: Array<CustomToscaFunction>;
@Input() readonly: boolean;
@Input() compositeService: ComponentMetadata;
this.parentServiceInputs = result.inputs;
this.parentServiceProperties = result.properties;
});
+ this.initCustomToscaFunctions();
this.loadNodeFilter();
this.translateService.languageChangedObservable.subscribe((lang) => {
I18nTexts.translateTexts(this.translateService);
});
}
+ private initCustomToscaFunctions() {
+ if (!this.customToscaFunctions) {
+ this.customToscaFunctions = [];
+ this.topologyTemplateService.getDefaultCustomFunction().toPromise().then((data) => {
+ for (let customFunction of data) {
+ this.customToscaFunctions.push(new CustomToscaFunction(customFunction));
+ }
+ });
+ }
+ }
+
ngOnChanges(changes): void {
if (changes.currentServiceInstance) {
this.currentServiceInstance = changes.currentServiceInstance.currentValue;
'parentServiceInputs': this.parentServiceInputs,
'parentServiceProperties': this.parentServiceProperties,
'selectedInstanceProperties': this.selectedInstanceProperties,
+ 'customToscaFunctions': this.customToscaFunctions,
'filterType': FilterType.PROPERTY,
}
);
}
createNodeFilter = (constraintType: string): void => {
+ this.customToscaFunctions = this.modalInstance.instance.dynamicContent.instance.customToscaFunctions;
this.isLoading = true;
this.topologyTemplateService.createServiceFilterConstraints(
this.compositeService.uniqueId,
'parentServiceInputs': this.parentServiceInputs,
'parentServiceProperties': this.parentServiceProperties,
'selectedInstanceProperties': this.selectedInstanceProperties,
+ 'customToscaFunctions': this.customToscaFunctions,
'filterType': FilterType.PROPERTY
}
);
+
this.modalInstance.instance.open();
}