config-editor-base 2.7.3 → 2.7.5

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]));
@@ -340,6 +338,11 @@ var publicSchemaFiles = function publicSchemaFiles(selectedConfig, schemaAry, co
340
338
  return e.includes(deviceType);
341
339
  });
342
340
  }
341
+ if (demoMode) {
342
+ schemaAryFiltered = schemaAry.filter(function (e) {
343
+ return e.includes("CANedge3");
344
+ });
345
+ }
343
346
  var loadedSchema = loadFile(schemaAryFiltered[0]);
344
347
  if (schemaAryFiltered[0] && loadedSchema) {
345
348
  dispatch(setSchemaFile(schemaAryFiltered));
@@ -348,7 +351,6 @@ var publicSchemaFiles = function publicSchemaFiles(selectedConfig, schemaAry, co
348
351
  console.log("Unable to load embedded Rule Schema");
349
352
  }
350
353
  if (uiSchemaAryFiltered && uiSchemaAryFiltered.length) {
351
- console.log("uiSchemaAryFiltered", uiSchemaAryFiltered);
352
354
  dispatch(resetUISchemaList());
353
355
  dispatch(setUISchemaFile(uiSchemaAryFiltered));
354
356
  dispatch(setUISchemaContent(loadFile(uiSchemaAryFiltered[0])));
@@ -408,6 +410,29 @@ var checkConfigTransmitPeriodDelay = function checkConfigTransmitPeriodDelay(con
408
410
  }
409
411
  };
410
412
  };
413
+ var checkConfigTransmitExceedLimits = function checkConfigTransmitExceedLimits(content) {
414
+ return function (dispatch) {
415
+ var transmitList = [];
416
+ for (var i = 1; i <= 2; i++) {
417
+ if (content["can_" + i] && Array.isArray(content["can_" + i].transmit)) {
418
+ transmitList = transmitList.concat(content["can_" + i].transmit);
419
+ }
420
+ }
421
+ var messageCount = transmitList.length;
422
+ var byteCount = transmitList.reduce(function (total, message) {
423
+ return total + (message.data ? message.data.length / 2 : 0);
424
+ }, 0);
425
+ var MAX_MESSAGES = 224;
426
+ var MAX_BYTES = 4096;
427
+ if (messageCount > MAX_MESSAGES || byteCount > MAX_BYTES) {
428
+ dispatch(set({
429
+ type: "warning",
430
+ 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",
431
+ autoClear: false
432
+ }));
433
+ }
434
+ };
435
+ };
411
436
  var checkConfigTransmitMonitoring = function checkConfigTransmitMonitoring(content) {
412
437
  return function (dispatch) {
413
438
  for (var i = 1; i < 3; i++) {
@@ -423,6 +448,24 @@ var checkConfigTransmitMonitoring = function checkConfigTransmitMonitoring(conte
423
448
  }
424
449
  };
425
450
  };
451
+ var checkConfigTransmitMonitoringRouting = function checkConfigTransmitMonitoringRouting(content) {
452
+ return function (dispatch) {
453
+ if (content["routing"] && content["routing"].length > 0) {
454
+ content["routing"].forEach(function (route) {
455
+ if (route.state === 1 && (route.chn_dst === 1 || route.chn_dst === 2)) {
456
+ var channelKey = "can_" + route.chn_dst;
457
+ if (content[channelKey] && content[channelKey].phy && content[channelKey].phy.mode !== 0) {
458
+ dispatch(set({
459
+ type: "warning",
460
+ 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.",
461
+ autoClear: false
462
+ }));
463
+ }
464
+ }
465
+ });
466
+ }
467
+ };
468
+ };
426
469
  var checkConfigFiltersDisabled = function checkConfigFiltersDisabled(content) {
427
470
  return function (dispatch) {
428
471
  for (var i = 1; i < 3; i++) {
@@ -577,7 +620,6 @@ var checkConfigTlsPort = function checkConfigTlsPort(content) {
577
620
  var checkMissingAPN = function checkMissingAPN(content) {
578
621
  return function (dispatch) {
579
622
  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
623
  if (content.connect.s3.server.endpoint != undefined && content.connect.cellular.apn != undefined) {
582
624
  if (content.connect.s3.server.endpoint.includes("http") && content.connect.cellular.apn == "") {
583
625
  dispatch(set({
@@ -701,6 +743,8 @@ var saveUpdatedConfiguration = function saveUpdatedConfiguration(filename, conte
701
743
  if (content.can_2 != undefined) {
702
744
  dispatch(checkConfigTransmitPeriodDelay(content));
703
745
  dispatch(checkConfigTransmitMonitoring(content));
746
+ dispatch(checkConfigTransmitMonitoringRouting(content));
747
+ dispatch(checkConfigTransmitExceedLimits(content));
704
748
  dispatch(checkConfigFiltersDisabled(content));
705
749
  dispatch(checkConfigTls(content));
706
750
  dispatch(checkConfigAwsEndpoint(content));
@@ -817,7 +861,9 @@ var actions = {
817
861
  resetFiles: resetFiles,
818
862
  resetLocalSchemaList: resetLocalSchemaList,
819
863
  checkConfigTransmitPeriodDelay: checkConfigTransmitPeriodDelay,
864
+ checkConfigTransmitExceedLimits: checkConfigTransmitExceedLimits,
820
865
  checkConfigTransmitMonitoring: checkConfigTransmitMonitoring,
866
+ checkConfigTransmitMonitoringRouting: checkConfigTransmitMonitoringRouting,
821
867
  checkConfigFiltersDisabled: checkConfigFiltersDisabled,
822
868
  checkConfigControlSignalZeroScalingFactor: checkConfigControlSignalZeroScalingFactor,
823
869
  checkConfigTls: checkConfigTls,