config-editor-base 2.1.3 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +99 -236
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +99 -236
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,26 +16,21 @@ function _extends() {
|
|
|
16
16
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
17
17
|
for (var i = 1; i < arguments.length; i++) {
|
|
18
18
|
var source = arguments[i];
|
|
19
|
-
|
|
20
19
|
for (var key in source) {
|
|
21
20
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
22
21
|
target[key] = source[key];
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
return target;
|
|
28
26
|
};
|
|
29
27
|
return _extends.apply(this, arguments);
|
|
30
28
|
}
|
|
31
|
-
|
|
32
29
|
function _inheritsLoose(subClass, superClass) {
|
|
33
30
|
subClass.prototype = Object.create(superClass.prototype);
|
|
34
31
|
subClass.prototype.constructor = subClass;
|
|
35
|
-
|
|
36
32
|
_setPrototypeOf(subClass, superClass);
|
|
37
33
|
}
|
|
38
|
-
|
|
39
34
|
function _setPrototypeOf(o, p) {
|
|
40
35
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
41
36
|
o.__proto__ = p;
|
|
@@ -43,12 +38,10 @@ function _setPrototypeOf(o, p) {
|
|
|
43
38
|
};
|
|
44
39
|
return _setPrototypeOf(o, p);
|
|
45
40
|
}
|
|
46
|
-
|
|
47
41
|
function _assertThisInitialized(self) {
|
|
48
42
|
if (self === void 0) {
|
|
49
43
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
50
44
|
}
|
|
51
|
-
|
|
52
45
|
return self;
|
|
53
46
|
}
|
|
54
47
|
|
|
@@ -77,7 +70,6 @@ var set = function set(alert) {
|
|
|
77
70
|
});
|
|
78
71
|
}, 5000);
|
|
79
72
|
}
|
|
80
|
-
|
|
81
73
|
dispatch({
|
|
82
74
|
type: SET,
|
|
83
75
|
alert: Object.assign({}, alert, {
|
|
@@ -104,44 +96,35 @@ var isValidConfig = function isValidConfig(file) {
|
|
|
104
96
|
};
|
|
105
97
|
var getFileType = function getFileType(dropdown) {
|
|
106
98
|
var type = '';
|
|
107
|
-
|
|
108
99
|
switch (true) {
|
|
109
100
|
case dropdown == 'Presentation Mode':
|
|
110
101
|
type = 'uischema';
|
|
111
102
|
break;
|
|
112
|
-
|
|
113
103
|
case dropdown == 'Rule Schema':
|
|
114
104
|
type = 'schema';
|
|
115
105
|
break;
|
|
116
|
-
|
|
117
106
|
case dropdown == 'Configuration File':
|
|
118
107
|
type = 'config';
|
|
119
108
|
break;
|
|
120
|
-
|
|
121
109
|
case dropdown == 'Previous Configuration File':
|
|
122
110
|
type = 'config-review';
|
|
123
111
|
break;
|
|
124
|
-
|
|
125
112
|
default:
|
|
126
113
|
type = 'invalid';
|
|
127
114
|
}
|
|
128
|
-
|
|
129
115
|
return type;
|
|
130
116
|
};
|
|
131
117
|
var loadFile = function loadFile(fileName) {
|
|
132
118
|
try {
|
|
133
119
|
var schema = require("./schema/" + fileName.split(' | ')[1] + "/" + fileName.split(' ')[0]);
|
|
134
|
-
|
|
135
120
|
return schema;
|
|
136
121
|
} catch (e) {
|
|
137
122
|
console.log(e);
|
|
138
123
|
return null;
|
|
139
124
|
}
|
|
140
125
|
};
|
|
141
|
-
|
|
142
126
|
var _require = require('detect-browser'),
|
|
143
|
-
|
|
144
|
-
|
|
127
|
+
detect = _require.detect;
|
|
145
128
|
var browser = detect();
|
|
146
129
|
var crcBrowserSupport = ['chrome', 'firefox', 'opera', 'safari', 'edge'].includes(browser.name);
|
|
147
130
|
|
|
@@ -168,11 +151,9 @@ var SET_CRC32_EDITOR_LIVE = "SET_CRC32_EDITOR_LIVE";
|
|
|
168
151
|
var calcCrc32EditorLive = function calcCrc32EditorLive() {
|
|
169
152
|
return function (dispatch, getState) {
|
|
170
153
|
var formData = getState().editor.formData;
|
|
171
|
-
|
|
172
154
|
if (crcBrowserSupport == 1 && formData) {
|
|
173
155
|
var _require = require("crc"),
|
|
174
|
-
|
|
175
|
-
|
|
156
|
+
crc32 = _require.crc32;
|
|
176
157
|
var crc32EditorLive = crc32(JSON.stringify(formData, null, 2)).toString(16).toUpperCase().padStart(8, "0");
|
|
177
158
|
dispatch(setCrc32EditorLive(crc32EditorLive));
|
|
178
159
|
} else {
|
|
@@ -194,7 +175,6 @@ var publicUiSchemaFiles = function publicUiSchemaFiles(uiSchemaAry, schemaAry, d
|
|
|
194
175
|
dispatch(setUISchemaFile(uiSchemaAry));
|
|
195
176
|
dispatch(setUISchemaContent(loadFile(uiSchemaAry[0])));
|
|
196
177
|
}
|
|
197
|
-
|
|
198
178
|
if (demoMode && schemaAry.length) {
|
|
199
179
|
dispatch(publicSchemaFiles(demoConfig, schemaAry, {}, uiSchemaAry));
|
|
200
180
|
}
|
|
@@ -206,44 +186,33 @@ var fetchFileContent = function fetchFileContent(fileName, type) {
|
|
|
206
186
|
case type == "uischema":
|
|
207
187
|
dispatch(setConfigContentPreSubmit());
|
|
208
188
|
dispatch(resetLocalUISchemaList());
|
|
209
|
-
|
|
210
189
|
if (fileName.match(regexUISchemaPublic) != null) {
|
|
211
190
|
dispatch(setUISchemaContent(loadFile(fileName)));
|
|
212
191
|
} else {
|
|
213
192
|
dispatch(setUISchemaContent(null));
|
|
214
193
|
}
|
|
215
|
-
|
|
216
194
|
break;
|
|
217
|
-
|
|
218
195
|
case type == "schema":
|
|
219
196
|
dispatch(resetLocalSchemaList());
|
|
220
|
-
|
|
221
197
|
if (fileName.match(regexSchemaPublic) != null) {
|
|
222
198
|
dispatch(setSchemaContent(loadFile(fileName)));
|
|
223
199
|
} else {
|
|
224
200
|
dispatch(setSchemaContent(null));
|
|
225
201
|
}
|
|
226
|
-
|
|
227
202
|
break;
|
|
228
|
-
|
|
229
203
|
case type == "config":
|
|
230
204
|
dispatch(resetLocalConfigList());
|
|
231
|
-
|
|
232
205
|
if (fileName == "None") {
|
|
233
206
|
dispatch(setConfigContent(null));
|
|
234
207
|
dispatch(setUpdatedFormData(null));
|
|
235
208
|
dispatch(setConfigContentPreChange(""));
|
|
236
209
|
}
|
|
237
|
-
|
|
238
210
|
break;
|
|
239
|
-
|
|
240
211
|
case type == "config-review":
|
|
241
212
|
dispatch(setConfigContentPreChange(getState().editor.configContentLocal));
|
|
242
|
-
|
|
243
213
|
if (fileName == "None") {
|
|
244
214
|
dispatch(setConfigContentPreChange(""));
|
|
245
215
|
}
|
|
246
|
-
|
|
247
216
|
break;
|
|
248
217
|
}
|
|
249
218
|
};
|
|
@@ -252,18 +221,15 @@ var handleUploadedFile = function handleUploadedFile(file, dropdown, schemaAry,
|
|
|
252
221
|
var type = getFileType(dropdown);
|
|
253
222
|
return function (dispatch, getState) {
|
|
254
223
|
var fileReader = new FileReader();
|
|
255
|
-
|
|
256
224
|
fileReader.onloadend = function (e) {
|
|
257
225
|
var content = fileReader.result;
|
|
258
226
|
var contentJSON = null;
|
|
259
227
|
var fileNameDisplay = file.name + " (local)";
|
|
260
|
-
|
|
261
228
|
try {
|
|
262
229
|
contentJSON = JSON.parse(content);
|
|
263
230
|
} catch (error) {
|
|
264
231
|
window.alert("Warning: " + file.name + " is invalid and was not loaded");
|
|
265
232
|
}
|
|
266
|
-
|
|
267
233
|
if (contentJSON != null) {
|
|
268
234
|
switch (true) {
|
|
269
235
|
case type == "uischema" && isValidUISchema(file.name):
|
|
@@ -271,22 +237,17 @@ var handleUploadedFile = function handleUploadedFile(file, dropdown, schemaAry,
|
|
|
271
237
|
dispatch(resetLocalUISchemaList());
|
|
272
238
|
dispatch(setUISchemaFile([fileNameDisplay]));
|
|
273
239
|
break;
|
|
274
|
-
|
|
275
240
|
case type == "schema" && isValidSchema(file.name):
|
|
276
241
|
dispatch(setSchemaContent(contentJSON));
|
|
277
242
|
dispatch(resetLocalSchemaList());
|
|
278
243
|
dispatch(setSchemaFile([fileNameDisplay]));
|
|
279
244
|
break;
|
|
280
|
-
|
|
281
245
|
case type == "config" && isValidConfig(file.name):
|
|
282
246
|
var localSchema = getState().editor.editorSchemaFiles[0] && getState().editor.editorSchemaFiles[0].name.includes("(local)") ? true : false;
|
|
283
|
-
|
|
284
247
|
if (file && file.name && file.name.length && localSchema == false && schemaAry && schemaAry.length) {
|
|
285
248
|
dispatch(publicSchemaFiles(file.name, schemaAry, contentJSON, uiSchemaAry));
|
|
286
249
|
}
|
|
287
|
-
|
|
288
250
|
var configIncludesServerDetails = JSON.stringify(contentJSON, null, 2).includes("http://") || JSON.stringify(contentJSON, null, 2).includes("https://");
|
|
289
|
-
|
|
290
251
|
if (configIncludesServerDetails) {
|
|
291
252
|
dispatch(set({
|
|
292
253
|
type: "warning",
|
|
@@ -294,7 +255,6 @@ var handleUploadedFile = function handleUploadedFile(file, dropdown, schemaAry,
|
|
|
294
255
|
autoClear: false
|
|
295
256
|
}));
|
|
296
257
|
}
|
|
297
|
-
|
|
298
258
|
dispatch(setConfigContentLocal(content));
|
|
299
259
|
dispatch(setConfigContent(contentJSON));
|
|
300
260
|
dispatch(resetLocalConfigList());
|
|
@@ -302,14 +262,12 @@ var handleUploadedFile = function handleUploadedFile(file, dropdown, schemaAry,
|
|
|
302
262
|
dispatch(setUpdatedFormData(contentJSON));
|
|
303
263
|
dispatch(setConfigContentPreChange(content));
|
|
304
264
|
break;
|
|
305
|
-
|
|
306
265
|
default:
|
|
307
266
|
window.alert(file.name + " is an invalid file/filename");
|
|
308
267
|
break;
|
|
309
268
|
}
|
|
310
269
|
}
|
|
311
270
|
};
|
|
312
|
-
|
|
313
271
|
fileReader.readAsText(file);
|
|
314
272
|
};
|
|
315
273
|
};
|
|
@@ -344,54 +302,43 @@ var setUISchemaFile = function setUISchemaFile(UISchemaFiles) {
|
|
|
344
302
|
var publicSchemaFiles = function publicSchemaFiles(selectedConfig, schemaAry, contentJSON, uiSchemaAry) {
|
|
345
303
|
return function (dispatch) {
|
|
346
304
|
dispatch(resetSchemaFiles());
|
|
347
|
-
|
|
348
305
|
if (selectedConfig) {
|
|
349
306
|
var deviceType = "Other";
|
|
350
|
-
|
|
351
307
|
if (contentJSON.can_2 != undefined && contentJSON.connect == undefined && contentJSON.gnss == undefined) {
|
|
352
308
|
deviceType = "CANedge1";
|
|
353
309
|
}
|
|
354
|
-
|
|
355
310
|
if (contentJSON.can_2 != undefined && contentJSON.connect == undefined && contentJSON.gnss != undefined) {
|
|
356
311
|
deviceType = "CANedge1 GNSS";
|
|
357
312
|
}
|
|
358
|
-
|
|
359
313
|
if (contentJSON.can_2 != undefined && contentJSON.connect != undefined && contentJSON.gnss == undefined) {
|
|
360
314
|
deviceType = "CANedge2";
|
|
361
315
|
}
|
|
362
|
-
|
|
363
316
|
if (contentJSON.can_2 != undefined && contentJSON.connect != undefined && contentJSON.gnss != undefined) {
|
|
364
317
|
deviceType = "CANedge2 GNSS";
|
|
365
318
|
}
|
|
366
|
-
|
|
367
319
|
var schemaAryFiltered = schemaAry.filter(function (e) {
|
|
368
320
|
return e.includes(selectedConfig.substr(7, 5));
|
|
369
321
|
});
|
|
370
322
|
var uiSchemaAryFiltered = uiSchemaAry.filter(function (e) {
|
|
371
323
|
return e.includes(selectedConfig.substr(7, 5));
|
|
372
324
|
});
|
|
373
|
-
|
|
374
325
|
if (!deviceType.includes("GNSS")) {
|
|
375
326
|
schemaAryFiltered = schemaAryFiltered.filter(function (e) {
|
|
376
327
|
return !e.includes("GNSS");
|
|
377
328
|
});
|
|
378
329
|
}
|
|
379
|
-
|
|
380
330
|
if (deviceType.includes("CANedge")) {
|
|
381
331
|
schemaAryFiltered = schemaAryFiltered.filter(function (e) {
|
|
382
332
|
return e.includes(deviceType);
|
|
383
333
|
});
|
|
384
334
|
}
|
|
385
|
-
|
|
386
335
|
var loadedSchema = loadFile(schemaAryFiltered[0]);
|
|
387
|
-
|
|
388
336
|
if (schemaAryFiltered[0] && loadedSchema) {
|
|
389
337
|
dispatch(setSchemaFile(schemaAryFiltered));
|
|
390
338
|
dispatch(setSchemaContent(loadedSchema));
|
|
391
339
|
} else {
|
|
392
340
|
console.log("Unable to load embedded Rule Schema");
|
|
393
341
|
}
|
|
394
|
-
|
|
395
342
|
if (uiSchemaAryFiltered && uiSchemaAryFiltered.length) {
|
|
396
343
|
dispatch(resetUISchemaList());
|
|
397
344
|
dispatch(setUISchemaFile(uiSchemaAryFiltered));
|
|
@@ -441,7 +388,6 @@ var checkConfigTransmitPeriodDelay = function checkConfigTransmitPeriodDelay(con
|
|
|
441
388
|
var transmitListFiltered = content["can_" + i].transmit.filter(function (e) {
|
|
442
389
|
return e.period < e.delay;
|
|
443
390
|
});
|
|
444
|
-
|
|
445
391
|
if (transmitListFiltered.length > 0) {
|
|
446
392
|
dispatch(set({
|
|
447
393
|
type: "warning",
|
|
@@ -475,7 +421,6 @@ var checkConfigFiltersDisabled = function checkConfigFiltersDisabled(content) {
|
|
|
475
421
|
var filterListFiltered = content["can_" + i].filter.id.filter(function (e) {
|
|
476
422
|
return e.state == 1;
|
|
477
423
|
});
|
|
478
|
-
|
|
479
424
|
if (filterListFiltered.length == 0) {
|
|
480
425
|
dispatch(set({
|
|
481
426
|
type: "warning",
|
|
@@ -502,6 +447,23 @@ var checkConfigTls = function checkConfigTls(content) {
|
|
|
502
447
|
}
|
|
503
448
|
};
|
|
504
449
|
};
|
|
450
|
+
var checkConfigAwsEndpoint = function checkConfigAwsEndpoint(content) {
|
|
451
|
+
var regexAwsS3Endpoint = new RegExp("^https?:\\/\\/s3\\.[a-z]{2}-[a-z]+-\\d{1}\\.amazonaws\\.com$", "g");
|
|
452
|
+
return function (dispatch) {
|
|
453
|
+
if (content.connect != undefined && content.connect.s3 != undefined && content.connect.s3.server != undefined) {
|
|
454
|
+
if (content.connect.s3.server.endpoint != undefined) {
|
|
455
|
+
var endpoint = content.connect.s3.server.endpoint;
|
|
456
|
+
if (endpoint.includes("amazonaws") && !regexAwsS3Endpoint.test(endpoint)) {
|
|
457
|
+
dispatch(set({
|
|
458
|
+
type: "warning",
|
|
459
|
+
message: "Your S3 endpoint seems to be for AWS, but with incorrect syntax. Please review the documentation on how to configure the device for AWS S3 endpoints",
|
|
460
|
+
autoClear: false
|
|
461
|
+
}));
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
};
|
|
505
467
|
var checkS3EncryptedPasswordsNoKpub = function checkS3EncryptedPasswordsNoKpub(content) {
|
|
506
468
|
return function (dispatch) {
|
|
507
469
|
if (content.connect != undefined && content.connect.s3 != undefined && content.connect.s3.server != undefined && content.general != undefined && content.general.security != undefined) {
|
|
@@ -517,6 +479,34 @@ var checkS3EncryptedPasswordsNoKpub = function checkS3EncryptedPasswordsNoKpub(c
|
|
|
517
479
|
}
|
|
518
480
|
};
|
|
519
481
|
};
|
|
482
|
+
var checkWiFiEncryptedPasswordsNoKpub = function checkWiFiEncryptedPasswordsNoKpub(content) {
|
|
483
|
+
return function (dispatch) {
|
|
484
|
+
if (content.connect != undefined && content.connect.wifi != undefined && content.connect.wifi.keyformat != undefined && content.general != undefined && content.general.security != undefined) {
|
|
485
|
+
if (content.connect.wifi.keyformat != undefined) {
|
|
486
|
+
if (content.connect.wifi.keyformat == 1 && (content.general.security.kpub == undefined || content.general.security.kpub == "")) {
|
|
487
|
+
dispatch(set({
|
|
488
|
+
type: "warning",
|
|
489
|
+
message: "Your WiFi Key format is set to Encrypted, but you have not provided the Server public key. Please review the documentation on how to encrypt passwords",
|
|
490
|
+
autoClear: false
|
|
491
|
+
}));
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
};
|
|
497
|
+
var checkFileSplitOffsetPeriod = function checkFileSplitOffsetPeriod(content) {
|
|
498
|
+
return function (dispatch) {
|
|
499
|
+
if (content.log != undefined && content.log.file != undefined && content.log.file.split_time_period != undefined && content.log.file.split_time_offset != undefined) {
|
|
500
|
+
if (content.log.file.split_time_offset > content.log.file.split_time_period) {
|
|
501
|
+
dispatch(set({
|
|
502
|
+
type: "warning",
|
|
503
|
+
message: "Your log file split time offset is set larger than your file split time period. This is invalid and will cause the device to reject the Configuration File",
|
|
504
|
+
autoClear: false
|
|
505
|
+
}));
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
};
|
|
520
510
|
var saveUpdatedConfiguration = function saveUpdatedConfiguration(filename, content) {
|
|
521
511
|
return function (dispatch) {
|
|
522
512
|
if (content.can_2 != undefined) {
|
|
@@ -524,9 +514,11 @@ var saveUpdatedConfiguration = function saveUpdatedConfiguration(filename, conte
|
|
|
524
514
|
dispatch(checkConfigTransmitMonitoring(content));
|
|
525
515
|
dispatch(checkConfigFiltersDisabled(content));
|
|
526
516
|
dispatch(checkConfigTls(content));
|
|
517
|
+
dispatch(checkConfigAwsEndpoint(content));
|
|
527
518
|
dispatch(checkS3EncryptedPasswordsNoKpub(content));
|
|
519
|
+
dispatch(checkWiFiEncryptedPasswordsNoKpub(content));
|
|
520
|
+
dispatch(checkFileSplitOffsetPeriod(content));
|
|
528
521
|
}
|
|
529
|
-
|
|
530
522
|
dispatch(setConfigContent(content));
|
|
531
523
|
var blob = new Blob([JSON.stringify(content, null, 2)], {
|
|
532
524
|
type: "text/json"
|
|
@@ -627,7 +619,10 @@ var actions = {
|
|
|
627
619
|
checkConfigTransmitMonitoring: checkConfigTransmitMonitoring,
|
|
628
620
|
checkConfigFiltersDisabled: checkConfigFiltersDisabled,
|
|
629
621
|
checkConfigTls: checkConfigTls,
|
|
622
|
+
checkConfigAwsEndpoint: checkConfigAwsEndpoint,
|
|
630
623
|
checkS3EncryptedPasswordsNoKpub: checkS3EncryptedPasswordsNoKpub,
|
|
624
|
+
checkWiFiEncryptedPasswordsNoKpub: checkWiFiEncryptedPasswordsNoKpub,
|
|
625
|
+
checkFileSplitOffsetPeriod: checkFileSplitOffsetPeriod,
|
|
631
626
|
saveUpdatedConfiguration: saveUpdatedConfiguration,
|
|
632
627
|
setUpdatedFormData: setUpdatedFormData,
|
|
633
628
|
setUpdatedFormDataValue: setUpdatedFormDataValue,
|
|
@@ -17847,7 +17842,6 @@ var customStyles = {
|
|
|
17847
17842
|
});
|
|
17848
17843
|
}
|
|
17849
17844
|
};
|
|
17850
|
-
|
|
17851
17845
|
var selectOptions = function selectOptions(Files) {
|
|
17852
17846
|
Files = lodash.orderBy(Files, ["name"], ["desc"]);
|
|
17853
17847
|
return [].concat(Files, defaultOptions).map(function (File) {
|
|
@@ -17857,25 +17851,19 @@ var selectOptions = function selectOptions(Files) {
|
|
|
17857
17851
|
};
|
|
17858
17852
|
});
|
|
17859
17853
|
};
|
|
17860
|
-
|
|
17861
17854
|
var EditorDropDown = /*#__PURE__*/function (_React$Component) {
|
|
17862
17855
|
_inheritsLoose(EditorDropDown, _React$Component);
|
|
17863
|
-
|
|
17864
17856
|
function EditorDropDown(props) {
|
|
17865
17857
|
var _this;
|
|
17866
|
-
|
|
17867
17858
|
_this = _React$Component.call(this, props) || this;
|
|
17868
|
-
|
|
17869
17859
|
_this.handleSelectChange = function (selectedValue) {
|
|
17870
17860
|
if (selectedValue.value === "Upload") {
|
|
17871
17861
|
_this.props.onChange("None", _this.props.name);
|
|
17872
|
-
|
|
17873
17862
|
_this.refs.fileUploader.click();
|
|
17874
17863
|
} else if (!selectedValue.value.includes("(local)")) {
|
|
17875
17864
|
_this.props.onChange(selectedValue.value, _this.props.name);
|
|
17876
17865
|
}
|
|
17877
17866
|
};
|
|
17878
|
-
|
|
17879
17867
|
_this.state = {
|
|
17880
17868
|
defaultOption: {
|
|
17881
17869
|
label: "None",
|
|
@@ -17884,9 +17872,7 @@ var EditorDropDown = /*#__PURE__*/function (_React$Component) {
|
|
|
17884
17872
|
};
|
|
17885
17873
|
return _this;
|
|
17886
17874
|
}
|
|
17887
|
-
|
|
17888
17875
|
var _proto = EditorDropDown.prototype;
|
|
17889
|
-
|
|
17890
17876
|
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
17891
17877
|
if (nextProps.selected != "") {
|
|
17892
17878
|
this.setState({
|
|
@@ -17901,22 +17887,19 @@ var EditorDropDown = /*#__PURE__*/function (_React$Component) {
|
|
|
17901
17887
|
});
|
|
17902
17888
|
}
|
|
17903
17889
|
};
|
|
17904
|
-
|
|
17905
17890
|
_proto.componentWillMount = function componentWillMount() {
|
|
17906
17891
|
this.setState({
|
|
17907
17892
|
defaultOption: selectOptions(this.props.options)[0]
|
|
17908
17893
|
});
|
|
17909
17894
|
};
|
|
17910
|
-
|
|
17911
17895
|
_proto.render = function render() {
|
|
17912
17896
|
var _this2 = this;
|
|
17913
|
-
|
|
17914
17897
|
var _this$props = this.props,
|
|
17915
|
-
|
|
17916
|
-
|
|
17917
|
-
|
|
17918
|
-
|
|
17919
|
-
|
|
17898
|
+
handleUploadedFile = _this$props.handleUploadedFile,
|
|
17899
|
+
options = _this$props.options,
|
|
17900
|
+
schemaAry = _this$props.schemaAry,
|
|
17901
|
+
uiSchemaAry = _this$props.uiSchemaAry,
|
|
17902
|
+
disabled = _this$props.disabled;
|
|
17920
17903
|
return /*#__PURE__*/React.createElement("div", {
|
|
17921
17904
|
className: "form-group pl0 field-string"
|
|
17922
17905
|
}, /*#__PURE__*/React.createElement("p", null, this.props.name), /*#__PURE__*/React.createElement(Select, {
|
|
@@ -17941,35 +17924,30 @@ var EditorDropDown = /*#__PURE__*/function (_React$Component) {
|
|
|
17941
17924
|
className: "field-description field-description-shift"
|
|
17942
17925
|
}, this.props.comment));
|
|
17943
17926
|
};
|
|
17944
|
-
|
|
17945
17927
|
return EditorDropDown;
|
|
17946
17928
|
}(React.Component);
|
|
17947
17929
|
|
|
17948
17930
|
var EditorSchemaModal = /*#__PURE__*/function (_React$Component) {
|
|
17949
17931
|
_inheritsLoose(EditorSchemaModal, _React$Component);
|
|
17950
|
-
|
|
17951
17932
|
function EditorSchemaModal(props) {
|
|
17952
17933
|
return _React$Component.call(this, props) || this;
|
|
17953
17934
|
}
|
|
17954
|
-
|
|
17955
17935
|
var _proto = EditorSchemaModal.prototype;
|
|
17956
|
-
|
|
17957
17936
|
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
17958
17937
|
this.props.resetFiles();
|
|
17959
17938
|
};
|
|
17960
|
-
|
|
17961
17939
|
_proto.render = function render() {
|
|
17962
17940
|
var _this$props = this.props,
|
|
17963
|
-
|
|
17964
|
-
|
|
17965
|
-
|
|
17966
|
-
|
|
17967
|
-
|
|
17968
|
-
|
|
17969
|
-
|
|
17970
|
-
|
|
17971
|
-
|
|
17972
|
-
|
|
17941
|
+
editorUISchemaFiles = _this$props.editorUISchemaFiles,
|
|
17942
|
+
editorSchemaFiles = _this$props.editorSchemaFiles,
|
|
17943
|
+
editorConfigFiles = _this$props.editorConfigFiles,
|
|
17944
|
+
handleUploadedFile = _this$props.handleUploadedFile,
|
|
17945
|
+
selecteduischema = _this$props.selecteduischema,
|
|
17946
|
+
selectedschema = _this$props.selectedschema,
|
|
17947
|
+
selectedconfig = _this$props.selectedconfig,
|
|
17948
|
+
handleDropdownChange = _this$props.handleDropdownChange,
|
|
17949
|
+
schemaAry = _this$props.schemaAry,
|
|
17950
|
+
uiSchemaAry = _this$props.uiSchemaAry;
|
|
17973
17951
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h4", null, "Schema & config loader"), /*#__PURE__*/React.createElement(EditorDropDown, {
|
|
17974
17952
|
disabled: editorSchemaFiles.length == 0 ? true : false,
|
|
17975
17953
|
options: editorUISchemaFiles,
|
|
@@ -18004,10 +17982,8 @@ var EditorSchemaModal = /*#__PURE__*/function (_React$Component) {
|
|
|
18004
17982
|
comment: "The Configuration File contains the settings that will be used on the device. You can upload a new Configuration File via the dropdown to modify it using the editor."
|
|
18005
17983
|
}));
|
|
18006
17984
|
};
|
|
18007
|
-
|
|
18008
17985
|
return EditorSchemaModal;
|
|
18009
17986
|
}(React.Component);
|
|
18010
|
-
|
|
18011
17987
|
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
18012
17988
|
return {
|
|
18013
17989
|
handleUploadedFile: function handleUploadedFile$1(file, type, schemaAry, uiSchemaAry) {
|
|
@@ -18018,19 +17994,14 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
18018
17994
|
}
|
|
18019
17995
|
};
|
|
18020
17996
|
};
|
|
18021
|
-
|
|
18022
17997
|
var EditorSchemaModal$1 = reactRedux.connect(null, mapDispatchToProps)(EditorSchemaModal);
|
|
18023
17998
|
|
|
18024
17999
|
var yourForm;
|
|
18025
|
-
|
|
18026
18000
|
var merge = require("deepmerge");
|
|
18027
|
-
|
|
18028
18001
|
var PartialConfigLoader = /*#__PURE__*/function (_React$Component) {
|
|
18029
18002
|
_inheritsLoose(PartialConfigLoader, _React$Component);
|
|
18030
|
-
|
|
18031
18003
|
function PartialConfigLoader(props) {
|
|
18032
18004
|
var _this;
|
|
18033
|
-
|
|
18034
18005
|
_this = _React$Component.call(this, props) || this;
|
|
18035
18006
|
_this.onReview = _this.onReview.bind(_assertThisInitialized(_this));
|
|
18036
18007
|
_this.onFilesError = _this.onFilesError.bind(_assertThisInitialized(_this));
|
|
@@ -18044,7 +18015,6 @@ var PartialConfigLoader = /*#__PURE__*/function (_React$Component) {
|
|
|
18044
18015
|
mergedConfigValid: "Unknown"
|
|
18045
18016
|
};
|
|
18046
18017
|
_this.fileReader = new FileReader();
|
|
18047
|
-
|
|
18048
18018
|
_this.fileReader.onload = function (event) {
|
|
18049
18019
|
try {
|
|
18050
18020
|
_this.setState({
|
|
@@ -18056,24 +18026,19 @@ var PartialConfigLoader = /*#__PURE__*/function (_React$Component) {
|
|
|
18056
18026
|
_this.onFilesError(e);
|
|
18057
18027
|
}
|
|
18058
18028
|
};
|
|
18059
|
-
|
|
18060
18029
|
return _this;
|
|
18061
18030
|
}
|
|
18062
|
-
|
|
18063
18031
|
var _proto = PartialConfigLoader.prototype;
|
|
18064
|
-
|
|
18065
18032
|
_proto.onSubmit = function onSubmit() {
|
|
18066
18033
|
this.setState({
|
|
18067
18034
|
mergedConfigValid: true
|
|
18068
18035
|
}, function () {});
|
|
18069
18036
|
};
|
|
18070
|
-
|
|
18071
18037
|
_proto.onValidationError = function onValidationError() {
|
|
18072
18038
|
this.setState({
|
|
18073
18039
|
mergedConfigValid: false
|
|
18074
18040
|
}, function () {});
|
|
18075
18041
|
};
|
|
18076
|
-
|
|
18077
18042
|
_proto.testMergedFile = function testMergedFile() {
|
|
18078
18043
|
var mergedConfigTemp = merge(this.props.formData, this.state.jsonFile);
|
|
18079
18044
|
this.setState({
|
|
@@ -18082,16 +18047,13 @@ var PartialConfigLoader = /*#__PURE__*/function (_React$Component) {
|
|
|
18082
18047
|
yourForm.submit();
|
|
18083
18048
|
});
|
|
18084
18049
|
};
|
|
18085
|
-
|
|
18086
18050
|
_proto.onFileChange = function onFileChange(file) {
|
|
18087
18051
|
this.setState({
|
|
18088
18052
|
jsonFileName: file[0].name
|
|
18089
18053
|
}, function () {});
|
|
18090
18054
|
};
|
|
18091
|
-
|
|
18092
18055
|
_proto.onFilesError = function onFilesError(error) {
|
|
18093
18056
|
var _this2 = this;
|
|
18094
|
-
|
|
18095
18057
|
this.setState({
|
|
18096
18058
|
jsonFile: {},
|
|
18097
18059
|
jsonFileName: ""
|
|
@@ -18099,10 +18061,8 @@ var PartialConfigLoader = /*#__PURE__*/function (_React$Component) {
|
|
|
18099
18061
|
_this2.props.showAlert("info", "Invalid JSON file - " + error.message);
|
|
18100
18062
|
});
|
|
18101
18063
|
};
|
|
18102
|
-
|
|
18103
18064
|
_proto.onReview = function onReview() {
|
|
18104
18065
|
var _this3 = this;
|
|
18105
|
-
|
|
18106
18066
|
console.log(this.state.mergedConfig);
|
|
18107
18067
|
this.props.setConfigContent(this.state.mergedConfig);
|
|
18108
18068
|
this.setState({
|
|
@@ -18110,22 +18070,19 @@ var PartialConfigLoader = /*#__PURE__*/function (_React$Component) {
|
|
|
18110
18070
|
jsonFileName: ""
|
|
18111
18071
|
}, function () {
|
|
18112
18072
|
_this3.props.showAlert("success", "Merged partial Configuration File with editor Configuration File");
|
|
18113
|
-
|
|
18114
18073
|
_this3.props.setUpdatedFormData(_this3.state.mergedConfig);
|
|
18115
18074
|
});
|
|
18116
18075
|
};
|
|
18117
|
-
|
|
18118
18076
|
_proto.render = function render() {
|
|
18119
18077
|
var _this4 = this;
|
|
18120
|
-
|
|
18121
18078
|
var _this$state = this.state,
|
|
18122
|
-
|
|
18123
|
-
|
|
18124
|
-
|
|
18125
|
-
|
|
18079
|
+
jsonFile = _this$state.jsonFile,
|
|
18080
|
+
jsonFileName = _this$state.jsonFileName,
|
|
18081
|
+
mergedConfig = _this$state.mergedConfig,
|
|
18082
|
+
mergedConfigValid = _this$state.mergedConfigValid;
|
|
18126
18083
|
var _this$props = this.props,
|
|
18127
|
-
|
|
18128
|
-
|
|
18084
|
+
formData = _this$props.formData,
|
|
18085
|
+
schemaContent = _this$props.schemaContent;
|
|
18129
18086
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h4", null, "Partial config loader"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
18130
18087
|
className: "form-group pl0 field-string"
|
|
18131
18088
|
}, /*#__PURE__*/React.createElement("p", {
|
|
@@ -18182,17 +18139,14 @@ var PartialConfigLoader = /*#__PURE__*/function (_React$Component) {
|
|
|
18182
18139
|
}
|
|
18183
18140
|
})))));
|
|
18184
18141
|
};
|
|
18185
|
-
|
|
18186
18142
|
return PartialConfigLoader;
|
|
18187
18143
|
}(React.Component);
|
|
18188
|
-
|
|
18189
18144
|
var mapStateToProps = function mapStateToProps(state) {
|
|
18190
18145
|
return {
|
|
18191
18146
|
formData: state.editor.formData,
|
|
18192
18147
|
schemaContent: state.editor.schemaContent
|
|
18193
18148
|
};
|
|
18194
18149
|
};
|
|
18195
|
-
|
|
18196
18150
|
var mapDispatchToProps$1 = function mapDispatchToProps(dispatch) {
|
|
18197
18151
|
return {
|
|
18198
18152
|
setConfigContent: function setConfigContent$1(content) {
|
|
@@ -18203,18 +18157,14 @@ var mapDispatchToProps$1 = function mapDispatchToProps(dispatch) {
|
|
|
18203
18157
|
}
|
|
18204
18158
|
};
|
|
18205
18159
|
};
|
|
18206
|
-
|
|
18207
18160
|
var PartialConfigLoader$1 = reactRedux.connect(mapStateToProps, mapDispatchToProps$1)(PartialConfigLoader);
|
|
18208
18161
|
|
|
18209
18162
|
var EditorToolButton = /*#__PURE__*/function (_React$Component) {
|
|
18210
18163
|
_inheritsLoose(EditorToolButton, _React$Component);
|
|
18211
|
-
|
|
18212
18164
|
function EditorToolButton(props) {
|
|
18213
18165
|
return _React$Component.call(this, props) || this;
|
|
18214
18166
|
}
|
|
18215
|
-
|
|
18216
18167
|
var _proto = EditorToolButton.prototype;
|
|
18217
|
-
|
|
18218
18168
|
_proto.render = function render() {
|
|
18219
18169
|
return /*#__PURE__*/React.createElement("div", {
|
|
18220
18170
|
className: "field-integer",
|
|
@@ -18231,19 +18181,15 @@ var EditorToolButton = /*#__PURE__*/function (_React$Component) {
|
|
|
18231
18181
|
className: "btn-field-description field-description-shift"
|
|
18232
18182
|
}, this.props.comment));
|
|
18233
18183
|
};
|
|
18234
|
-
|
|
18235
18184
|
return EditorToolButton;
|
|
18236
18185
|
}(React.Component);
|
|
18237
18186
|
|
|
18238
18187
|
var EditorToolModalWrapper = /*#__PURE__*/function (_React$Component) {
|
|
18239
18188
|
_inheritsLoose(EditorToolModalWrapper, _React$Component);
|
|
18240
|
-
|
|
18241
18189
|
function EditorToolModalWrapper(props) {
|
|
18242
18190
|
return _React$Component.call(this, props) || this;
|
|
18243
18191
|
}
|
|
18244
|
-
|
|
18245
18192
|
var _proto = EditorToolModalWrapper.prototype;
|
|
18246
|
-
|
|
18247
18193
|
_proto.render = function render() {
|
|
18248
18194
|
return /*#__PURE__*/React.createElement("div", {
|
|
18249
18195
|
className: "tools-side-bar"
|
|
@@ -18257,13 +18203,12 @@ var EditorToolModalWrapper = /*#__PURE__*/function (_React$Component) {
|
|
|
18257
18203
|
}
|
|
18258
18204
|
}, "\xD7")), this.props.modal);
|
|
18259
18205
|
};
|
|
18260
|
-
|
|
18261
18206
|
return EditorToolModalWrapper;
|
|
18262
18207
|
}(React.Component);
|
|
18263
18208
|
|
|
18264
18209
|
function EditorNavs(_ref) {
|
|
18265
18210
|
var links = _ref.navs.links,
|
|
18266
|
-
|
|
18211
|
+
onNavChange = _ref.onNavChange;
|
|
18267
18212
|
var relLinks = links.filter(function (_ref2) {
|
|
18268
18213
|
var nav = _ref2.nav;
|
|
18269
18214
|
return nav !== applyNav.GENERIC_NAV;
|
|
@@ -18280,9 +18225,9 @@ function EditorNavs(_ref) {
|
|
|
18280
18225
|
className: "nav navbar-nav navbar-ul-margin-reduce"
|
|
18281
18226
|
}, relLinks.map(function (_ref3, i) {
|
|
18282
18227
|
var nav = _ref3.nav,
|
|
18283
|
-
|
|
18284
|
-
|
|
18285
|
-
|
|
18228
|
+
name = _ref3.name,
|
|
18229
|
+
icon = _ref3.icon,
|
|
18230
|
+
isActive = _ref3.isActive;
|
|
18286
18231
|
return nav !== "GEOFENCE" ?
|
|
18287
18232
|
/*#__PURE__*/
|
|
18288
18233
|
React.createElement("li", {
|
|
@@ -18352,33 +18297,24 @@ var selectOptions$1 = function selectOptions(Files) {
|
|
|
18352
18297
|
};
|
|
18353
18298
|
});
|
|
18354
18299
|
};
|
|
18355
|
-
|
|
18356
18300
|
var pastCrc32 = "N/A";
|
|
18357
|
-
|
|
18358
18301
|
var _require$1 = require("detect-browser"),
|
|
18359
|
-
|
|
18360
|
-
|
|
18302
|
+
detect$1 = _require$1.detect;
|
|
18361
18303
|
var browser$1 = detect$1();
|
|
18362
18304
|
var crcBrowserSupport$1 = ["chrome", "firefox", "opera", "safari", "edge"].includes(browser$1.name);
|
|
18363
|
-
|
|
18364
18305
|
var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
|
|
18365
18306
|
_inheritsLoose(EditorChangesComparison, _React$Component);
|
|
18366
|
-
|
|
18367
18307
|
function EditorChangesComparison(props) {
|
|
18368
18308
|
var _this;
|
|
18369
|
-
|
|
18370
18309
|
_this = _React$Component.call(this, props) || this;
|
|
18371
|
-
|
|
18372
18310
|
_this.toggleCheckbox = function () {
|
|
18373
18311
|
_this.setState({
|
|
18374
18312
|
hideWhiteSpace: !_this.state.hideWhiteSpace
|
|
18375
18313
|
});
|
|
18376
18314
|
};
|
|
18377
|
-
|
|
18378
18315
|
_this.handleSelectChange = function (selectedValue) {
|
|
18379
18316
|
_this.props.handleDropdownChange(selectedValue.value, "Previous Configuration File");
|
|
18380
18317
|
};
|
|
18381
|
-
|
|
18382
18318
|
_this.toggleCheckbox = _this.toggleCheckbox.bind(_assertThisInitialized(_this));
|
|
18383
18319
|
_this.handleSelectChange = _this.handleSelectChange.bind(_assertThisInitialized(_this));
|
|
18384
18320
|
_this.state = {
|
|
@@ -18386,32 +18322,27 @@ var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
|
|
|
18386
18322
|
};
|
|
18387
18323
|
return _this;
|
|
18388
18324
|
}
|
|
18389
|
-
|
|
18390
18325
|
var _proto = EditorChangesComparison.prototype;
|
|
18391
|
-
|
|
18392
18326
|
_proto.render = function render() {
|
|
18393
18327
|
var _this$props = this.props,
|
|
18394
|
-
|
|
18395
|
-
|
|
18396
|
-
|
|
18397
|
-
|
|
18398
|
-
|
|
18399
|
-
|
|
18400
|
-
|
|
18401
|
-
|
|
18402
|
-
|
|
18403
|
-
|
|
18328
|
+
options = _this$props.options,
|
|
18329
|
+
selected = _this$props.selected,
|
|
18330
|
+
past = _this$props.past,
|
|
18331
|
+
current = _this$props.current,
|
|
18332
|
+
closeChangesModal = _this$props.closeChangesModal,
|
|
18333
|
+
revisedConfigFile = _this$props.revisedConfigFile,
|
|
18334
|
+
crc32EditorLive = _this$props.crc32EditorLive,
|
|
18335
|
+
isCompareChanges = _this$props.isCompareChanges,
|
|
18336
|
+
enableDownload = _this$props.enableDownload,
|
|
18337
|
+
externalSubmit = _this$props.externalSubmit;
|
|
18404
18338
|
var pastCleaned = past && Object.keys(past).length ? JSON.stringify(JSON.parse(past), null, 2) : "";
|
|
18405
|
-
|
|
18406
18339
|
if (crcBrowserSupport$1 == 1 && past && Object.keys(past).length) {
|
|
18407
18340
|
var _require2 = require("crc"),
|
|
18408
|
-
|
|
18409
|
-
|
|
18341
|
+
crc32 = _require2.crc32;
|
|
18410
18342
|
pastCrc32 = crc32(past).toString(16).toUpperCase().padStart(8, "0");
|
|
18411
18343
|
} else {
|
|
18412
18344
|
pastCrc32 = "N/A";
|
|
18413
18345
|
}
|
|
18414
|
-
|
|
18415
18346
|
return /*#__PURE__*/React.createElement("div", {
|
|
18416
18347
|
className: isCompareChanges ? "show modal-custom-wrapper" : "hidden modal-custom-wrapper"
|
|
18417
18348
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -18490,10 +18421,8 @@ var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
|
|
|
18490
18421
|
className: "btn btn-primary ml15"
|
|
18491
18422
|
}, " ", "Download to disk", " "))));
|
|
18492
18423
|
};
|
|
18493
|
-
|
|
18494
18424
|
return EditorChangesComparison;
|
|
18495
18425
|
}(React.Component);
|
|
18496
|
-
|
|
18497
18426
|
function mapStateToProps$1(state) {
|
|
18498
18427
|
return {
|
|
18499
18428
|
past: state.editor.configContentPreChange,
|
|
@@ -18501,7 +18430,6 @@ function mapStateToProps$1(state) {
|
|
|
18501
18430
|
crc32EditorLive: state.editor.crc32EditorLive
|
|
18502
18431
|
};
|
|
18503
18432
|
}
|
|
18504
|
-
|
|
18505
18433
|
var EditorChangesComparison$1 = reactRedux.connect(mapStateToProps$1)(EditorChangesComparison);
|
|
18506
18434
|
|
|
18507
18435
|
var regexRevision = new RegExp('\\d{2}\\.\\d{2}\\.json', 'g');
|
|
@@ -18509,22 +18437,16 @@ var isDownloadConfig = false;
|
|
|
18509
18437
|
var activatedTab;
|
|
18510
18438
|
var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
18511
18439
|
_inheritsLoose(EditorSection, _React$Component);
|
|
18512
|
-
|
|
18513
18440
|
function EditorSection(props) {
|
|
18514
18441
|
var _this;
|
|
18515
|
-
|
|
18516
18442
|
_this = _React$Component.call(this, props) || this;
|
|
18517
|
-
|
|
18518
18443
|
_this.handleChange = function (_ref) {
|
|
18519
18444
|
var formData = _ref.formData;
|
|
18520
|
-
|
|
18521
18445
|
_this.props.setUpdatedFormData(formData);
|
|
18522
18446
|
};
|
|
18523
|
-
|
|
18524
18447
|
_this.onNavChange = function (nav) {
|
|
18525
18448
|
activatedTab = nav[0];
|
|
18526
18449
|
};
|
|
18527
|
-
|
|
18528
18450
|
_this.editorForm = React.createRef();
|
|
18529
18451
|
_this.handleCompareChanges = _this.handleCompareChanges.bind(_assertThisInitialized(_this));
|
|
18530
18452
|
_this.closeChangesModal = _this.closeChangesModal.bind(_assertThisInitialized(_this));
|
|
@@ -18555,18 +18477,14 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18555
18477
|
_this.s3 = _this.props.fetchFileContentExt ? true : false;
|
|
18556
18478
|
return _this;
|
|
18557
18479
|
}
|
|
18558
|
-
|
|
18559
18480
|
var _proto = EditorSection.prototype;
|
|
18560
|
-
|
|
18561
18481
|
_proto.escFunction = function escFunction(event) {
|
|
18562
18482
|
if (event.keyCode === 27) {
|
|
18563
18483
|
this.closeChangesModal();
|
|
18564
18484
|
}
|
|
18565
18485
|
};
|
|
18566
|
-
|
|
18567
18486
|
_proto.subMenuBtnClick = function subMenuBtnClick(name) {
|
|
18568
18487
|
var _this2 = this;
|
|
18569
|
-
|
|
18570
18488
|
var sideBar = this.state.activeSideBar == name ? 'none' : name;
|
|
18571
18489
|
this.setState({
|
|
18572
18490
|
activeSideBar: sideBar
|
|
@@ -18574,17 +18492,14 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18574
18492
|
_this2.props.setConfigContentPreSubmit();
|
|
18575
18493
|
});
|
|
18576
18494
|
};
|
|
18577
|
-
|
|
18578
18495
|
_proto.hideUischemaModal = function hideUischemaModal() {
|
|
18579
18496
|
this.setState({
|
|
18580
18497
|
showUischemaModal: false
|
|
18581
18498
|
});
|
|
18582
18499
|
};
|
|
18583
|
-
|
|
18584
18500
|
_proto.handleDropdownChange = function handleDropdownChange(selection, dropdown) {
|
|
18585
18501
|
var _this$setState,
|
|
18586
|
-
|
|
18587
|
-
|
|
18502
|
+
_this3 = this;
|
|
18588
18503
|
var fileType = getFileType(dropdown);
|
|
18589
18504
|
this.setState((_this$setState = {}, _this$setState[fileType] = selection, _this$setState['selected' + fileType] = selection, _this$setState[fileType.replace('-', '')] = {
|
|
18590
18505
|
value: selection,
|
|
@@ -18597,39 +18512,31 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18597
18512
|
}
|
|
18598
18513
|
});
|
|
18599
18514
|
};
|
|
18600
|
-
|
|
18601
18515
|
_proto.handleCompareChanges = function handleCompareChanges(e) {
|
|
18602
18516
|
this.setState({
|
|
18603
18517
|
isCompareChanges: !this.state.isCompareChanges
|
|
18604
18518
|
});
|
|
18605
18519
|
};
|
|
18606
|
-
|
|
18607
18520
|
_proto.closeChangesModal = function closeChangesModal(e) {
|
|
18608
18521
|
this.setState({
|
|
18609
18522
|
isCompareChanges: false
|
|
18610
18523
|
});
|
|
18611
18524
|
document.body.style.overflow = 'auto';
|
|
18612
18525
|
};
|
|
18613
|
-
|
|
18614
18526
|
_proto.enableDownload = function enableDownload() {
|
|
18615
18527
|
isDownloadConfig = true;
|
|
18616
18528
|
};
|
|
18617
|
-
|
|
18618
18529
|
_proto.componentWillMount = function componentWillMount() {
|
|
18619
18530
|
this.props.publicUiSchemaFiles(this.props.uiSchemaAry, this.props.schemaAry, this.props.demoMode);
|
|
18620
18531
|
};
|
|
18621
|
-
|
|
18622
18532
|
_proto.componentDidMount = function componentDidMount() {
|
|
18623
18533
|
document.addEventListener('keydown', this.escFunction, false);
|
|
18624
18534
|
};
|
|
18625
|
-
|
|
18626
18535
|
_proto.componentWillUnMount = function componentWillUnMount() {
|
|
18627
18536
|
document.removeEventListener('keydown', this.escFunction, false);
|
|
18628
18537
|
};
|
|
18629
|
-
|
|
18630
18538
|
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
18631
18539
|
var _this4 = this;
|
|
18632
|
-
|
|
18633
18540
|
var uiLocal = nextProps.editorUISchemaFiles.filter(function (file) {
|
|
18634
18541
|
return file.name.includes('(local)');
|
|
18635
18542
|
});
|
|
@@ -18639,25 +18546,21 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18639
18546
|
var configLocal = nextProps.editorConfigFiles.filter(function (file) {
|
|
18640
18547
|
return file.name.includes('(local)');
|
|
18641
18548
|
});
|
|
18642
|
-
|
|
18643
18549
|
if (uiLocal.length) {
|
|
18644
18550
|
this.setState({
|
|
18645
18551
|
selecteduischema: uiLocal[0].name
|
|
18646
18552
|
});
|
|
18647
18553
|
}
|
|
18648
|
-
|
|
18649
18554
|
if (schemaLocal.length) {
|
|
18650
18555
|
this.setState({
|
|
18651
18556
|
selectedschema: schemaLocal[0].name
|
|
18652
18557
|
});
|
|
18653
18558
|
}
|
|
18654
|
-
|
|
18655
18559
|
if (configLocal.length) {
|
|
18656
18560
|
this.setState({
|
|
18657
18561
|
selectedconfig: configLocal[0].name
|
|
18658
18562
|
});
|
|
18659
18563
|
}
|
|
18660
|
-
|
|
18661
18564
|
if (nextProps.editorConfigFiles.length == 0) {
|
|
18662
18565
|
this.setState({
|
|
18663
18566
|
configreview: {
|
|
@@ -18666,7 +18569,6 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18666
18569
|
}
|
|
18667
18570
|
});
|
|
18668
18571
|
}
|
|
18669
|
-
|
|
18670
18572
|
if (this.props.editorConfigFiles.length != nextProps.editorConfigFiles.length && nextProps.editorConfigFiles[0] && nextProps.editorConfigFiles[0].name) {
|
|
18671
18573
|
var configName = configLocal.length ? configLocal[0].name : nextProps.editorConfigFiles[0].name;
|
|
18672
18574
|
this.setState({
|
|
@@ -18683,39 +18585,30 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18683
18585
|
});
|
|
18684
18586
|
}
|
|
18685
18587
|
};
|
|
18686
|
-
|
|
18687
18588
|
_proto.onSubmit = function onSubmit(_ref2) {
|
|
18688
18589
|
var _this5 = this;
|
|
18689
|
-
|
|
18690
18590
|
var formData = _ref2.formData;
|
|
18691
|
-
|
|
18692
18591
|
if (this.props.schemaContent == undefined || this.props.schemaContent == null) {
|
|
18693
18592
|
this.props.showAlert('info', 'No Rule Schema has been loaded');
|
|
18694
18593
|
return;
|
|
18695
18594
|
}
|
|
18696
|
-
|
|
18697
18595
|
var checkSchemaList = this.props.editorSchemaFiles.length ? this.props.editorSchemaFiles[0].name : null;
|
|
18698
18596
|
var checkSchemaUpload = this.props.editorSchemaFiles.filter(function (file) {
|
|
18699
18597
|
return file.name.includes('(local)');
|
|
18700
18598
|
});
|
|
18701
18599
|
var checkUpload = null;
|
|
18702
|
-
|
|
18703
18600
|
if (checkSchemaUpload.length) {
|
|
18704
18601
|
checkUpload = checkSchemaUpload[0].name.split(' ')[0];
|
|
18705
18602
|
}
|
|
18706
|
-
|
|
18707
18603
|
this.setState({
|
|
18708
18604
|
schema: checkUpload ? checkUpload : this.state.selectedschema ? this.state.selectedschema : checkSchemaList,
|
|
18709
18605
|
formData: formData,
|
|
18710
18606
|
isSubmitting: true
|
|
18711
18607
|
}, function () {
|
|
18712
18608
|
var tempJson = JSON.stringify(formData, null, 2);
|
|
18713
|
-
|
|
18714
18609
|
_this5.props.setConfigContent(JSON.parse(tempJson));
|
|
18715
|
-
|
|
18716
18610
|
var revisedConfigFileSchema = _this5.state.schema;
|
|
18717
18611
|
var revisedConfigFile = "config-" + revisedConfigFileSchema.match(regexRevision);
|
|
18718
|
-
|
|
18719
18612
|
if (_this5.state.isCompareChanges === false) {
|
|
18720
18613
|
_this5.setState({
|
|
18721
18614
|
isCompareChanges: true,
|
|
@@ -18724,23 +18617,18 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18724
18617
|
label: revisedConfigFile
|
|
18725
18618
|
}
|
|
18726
18619
|
});
|
|
18727
|
-
|
|
18728
18620
|
document.body.style.overflow = 'hidden';
|
|
18729
18621
|
} else {
|
|
18730
18622
|
if (isDownloadConfig) {
|
|
18731
18623
|
_this5.props.saveUpdatedConfiguration(revisedConfigFile, formData);
|
|
18732
|
-
|
|
18733
18624
|
isDownloadConfig = false;
|
|
18734
18625
|
document.body.style.overflow = 'auto';
|
|
18735
|
-
|
|
18736
18626
|
_this5.setState({
|
|
18737
18627
|
isCompareChanges: false
|
|
18738
18628
|
});
|
|
18739
18629
|
} else {
|
|
18740
18630
|
_this5.props.updateConfigFileExt(JSON.stringify(formData, null, 2), "" + revisedConfigFile);
|
|
18741
|
-
|
|
18742
18631
|
document.body.style.overflow = 'auto';
|
|
18743
|
-
|
|
18744
18632
|
_this5.setState({
|
|
18745
18633
|
isCompareChanges: false
|
|
18746
18634
|
});
|
|
@@ -18748,24 +18636,21 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18748
18636
|
}
|
|
18749
18637
|
});
|
|
18750
18638
|
};
|
|
18751
|
-
|
|
18752
18639
|
_proto.handleError = function handleError(errors) {
|
|
18753
18640
|
isDownloadConfig = false;
|
|
18754
18641
|
this.props.showAlert('danger', 'The config contains validation errors (see top of editor) - please review and try again');
|
|
18755
18642
|
};
|
|
18756
|
-
|
|
18757
18643
|
_proto.render = function render() {
|
|
18758
18644
|
var _this6 = this;
|
|
18759
|
-
|
|
18760
18645
|
var _this$props = this.props,
|
|
18761
|
-
|
|
18762
|
-
|
|
18763
|
-
|
|
18764
|
-
|
|
18765
|
-
|
|
18766
|
-
|
|
18767
|
-
|
|
18768
|
-
|
|
18646
|
+
editorSchemaFiles = _this$props.editorSchemaFiles,
|
|
18647
|
+
editorConfigFiles = _this$props.editorConfigFiles,
|
|
18648
|
+
editorUISchemaFiles = _this$props.editorUISchemaFiles,
|
|
18649
|
+
configContent = _this$props.configContent,
|
|
18650
|
+
uiContent = _this$props.uiContent,
|
|
18651
|
+
schemaContent = _this$props.schemaContent,
|
|
18652
|
+
editorTools = _this$props.editorTools,
|
|
18653
|
+
sideBarPadding = _this$props.sideBarPadding;
|
|
18769
18654
|
var editorUISchemaFile = editorUISchemaFiles[0] ? editorUISchemaFiles[0].name : "";
|
|
18770
18655
|
var editorUIAdvancedSimpleTest = editorUISchemaFile.includes("Simple") || editorUISchemaFile.includes("Advanced");
|
|
18771
18656
|
var FormWithNav = schemaContent ? applyNav__default(Form, EditorNavs) : Form;
|
|
@@ -18892,10 +18777,8 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18892
18777
|
className: "config-bar-background"
|
|
18893
18778
|
}));
|
|
18894
18779
|
};
|
|
18895
|
-
|
|
18896
18780
|
return EditorSection;
|
|
18897
18781
|
}(React.Component);
|
|
18898
|
-
|
|
18899
18782
|
var mapStateToProps$2 = function mapStateToProps(state) {
|
|
18900
18783
|
return {
|
|
18901
18784
|
editorSchemaFiles: state.editor.editorSchemaFiles,
|
|
@@ -18907,7 +18790,6 @@ var mapStateToProps$2 = function mapStateToProps(state) {
|
|
|
18907
18790
|
configContentPreChange: state.editor.configContentPreChange
|
|
18908
18791
|
};
|
|
18909
18792
|
};
|
|
18910
|
-
|
|
18911
18793
|
var mapDispatchToProps$2 = function mapDispatchToProps(dispatch) {
|
|
18912
18794
|
return {
|
|
18913
18795
|
fetchFileContent: function fetchFileContent$1(fileName, fileType) {
|
|
@@ -18930,7 +18812,6 @@ var mapDispatchToProps$2 = function mapDispatchToProps(dispatch) {
|
|
|
18930
18812
|
}
|
|
18931
18813
|
};
|
|
18932
18814
|
};
|
|
18933
|
-
|
|
18934
18815
|
var EditorSection$1 = reactRedux.connect(mapStateToProps$2, mapDispatchToProps$2)(EditorSection);
|
|
18935
18816
|
|
|
18936
18817
|
var reducer = (function (state, action) {
|
|
@@ -18945,101 +18826,83 @@ var reducer = (function (state, action) {
|
|
|
18945
18826
|
crc32EditorLive: ""
|
|
18946
18827
|
};
|
|
18947
18828
|
}
|
|
18948
|
-
|
|
18949
18829
|
switch (action.type) {
|
|
18950
18830
|
case SET_CRC32_EDITOR_LIVE:
|
|
18951
18831
|
return _extends({}, state, {
|
|
18952
18832
|
crc32EditorLive: action.crc32EditorLive
|
|
18953
18833
|
});
|
|
18954
|
-
|
|
18955
18834
|
case RESET_SCHEMA_FILES:
|
|
18956
18835
|
return {
|
|
18957
18836
|
editorSchemaFiles: [],
|
|
18958
18837
|
editorConfigFiles: [],
|
|
18959
18838
|
editorUISchemaFiles: []
|
|
18960
18839
|
};
|
|
18961
|
-
|
|
18962
18840
|
case SET_CONFIG_DATA:
|
|
18963
18841
|
return _extends({}, state, {
|
|
18964
18842
|
configContent: action.configContent
|
|
18965
18843
|
});
|
|
18966
|
-
|
|
18967
18844
|
case SET_SCHEMA_DATA:
|
|
18968
18845
|
return _extends({}, state, {
|
|
18969
18846
|
schemaContent: action.schemaContent
|
|
18970
18847
|
});
|
|
18971
|
-
|
|
18972
18848
|
case SET_UI_SCHEMA_DATA:
|
|
18973
18849
|
return _extends({}, state, {
|
|
18974
18850
|
uiContent: action.uiContent
|
|
18975
18851
|
});
|
|
18976
|
-
|
|
18977
18852
|
case SET_UISCHEMA_LIST:
|
|
18978
18853
|
return _extends({}, state, {
|
|
18979
18854
|
editorUISchemaFiles: lodash.uniqBy([].concat(state.editorUISchemaFiles, action.UISchemaFiles), "name")
|
|
18980
18855
|
});
|
|
18981
|
-
|
|
18982
18856
|
case SET_SCHEMA_LIST:
|
|
18983
18857
|
return _extends({}, state, {
|
|
18984
18858
|
editorSchemaFiles: lodash.uniqBy([].concat(state.editorSchemaFiles, action.schemaFiles), "name")
|
|
18985
18859
|
});
|
|
18986
|
-
|
|
18987
18860
|
case SET_CONFIG_LIST:
|
|
18988
18861
|
return _extends({}, state, {
|
|
18989
18862
|
editorConfigFiles: lodash.uniqBy([].concat(state.editorConfigFiles, action.configFiles), "name")
|
|
18990
18863
|
});
|
|
18991
|
-
|
|
18992
18864
|
case RESET_UISCHEMA_LIST:
|
|
18993
18865
|
return _extends({}, state, {
|
|
18994
18866
|
editorUISchemaFiles: action.UISchemaFiles
|
|
18995
18867
|
});
|
|
18996
|
-
|
|
18997
18868
|
case RESET_LOCAL_UISCHEMA_LIST:
|
|
18998
18869
|
return _extends({}, state, {
|
|
18999
18870
|
editorUISchemaFiles: state.editorUISchemaFiles.filter(function (file) {
|
|
19000
18871
|
return !file.name.includes("(local)");
|
|
19001
18872
|
})
|
|
19002
18873
|
});
|
|
19003
|
-
|
|
19004
18874
|
case RESET_CONFIG_LIST:
|
|
19005
18875
|
return _extends({}, state, {
|
|
19006
18876
|
editorConfigFiles: action.configFiles
|
|
19007
18877
|
});
|
|
19008
|
-
|
|
19009
18878
|
case RESET_LOCAL_CONFIG_LIST:
|
|
19010
18879
|
return _extends({}, state, {
|
|
19011
18880
|
editorConfigFiles: state.editorConfigFiles.filter(function (file) {
|
|
19012
18881
|
return file.name.split(".").slice(-1)[0] == "json";
|
|
19013
18882
|
})
|
|
19014
18883
|
});
|
|
19015
|
-
|
|
19016
18884
|
case RESET_SCHEMA_LIST:
|
|
19017
18885
|
return _extends({}, state, {
|
|
19018
18886
|
editorSchemaFiles: action.schemaFiles
|
|
19019
18887
|
});
|
|
19020
|
-
|
|
19021
18888
|
case RESET_LOCAL_SCHEMA_LIST:
|
|
19022
18889
|
return _extends({}, state, {
|
|
19023
18890
|
editorSchemaFiles: state.editorSchemaFiles.filter(function (file) {
|
|
19024
18891
|
return !file.name.includes("(local)");
|
|
19025
18892
|
})
|
|
19026
18893
|
});
|
|
19027
|
-
|
|
19028
18894
|
case SET_CONFIG_DATA_PRE_CHANGE:
|
|
19029
18895
|
return _extends({}, state, {
|
|
19030
18896
|
configContentPreChange: action.configContentPreChange
|
|
19031
18897
|
});
|
|
19032
|
-
|
|
19033
18898
|
case SET_CONFIG_DATA_LOCAL:
|
|
19034
18899
|
return _extends({}, state, {
|
|
19035
18900
|
configContentLocal: action.configContentLocal
|
|
19036
18901
|
});
|
|
19037
|
-
|
|
19038
18902
|
case SET_UPDATED_FORM_DATA:
|
|
19039
18903
|
return _extends({}, state, {
|
|
19040
18904
|
formData: action.formData
|
|
19041
18905
|
});
|
|
19042
|
-
|
|
19043
18906
|
default:
|
|
19044
18907
|
return state;
|
|
19045
18908
|
}
|