config-editor-base 2.0.8 → 2.1.0

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
@@ -434,41 +434,47 @@ var resetLocalSchemaList = function resetLocalSchemaList() {
434
434
  type: RESET_LOCAL_SCHEMA_LIST
435
435
  };
436
436
  };
437
- var saveUpdatedConfiguration = function saveUpdatedConfiguration(filename, content) {
437
+ var checkConfigTransmitPeriodDelay = function checkConfigTransmitPeriodDelay(content) {
438
438
  return function (dispatch) {
439
- var contentJSON = content;
439
+ console.log("We get here right?");
440
+
441
+ for (var i = 1; i < 3; i++) {
442
+ console.log("Check contents", content["can_" + i], content["can_" + i].transmit);
440
443
 
441
- if (contentJSON.can_2 != undefined) {
442
- if (contentJSON.can_1.transmit != undefined) {
443
- var transmitList1 = contentJSON.can_1.transmit;
444
- var transmitList1Filtered = transmitList1.filter(function (e) {
444
+ if (content["can_" + i].transmit != undefined) {
445
+ var transmitList = content["can_" + i].transmit;
446
+ var transmitListFiltered = transmitList.filter(function (e) {
445
447
  return e.period < e.delay;
446
448
  });
447
449
 
448
- if (transmitList1Filtered.length > 0) {
450
+ if (transmitListFiltered.length > 0) {
449
451
  dispatch(set({
450
452
  type: "warning",
451
- message: "Your CAN CH1 transmit list includes one or more entries with period < delay. This is invalid and will cause the device to reject your Configuration File.",
453
+ 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.",
452
454
  autoClear: false
453
455
  }));
454
456
  }
455
457
  }
456
-
457
- if (contentJSON.can_2.transmit != undefined) {
458
- var transmitList2 = contentJSON.can_2.transmit;
459
- var transmitList2Filtered = transmitList2.filter(function (e) {
460
- return e.period < e.delay;
461
- });
462
-
463
- if (transmitList2Filtered.length > 0) {
458
+ }
459
+ };
460
+ };
461
+ var checkConfigTransmitMonitoring = function checkConfigTransmitMonitoring(content) {
462
+ return function (dispatch) {
463
+ for (var i = 1; i < 3; i++) {
464
+ if (content["can_" + i].transmit != undefined && content["can_" + i].phy != undefined && content["can_" + i].phy.mode != undefined && content["can_" + i].transmit.length > 0) {
465
+ if (content["can_" + i].phy.mode != 0) {
464
466
  dispatch(set({
465
467
  type: "warning",
466
- message: "Your CAN CH2 transmit list includes one or more entries with period < delay. This is invalid and will cause the device to reject your Configuration File.",
468
+ 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.",
467
469
  autoClear: false
468
470
  }));
469
471
  }
470
472
  }
471
473
  }
474
+ };
475
+ };
476
+ var saveUpdatedConfiguration = function saveUpdatedConfiguration(filename, content) {
477
+ return function (dispatch) {
472
478
 
473
479
  dispatch(setConfigContent(content));
474
480
  var blob = new Blob([JSON.stringify(content, null, 2)], {
@@ -566,6 +572,8 @@ var actions = {
566
572
  setSchemaContent: setSchemaContent,
567
573
  resetFiles: resetFiles,
568
574
  resetLocalSchemaList: resetLocalSchemaList,
575
+ checkConfigTransmitPeriodDelay: checkConfigTransmitPeriodDelay,
576
+ checkConfigTransmitMonitoring: checkConfigTransmitMonitoring,
569
577
  saveUpdatedConfiguration: saveUpdatedConfiguration,
570
578
  setUpdatedFormData: setUpdatedFormData,
571
579
  setUpdatedFormDataValue: setUpdatedFormDataValue,