Skip to content

Conversation

@garvit000
Copy link

This PR fixes Issue #151 where the "CAN" feature category remained visible even when selecting a board that does not support CAN.

The Fix:

  • Updated fillBuildOptions in JS to re-render the category list whenever the board selection changes.
  • Added logic to hide the "CAN" category if the selected board's metadata indicates has_can: false.
  • Updated backend metadata fetching to correctly identify CAN support for newer boards (e.g., CubeOrange) by following include directives in hwdef.dat.

Test Plan:

  1. Select "CubeOrange" -> Verify "CAN" category is visible (True Positive).
  2. Select "KakuteF4-Mini" -> Verify "CAN" category disappears (True Negative).

Closes #151

f"Redis connection established with {redis_host}:{redis_port}"
)
self.__boards_key_prefix = "boards-"
# bump version to invalidate stale board metadata in cache
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this change. We can handle the upgrade by manually clearing the cache.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted the change


def __get_boards_at_commit_from_repo(self, remote: str,
commit_ref: str) -> tuple[list, list]:
commit_ref: str) -> tuple[list[dict], list[dict]]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be documented in the comment.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the comment

try:
non_periph_boards, periph_boards = boards
needs_upgrade = False
if non_periph_boards and isinstance(non_periph_boards[0], str):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this as well. No need to worry about the upgrade due to cached stuff. We can clear it manually.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

vehicle_id=vehicle,
)
if board not in boards_at_commit:
board_names_at_commit = [b["name"] for b in boards_at_commit]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better define a class for board with id, name and attributes, in the attributed put the has_can thing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defined a BoardMetadata class for above listed

@garvit000
Copy link
Author

Hey @shiv-tyagi thanks for reviewing, I have addressed all the requested changes could you re-review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dont present CAN items if CAN is not present in hwdef

2 participants