config-editor-base 2.1.2 → 2.1.3

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 CHANGED
@@ -435,23 +435,17 @@ var resetLocalSchemaList = function resetLocalSchemaList() {
435
435
  };
436
436
  };
437
437
  var checkConfigTransmitPeriodDelay = function checkConfigTransmitPeriodDelay(content) {
438
- console.log("We get outside dispatch?");
439
438
  return function (dispatch) {
440
- console.log("We get here right?");
441
-
442
439
  for (var i = 1; i < 3; i++) {
443
- console.log("Check contents", content["can_" + i], content["can_" + i].transmit);
444
-
445
440
  if (content["can_" + i].transmit != undefined) {
446
- var transmitList = content["can_" + i].transmit;
447
- var transmitListFiltered = transmitList.filter(function (e) {
441
+ var transmitListFiltered = content["can_" + i].transmit.filter(function (e) {
448
442
  return e.period < e.delay;
449
443
  });
450
444
 
451
445
  if (transmitListFiltered.length > 0) {
452
446
  dispatch(set({
453
447
  type: "warning",
454
- message: "Your CAN CH" + i + " transmit list includes one or more entries with period < delay. This is invalid and will cause the device to reject your Configuration File.",
448
+ message: "Your CAN CH" + i + " transmit list includes one or more entries with period < delay. This is invalid and will cause the device to reject your Configuration File",
455
449
  autoClear: false
456
450
  }));
457
451
  }
@@ -466,7 +460,56 @@ var checkConfigTransmitMonitoring = function checkConfigTransmitMonitoring(conte
466
460
  if (content["can_" + i].phy.mode != 0) {
467
461
  dispatch(set({
468
462
  type: "warning",
469
- message: "Your CAN CH" + i + " has a non-empty transmit list, but the device will not transmit any messages unless the mode is set to Normal.",
463
+ message: "Your CAN CH" + i + " has a non-empty transmit list, but the device will not transmit any messages unless the mode is set to Normal",
464
+ autoClear: false
465
+ }));
466
+ }
467
+ }
468
+ }
469
+ };
470
+ };
471
+ var checkConfigFiltersDisabled = function checkConfigFiltersDisabled(content) {
472
+ return function (dispatch) {
473
+ for (var i = 1; i < 3; i++) {
474
+ if (content["can_" + i].filter != undefined && content["can_" + i].filter.id != undefined) {
475
+ var filterListFiltered = content["can_" + i].filter.id.filter(function (e) {
476
+ return e.state == 1;
477
+ });
478
+
479
+ if (filterListFiltered.length == 0) {
480
+ dispatch(set({
481
+ type: "warning",
482
+ message: "Your CAN CH" + i + " filter list contains only disabled filters - no data will be recorded on this channel",
483
+ autoClear: false
484
+ }));
485
+ }
486
+ }
487
+ }
488
+ };
489
+ };
490
+ var checkConfigTls = function checkConfigTls(content) {
491
+ return function (dispatch) {
492
+ if (content.connect != undefined && content.connect.s3 != undefined && content.connect.s3.server != undefined) {
493
+ if (content.connect.s3.server.endpoint != undefined && content.connect.s3.server.port != undefined) {
494
+ if (content.connect.s3.server.endpoint.includes("https://") && content.connect.s3.server.port == 80) {
495
+ dispatch(set({
496
+ type: "warning",
497
+ message: "Your S3 server endpoint uses TLS (https://), but your port is 80. This is most likely incorrect and may result in the device being unable to connect. Please review the documentation on how to enable TLS",
498
+ autoClear: false
499
+ }));
500
+ }
501
+ }
502
+ }
503
+ };
504
+ };
505
+ var checkS3EncryptedPasswordsNoKpub = function checkS3EncryptedPasswordsNoKpub(content) {
506
+ return function (dispatch) {
507
+ if (content.connect != undefined && content.connect.s3 != undefined && content.connect.s3.server != undefined && content.general != undefined && content.general.security != undefined) {
508
+ if (content.connect.s3.server.secretkey != undefined && content.connect.s3.server.keyformat != undefined) {
509
+ if (content.connect.s3.server.keyformat == 1 && (content.general.security.kpub == undefined || content.general.security.kpub == "")) {
510
+ dispatch(set({
511
+ type: "warning",
512
+ message: "Your S3 SecretKey format is set to Encrypted, but you have not provided the Server public key. Please review the documentation on how to encrypt passwords",
470
513
  autoClear: false
471
514
  }));
472
515
  }
@@ -477,9 +520,11 @@ var checkConfigTransmitMonitoring = function checkConfigTransmitMonitoring(conte
477
520
  var saveUpdatedConfiguration = function saveUpdatedConfiguration(filename, content) {
478
521
  return function (dispatch) {
479
522
  if (content.can_2 != undefined) {
480
- console.log("What about here?");
481
523
  dispatch(checkConfigTransmitPeriodDelay(content));
482
524
  dispatch(checkConfigTransmitMonitoring(content));
525
+ dispatch(checkConfigFiltersDisabled(content));
526
+ dispatch(checkConfigTls(content));
527
+ dispatch(checkS3EncryptedPasswordsNoKpub(content));
483
528
  }
484
529
 
485
530
  dispatch(setConfigContent(content));
@@ -580,6 +625,9 @@ var actions = {
580
625
  resetLocalSchemaList: resetLocalSchemaList,
581
626
  checkConfigTransmitPeriodDelay: checkConfigTransmitPeriodDelay,
582
627
  checkConfigTransmitMonitoring: checkConfigTransmitMonitoring,
628
+ checkConfigFiltersDisabled: checkConfigFiltersDisabled,
629
+ checkConfigTls: checkConfigTls,
630
+ checkS3EncryptedPasswordsNoKpub: checkS3EncryptedPasswordsNoKpub,
583
631
  saveUpdatedConfiguration: saveUpdatedConfiguration,
584
632
  setUpdatedFormData: setUpdatedFormData,
585
633
  setUpdatedFormDataValue: setUpdatedFormDataValue,