2 * Created by ob0695 on 9/4/2017.
5 * Created by rc2122 on 9/4/2017.
7 import {Component, Inject, forwardRef} from '@angular/core';
8 import {IStepComponent} from "app/models"
9 import {ConnectionWizardService} from "../connection-wizard.service";
10 import {PropertyFEModel} from "app/models/properties-inputs/property-fe-model";
11 import {InstanceFePropertiesMap} from "app/models/properties-inputs/property-fe-map";
12 import {PropertiesUtils} from "app/ng2/pages/properties-assignment/services/properties.utils";
13 import { ComponentInstanceServiceNg2 } from "app/ng2/services/component-instance-services/component-instance.service";
16 selector: 'properties-step',
17 templateUrl: './properties-step.component.html',
18 styleUrls: ['./properties-step.component.less']
21 export class PropertiesStepComponent implements IStepComponent{
23 capabilityPropertiesMap: InstanceFePropertiesMap;
24 savingProperty:boolean = false;
26 constructor(@Inject(forwardRef(() => ConnectionWizardService)) public connectWizardService: ConnectionWizardService, private componentInstanceServiceNg2:ComponentInstanceServiceNg2, private propertiesUtils:PropertiesUtils) {
28 this.capabilityPropertiesMap = this.propertiesUtils.convertPropertiesMapToFEAndCreateChildren({'capability' : connectWizardService.selectedMatch.capability.properties}, false);
32 this.connectWizardService.changedCapabilityProperties = [];
35 onPropertySelectedUpdate = ($event) => {
36 console.log("==>" + 'PROPERTY VALUE SELECTED');
37 // this.selectedFlatProperty = $event;
38 // let parentProperty:PropertyFEModel = this.propertiesService.getParentPropertyFEModelFromPath(this.instanceFePropertiesMap[this.selectedFlatProperty.instanceName], this.selectedFlatProperty.path);
39 // parentProperty.expandedChildPropertyId = this.selectedFlatProperty.path;
42 propertyValueChanged = (property: PropertyFEModel) => {
43 if (!property.isDeclared) {
44 const propChangedIdx = this.connectWizardService.changedCapabilityProperties.indexOf(property);
45 if (property.hasValueObjChanged()) {
46 // if (this.componentInstanceServiceNg2.hasPropertyChanged(property)) {
47 console.log("==>" + this.constructor.name + ": propertyValueChanged " + property);
48 if (propChangedIdx === -1) {
49 this.connectWizardService.changedCapabilityProperties.push(property);
53 if (propChangedIdx !== -1) {
54 console.log("==>" + this.constructor.name + ": propertyValueChanged (reset to original) " + property);
55 this.connectWizardService.changedCapabilityProperties.splice(propChangedIdx, 1);
61 preventNext = ():boolean => {
65 preventBack = ():boolean => {
66 return this.savingProperty;