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