config-editor-base 2.9.3 → 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
@@ -23978,16 +23978,29 @@ var FilterBuilderTool = /*#__PURE__*/function (_React$Component) {
23978
23978
  var isPdu1 = (pgn & 0xFF00) < 0xF000;
23979
23979
  var mask = isPdu1 ? "3FF0000" : "3FFFF00";
23980
23980
  var filterId = isPdu1 ? ((pgn & 0x3FF00) << 8).toString(16).toUpperCase() : (pgn << 8).toString(16).toUpperCase();
23981
- var filter = {
23982
- name: (_entry4.messageName || "PGN " + pgn.toString(16).toUpperCase()).substring(0, 16),
23983
- state: 1,
23984
- type: filterTypeValue,
23985
- id_format: 1,
23986
- method: 1,
23987
- f1: filterId,
23988
- f2: mask,
23989
- prescaler_type: prescaler_type
23990
- };
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
+ }
23991
24004
  if (prescaler_value !== undefined) {
23992
24005
  filter.prescaler_value = prescaler_value;
23993
24006
  }
@@ -24094,10 +24107,14 @@ var FilterBuilderTool = /*#__PURE__*/function (_React$Component) {
24094
24107
  });
24095
24108
  var validate = ajv.compile(schemaContent);
24096
24109
  var valid = validate(mergedConfigTemp);
24110
+ if (!valid && validate.errors) {
24111
+ console.log("AJV validation errors:", validate.errors);
24112
+ }
24097
24113
  _this11.setState({
24098
24114
  mergedConfigValid: valid
24099
24115
  });
24100
24116
  } catch (e) {
24117
+ console.log("AJV compilation/validation exception:", e);
24101
24118
  _this11.setState({
24102
24119
  mergedConfigValid: false
24103
24120
  });
@@ -24857,7 +24874,8 @@ var FilterBuilderTool = /*#__PURE__*/function (_React$Component) {
24857
24874
  style: {
24858
24875
  opacity: _this12.props.deviceType === "CANmod" ? 0.5 : 1,
24859
24876
  pointerEvents: _this12.props.deviceType === "CANmod" ? "none" : "auto"
24860
- }
24877
+ },
24878
+ title: _this12.props.deviceType === "CANmod" ? "CANmod only supports acceptance filters" : ""
24861
24879
  }, /*#__PURE__*/React.createElement(SimpleDropdown, {
24862
24880
  name: "Type",
24863
24881
  options: [{
@@ -24875,13 +24893,7 @@ var FilterBuilderTool = /*#__PURE__*/function (_React$Component) {
24875
24893
  return _this12.generateFilterConfig();
24876
24894
  });
24877
24895
  }
24878
- }), _this12.props.deviceType === "CANmod" && /*#__PURE__*/React.createElement("span", {
24879
- className: "field-description",
24880
- style: {
24881
- fontSize: "11px",
24882
- color: "#999"
24883
- }
24884
- }, "CANmod only supports acceptance filters")), _this12.state.filterType === "acceptance" && /*#__PURE__*/React.createElement("div", {
24896
+ })), _this12.state.filterType === "acceptance" && /*#__PURE__*/React.createElement("div", {
24885
24897
  className: "col-xs-6"
24886
24898
  }, /*#__PURE__*/React.createElement(SimpleDropdown, {
24887
24899
  name: "Prescaler",
@@ -25064,13 +25076,29 @@ var FilterBuilderTool = /*#__PURE__*/function (_React$Component) {
25064
25076
  className: "btn btn-default",
25065
25077
  onClick: _this12.onDownload,
25066
25078
  disabled: Object.keys(_this12.state.generatedFilterConfig).length === 0
25067
- }, "Download JSON")), _this12.props.formData && Object.keys(_this12.props.formData).length > 0 && isDeviceSupported && !isFirmwareSupported && /*#__PURE__*/React.createElement("div", {
25068
- style: {
25069
- fontSize: "12px",
25070
- color: "#666",
25071
- 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";
25072
25093
  }
25073
- }, "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
+ }());
25074
25102
  }(), Object.keys(_this12.state.generatedFilterConfig).length > 0 && /*#__PURE__*/React.createElement("div", {
25075
25103
  style: {
25076
25104
  marginTop: "10px"