1 import {Component, OnInit, Inject, forwardRef} from "@angular/core";
2 import {IStepComponent} from "../../../../models/wizard-step";
3 import {Dictionary} from "lodash";
4 import { Match} from "app/models";
5 import {ConnectionWizardService} from "../connection-wizard.service";
6 import {Requirement} from "../../../../models/requirement";
7 import {Capability} from "../../../../models/capability";
8 import {PropertyModel} from "../../../../models/properties";
11 selector: 'from-node-step',
12 templateUrl: './from-node-step.component.html'
15 export class FromNodeStepComponent implements IStepComponent, OnInit{
17 constructor(@Inject(forwardRef(() => ConnectionWizardService)) public connectWizardService: ConnectionWizardService) {}
19 optionalRequirementsMap: Dictionary<Requirement[]>;
20 optionalCapabilitiesMap: Dictionary<Capability[]>;
23 this.optionalRequirementsMap = this.connectWizardService.getOptionalRequirementsByInstanceUniqueId(true);
24 this.optionalCapabilitiesMap = this.connectWizardService.getOptionalCapabilitiesByInstanceUniqueId(false);
27 preventNext = ():boolean => {
28 return !this.connectWizardService.selectedMatch || (!this.connectWizardService.selectedMatch.capability && !this.connectWizardService.selectedMatch.requirement);
31 preventBack = ():boolean => {
35 private updateSelectedReqOrCap = (selected:Requirement|Capability):void => {
37 this.connectWizardService.selectedMatch = null;
38 } else if(selected instanceof Requirement){
39 this.connectWizardService.selectedMatch = new Match(<Requirement>selected, null, true, this.connectWizardService.connectRelationModel.fromNode.componentInstance.uniqueId, null);
41 this.connectWizardService.selectedMatch = new Match(null,<Capability>selected , false, null, this.connectWizardService.connectRelationModel.fromNode.componentInstance.uniqueId);