config-editor-base 2.1.2 → 2.1.4

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,41 @@ 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",
470
498
  autoClear: false
471
499
  }));
472
500
  }
@@ -474,12 +502,59 @@ var checkConfigTransmitMonitoring = function checkConfigTransmitMonitoring(conte
474
502
  }
475
503
  };
476
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",
513
+ autoClear: false
514
+ }));
515
+ }
516
+ }
517
+ }
518
+ };
519
+ };
520
+ var checkWiFiEncryptedPasswordsNoKpub = function checkWiFiEncryptedPasswordsNoKpub(content) {
521
+ return function (dispatch) {
522
+ if (content.connect != undefined && content.connect.wifi != undefined && content.connect.wifi.keyformat != undefined && content.general != undefined && content.general.security != undefined) {
523
+ if (content.connect.wifi.keyformat != undefined) {
524
+ if (content.connect.wifi.keyformat == 1 && (content.general.security.kpub == undefined || content.general.security.kpub == "")) {
525
+ dispatch(set({
526
+ type: "warning",
527
+ 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",
528
+ autoClear: false
529
+ }));
530
+ }
531
+ }
532
+ }
533
+ };
534
+ };
535
+ var checkFileSplitOffsetPeriod = function checkFileSplitOffsetPeriod(content) {
536
+ return function (dispatch) {
537
+ if (content.log != undefined && content.log.file != undefined && content.log.file.split_time_period != undefined && content.log.file.split_time_offset != undefined) {
538
+ if (content.log.file.split_time_offset > content.log.file.split_time_period) {
539
+ dispatch(set({
540
+ type: "warning",
541
+ 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",
542
+ autoClear: false
543
+ }));
544
+ }
545
+ }
546
+ };
547
+ };
477
548
  var saveUpdatedConfiguration = function saveUpdatedConfiguration(filename, content) {
478
549
  return function (dispatch) {
479
550
  if (content.can_2 != undefined) {
480
- console.log("What about here?");
481
551
  dispatch(checkConfigTransmitPeriodDelay(content));
482
552
  dispatch(checkConfigTransmitMonitoring(content));
553
+ dispatch(checkConfigFiltersDisabled(content));
554
+ dispatch(checkConfigTls(content));
555
+ dispatch(checkS3EncryptedPasswordsNoKpub(content));
556
+ dispatch(checkWiFiEncryptedPasswordsNoKpub(content));
557
+ dispatch(checkFileSplitOffsetPeriod(content));
483
558
  }
484
559
 
485
560
  dispatch(setConfigContent(content));
@@ -580,6 +655,11 @@ var actions = {
580
655
  resetLocalSchemaList: resetLocalSchemaList,
581
656
  checkConfigTransmitPeriodDelay: checkConfigTransmitPeriodDelay,
582
657
  checkConfigTransmitMonitoring: checkConfigTransmitMonitoring,
658
+ checkConfigFiltersDisabled: checkConfigFiltersDisabled,
659
+ checkConfigTls: checkConfigTls,
660
+ checkS3EncryptedPasswordsNoKpub: checkS3EncryptedPasswordsNoKpub,
661
+ checkWiFiEncryptedPasswordsNoKpub: checkWiFiEncryptedPasswordsNoKpub,
662
+ checkFileSplitOffsetPeriod: checkFileSplitOffsetPeriod,
583
663
  saveUpdatedConfiguration: saveUpdatedConfiguration,
584
664
  setUpdatedFormData: setUpdatedFormData,
585
665
  setUpdatedFormDataValue: setUpdatedFormDataValue,