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