config-editor-base 2.0.7 → 2.0.9

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,43 @@ 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;
440
- console.log("contentJSON", contentJSON);
441
- console.log("contentJSON.can_1", contentJSON.can_1);
442
-
443
- if (contentJSON.can_2 != undefined) {
444
- var transmitList1 = contentJSON.can_1.transmit;
445
- var transmitList2 = contentJSON.can_2.transmit;
446
- transmitList1Filtered = transmitList1.filter(function (e) {
447
- return e.period < e.delay;
448
- });
449
- transmitList2Filtered = transmitList2.filter(function (e) {
450
- return e.period < e.delay;
451
- });
452
- }
453
-
454
- console.log("transmitList1Filtered", transmitList1Filtered);
455
- console.log("transmitList2Filtered", transmitList2Filtered);
439
+ for (var i = 1; i < 3; i++) {
440
+ if (content["can_" + i].transmit != undefined) {
441
+ var transmitList = content["can_" + i].transmit;
442
+ var transmitListFiltered = transmitList.filter(function (e) {
443
+ return e.period < e.delay;
444
+ });
456
445
 
457
- if (transmitList1Filtered.length > 0) {
458
- dispatch(set({
459
- type: "warning",
460
- 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.",
461
- autoClear: false
462
- }));
446
+ if (transmitListFiltered.length > 0) {
447
+ dispatch(set({
448
+ type: "warning",
449
+ 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.",
450
+ autoClear: false
451
+ }));
452
+ }
453
+ }
463
454
  }
464
-
465
- if (transmitList2Filtered.length > 0) {
466
- dispatch(set({
467
- type: "warning",
468
- 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.",
469
- autoClear: false
470
- }));
455
+ };
456
+ };
457
+ var checkConfigTransmitMonitoring = function checkConfigTransmitMonitoring(content) {
458
+ return function (dispatch) {
459
+ for (var i = 1; i < 3; i++) {
460
+ if (content["can_" + i].transmit != undefined && content["can_" + i].phy != undefined && content["can_" + i].phy.mode != undefined && content["can_" + i].transmit.length > 0) {
461
+ if (content["can_" + i].phy.mode == 2) {
462
+ dispatch(set({
463
+ type: "warning",
464
+ message: "Your CAN CH" + i + " has a non-empty transmit list, but the mode is set to Monitoring. Note that the device will not transmit any messages unless the mode is set to Normal",
465
+ autoClear: false
466
+ }));
467
+ }
468
+ }
471
469
  }
470
+ };
471
+ };
472
+ var saveUpdatedConfiguration = function saveUpdatedConfiguration(filename, content) {
473
+ return function (dispatch) {
472
474
 
473
475
  dispatch(setConfigContent(content));
474
476
  var blob = new Blob([JSON.stringify(content, null, 2)], {
@@ -566,6 +568,8 @@ var actions = {
566
568
  setSchemaContent: setSchemaContent,
567
569
  resetFiles: resetFiles,
568
570
  resetLocalSchemaList: resetLocalSchemaList,
571
+ checkConfigTransmitPeriodDelay: checkConfigTransmitPeriodDelay,
572
+ checkConfigTransmitMonitoring: checkConfigTransmitMonitoring,
569
573
  saveUpdatedConfiguration: saveUpdatedConfiguration,
570
574
  setUpdatedFormData: setUpdatedFormData,
571
575
  setUpdatedFormDataValue: setUpdatedFormDataValue,