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.
@@ -230,8 +230,6 @@ var handleUploadedFile = function handleUploadedFile(file, dropdown, schemaAry,
230
230
  if (contentJSON != null) {
231
231
  switch (true) {
232
232
  case type == "uischema" && isValidUISchema(file.name):
233
- console.log("contentJSON", contentJSON);
234
- console.log("fileNameDisplay", fileNameDisplay);
235
233
  dispatch(setUISchemaContent(contentJSON));
236
234
  dispatch(resetLocalUISchemaList());
237
235
  dispatch(setUISchemaFile([fileNameDisplay]));
@@ -337,6 +335,11 @@ var publicSchemaFiles = function publicSchemaFiles(selectedConfig, schemaAry, co
337
335
  return e.includes(deviceType);
338
336
  });
339
337
  }
338
+ if (demoMode) {
339
+ schemaAryFiltered = schemaAry.filter(function (e) {
340
+ return e.includes("CANedge3");
341
+ });
342
+ }
340
343
  var loadedSchema = loadFile(schemaAryFiltered[0]);
341
344
  if (schemaAryFiltered[0] && loadedSchema) {
342
345
  dispatch(setSchemaFile(schemaAryFiltered));
@@ -345,7 +348,6 @@ var publicSchemaFiles = function publicSchemaFiles(selectedConfig, schemaAry, co
345
348
  console.log("Unable to load embedded Rule Schema");
346
349
  }
347
350
  if (uiSchemaAryFiltered && uiSchemaAryFiltered.length) {
348
- console.log("uiSchemaAryFiltered", uiSchemaAryFiltered);
349
351
  dispatch(resetUISchemaList());
350
352
  dispatch(setUISchemaFile(uiSchemaAryFiltered));
351
353
  dispatch(setUISchemaContent(loadFile(uiSchemaAryFiltered[0])));
@@ -405,6 +407,29 @@ var checkConfigTransmitPeriodDelay = function checkConfigTransmitPeriodDelay(con
405
407
  }
406
408
  };
407
409
  };
410
+ var checkConfigTransmitExceedLimits = function checkConfigTransmitExceedLimits(content) {
411
+ return function (dispatch) {
412
+ var transmitList = [];
413
+ for (var i = 1; i <= 2; i++) {
414
+ if (content["can_" + i] && Array.isArray(content["can_" + i].transmit)) {
415
+ transmitList = transmitList.concat(content["can_" + i].transmit);
416
+ }
417
+ }
418
+ var messageCount = transmitList.length;
419
+ var byteCount = transmitList.reduce(function (total, message) {
420
+ return total + (message.data ? message.data.length / 2 : 0);
421
+ }, 0);
422
+ var MAX_MESSAGES = 224;
423
+ var MAX_BYTES = 4096;
424
+ if (messageCount > MAX_MESSAGES || byteCount > MAX_BYTES) {
425
+ dispatch(set({
426
+ type: "warning",
427
+ 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",
428
+ autoClear: false
429
+ }));
430
+ }
431
+ };
432
+ };
408
433
  var checkConfigTransmitMonitoring = function checkConfigTransmitMonitoring(content) {
409
434
  return function (dispatch) {
410
435
  for (var i = 1; i < 3; i++) {
@@ -420,6 +445,24 @@ var checkConfigTransmitMonitoring = function checkConfigTransmitMonitoring(conte
420
445
  }
421
446
  };
422
447
  };
448
+ var checkConfigTransmitMonitoringRouting = function checkConfigTransmitMonitoringRouting(content) {
449
+ return function (dispatch) {
450
+ if (content["routing"] && content["routing"].length > 0) {
451
+ content["routing"].forEach(function (route) {
452
+ if (route.state === 1 && (route.chn_dst === 1 || route.chn_dst === 2)) {
453
+ var channelKey = "can_" + route.chn_dst;
454
+ if (content[channelKey] && content[channelKey].phy && content[channelKey].phy.mode !== 0) {
455
+ dispatch(set({
456
+ type: "warning",
457
+ 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.",
458
+ autoClear: false
459
+ }));
460
+ }
461
+ }
462
+ });
463
+ }
464
+ };
465
+ };
423
466
  var checkConfigFiltersDisabled = function checkConfigFiltersDisabled(content) {
424
467
  return function (dispatch) {
425
468
  for (var i = 1; i < 3; i++) {
@@ -574,7 +617,6 @@ var checkConfigTlsPort = function checkConfigTlsPort(content) {
574
617
  var checkMissingAPN = function checkMissingAPN(content) {
575
618
  return function (dispatch) {
576
619
  if (content.connect != undefined && content.connect.s3 != undefined && content.connect.s3.server != undefined && content.connect.cellular != undefined && content.connect.cellular.apn != undefined) {
577
- console.log("content.connect.cellular.apn", content.connect.cellular.apn);
578
620
  if (content.connect.s3.server.endpoint != undefined && content.connect.cellular.apn != undefined) {
579
621
  if (content.connect.s3.server.endpoint.includes("http") && content.connect.cellular.apn == "") {
580
622
  dispatch(set({
@@ -698,6 +740,8 @@ var saveUpdatedConfiguration = function saveUpdatedConfiguration(filename, conte
698
740
  if (content.can_2 != undefined) {
699
741
  dispatch(checkConfigTransmitPeriodDelay(content));
700
742
  dispatch(checkConfigTransmitMonitoring(content));
743
+ dispatch(checkConfigTransmitMonitoringRouting(content));
744
+ dispatch(checkConfigTransmitExceedLimits(content));
701
745
  dispatch(checkConfigFiltersDisabled(content));
702
746
  dispatch(checkConfigTls(content));
703
747
  dispatch(checkConfigAwsEndpoint(content));
@@ -814,7 +858,9 @@ var actions = {
814
858
  resetFiles: resetFiles,
815
859
  resetLocalSchemaList: resetLocalSchemaList,
816
860
  checkConfigTransmitPeriodDelay: checkConfigTransmitPeriodDelay,
861
+ checkConfigTransmitExceedLimits: checkConfigTransmitExceedLimits,
817
862
  checkConfigTransmitMonitoring: checkConfigTransmitMonitoring,
863
+ checkConfigTransmitMonitoringRouting: checkConfigTransmitMonitoringRouting,
818
864
  checkConfigFiltersDisabled: checkConfigFiltersDisabled,
819
865
  checkConfigControlSignalZeroScalingFactor: checkConfigControlSignalZeroScalingFactor,
820
866
  checkConfigTls: checkConfigTls,