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.
@@ -23975,16 +23975,29 @@ var FilterBuilderTool = /*#__PURE__*/function (_React$Component) {
23975
23975
  var isPdu1 = (pgn & 0xFF00) < 0xF000;
23976
23976
  var mask = isPdu1 ? "3FF0000" : "3FFFF00";
23977
23977
  var filterId = isPdu1 ? ((pgn & 0x3FF00) << 8).toString(16).toUpperCase() : (pgn << 8).toString(16).toUpperCase();
23978
- var filter = {
23979
- name: (_entry4.messageName || "PGN " + pgn.toString(16).toUpperCase()).substring(0, 16),
23980
- state: 1,
23981
- type: filterTypeValue,
23982
- id_format: 1,
23983
- method: 1,
23984
- f1: filterId,
23985
- f2: mask,
23986
- prescaler_type: prescaler_type
23987
- };
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
+ }
23988
24001
  if (prescaler_value !== undefined) {
23989
24002
  filter.prescaler_value = prescaler_value;
23990
24003
  }
@@ -24091,10 +24104,14 @@ var FilterBuilderTool = /*#__PURE__*/function (_React$Component) {
24091
24104
  });
24092
24105
  var validate = ajv.compile(schemaContent);
24093
24106
  var valid = validate(mergedConfigTemp);
24107
+ if (!valid && validate.errors) {
24108
+ console.log("AJV validation errors:", validate.errors);
24109
+ }
24094
24110
  _this11.setState({
24095
24111
  mergedConfigValid: valid
24096
24112
  });
24097
24113
  } catch (e) {
24114
+ console.log("AJV compilation/validation exception:", e);
24098
24115
  _this11.setState({
24099
24116
  mergedConfigValid: false
24100
24117
  });
@@ -24854,7 +24871,8 @@ var FilterBuilderTool = /*#__PURE__*/function (_React$Component) {
24854
24871
  style: {
24855
24872
  opacity: _this12.props.deviceType === "CANmod" ? 0.5 : 1,
24856
24873
  pointerEvents: _this12.props.deviceType === "CANmod" ? "none" : "auto"
24857
- }
24874
+ },
24875
+ title: _this12.props.deviceType === "CANmod" ? "CANmod only supports acceptance filters" : ""
24858
24876
  }, /*#__PURE__*/React.createElement(SimpleDropdown, {
24859
24877
  name: "Type",
24860
24878
  options: [{
@@ -24872,13 +24890,7 @@ var FilterBuilderTool = /*#__PURE__*/function (_React$Component) {
24872
24890
  return _this12.generateFilterConfig();
24873
24891
  });
24874
24892
  }
24875
- }), _this12.props.deviceType === "CANmod" && /*#__PURE__*/React.createElement("span", {
24876
- className: "field-description",
24877
- style: {
24878
- fontSize: "11px",
24879
- color: "#999"
24880
- }
24881
- }, "CANmod only supports acceptance filters")), _this12.state.filterType === "acceptance" && /*#__PURE__*/React.createElement("div", {
24893
+ })), _this12.state.filterType === "acceptance" && /*#__PURE__*/React.createElement("div", {
24882
24894
  className: "col-xs-6"
24883
24895
  }, /*#__PURE__*/React.createElement(SimpleDropdown, {
24884
24896
  name: "Prescaler",
@@ -25061,13 +25073,29 @@ var FilterBuilderTool = /*#__PURE__*/function (_React$Component) {
25061
25073
  className: "btn btn-default",
25062
25074
  onClick: _this12.onDownload,
25063
25075
  disabled: Object.keys(_this12.state.generatedFilterConfig).length === 0
25064
- }, "Download JSON")), _this12.props.formData && Object.keys(_this12.props.formData).length > 0 && isDeviceSupported && !isFirmwareSupported && /*#__PURE__*/React.createElement("div", {
25065
- style: {
25066
- fontSize: "12px",
25067
- color: "#666",
25068
- 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";
25069
25090
  }
25070
- }, "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
+ }());
25071
25099
  }(), Object.keys(_this12.state.generatedFilterConfig).length > 0 && /*#__PURE__*/React.createElement("div", {
25072
25100
  style: {
25073
25101
  marginTop: "10px"