@@ -2,12 +2,13 @@ import { componentTypes, validatorTypes } from '@@ddf';
2
2
import {
3
3
actionChange , runOptionChange , runOptions , subActionChange , objectTypeChange , restructureOptions ,
4
4
} from './helper' ;
5
+ import { FIELD_IDS } from './schedule-form-constants' ;
5
6
6
7
export const attributeValueLimit = 5 ;
7
8
8
9
export const nameField = ( ) => ( {
9
10
component : componentTypes . TEXT_FIELD ,
10
- name : 'name' ,
11
+ name : FIELD_IDS . NAME ,
11
12
label : __ ( 'Name' ) ,
12
13
maxLength : 50 ,
13
14
isRequired : true ,
@@ -17,7 +18,7 @@ export const nameField = () => ({
17
18
18
19
export const descriptionField = ( ) => ( {
19
20
component : componentTypes . TEXT_FIELD ,
20
- name : 'description' ,
21
+ name : FIELD_IDS . DESCRIPTION ,
21
22
label : __ ( 'Description' ) ,
22
23
isRequired : true ,
23
24
maxLength : 100 ,
@@ -26,14 +27,14 @@ export const descriptionField = () => ({
26
27
27
28
export const activeField = ( ) => ( {
28
29
component : componentTypes . CHECKBOX ,
29
- name : 'enabled' ,
30
+ name : FIELD_IDS . ACTIVE ,
30
31
label : __ ( 'Active' ) ,
31
32
} ) ;
32
33
33
34
export const actionField = ( actionOptions , filterOptions , setData , data ) => ( {
34
35
component : componentTypes . SELECT ,
35
36
id : 'action' ,
36
- name : 'action_typ' ,
37
+ name : FIELD_IDS . ACTION_TYPE ,
37
38
label : __ ( 'Action' ) ,
38
39
initialValue : 'vm' ,
39
40
onChange : ( value ) => actionChange ( value , filterOptions , setData , data ) ,
@@ -44,7 +45,7 @@ export const actionField = (actionOptions, filterOptions, setData, data) => ({
44
45
export const filterField = ( setData , data ) => ( {
45
46
component : componentTypes . SELECT ,
46
47
id : 'filter_type' ,
47
- name : 'filter_typ' ,
48
+ name : FIELD_IDS . FILTER_TYPE ,
48
49
label : __ ( 'Filter' ) ,
49
50
onChange : ( value ) => subActionChange ( value , setData , data ) ,
50
51
hideField : data . displayFields . filterType ,
@@ -55,7 +56,7 @@ export const filterField = (setData, data) => ({
55
56
export const targetField = ( data ) => ( {
56
57
component : componentTypes . SELECT ,
57
58
id : 'filter_value' ,
58
- name : 'filter_value' ,
59
+ name : FIELD_IDS . FILTER_VALUE ,
59
60
label : __ ( 'Filter Item' ) ,
60
61
hideField : data . displayFields . target ,
61
62
options : data . options . target ,
@@ -66,7 +67,7 @@ export const targetField = (data) => ({
66
67
export const zoneField = ( data ) => ( {
67
68
component : componentTypes . SELECT ,
68
69
id : 'zone' ,
69
- name : 'zone_id' ,
70
+ name : FIELD_IDS . ZONE ,
70
71
label : __ ( 'Zone' ) ,
71
72
placeholder : __ ( '<Choose>' ) ,
72
73
includeEmpty : true ,
@@ -87,7 +88,7 @@ export const plainField = (name, text, data) => ({
87
88
export const systemField = ( data ) => ( {
88
89
component : componentTypes . SELECT ,
89
90
id : 'system' ,
90
- name : 'instance_name' ,
91
+ name : FIELD_IDS . SYSTEM ,
91
92
label : __ ( 'System/Process' ) ,
92
93
hideField : data . displayFields . automationFields ,
93
94
options : data . options . request ,
@@ -99,7 +100,7 @@ export const systemField = (data) => ({
99
100
100
101
export const objectMessageField = ( data ) => ( {
101
102
component : componentTypes . TEXT_FIELD ,
102
- id : 'message' ,
103
+ id : FIELD_IDS . MESSAGE ,
103
104
name : 'object_message' ,
104
105
label : __ ( 'Message' ) ,
105
106
hideField : data . displayFields . automationFields ,
@@ -109,7 +110,7 @@ export const objectMessageField = (data) => ({
109
110
110
111
export const objectRequestField = ( data ) => ( {
111
112
component : componentTypes . TEXT_FIELD ,
112
- id : 'request' ,
113
+ id : FIELD_IDS . REQUEST ,
113
114
name : 'object_request' ,
114
115
label : __ ( 'Request' ) ,
115
116
hideField : data . displayFields . automationFields ,
@@ -120,7 +121,7 @@ export const objectRequestField = (data) => ({
120
121
export const objectTypeField = ( setData , data ) => ( {
121
122
component : componentTypes . SELECT ,
122
123
id : 'object_type' ,
123
- name : 'target_class' ,
124
+ name : FIELD_IDS . OBJECT_TYPE ,
124
125
onChange : ( value ) => objectTypeChange ( value , setData , data ) ,
125
126
hideField : data . displayFields . automationFields ,
126
127
placeholder : __ ( '<Choose>' ) ,
@@ -137,7 +138,7 @@ export const objectTypeField = (setData, data) => ({
137
138
export const objectItemField = ( data ) => ( {
138
139
component : componentTypes . SELECT ,
139
140
id : 'object_item' ,
140
- name : 'target_id' ,
141
+ name : FIELD_IDS . OBJECT_ITEM ,
141
142
hideField : data . displayFields . objectItem ,
142
143
options : data . options . objectItem ,
143
144
placeholder : __ ( '<Choose>' ) ,
@@ -165,14 +166,14 @@ const attributeValueField = (count) => ({
165
166
} ,
166
167
{
167
168
component : componentTypes . TEXT_FIELD ,
168
- id : `attribute_ ${ count } ` ,
169
+ id : `${ FIELD_IDS . ATTRIBUTE_PREFIX } ${ count } ` ,
169
170
name : `attribute_${ count } ` ,
170
171
label : __ ( ' ' ) ,
171
172
className : 'attribute-value-row-attribute' ,
172
173
} ,
173
174
{
174
175
component : componentTypes . TEXT_FIELD ,
175
- id : `value_ ${ count } ` ,
176
+ id : `${ FIELD_IDS . VALUE_PREFIX } ${ count } ` ,
176
177
name : `value_${ count } ` ,
177
178
label : __ ( ' ' ) ,
178
179
className : 'attribute-value-row-value' ,
@@ -194,7 +195,7 @@ export const attributeValueFields = (data, limit) => ({
194
195
fields : [ [ ...Array ( limit ) ] . map ( ( _item , i ) => attributeValueField ( i + 1 ) ) ,
195
196
{
196
197
component : componentTypes . TEXT_FIELD ,
197
- id : `starting_object` ,
198
+ id : FIELD_IDS . STARTING_OBJECT ,
198
199
name : `starting_object` ,
199
200
label : __ ( ' ' ) ,
200
201
value : 'SYSTEM/PROCESS' ,
@@ -206,7 +207,7 @@ export const attributeValueFields = (data, limit) => ({
206
207
export const runField = ( setData , data ) => ( {
207
208
component : componentTypes . SELECT ,
208
209
id : 'run' ,
209
- name : 'timer_typ' ,
210
+ name : FIELD_IDS . TIMER_TYPE ,
210
211
label : __ ( 'Run' ) ,
211
212
initialValue : 'Once' ,
212
213
isRequired : true ,
@@ -217,7 +218,7 @@ export const runField = (setData, data) => ({
217
218
export const timerValueField = ( data ) => ( {
218
219
component : componentTypes . SELECT ,
219
220
id : 'timer_value' ,
220
- name : 'timer_value' ,
221
+ name : FIELD_IDS . TIMER_VALUE ,
221
222
label : __ ( 'Every' ) ,
222
223
hideField : data . displayFields . everyTime ,
223
224
options : data . options . everyTime ,
@@ -229,7 +230,7 @@ export const timerValueField = (data) => ({
229
230
export const timezoneField = ( data ) => ( {
230
231
component : componentTypes . SELECT ,
231
232
id : 'time_zone' ,
232
- name : 'time_zone' ,
233
+ name : FIELD_IDS . TIME_ZONE ,
233
234
isRequired : true ,
234
235
placeholder : __ ( '<Choose>' ) ,
235
236
includeEmpty : true ,
@@ -243,7 +244,7 @@ export const timezoneField = (data) => ({
243
244
244
245
export const startDateField = ( ) => ( {
245
246
component : componentTypes . DATE_PICKER ,
246
- name : 'start_date' ,
247
+ name : FIELD_IDS . START_DATE ,
247
248
label : __ ( 'Starting Date' ) ,
248
249
datePickerType : 'single' ,
249
250
isRequired : true ,
@@ -252,7 +253,7 @@ export const startDateField = () => ({
252
253
253
254
export const startTimeField = ( ) => ( {
254
255
component : componentTypes . TIME_PICKER ,
255
- id : 'start_time' ,
256
+ id : FIELD_IDS . START_TIME ,
256
257
name : 'start_hour' ,
257
258
label : __ ( 'Starting Time' ) ,
258
259
isRequired : true ,
0 commit comments