config-editor-base 2.7.2 → 2.7.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
@@ -233,8 +233,6 @@ var handleUploadedFile = function handleUploadedFile(file, dropdown, schemaAry,
233
233
  if (contentJSON != null) {
234
234
  switch (true) {
235
235
  case type == "uischema" && isValidUISchema(file.name):
236
- console.log("contentJSON", contentJSON);
237
- console.log("fileNameDisplay", fileNameDisplay);
238
236
  dispatch(setUISchemaContent(contentJSON));
239
237
  dispatch(resetLocalUISchemaList());
240
238
  dispatch(setUISchemaFile([fileNameDisplay]));
@@ -348,7 +346,6 @@ var publicSchemaFiles = function publicSchemaFiles(selectedConfig, schemaAry, co
348
346
  console.log("Unable to load embedded Rule Schema");
349
347
  }
350
348
  if (uiSchemaAryFiltered && uiSchemaAryFiltered.length) {
351
- console.log("uiSchemaAryFiltered", uiSchemaAryFiltered);
352
349
  dispatch(resetUISchemaList());
353
350
  dispatch(setUISchemaFile(uiSchemaAryFiltered));
354
351
  dispatch(setUISchemaContent(loadFile(uiSchemaAryFiltered[0])));
@@ -408,6 +405,29 @@ var checkConfigTransmitPeriodDelay = function checkConfigTransmitPeriodDelay(con
408
405
  }
409
406
  };
410
407
  };
408
+ var checkConfigTransmitExceedLimits = function checkConfigTransmitExceedLimits(content) {
409
+ return function (dispatch) {
410
+ var transmitList = [];
411
+ for (var i = 1; i <= 2; i++) {
412
+ if (content["can_" + i] && Array.isArray(content["can_" + i].transmit)) {
413
+ transmitList = transmitList.concat(content["can_" + i].transmit);
414
+ }
415
+ }
416
+ var messageCount = transmitList.length;
417
+ var byteCount = transmitList.reduce(function (total, message) {
418
+ return total + (message.data ? message.data.length / 2 : 0);
419
+ }, 0);
420
+ var MAX_MESSAGES = 224;
421
+ var MAX_BYTES = 4096;
422
+ if (messageCount > MAX_MESSAGES || byteCount > MAX_BYTES) {
423
+ dispatch(set({
424
+ type: "warning",
425
+ message: "Your CAN transmit list(s) exceed the limits: " + messageCount + " messages (max 224) and " + byteCount + " bytes (max 4096). This is invalid and will cause the device to reject your Configuration File",
426
+ autoClear: false
427
+ }));
428
+ }
429
+ };
430
+ };
411
431
  var checkConfigTransmitMonitoring = function checkConfigTransmitMonitoring(content) {
412
432
  return function (dispatch) {
413
433
  for (var i = 1; i < 3; i++) {
@@ -423,6 +443,24 @@ var checkConfigTransmitMonitoring = function checkConfigTransmitMonitoring(conte
423
443
  }
424
444
  };
425
445
  };
446
+ var checkConfigTransmitMonitoringRouting = function checkConfigTransmitMonitoringRouting(content) {
447
+ return function (dispatch) {
448
+ if (content["routing"] && content["routing"].length > 0) {
449
+ content["routing"].forEach(function (route) {
450
+ if (route.state === 1 && (route.chn_dst === 1 || route.chn_dst === 2)) {
451
+ var channelKey = "can_" + route.chn_dst;
452
+ if (content[channelKey] && content[channelKey].phy && content[channelKey].phy.mode !== 0) {
453
+ dispatch(set({
454
+ type: "warning",
455
+ message: "You are routing a message onto CAN CH" + route.chn_dst + ", but the device will not route any messages unless the CAN CH" + route.chn_dst + " mode is set to Normal.",
456
+ autoClear: false
457
+ }));
458
+ }
459
+ }
460
+ });
461
+ }
462
+ };
463
+ };
426
464
  var checkConfigFiltersDisabled = function checkConfigFiltersDisabled(content) {
427
465
  return function (dispatch) {
428
466
  for (var i = 1; i < 3; i++) {
@@ -577,7 +615,6 @@ var checkConfigTlsPort = function checkConfigTlsPort(content) {
577
615
  var checkMissingAPN = function checkMissingAPN(content) {
578
616
  return function (dispatch) {
579
617
  if (content.connect != undefined && content.connect.s3 != undefined && content.connect.s3.server != undefined && content.connect.cellular != undefined && content.connect.cellular.apn != undefined) {
580
- console.log("content.connect.cellular.apn", content.connect.cellular.apn);
581
618
  if (content.connect.s3.server.endpoint != undefined && content.connect.cellular.apn != undefined) {
582
619
  if (content.connect.s3.server.endpoint.includes("http") && content.connect.cellular.apn == "") {
583
620
  dispatch(set({
@@ -590,6 +627,32 @@ var checkMissingAPN = function checkMissingAPN(content) {
590
627
  }
591
628
  };
592
629
  };
630
+ var checkMissingWiFi = function checkMissingWiFi(content) {
631
+ return function (dispatch) {
632
+ if (content.connect != undefined && content.connect.s3 != undefined && content.connect.s3.server != undefined && content.connect.wifi != undefined && content.connect.wifi.accesspoint != undefined) {
633
+ if (content.connect.s3.server.endpoint != undefined && content.connect.wifi.accesspoint.length == 0 && content.connect.s3.server.endpoint.includes("http")) {
634
+ dispatch(set({
635
+ type: "warning",
636
+ message: "Your S3 details appear populated, but you have added no WiFi details. Your device will therefore be unable to connect to your server.",
637
+ autoClear: false
638
+ }));
639
+ }
640
+ }
641
+ };
642
+ };
643
+ var checkMissingS3IfWiFi = function checkMissingS3IfWiFi(content) {
644
+ return function (dispatch) {
645
+ if (content.connect != undefined && content.connect.s3 != undefined && content.connect.s3.server != undefined && content.connect.wifi != undefined && content.connect.wifi.accesspoint != undefined) {
646
+ if (content.connect.wifi.accesspoint.length > 0 && content.connect.protocol != undefined && content.connect.protocol == 0 && (content.connect.s3.server.endpoint != undefined && !content.connect.s3.server.endpoint.includes("http") || content.connect.s3.server.endpoint == undefined)) {
647
+ dispatch(set({
648
+ type: "warning",
649
+ message: "Your have added WiFi details, but no S3 endpoint is added. Your device will therefore be unable to connect to your server.",
650
+ autoClear: false
651
+ }));
652
+ }
653
+ }
654
+ };
655
+ };
593
656
  var checkIncorrectAPNTelekom = function checkIncorrectAPNTelekom(content) {
594
657
  return function (dispatch) {
595
658
  if (content.connect != undefined && content.connect.s3 != undefined && content.connect.s3.server != undefined && content.connect.cellular != undefined && content.connect.cellular.apn != undefined) {
@@ -675,6 +738,8 @@ var saveUpdatedConfiguration = function saveUpdatedConfiguration(filename, conte
675
738
  if (content.can_2 != undefined) {
676
739
  dispatch(checkConfigTransmitPeriodDelay(content));
677
740
  dispatch(checkConfigTransmitMonitoring(content));
741
+ dispatch(checkConfigTransmitMonitoringRouting(content));
742
+ dispatch(checkConfigTransmitExceedLimits(content));
678
743
  dispatch(checkConfigFiltersDisabled(content));
679
744
  dispatch(checkConfigTls(content));
680
745
  dispatch(checkConfigAwsEndpoint(content));
@@ -685,6 +750,8 @@ var saveUpdatedConfiguration = function saveUpdatedConfiguration(filename, conte
685
750
  dispatch(checkConfigTlsPort(content));
686
751
  dispatch(checkFileSplitValue(content));
687
752
  dispatch(checkMissingAPN(content));
753
+ dispatch(checkMissingWiFi(content));
754
+ dispatch(checkMissingS3IfWiFi(content));
688
755
  dispatch(checkIncorrectAPNSuperSIM(content));
689
756
  dispatch(checkIncorrectAPNTelekom(content));
690
757
  dispatch(checkIncorrectAPNSpaces(content));
@@ -789,7 +856,9 @@ var actions = {
789
856
  resetFiles: resetFiles,
790
857
  resetLocalSchemaList: resetLocalSchemaList,
791
858
  checkConfigTransmitPeriodDelay: checkConfigTransmitPeriodDelay,
859
+ checkConfigTransmitExceedLimits: checkConfigTransmitExceedLimits,
792
860
  checkConfigTransmitMonitoring: checkConfigTransmitMonitoring,
861
+ checkConfigTransmitMonitoringRouting: checkConfigTransmitMonitoringRouting,
793
862
  checkConfigFiltersDisabled: checkConfigFiltersDisabled,
794
863
  checkConfigControlSignalZeroScalingFactor: checkConfigControlSignalZeroScalingFactor,
795
864
  checkConfigTls: checkConfigTls,
@@ -800,6 +869,8 @@ var actions = {
800
869
  checkRTCAdjustment: checkRTCAdjustment,
801
870
  checkConfigTlsPort: checkConfigTlsPort,
802
871
  checkMissingAPN: checkMissingAPN,
872
+ checkMissingWiFi: checkMissingWiFi,
873
+ checkMissingS3IfWiFi: checkMissingS3IfWiFi,
803
874
  checkIncorrectAPNTelekom: checkIncorrectAPNTelekom,
804
875
  checkIncorrectAPNSuperSIM: checkIncorrectAPNSuperSIM,
805
876
  checkIncorrectRoamingSuperSIM: checkIncorrectRoamingSuperSIM,