summaryrefslogtreecommitdiffstats
path: root/public/src/app/rule-engine/action-list
diff options
context:
space:
mode:
Diffstat (limited to 'public/src/app/rule-engine/action-list')
-rw-r--r--public/src/app/rule-engine/action-list/action-list.component.html18
-rw-r--r--public/src/app/rule-engine/action-list/action-list.component.scss4
-rw-r--r--public/src/app/rule-engine/action-list/action-list.component.ts70
3 files changed, 63 insertions, 29 deletions
diff --git a/public/src/app/rule-engine/action-list/action-list.component.html b/public/src/app/rule-engine/action-list/action-list.component.html
index e7879b7..1ee74df 100644
--- a/public/src/app/rule-engine/action-list/action-list.component.html
+++ b/public/src/app/rule-engine/action-list/action-list.component.html
@@ -1,10 +1,10 @@
<form #actionListFrm="ngForm" class="wrapper" data-tests-id="popupRuleEditor">
<div class="header">
- <div style="display: flex; justify-content: flex-end; align-items: center;">
+ <div style="display: flex; justify-content: flex-end; align-items: center; margin-left: 20px;">
<a (click)="closeDialog()" data-tests-id="btnBackRule" style="cursor: pointer;text-decoration: none; color: #009fdb;">
<mat-icon fontSet="fontawesome" fontIcon="fa-angle-left" style="height: 22px; width: 22px; font-size: 22px; padding-right: 20px;"></mat-icon>
</a>
- <span style="font-size: 18px;">New Rule Editor</span>
+ <span style="font-size: 18px;">{{title}}</span>
</div>
<div style="display: flex; justify-content: flex-end; align-items: center; padding: 10px;">
@@ -17,7 +17,7 @@
align-items: center;" [innerHTML]="'save' | feather:22"></span>
</button>
- <button mat-raised-button [disabled]="actions.length === 0" style="height: 35px; margin-left: 20px;" color="primary" data-tests-id="btnDone"
+ <button mat-raised-button [disabled]="actions.length === 0" style="height: 35px; margin-left: 10px;" color="primary" data-tests-id="btnDone"
(click)="saveAndDone()">
Done
</button>
@@ -62,18 +62,24 @@
<div style="display: flex;">
<select [(ngModel)]="selectedAction" name="selectedAction" style="height: 2rem; width: 150px; margin-right: 1rem;" data-tests-id="selectAction">
<option [ngValue]="null" disabled>Select Action</option>
+
<option value="copy">Copy</option>
<option value="concat">Concat</option>
<option value="map">Map</option>
<option value="date formatter">Date Formatter</option>
+ <option value="log text">Log Text</option>
+ <option value="log event">Log Event</option>
+ <option value="replace text">Replace Text</option>
+ <option value="clear">Clear</option>
+
</select>
<div style="display: flex; align-items: center;">
- <button mat-mini-fab color="primary" style="height: 24px; width: 24px; display:flex; justify-content: center;" (click)="addAction2list(selectedAction)"
+ <button mat-mini-fab color="primary" style="height: 16px; width: 16px; display:flex; justify-content: center;" (click)="addAction2list(selectedAction)"
data-tests-id="btnAddAction">
- <span style="display: flex; justify-content: center; align-items: center" [innerHTML]="'plus' | feather:16"></span>
+ <span style="display: flex; justify-content: center; align-items: center" [innerHTML]="'plus' | feather:12"></span>
</button>
- <span style="color: #009FDB; display: flex; justify-content: center; padding-left: 10px">Add Action</span>
+ <span style="color: #009FDB; display: flex; justify-content: center; padding-left: 6px">Add Action</span>
</div>
</div>
diff --git a/public/src/app/rule-engine/action-list/action-list.component.scss b/public/src/app/rule-engine/action-list/action-list.component.scss
index 39b9dce..67fa048 100644
--- a/public/src/app/rule-engine/action-list/action-list.component.scss
+++ b/public/src/app/rule-engine/action-list/action-list.component.scss
@@ -9,7 +9,9 @@
justify-content: space-between;
align-items: center;
color: #191919;
- border-bottom: 2px solid #d2d2d2;
+ border-bottom: 1px solid #d2d2d2;
+ padding-bottom: 0px;
+ margin: 0;
// padding: 0.4rem 1rem;
}
diff --git a/public/src/app/rule-engine/action-list/action-list.component.ts b/public/src/app/rule-engine/action-list/action-list.component.ts
index 40ff46d..27a74d4 100644
--- a/public/src/app/rule-engine/action-list/action-list.component.ts
+++ b/public/src/app/rule-engine/action-list/action-list.component.ts
@@ -1,20 +1,16 @@
import {
+ AfterViewInit,
Component,
- Inject,
- ViewChildren,
QueryList,
- AfterViewInit,
ViewChild,
- Input
+ ViewChildren
} from '@angular/core';
-import { RuleEngineApiService } from '../api/rule-engine-api.service';
-import { Subject } from 'rxjs/Subject';
-import { v1 as uuid } from 'uuid';
-import { environment } from '../../../environments/environment';
-import { ActionComponent } from '../action/action.component';
+import { NgForm } from '@angular/forms';
import { cloneDeep } from 'lodash';
+import { v1 as uuid } from 'uuid';
import { Store } from '../../store/store';
-import { NgForm } from '@angular/forms';
+import { ActionComponent } from '../action/action.component';
+import { RuleEngineApiService } from '../api/rule-engine-api.service';
@Component({
selector: 'app-action-list',
@@ -22,6 +18,7 @@ import { NgForm } from '@angular/forms';
styleUrls: ['./action-list.component.scss']
})
export class ActionListComponent implements AfterViewInit {
+ title = '';
error: Array<string>;
condition: any;
eventType: string;
@@ -53,8 +50,10 @@ export class ActionListComponent implements AfterViewInit {
this.condition = data.item.condition;
this.uid = data.item.uid;
this.description = data.item.description;
+ this.title = this.description + ' - Rule Editor';
this.ifStatement = this.condition == null ? false : true;
} else {
+ this.title = 'New Rule Editor';
this.actions = new Array();
this.backupActionForCancel = new Array();
this.condition = null;
@@ -97,12 +96,24 @@ export class ActionListComponent implements AfterViewInit {
value: '',
regex: '',
state: 'closed',
- values: [{ value: '' }, { value: '' }]
+ values: [
+ {
+ value: ''
+ },
+ {
+ value: ''
+ }
+ ]
},
actionType: this.selectedAction,
target: '',
map: {
- values: [{ key: '', value: '' }],
+ values: [
+ {
+ key: '',
+ value: ''
+ }
+ ],
haveDefault: false,
default: ''
},
@@ -111,6 +122,18 @@ export class ActionListComponent implements AfterViewInit {
toFormat: '',
fromTimezone: '',
toTimezone: ''
+ },
+ replaceText: {
+ find: '',
+ replace: ''
+ },
+ logText: {
+ name: '',
+ level: '',
+ text: ''
+ },
+ logEvent: {
+ title: ''
}
});
}
@@ -162,7 +185,10 @@ export class ActionListComponent implements AfterViewInit {
? item.target
: item.selectedNode.id,
map: item.map,
- dateFormatter: item.dateFormatter
+ dateFormatter: item.dateFormatter,
+ replaceText: item.replaceText,
+ logText: item.logText,
+ logEvent: item.logEvent
};
});
let conditionData2server = null;
@@ -178,6 +204,7 @@ export class ActionListComponent implements AfterViewInit {
return {
version: this.version,
eventType: this.eventType,
+ notifyId: this.store.notifyIdValue,
uid: this.uid,
description: this.description,
actions: actionSetData,
@@ -225,12 +252,12 @@ export class ActionListComponent implements AfterViewInit {
const actionComp = this.actionsRef.toArray();
const filterInvalidActions = actionComp.filter(comp => {
return (
- comp.fromInstance.fromFrm.invalid ||
- comp.targetInstance.targetFrm.invalid ||
- comp.actionFrm.invalid
+ // (comp.fromInstance && comp.fromInstance.fromFrm.invalid) ||
+ // (comp.targetInstance && comp.targetInstance.targetFrm.invalid) ||
+ comp.actionFrm && comp.actionFrm.invalid
);
});
- if (this.actionListFrm.valid && filterInvalidActions.length === 0) {
+ if (this.actionListFrm.valid && filterInvalidActions.length == 0) {
const data = this.prepareDataToSaveRule();
this.store.loader = true;
this._ruleApi.modifyRule(data).subscribe(
@@ -249,11 +276,10 @@ export class ActionListComponent implements AfterViewInit {
}
);
} else {
- // scroll to first invalid element
- const elId = filterInvalidActions[0].action.id;
- const el = document.getElementById(elId as string);
- const label = el.children.item(0) as HTMLElement;
- el.scrollIntoView();
+ // scroll to first invalid element const elId =
+ // filterInvalidActions[0].action.id; const el = document.getElementById(elId as
+ // string); const label = el.children.item(0) as HTMLElement;
+ // el.scrollIntoView();
}
}