summaryrefslogtreecommitdiffstats
path: root/public/src/app/rule-engine/action/action.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'public/src/app/rule-engine/action/action.component.ts')
-rw-r--r--public/src/app/rule-engine/action/action.component.ts51
1 files changed, 51 insertions, 0 deletions
diff --git a/public/src/app/rule-engine/action/action.component.ts b/public/src/app/rule-engine/action/action.component.ts
new file mode 100644
index 0000000..9c7023f
--- /dev/null
+++ b/public/src/app/rule-engine/action/action.component.ts
@@ -0,0 +1,51 @@
+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);
+ 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);
+ }
+}