blob: 1a62e1a8fb52c1eb99eafead18111522d694aa41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
import { Component, Inject, Input, OnInit, ViewChild } from '@angular/core';
// import { Copy } from "../model";
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Rx';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import { Subject } from 'rxjs/Subject';
import { NgForm } from '@angular/forms';
@Component({
selector: 'app-action',
templateUrl: './action.component.html',
styleUrls: ['./action.component.scss']
})
export class ActionComponent implements OnInit {
@Input() action;
@ViewChild('from') fromInstance;
@ViewChild('target') targetInstance;
@ViewChild('actionFrm') actionFrm: NgForm;
highlight = 'black';
hoveredIndex;
changeStyle($event) {
this.highlight = $event.type === 'mouseover' ? 'highlight' : 'black';
}
ngOnInit(): void {
console.log(this.action.id);
if (this.action.from !== '') {
console.log('Action %o', this.action);
this.fromInstance.updateMode(this.action.from);
}
if (this.action.target !== '') {
this.targetInstance.updateMode(this.action);
}
}
updateFrom(data) {
this.action.from = data;
}
updateTarget(data) {
this.action.selectedNode = data;
}
/* map functionality */
addMapRow() {
this.action.map.values.push({ key: '', value: '' });
}
removeMapRow(index) {
this.action.map.values.splice(index, 1);
}
changeCheckbox() {
console.log(this.action.id);
return (this.action.map.haveDefault = !this.action.map.haveDefault);
}
}
|