config-editor-base 2.1.4 → 2.1.6
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 +68 -237
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +68 -237
- 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));
|
|
@@ -439,9 +386,8 @@ var checkConfigTransmitPeriodDelay = function checkConfigTransmitPeriodDelay(con
|
|
|
439
386
|
for (var i = 1; i < 3; i++) {
|
|
440
387
|
if (content["can_" + i].transmit != undefined) {
|
|
441
388
|
var transmitListFiltered = content["can_" + i].transmit.filter(function (e) {
|
|
442
|
-
return e.period < e.delay;
|
|
389
|
+
return e.period > 0 && 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) {
|
|
@@ -552,11 +514,11 @@ var saveUpdatedConfiguration = function saveUpdatedConfiguration(filename, conte
|
|
|
552
514
|
dispatch(checkConfigTransmitMonitoring(content));
|
|
553
515
|
dispatch(checkConfigFiltersDisabled(content));
|
|
554
516
|
dispatch(checkConfigTls(content));
|
|
517
|
+
dispatch(checkConfigAwsEndpoint(content));
|
|
555
518
|
dispatch(checkS3EncryptedPasswordsNoKpub(content));
|
|
556
519
|
dispatch(checkWiFiEncryptedPasswordsNoKpub(content));
|
|
557
520
|
dispatch(checkFileSplitOffsetPeriod(content));
|
|
558
521
|
}
|
|
559
|
-
|
|
560
522
|
dispatch(setConfigContent(content));
|
|
561
523
|
var blob = new Blob([JSON.stringify(content, null, 2)], {
|
|
562
524
|
type: "text/json"
|
|
@@ -657,6 +619,7 @@ var actions = {
|
|
|
657
619
|
checkConfigTransmitMonitoring: checkConfigTransmitMonitoring,
|
|
658
620
|
checkConfigFiltersDisabled: checkConfigFiltersDisabled,
|
|
659
621
|
checkConfigTls: checkConfigTls,
|
|
622
|
+
checkConfigAwsEndpoint: checkConfigAwsEndpoint,
|
|
660
623
|
checkS3EncryptedPasswordsNoKpub: checkS3EncryptedPasswordsNoKpub,
|
|
661
624
|
checkWiFiEncryptedPasswordsNoKpub: checkWiFiEncryptedPasswordsNoKpub,
|
|
662
625
|
checkFileSplitOffsetPeriod: checkFileSplitOffsetPeriod,
|
|
@@ -17879,7 +17842,6 @@ var customStyles = {
|
|
|
17879
17842
|
});
|
|
17880
17843
|
}
|
|
17881
17844
|
};
|
|
17882
|
-
|
|
17883
17845
|
var selectOptions = function selectOptions(Files) {
|
|
17884
17846
|
Files = lodash.orderBy(Files, ["name"], ["desc"]);
|
|
17885
17847
|
return [].concat(Files, defaultOptions).map(function (File) {
|
|
@@ -17889,25 +17851,19 @@ var selectOptions = function selectOptions(Files) {
|
|
|
17889
17851
|
};
|
|
17890
17852
|
});
|
|
17891
17853
|
};
|
|
17892
|
-
|
|
17893
17854
|
var EditorDropDown = /*#__PURE__*/function (_React$Component) {
|
|
17894
17855
|
_inheritsLoose(EditorDropDown, _React$Component);
|
|
17895
|
-
|
|
17896
17856
|
function EditorDropDown(props) {
|
|
17897
17857
|
var _this;
|
|
17898
|
-
|
|
17899
17858
|
_this = _React$Component.call(this, props) || this;
|
|
17900
|
-
|
|
17901
17859
|
_this.handleSelectChange = function (selectedValue) {
|
|
17902
17860
|
if (selectedValue.value === "Upload") {
|
|
17903
17861
|
_this.props.onChange("None", _this.props.name);
|
|
17904
|
-
|
|
17905
17862
|
_this.refs.fileUploader.click();
|
|
17906
17863
|
} else if (!selectedValue.value.includes("(local)")) {
|
|
17907
17864
|
_this.props.onChange(selectedValue.value, _this.props.name);
|
|
17908
17865
|
}
|
|
17909
17866
|
};
|
|
17910
|
-
|
|
17911
17867
|
_this.state = {
|
|
17912
17868
|
defaultOption: {
|
|
17913
17869
|
label: "None",
|
|
@@ -17916,9 +17872,7 @@ var EditorDropDown = /*#__PURE__*/function (_React$Component) {
|
|
|
17916
17872
|
};
|
|
17917
17873
|
return _this;
|
|
17918
17874
|
}
|
|
17919
|
-
|
|
17920
17875
|
var _proto = EditorDropDown.prototype;
|
|
17921
|
-
|
|
17922
17876
|
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
17923
17877
|
if (nextProps.selected != "") {
|
|
17924
17878
|
this.setState({
|
|
@@ -17933,22 +17887,19 @@ var EditorDropDown = /*#__PURE__*/function (_React$Component) {
|
|
|
17933
17887
|
});
|
|
17934
17888
|
}
|
|
17935
17889
|
};
|
|
17936
|
-
|
|
17937
17890
|
_proto.componentWillMount = function componentWillMount() {
|
|
17938
17891
|
this.setState({
|
|
17939
17892
|
defaultOption: selectOptions(this.props.options)[0]
|
|
17940
17893
|
});
|
|
17941
17894
|
};
|
|
17942
|
-
|
|
17943
17895
|
_proto.render = function render() {
|
|
17944
17896
|
var _this2 = this;
|
|
17945
|
-
|
|
17946
17897
|
var _this$props = this.props,
|
|
17947
|
-
|
|
17948
|
-
|
|
17949
|
-
|
|
17950
|
-
|
|
17951
|
-
|
|
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;
|
|
17952
17903
|
return /*#__PURE__*/React.createElement("div", {
|
|
17953
17904
|
className: "form-group pl0 field-string"
|
|
17954
17905
|
}, /*#__PURE__*/React.createElement("p", null, this.props.name), /*#__PURE__*/React.createElement(Select, {
|
|
@@ -17973,35 +17924,30 @@ var EditorDropDown = /*#__PURE__*/function (_React$Component) {
|
|
|
17973
17924
|
className: "field-description field-description-shift"
|
|
17974
17925
|
}, this.props.comment));
|
|
17975
17926
|
};
|
|
17976
|
-
|
|
17977
17927
|
return EditorDropDown;
|
|
17978
17928
|
}(React.Component);
|
|
17979
17929
|
|
|
17980
17930
|
var EditorSchemaModal = /*#__PURE__*/function (_React$Component) {
|
|
17981
17931
|
_inheritsLoose(EditorSchemaModal, _React$Component);
|
|
17982
|
-
|
|
17983
17932
|
function EditorSchemaModal(props) {
|
|
17984
17933
|
return _React$Component.call(this, props) || this;
|
|
17985
17934
|
}
|
|
17986
|
-
|
|
17987
17935
|
var _proto = EditorSchemaModal.prototype;
|
|
17988
|
-
|
|
17989
17936
|
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
17990
17937
|
this.props.resetFiles();
|
|
17991
17938
|
};
|
|
17992
|
-
|
|
17993
17939
|
_proto.render = function render() {
|
|
17994
17940
|
var _this$props = this.props,
|
|
17995
|
-
|
|
17996
|
-
|
|
17997
|
-
|
|
17998
|
-
|
|
17999
|
-
|
|
18000
|
-
|
|
18001
|
-
|
|
18002
|
-
|
|
18003
|
-
|
|
18004
|
-
|
|
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;
|
|
18005
17951
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h4", null, "Schema & config loader"), /*#__PURE__*/React.createElement(EditorDropDown, {
|
|
18006
17952
|
disabled: editorSchemaFiles.length == 0 ? true : false,
|
|
18007
17953
|
options: editorUISchemaFiles,
|
|
@@ -18036,10 +17982,8 @@ var EditorSchemaModal = /*#__PURE__*/function (_React$Component) {
|
|
|
18036
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."
|
|
18037
17983
|
}));
|
|
18038
17984
|
};
|
|
18039
|
-
|
|
18040
17985
|
return EditorSchemaModal;
|
|
18041
17986
|
}(React.Component);
|
|
18042
|
-
|
|
18043
17987
|
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
18044
17988
|
return {
|
|
18045
17989
|
handleUploadedFile: function handleUploadedFile$1(file, type, schemaAry, uiSchemaAry) {
|
|
@@ -18050,19 +17994,14 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
18050
17994
|
}
|
|
18051
17995
|
};
|
|
18052
17996
|
};
|
|
18053
|
-
|
|
18054
17997
|
var EditorSchemaModal$1 = reactRedux.connect(null, mapDispatchToProps)(EditorSchemaModal);
|
|
18055
17998
|
|
|
18056
17999
|
var yourForm;
|
|
18057
|
-
|
|
18058
18000
|
var merge = require("deepmerge");
|
|
18059
|
-
|
|
18060
18001
|
var PartialConfigLoader = /*#__PURE__*/function (_React$Component) {
|
|
18061
18002
|
_inheritsLoose(PartialConfigLoader, _React$Component);
|
|
18062
|
-
|
|
18063
18003
|
function PartialConfigLoader(props) {
|
|
18064
18004
|
var _this;
|
|
18065
|
-
|
|
18066
18005
|
_this = _React$Component.call(this, props) || this;
|
|
18067
18006
|
_this.onReview = _this.onReview.bind(_assertThisInitialized(_this));
|
|
18068
18007
|
_this.onFilesError = _this.onFilesError.bind(_assertThisInitialized(_this));
|
|
@@ -18076,7 +18015,6 @@ var PartialConfigLoader = /*#__PURE__*/function (_React$Component) {
|
|
|
18076
18015
|
mergedConfigValid: "Unknown"
|
|
18077
18016
|
};
|
|
18078
18017
|
_this.fileReader = new FileReader();
|
|
18079
|
-
|
|
18080
18018
|
_this.fileReader.onload = function (event) {
|
|
18081
18019
|
try {
|
|
18082
18020
|
_this.setState({
|
|
@@ -18088,24 +18026,19 @@ var PartialConfigLoader = /*#__PURE__*/function (_React$Component) {
|
|
|
18088
18026
|
_this.onFilesError(e);
|
|
18089
18027
|
}
|
|
18090
18028
|
};
|
|
18091
|
-
|
|
18092
18029
|
return _this;
|
|
18093
18030
|
}
|
|
18094
|
-
|
|
18095
18031
|
var _proto = PartialConfigLoader.prototype;
|
|
18096
|
-
|
|
18097
18032
|
_proto.onSubmit = function onSubmit() {
|
|
18098
18033
|
this.setState({
|
|
18099
18034
|
mergedConfigValid: true
|
|
18100
18035
|
}, function () {});
|
|
18101
18036
|
};
|
|
18102
|
-
|
|
18103
18037
|
_proto.onValidationError = function onValidationError() {
|
|
18104
18038
|
this.setState({
|
|
18105
18039
|
mergedConfigValid: false
|
|
18106
18040
|
}, function () {});
|
|
18107
18041
|
};
|
|
18108
|
-
|
|
18109
18042
|
_proto.testMergedFile = function testMergedFile() {
|
|
18110
18043
|
var mergedConfigTemp = merge(this.props.formData, this.state.jsonFile);
|
|
18111
18044
|
this.setState({
|
|
@@ -18114,16 +18047,13 @@ var PartialConfigLoader = /*#__PURE__*/function (_React$Component) {
|
|
|
18114
18047
|
yourForm.submit();
|
|
18115
18048
|
});
|
|
18116
18049
|
};
|
|
18117
|
-
|
|
18118
18050
|
_proto.onFileChange = function onFileChange(file) {
|
|
18119
18051
|
this.setState({
|
|
18120
18052
|
jsonFileName: file[0].name
|
|
18121
18053
|
}, function () {});
|
|
18122
18054
|
};
|
|
18123
|
-
|
|
18124
18055
|
_proto.onFilesError = function onFilesError(error) {
|
|
18125
18056
|
var _this2 = this;
|
|
18126
|
-
|
|
18127
18057
|
this.setState({
|
|
18128
18058
|
jsonFile: {},
|
|
18129
18059
|
jsonFileName: ""
|
|
@@ -18131,10 +18061,8 @@ var PartialConfigLoader = /*#__PURE__*/function (_React$Component) {
|
|
|
18131
18061
|
_this2.props.showAlert("info", "Invalid JSON file - " + error.message);
|
|
18132
18062
|
});
|
|
18133
18063
|
};
|
|
18134
|
-
|
|
18135
18064
|
_proto.onReview = function onReview() {
|
|
18136
18065
|
var _this3 = this;
|
|
18137
|
-
|
|
18138
18066
|
console.log(this.state.mergedConfig);
|
|
18139
18067
|
this.props.setConfigContent(this.state.mergedConfig);
|
|
18140
18068
|
this.setState({
|
|
@@ -18142,22 +18070,19 @@ var PartialConfigLoader = /*#__PURE__*/function (_React$Component) {
|
|
|
18142
18070
|
jsonFileName: ""
|
|
18143
18071
|
}, function () {
|
|
18144
18072
|
_this3.props.showAlert("success", "Merged partial Configuration File with editor Configuration File");
|
|
18145
|
-
|
|
18146
18073
|
_this3.props.setUpdatedFormData(_this3.state.mergedConfig);
|
|
18147
18074
|
});
|
|
18148
18075
|
};
|
|
18149
|
-
|
|
18150
18076
|
_proto.render = function render() {
|
|
18151
18077
|
var _this4 = this;
|
|
18152
|
-
|
|
18153
18078
|
var _this$state = this.state,
|
|
18154
|
-
|
|
18155
|
-
|
|
18156
|
-
|
|
18157
|
-
|
|
18079
|
+
jsonFile = _this$state.jsonFile,
|
|
18080
|
+
jsonFileName = _this$state.jsonFileName,
|
|
18081
|
+
mergedConfig = _this$state.mergedConfig,
|
|
18082
|
+
mergedConfigValid = _this$state.mergedConfigValid;
|
|
18158
18083
|
var _this$props = this.props,
|
|
18159
|
-
|
|
18160
|
-
|
|
18084
|
+
formData = _this$props.formData,
|
|
18085
|
+
schemaContent = _this$props.schemaContent;
|
|
18161
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", {
|
|
18162
18087
|
className: "form-group pl0 field-string"
|
|
18163
18088
|
}, /*#__PURE__*/React.createElement("p", {
|
|
@@ -18214,17 +18139,14 @@ var PartialConfigLoader = /*#__PURE__*/function (_React$Component) {
|
|
|
18214
18139
|
}
|
|
18215
18140
|
})))));
|
|
18216
18141
|
};
|
|
18217
|
-
|
|
18218
18142
|
return PartialConfigLoader;
|
|
18219
18143
|
}(React.Component);
|
|
18220
|
-
|
|
18221
18144
|
var mapStateToProps = function mapStateToProps(state) {
|
|
18222
18145
|
return {
|
|
18223
18146
|
formData: state.editor.formData,
|
|
18224
18147
|
schemaContent: state.editor.schemaContent
|
|
18225
18148
|
};
|
|
18226
18149
|
};
|
|
18227
|
-
|
|
18228
18150
|
var mapDispatchToProps$1 = function mapDispatchToProps(dispatch) {
|
|
18229
18151
|
return {
|
|
18230
18152
|
setConfigContent: function setConfigContent$1(content) {
|
|
@@ -18235,18 +18157,14 @@ var mapDispatchToProps$1 = function mapDispatchToProps(dispatch) {
|
|
|
18235
18157
|
}
|
|
18236
18158
|
};
|
|
18237
18159
|
};
|
|
18238
|
-
|
|
18239
18160
|
var PartialConfigLoader$1 = reactRedux.connect(mapStateToProps, mapDispatchToProps$1)(PartialConfigLoader);
|
|
18240
18161
|
|
|
18241
18162
|
var EditorToolButton = /*#__PURE__*/function (_React$Component) {
|
|
18242
18163
|
_inheritsLoose(EditorToolButton, _React$Component);
|
|
18243
|
-
|
|
18244
18164
|
function EditorToolButton(props) {
|
|
18245
18165
|
return _React$Component.call(this, props) || this;
|
|
18246
18166
|
}
|
|
18247
|
-
|
|
18248
18167
|
var _proto = EditorToolButton.prototype;
|
|
18249
|
-
|
|
18250
18168
|
_proto.render = function render() {
|
|
18251
18169
|
return /*#__PURE__*/React.createElement("div", {
|
|
18252
18170
|
className: "field-integer",
|
|
@@ -18263,19 +18181,15 @@ var EditorToolButton = /*#__PURE__*/function (_React$Component) {
|
|
|
18263
18181
|
className: "btn-field-description field-description-shift"
|
|
18264
18182
|
}, this.props.comment));
|
|
18265
18183
|
};
|
|
18266
|
-
|
|
18267
18184
|
return EditorToolButton;
|
|
18268
18185
|
}(React.Component);
|
|
18269
18186
|
|
|
18270
18187
|
var EditorToolModalWrapper = /*#__PURE__*/function (_React$Component) {
|
|
18271
18188
|
_inheritsLoose(EditorToolModalWrapper, _React$Component);
|
|
18272
|
-
|
|
18273
18189
|
function EditorToolModalWrapper(props) {
|
|
18274
18190
|
return _React$Component.call(this, props) || this;
|
|
18275
18191
|
}
|
|
18276
|
-
|
|
18277
18192
|
var _proto = EditorToolModalWrapper.prototype;
|
|
18278
|
-
|
|
18279
18193
|
_proto.render = function render() {
|
|
18280
18194
|
return /*#__PURE__*/React.createElement("div", {
|
|
18281
18195
|
className: "tools-side-bar"
|
|
@@ -18289,13 +18203,12 @@ var EditorToolModalWrapper = /*#__PURE__*/function (_React$Component) {
|
|
|
18289
18203
|
}
|
|
18290
18204
|
}, "\xD7")), this.props.modal);
|
|
18291
18205
|
};
|
|
18292
|
-
|
|
18293
18206
|
return EditorToolModalWrapper;
|
|
18294
18207
|
}(React.Component);
|
|
18295
18208
|
|
|
18296
18209
|
function EditorNavs(_ref) {
|
|
18297
18210
|
var links = _ref.navs.links,
|
|
18298
|
-
|
|
18211
|
+
onNavChange = _ref.onNavChange;
|
|
18299
18212
|
var relLinks = links.filter(function (_ref2) {
|
|
18300
18213
|
var nav = _ref2.nav;
|
|
18301
18214
|
return nav !== applyNav.GENERIC_NAV;
|
|
@@ -18312,9 +18225,9 @@ function EditorNavs(_ref) {
|
|
|
18312
18225
|
className: "nav navbar-nav navbar-ul-margin-reduce"
|
|
18313
18226
|
}, relLinks.map(function (_ref3, i) {
|
|
18314
18227
|
var nav = _ref3.nav,
|
|
18315
|
-
|
|
18316
|
-
|
|
18317
|
-
|
|
18228
|
+
name = _ref3.name,
|
|
18229
|
+
icon = _ref3.icon,
|
|
18230
|
+
isActive = _ref3.isActive;
|
|
18318
18231
|
return nav !== "GEOFENCE" ?
|
|
18319
18232
|
/*#__PURE__*/
|
|
18320
18233
|
React.createElement("li", {
|
|
@@ -18384,33 +18297,24 @@ var selectOptions$1 = function selectOptions(Files) {
|
|
|
18384
18297
|
};
|
|
18385
18298
|
});
|
|
18386
18299
|
};
|
|
18387
|
-
|
|
18388
18300
|
var pastCrc32 = "N/A";
|
|
18389
|
-
|
|
18390
18301
|
var _require$1 = require("detect-browser"),
|
|
18391
|
-
|
|
18392
|
-
|
|
18302
|
+
detect$1 = _require$1.detect;
|
|
18393
18303
|
var browser$1 = detect$1();
|
|
18394
18304
|
var crcBrowserSupport$1 = ["chrome", "firefox", "opera", "safari", "edge"].includes(browser$1.name);
|
|
18395
|
-
|
|
18396
18305
|
var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
|
|
18397
18306
|
_inheritsLoose(EditorChangesComparison, _React$Component);
|
|
18398
|
-
|
|
18399
18307
|
function EditorChangesComparison(props) {
|
|
18400
18308
|
var _this;
|
|
18401
|
-
|
|
18402
18309
|
_this = _React$Component.call(this, props) || this;
|
|
18403
|
-
|
|
18404
18310
|
_this.toggleCheckbox = function () {
|
|
18405
18311
|
_this.setState({
|
|
18406
18312
|
hideWhiteSpace: !_this.state.hideWhiteSpace
|
|
18407
18313
|
});
|
|
18408
18314
|
};
|
|
18409
|
-
|
|
18410
18315
|
_this.handleSelectChange = function (selectedValue) {
|
|
18411
18316
|
_this.props.handleDropdownChange(selectedValue.value, "Previous Configuration File");
|
|
18412
18317
|
};
|
|
18413
|
-
|
|
18414
18318
|
_this.toggleCheckbox = _this.toggleCheckbox.bind(_assertThisInitialized(_this));
|
|
18415
18319
|
_this.handleSelectChange = _this.handleSelectChange.bind(_assertThisInitialized(_this));
|
|
18416
18320
|
_this.state = {
|
|
@@ -18418,32 +18322,27 @@ var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
|
|
|
18418
18322
|
};
|
|
18419
18323
|
return _this;
|
|
18420
18324
|
}
|
|
18421
|
-
|
|
18422
18325
|
var _proto = EditorChangesComparison.prototype;
|
|
18423
|
-
|
|
18424
18326
|
_proto.render = function render() {
|
|
18425
18327
|
var _this$props = this.props,
|
|
18426
|
-
|
|
18427
|
-
|
|
18428
|
-
|
|
18429
|
-
|
|
18430
|
-
|
|
18431
|
-
|
|
18432
|
-
|
|
18433
|
-
|
|
18434
|
-
|
|
18435
|
-
|
|
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;
|
|
18436
18338
|
var pastCleaned = past && Object.keys(past).length ? JSON.stringify(JSON.parse(past), null, 2) : "";
|
|
18437
|
-
|
|
18438
18339
|
if (crcBrowserSupport$1 == 1 && past && Object.keys(past).length) {
|
|
18439
18340
|
var _require2 = require("crc"),
|
|
18440
|
-
|
|
18441
|
-
|
|
18341
|
+
crc32 = _require2.crc32;
|
|
18442
18342
|
pastCrc32 = crc32(past).toString(16).toUpperCase().padStart(8, "0");
|
|
18443
18343
|
} else {
|
|
18444
18344
|
pastCrc32 = "N/A";
|
|
18445
18345
|
}
|
|
18446
|
-
|
|
18447
18346
|
return /*#__PURE__*/React.createElement("div", {
|
|
18448
18347
|
className: isCompareChanges ? "show modal-custom-wrapper" : "hidden modal-custom-wrapper"
|
|
18449
18348
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -18522,10 +18421,8 @@ var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
|
|
|
18522
18421
|
className: "btn btn-primary ml15"
|
|
18523
18422
|
}, " ", "Download to disk", " "))));
|
|
18524
18423
|
};
|
|
18525
|
-
|
|
18526
18424
|
return EditorChangesComparison;
|
|
18527
18425
|
}(React.Component);
|
|
18528
|
-
|
|
18529
18426
|
function mapStateToProps$1(state) {
|
|
18530
18427
|
return {
|
|
18531
18428
|
past: state.editor.configContentPreChange,
|
|
@@ -18533,7 +18430,6 @@ function mapStateToProps$1(state) {
|
|
|
18533
18430
|
crc32EditorLive: state.editor.crc32EditorLive
|
|
18534
18431
|
};
|
|
18535
18432
|
}
|
|
18536
|
-
|
|
18537
18433
|
var EditorChangesComparison$1 = reactRedux.connect(mapStateToProps$1)(EditorChangesComparison);
|
|
18538
18434
|
|
|
18539
18435
|
var regexRevision = new RegExp('\\d{2}\\.\\d{2}\\.json', 'g');
|
|
@@ -18541,22 +18437,16 @@ var isDownloadConfig = false;
|
|
|
18541
18437
|
var activatedTab;
|
|
18542
18438
|
var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
18543
18439
|
_inheritsLoose(EditorSection, _React$Component);
|
|
18544
|
-
|
|
18545
18440
|
function EditorSection(props) {
|
|
18546
18441
|
var _this;
|
|
18547
|
-
|
|
18548
18442
|
_this = _React$Component.call(this, props) || this;
|
|
18549
|
-
|
|
18550
18443
|
_this.handleChange = function (_ref) {
|
|
18551
18444
|
var formData = _ref.formData;
|
|
18552
|
-
|
|
18553
18445
|
_this.props.setUpdatedFormData(formData);
|
|
18554
18446
|
};
|
|
18555
|
-
|
|
18556
18447
|
_this.onNavChange = function (nav) {
|
|
18557
18448
|
activatedTab = nav[0];
|
|
18558
18449
|
};
|
|
18559
|
-
|
|
18560
18450
|
_this.editorForm = React.createRef();
|
|
18561
18451
|
_this.handleCompareChanges = _this.handleCompareChanges.bind(_assertThisInitialized(_this));
|
|
18562
18452
|
_this.closeChangesModal = _this.closeChangesModal.bind(_assertThisInitialized(_this));
|
|
@@ -18587,18 +18477,14 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18587
18477
|
_this.s3 = _this.props.fetchFileContentExt ? true : false;
|
|
18588
18478
|
return _this;
|
|
18589
18479
|
}
|
|
18590
|
-
|
|
18591
18480
|
var _proto = EditorSection.prototype;
|
|
18592
|
-
|
|
18593
18481
|
_proto.escFunction = function escFunction(event) {
|
|
18594
18482
|
if (event.keyCode === 27) {
|
|
18595
18483
|
this.closeChangesModal();
|
|
18596
18484
|
}
|
|
18597
18485
|
};
|
|
18598
|
-
|
|
18599
18486
|
_proto.subMenuBtnClick = function subMenuBtnClick(name) {
|
|
18600
18487
|
var _this2 = this;
|
|
18601
|
-
|
|
18602
18488
|
var sideBar = this.state.activeSideBar == name ? 'none' : name;
|
|
18603
18489
|
this.setState({
|
|
18604
18490
|
activeSideBar: sideBar
|
|
@@ -18606,17 +18492,14 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18606
18492
|
_this2.props.setConfigContentPreSubmit();
|
|
18607
18493
|
});
|
|
18608
18494
|
};
|
|
18609
|
-
|
|
18610
18495
|
_proto.hideUischemaModal = function hideUischemaModal() {
|
|
18611
18496
|
this.setState({
|
|
18612
18497
|
showUischemaModal: false
|
|
18613
18498
|
});
|
|
18614
18499
|
};
|
|
18615
|
-
|
|
18616
18500
|
_proto.handleDropdownChange = function handleDropdownChange(selection, dropdown) {
|
|
18617
18501
|
var _this$setState,
|
|
18618
|
-
|
|
18619
|
-
|
|
18502
|
+
_this3 = this;
|
|
18620
18503
|
var fileType = getFileType(dropdown);
|
|
18621
18504
|
this.setState((_this$setState = {}, _this$setState[fileType] = selection, _this$setState['selected' + fileType] = selection, _this$setState[fileType.replace('-', '')] = {
|
|
18622
18505
|
value: selection,
|
|
@@ -18629,39 +18512,31 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18629
18512
|
}
|
|
18630
18513
|
});
|
|
18631
18514
|
};
|
|
18632
|
-
|
|
18633
18515
|
_proto.handleCompareChanges = function handleCompareChanges(e) {
|
|
18634
18516
|
this.setState({
|
|
18635
18517
|
isCompareChanges: !this.state.isCompareChanges
|
|
18636
18518
|
});
|
|
18637
18519
|
};
|
|
18638
|
-
|
|
18639
18520
|
_proto.closeChangesModal = function closeChangesModal(e) {
|
|
18640
18521
|
this.setState({
|
|
18641
18522
|
isCompareChanges: false
|
|
18642
18523
|
});
|
|
18643
18524
|
document.body.style.overflow = 'auto';
|
|
18644
18525
|
};
|
|
18645
|
-
|
|
18646
18526
|
_proto.enableDownload = function enableDownload() {
|
|
18647
18527
|
isDownloadConfig = true;
|
|
18648
18528
|
};
|
|
18649
|
-
|
|
18650
18529
|
_proto.componentWillMount = function componentWillMount() {
|
|
18651
18530
|
this.props.publicUiSchemaFiles(this.props.uiSchemaAry, this.props.schemaAry, this.props.demoMode);
|
|
18652
18531
|
};
|
|
18653
|
-
|
|
18654
18532
|
_proto.componentDidMount = function componentDidMount() {
|
|
18655
18533
|
document.addEventListener('keydown', this.escFunction, false);
|
|
18656
18534
|
};
|
|
18657
|
-
|
|
18658
18535
|
_proto.componentWillUnMount = function componentWillUnMount() {
|
|
18659
18536
|
document.removeEventListener('keydown', this.escFunction, false);
|
|
18660
18537
|
};
|
|
18661
|
-
|
|
18662
18538
|
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
18663
18539
|
var _this4 = this;
|
|
18664
|
-
|
|
18665
18540
|
var uiLocal = nextProps.editorUISchemaFiles.filter(function (file) {
|
|
18666
18541
|
return file.name.includes('(local)');
|
|
18667
18542
|
});
|
|
@@ -18671,25 +18546,21 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18671
18546
|
var configLocal = nextProps.editorConfigFiles.filter(function (file) {
|
|
18672
18547
|
return file.name.includes('(local)');
|
|
18673
18548
|
});
|
|
18674
|
-
|
|
18675
18549
|
if (uiLocal.length) {
|
|
18676
18550
|
this.setState({
|
|
18677
18551
|
selecteduischema: uiLocal[0].name
|
|
18678
18552
|
});
|
|
18679
18553
|
}
|
|
18680
|
-
|
|
18681
18554
|
if (schemaLocal.length) {
|
|
18682
18555
|
this.setState({
|
|
18683
18556
|
selectedschema: schemaLocal[0].name
|
|
18684
18557
|
});
|
|
18685
18558
|
}
|
|
18686
|
-
|
|
18687
18559
|
if (configLocal.length) {
|
|
18688
18560
|
this.setState({
|
|
18689
18561
|
selectedconfig: configLocal[0].name
|
|
18690
18562
|
});
|
|
18691
18563
|
}
|
|
18692
|
-
|
|
18693
18564
|
if (nextProps.editorConfigFiles.length == 0) {
|
|
18694
18565
|
this.setState({
|
|
18695
18566
|
configreview: {
|
|
@@ -18698,7 +18569,6 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18698
18569
|
}
|
|
18699
18570
|
});
|
|
18700
18571
|
}
|
|
18701
|
-
|
|
18702
18572
|
if (this.props.editorConfigFiles.length != nextProps.editorConfigFiles.length && nextProps.editorConfigFiles[0] && nextProps.editorConfigFiles[0].name) {
|
|
18703
18573
|
var configName = configLocal.length ? configLocal[0].name : nextProps.editorConfigFiles[0].name;
|
|
18704
18574
|
this.setState({
|
|
@@ -18715,39 +18585,30 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18715
18585
|
});
|
|
18716
18586
|
}
|
|
18717
18587
|
};
|
|
18718
|
-
|
|
18719
18588
|
_proto.onSubmit = function onSubmit(_ref2) {
|
|
18720
18589
|
var _this5 = this;
|
|
18721
|
-
|
|
18722
18590
|
var formData = _ref2.formData;
|
|
18723
|
-
|
|
18724
18591
|
if (this.props.schemaContent == undefined || this.props.schemaContent == null) {
|
|
18725
18592
|
this.props.showAlert('info', 'No Rule Schema has been loaded');
|
|
18726
18593
|
return;
|
|
18727
18594
|
}
|
|
18728
|
-
|
|
18729
18595
|
var checkSchemaList = this.props.editorSchemaFiles.length ? this.props.editorSchemaFiles[0].name : null;
|
|
18730
18596
|
var checkSchemaUpload = this.props.editorSchemaFiles.filter(function (file) {
|
|
18731
18597
|
return file.name.includes('(local)');
|
|
18732
18598
|
});
|
|
18733
18599
|
var checkUpload = null;
|
|
18734
|
-
|
|
18735
18600
|
if (checkSchemaUpload.length) {
|
|
18736
18601
|
checkUpload = checkSchemaUpload[0].name.split(' ')[0];
|
|
18737
18602
|
}
|
|
18738
|
-
|
|
18739
18603
|
this.setState({
|
|
18740
18604
|
schema: checkUpload ? checkUpload : this.state.selectedschema ? this.state.selectedschema : checkSchemaList,
|
|
18741
18605
|
formData: formData,
|
|
18742
18606
|
isSubmitting: true
|
|
18743
18607
|
}, function () {
|
|
18744
18608
|
var tempJson = JSON.stringify(formData, null, 2);
|
|
18745
|
-
|
|
18746
18609
|
_this5.props.setConfigContent(JSON.parse(tempJson));
|
|
18747
|
-
|
|
18748
18610
|
var revisedConfigFileSchema = _this5.state.schema;
|
|
18749
18611
|
var revisedConfigFile = "config-" + revisedConfigFileSchema.match(regexRevision);
|
|
18750
|
-
|
|
18751
18612
|
if (_this5.state.isCompareChanges === false) {
|
|
18752
18613
|
_this5.setState({
|
|
18753
18614
|
isCompareChanges: true,
|
|
@@ -18756,23 +18617,18 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18756
18617
|
label: revisedConfigFile
|
|
18757
18618
|
}
|
|
18758
18619
|
});
|
|
18759
|
-
|
|
18760
18620
|
document.body.style.overflow = 'hidden';
|
|
18761
18621
|
} else {
|
|
18762
18622
|
if (isDownloadConfig) {
|
|
18763
18623
|
_this5.props.saveUpdatedConfiguration(revisedConfigFile, formData);
|
|
18764
|
-
|
|
18765
18624
|
isDownloadConfig = false;
|
|
18766
18625
|
document.body.style.overflow = 'auto';
|
|
18767
|
-
|
|
18768
18626
|
_this5.setState({
|
|
18769
18627
|
isCompareChanges: false
|
|
18770
18628
|
});
|
|
18771
18629
|
} else {
|
|
18772
18630
|
_this5.props.updateConfigFileExt(JSON.stringify(formData, null, 2), "" + revisedConfigFile);
|
|
18773
|
-
|
|
18774
18631
|
document.body.style.overflow = 'auto';
|
|
18775
|
-
|
|
18776
18632
|
_this5.setState({
|
|
18777
18633
|
isCompareChanges: false
|
|
18778
18634
|
});
|
|
@@ -18780,24 +18636,21 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18780
18636
|
}
|
|
18781
18637
|
});
|
|
18782
18638
|
};
|
|
18783
|
-
|
|
18784
18639
|
_proto.handleError = function handleError(errors) {
|
|
18785
18640
|
isDownloadConfig = false;
|
|
18786
18641
|
this.props.showAlert('danger', 'The config contains validation errors (see top of editor) - please review and try again');
|
|
18787
18642
|
};
|
|
18788
|
-
|
|
18789
18643
|
_proto.render = function render() {
|
|
18790
18644
|
var _this6 = this;
|
|
18791
|
-
|
|
18792
18645
|
var _this$props = this.props,
|
|
18793
|
-
|
|
18794
|
-
|
|
18795
|
-
|
|
18796
|
-
|
|
18797
|
-
|
|
18798
|
-
|
|
18799
|
-
|
|
18800
|
-
|
|
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;
|
|
18801
18654
|
var editorUISchemaFile = editorUISchemaFiles[0] ? editorUISchemaFiles[0].name : "";
|
|
18802
18655
|
var editorUIAdvancedSimpleTest = editorUISchemaFile.includes("Simple") || editorUISchemaFile.includes("Advanced");
|
|
18803
18656
|
var FormWithNav = schemaContent ? applyNav__default(Form, EditorNavs) : Form;
|
|
@@ -18924,10 +18777,8 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
18924
18777
|
className: "config-bar-background"
|
|
18925
18778
|
}));
|
|
18926
18779
|
};
|
|
18927
|
-
|
|
18928
18780
|
return EditorSection;
|
|
18929
18781
|
}(React.Component);
|
|
18930
|
-
|
|
18931
18782
|
var mapStateToProps$2 = function mapStateToProps(state) {
|
|
18932
18783
|
return {
|
|
18933
18784
|
editorSchemaFiles: state.editor.editorSchemaFiles,
|
|
@@ -18939,7 +18790,6 @@ var mapStateToProps$2 = function mapStateToProps(state) {
|
|
|
18939
18790
|
configContentPreChange: state.editor.configContentPreChange
|
|
18940
18791
|
};
|
|
18941
18792
|
};
|
|
18942
|
-
|
|
18943
18793
|
var mapDispatchToProps$2 = function mapDispatchToProps(dispatch) {
|
|
18944
18794
|
return {
|
|
18945
18795
|
fetchFileContent: function fetchFileContent$1(fileName, fileType) {
|
|
@@ -18962,7 +18812,6 @@ var mapDispatchToProps$2 = function mapDispatchToProps(dispatch) {
|
|
|
18962
18812
|
}
|
|
18963
18813
|
};
|
|
18964
18814
|
};
|
|
18965
|
-
|
|
18966
18815
|
var EditorSection$1 = reactRedux.connect(mapStateToProps$2, mapDispatchToProps$2)(EditorSection);
|
|
18967
18816
|
|
|
18968
18817
|
var reducer = (function (state, action) {
|
|
@@ -18977,101 +18826,83 @@ var reducer = (function (state, action) {
|
|
|
18977
18826
|
crc32EditorLive: ""
|
|
18978
18827
|
};
|
|
18979
18828
|
}
|
|
18980
|
-
|
|
18981
18829
|
switch (action.type) {
|
|
18982
18830
|
case SET_CRC32_EDITOR_LIVE:
|
|
18983
18831
|
return _extends({}, state, {
|
|
18984
18832
|
crc32EditorLive: action.crc32EditorLive
|
|
18985
18833
|
});
|
|
18986
|
-
|
|
18987
18834
|
case RESET_SCHEMA_FILES:
|
|
18988
18835
|
return {
|
|
18989
18836
|
editorSchemaFiles: [],
|
|
18990
18837
|
editorConfigFiles: [],
|
|
18991
18838
|
editorUISchemaFiles: []
|
|
18992
18839
|
};
|
|
18993
|
-
|
|
18994
18840
|
case SET_CONFIG_DATA:
|
|
18995
18841
|
return _extends({}, state, {
|
|
18996
18842
|
configContent: action.configContent
|
|
18997
18843
|
});
|
|
18998
|
-
|
|
18999
18844
|
case SET_SCHEMA_DATA:
|
|
19000
18845
|
return _extends({}, state, {
|
|
19001
18846
|
schemaContent: action.schemaContent
|
|
19002
18847
|
});
|
|
19003
|
-
|
|
19004
18848
|
case SET_UI_SCHEMA_DATA:
|
|
19005
18849
|
return _extends({}, state, {
|
|
19006
18850
|
uiContent: action.uiContent
|
|
19007
18851
|
});
|
|
19008
|
-
|
|
19009
18852
|
case SET_UISCHEMA_LIST:
|
|
19010
18853
|
return _extends({}, state, {
|
|
19011
18854
|
editorUISchemaFiles: lodash.uniqBy([].concat(state.editorUISchemaFiles, action.UISchemaFiles), "name")
|
|
19012
18855
|
});
|
|
19013
|
-
|
|
19014
18856
|
case SET_SCHEMA_LIST:
|
|
19015
18857
|
return _extends({}, state, {
|
|
19016
18858
|
editorSchemaFiles: lodash.uniqBy([].concat(state.editorSchemaFiles, action.schemaFiles), "name")
|
|
19017
18859
|
});
|
|
19018
|
-
|
|
19019
18860
|
case SET_CONFIG_LIST:
|
|
19020
18861
|
return _extends({}, state, {
|
|
19021
18862
|
editorConfigFiles: lodash.uniqBy([].concat(state.editorConfigFiles, action.configFiles), "name")
|
|
19022
18863
|
});
|
|
19023
|
-
|
|
19024
18864
|
case RESET_UISCHEMA_LIST:
|
|
19025
18865
|
return _extends({}, state, {
|
|
19026
18866
|
editorUISchemaFiles: action.UISchemaFiles
|
|
19027
18867
|
});
|
|
19028
|
-
|
|
19029
18868
|
case RESET_LOCAL_UISCHEMA_LIST:
|
|
19030
18869
|
return _extends({}, state, {
|
|
19031
18870
|
editorUISchemaFiles: state.editorUISchemaFiles.filter(function (file) {
|
|
19032
18871
|
return !file.name.includes("(local)");
|
|
19033
18872
|
})
|
|
19034
18873
|
});
|
|
19035
|
-
|
|
19036
18874
|
case RESET_CONFIG_LIST:
|
|
19037
18875
|
return _extends({}, state, {
|
|
19038
18876
|
editorConfigFiles: action.configFiles
|
|
19039
18877
|
});
|
|
19040
|
-
|
|
19041
18878
|
case RESET_LOCAL_CONFIG_LIST:
|
|
19042
18879
|
return _extends({}, state, {
|
|
19043
18880
|
editorConfigFiles: state.editorConfigFiles.filter(function (file) {
|
|
19044
18881
|
return file.name.split(".").slice(-1)[0] == "json";
|
|
19045
18882
|
})
|
|
19046
18883
|
});
|
|
19047
|
-
|
|
19048
18884
|
case RESET_SCHEMA_LIST:
|
|
19049
18885
|
return _extends({}, state, {
|
|
19050
18886
|
editorSchemaFiles: action.schemaFiles
|
|
19051
18887
|
});
|
|
19052
|
-
|
|
19053
18888
|
case RESET_LOCAL_SCHEMA_LIST:
|
|
19054
18889
|
return _extends({}, state, {
|
|
19055
18890
|
editorSchemaFiles: state.editorSchemaFiles.filter(function (file) {
|
|
19056
18891
|
return !file.name.includes("(local)");
|
|
19057
18892
|
})
|
|
19058
18893
|
});
|
|
19059
|
-
|
|
19060
18894
|
case SET_CONFIG_DATA_PRE_CHANGE:
|
|
19061
18895
|
return _extends({}, state, {
|
|
19062
18896
|
configContentPreChange: action.configContentPreChange
|
|
19063
18897
|
});
|
|
19064
|
-
|
|
19065
18898
|
case SET_CONFIG_DATA_LOCAL:
|
|
19066
18899
|
return _extends({}, state, {
|
|
19067
18900
|
configContentLocal: action.configContentLocal
|
|
19068
18901
|
});
|
|
19069
|
-
|
|
19070
18902
|
case SET_UPDATED_FORM_DATA:
|
|
19071
18903
|
return _extends({}, state, {
|
|
19072
18904
|
formData: action.formData
|
|
19073
18905
|
});
|
|
19074
|
-
|
|
19075
18906
|
default:
|
|
19076
18907
|
return state;
|
|
19077
18908
|
}
|