@@ -10,35 +10,33 @@ import {
1010 ALERT_WORKFLOW_TAGS ,
1111} from '../../common/technical_rule_data_field_names' ;
1212
13- export const getStatusUpdateScript = ( status : string ) => {
14- return `
15- if (ctx._source['${ ALERT_WORKFLOW_STATUS } '] != null) {
16- ctx._source['${ ALERT_WORKFLOW_STATUS } '] = '${ status } ';
17- }
18- if (ctx._source.signal != null && ctx._source.signal.status != null) {
19- ctx._source.signal.status = '${ status } ';
20- }
21- ` ;
22- } ;
13+ export const STATUS_UPDATE_SCRIPT = `
14+ if (ctx._source['${ ALERT_WORKFLOW_STATUS } '] != null) {
15+ ctx._source['${ ALERT_WORKFLOW_STATUS } '] = params.status;
16+ }
17+ if (ctx._source.signal != null && ctx._source.signal.status != null) {
18+ ctx._source.signal.status = params.status;
19+ }
20+ ` ;
2321
2422export const ADD_TAGS_UPDATE_SCRIPT = `
25- if (ctx._source['${ ALERT_WORKFLOW_TAGS } '] == null) {
26- ctx._source['${ ALERT_WORKFLOW_TAGS } '] = new ArrayList();
27- }
28- for (item in params.addTags) {
29- if (!ctx._source['${ ALERT_WORKFLOW_TAGS } '].contains(item)) {
30- ctx._source['${ ALERT_WORKFLOW_TAGS } '].add(item);
31- }
32- }
33- `;
23+ if (ctx._source['${ ALERT_WORKFLOW_TAGS } '] == null) {
24+ ctx._source['${ ALERT_WORKFLOW_TAGS } '] = new ArrayList();
25+ }
26+ for (item in params.addTags) {
27+ if (!ctx._source['${ ALERT_WORKFLOW_TAGS } '].contains(item)) {
28+ ctx._source['${ ALERT_WORKFLOW_TAGS } '].add(item);
29+ }
30+ }
31+ ` ;
3432
3533export const REMOVE_TAGS_UPDATE_SCRIPT = `
36- if (ctx._source['${ ALERT_WORKFLOW_TAGS } '] != null) {
37- for (int i = 0; i < params.removeTags.length; i++) {
38- if (ctx._source['${ ALERT_WORKFLOW_TAGS } '].contains(params.removeTags[i])) {
39- int index = ctx._source['${ ALERT_WORKFLOW_TAGS } '].indexOf(params.removeTags[i]);
40- ctx._source['${ ALERT_WORKFLOW_TAGS } '].remove(index);
41- }
42- }
43- }
44- `;
34+ if (ctx._source['${ ALERT_WORKFLOW_TAGS } '] != null) {
35+ for (int i = 0; i < params.removeTags.length; i++) {
36+ if (ctx._source['${ ALERT_WORKFLOW_TAGS } '].contains(params.removeTags[i])) {
37+ int index = ctx._source['${ ALERT_WORKFLOW_TAGS } '].indexOf(params.removeTags[i]);
38+ ctx._source['${ ALERT_WORKFLOW_TAGS } '].remove(index);
39+ }
40+ }
41+ }
42+ ` ;
0 commit comments