config-editor-base 2.9.2 → 2.9.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.
@@ -977,8 +977,6 @@ var checkConfigFilterLimits = function checkConfigFilterLimits(content) {
977
977
  count11Bit++;
978
978
  }
979
979
  }
980
- console.log("count11Bit", count11Bit);
981
- console.log("count29Bit", count29Bit);
982
980
  if (count11Bit > MAX_11BIT_FILTERS) {
983
981
  dispatch(set({
984
982
  type: "warning",
@@ -19592,7 +19590,7 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
19592
19590
  transition: 'opacity 1s ease-out',
19593
19591
  opacity: this.state.showNewToolsHighlight ? 1 : 0
19594
19592
  }
19595
- }, "New: OBD & filter builder tools"))))))), /*#__PURE__*/React.createElement("div", {
19593
+ }, "Tip: New editor tools added"))))))), /*#__PURE__*/React.createElement("div", {
19596
19594
  className: "config-bar-background"
19597
19595
  }));
19598
19596
  };
@@ -23977,16 +23975,29 @@ var FilterBuilderTool = /*#__PURE__*/function (_React$Component) {
23977
23975
  var isPdu1 = (pgn & 0xFF00) < 0xF000;
23978
23976
  var mask = isPdu1 ? "3FF0000" : "3FFFF00";
23979
23977
  var filterId = isPdu1 ? ((pgn & 0x3FF00) << 8).toString(16).toUpperCase() : (pgn << 8).toString(16).toUpperCase();
23980
- var filter = {
23981
- name: (_entry4.messageName || "PGN " + pgn.toString(16).toUpperCase()).substring(0, 16),
23982
- state: 1,
23983
- type: filterTypeValue,
23984
- id_format: 1,
23985
- method: 1,
23986
- f1: filterId,
23987
- f2: mask,
23988
- prescaler_type: prescaler_type
23989
- };
23978
+ var filter = void 0;
23979
+ if (isCanmodRouter) {
23980
+ filter = {
23981
+ name: (_entry4.messageName || "PGN " + pgn.toString(16).toUpperCase()).substring(0, 16),
23982
+ state: 1,
23983
+ id_format: 1,
23984
+ frame_format: 2,
23985
+ f1: filterId,
23986
+ f2: mask,
23987
+ prescaler_type: prescaler_type
23988
+ };
23989
+ } else {
23990
+ filter = {
23991
+ name: (_entry4.messageName || "PGN " + pgn.toString(16).toUpperCase()).substring(0, 16),
23992
+ state: 1,
23993
+ type: filterTypeValue,
23994
+ id_format: 1,
23995
+ method: 1,
23996
+ f1: filterId,
23997
+ f2: mask,
23998
+ prescaler_type: prescaler_type
23999
+ };
24000
+ }
23990
24001
  if (prescaler_value !== undefined) {
23991
24002
  filter.prescaler_value = prescaler_value;
23992
24003
  }
@@ -24093,10 +24104,14 @@ var FilterBuilderTool = /*#__PURE__*/function (_React$Component) {
24093
24104
  });
24094
24105
  var validate = ajv.compile(schemaContent);
24095
24106
  var valid = validate(mergedConfigTemp);
24107
+ if (!valid && validate.errors) {
24108
+ console.log("AJV validation errors:", validate.errors);
24109
+ }
24096
24110
  _this11.setState({
24097
24111
  mergedConfigValid: valid
24098
24112
  });
24099
24113
  } catch (e) {
24114
+ console.log("AJV compilation/validation exception:", e);
24100
24115
  _this11.setState({
24101
24116
  mergedConfigValid: false
24102
24117
  });
@@ -24856,7 +24871,8 @@ var FilterBuilderTool = /*#__PURE__*/function (_React$Component) {
24856
24871
  style: {
24857
24872
  opacity: _this12.props.deviceType === "CANmod" ? 0.5 : 1,
24858
24873
  pointerEvents: _this12.props.deviceType === "CANmod" ? "none" : "auto"
24859
- }
24874
+ },
24875
+ title: _this12.props.deviceType === "CANmod" ? "CANmod only supports acceptance filters" : ""
24860
24876
  }, /*#__PURE__*/React.createElement(SimpleDropdown, {
24861
24877
  name: "Type",
24862
24878
  options: [{
@@ -24874,13 +24890,7 @@ var FilterBuilderTool = /*#__PURE__*/function (_React$Component) {
24874
24890
  return _this12.generateFilterConfig();
24875
24891
  });
24876
24892
  }
24877
- }), _this12.props.deviceType === "CANmod" && /*#__PURE__*/React.createElement("span", {
24878
- className: "field-description",
24879
- style: {
24880
- fontSize: "11px",
24881
- color: "#999"
24882
- }
24883
- }, "CANmod only supports acceptance filters")), _this12.state.filterType === "acceptance" && /*#__PURE__*/React.createElement("div", {
24893
+ })), _this12.state.filterType === "acceptance" && /*#__PURE__*/React.createElement("div", {
24884
24894
  className: "col-xs-6"
24885
24895
  }, /*#__PURE__*/React.createElement(SimpleDropdown, {
24886
24896
  name: "Prescaler",
@@ -25063,13 +25073,29 @@ var FilterBuilderTool = /*#__PURE__*/function (_React$Component) {
25063
25073
  className: "btn btn-default",
25064
25074
  onClick: _this12.onDownload,
25065
25075
  disabled: Object.keys(_this12.state.generatedFilterConfig).length === 0
25066
- }, "Download JSON")), _this12.props.formData && Object.keys(_this12.props.formData).length > 0 && isDeviceSupported && !isFirmwareSupported && /*#__PURE__*/React.createElement("div", {
25067
- style: {
25068
- fontSize: "12px",
25069
- color: "#666",
25070
- marginTop: "8px"
25076
+ }, "Download JSON")), function () {
25077
+ var mergeDisabled = !_this12.props.formData || Object.keys(_this12.props.formData).length === 0 || _this12.state.mergedConfigValid !== true || !isFirmwareSupported || !isDeviceSupported;
25078
+ if (!mergeDisabled) return null;
25079
+ var reason = "";
25080
+ if (!_this12.props.formData || Object.keys(_this12.props.formData).length === 0) {
25081
+ reason = "No configuration file loaded";
25082
+ } else if (!isDeviceSupported) {
25083
+ reason = "Only CANmod.router is supported for CANmod devices";
25084
+ } else if (!isFirmwareSupported) {
25085
+ reason = "Merging requires firmware " + minFirmware + ".XX+ - please update your device";
25086
+ } else if (_this12.state.mergedConfigValid === "Unknown") {
25087
+ reason = "No filters selected";
25088
+ } else if (_this12.state.mergedConfigValid === false) {
25089
+ reason = "Generated filter configuration is invalid";
25071
25090
  }
25072
- }, "Merging requires firmware ", minFirmware, ".XX+ - please update your device"));
25091
+ return reason ? /*#__PURE__*/React.createElement("div", {
25092
+ style: {
25093
+ fontSize: "12px",
25094
+ color: "#d9534f",
25095
+ marginTop: "8px"
25096
+ }
25097
+ }, reason) : null;
25098
+ }());
25073
25099
  }(), Object.keys(_this12.state.generatedFilterConfig).length > 0 && /*#__PURE__*/React.createElement("div", {
25074
25100
  style: {
25075
25101
  marginTop: "10px"