Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add search capabilities to Peripheral Inspector view #25

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

martin-fleck-at
Copy link
Contributor

@martin-fleck-at martin-fleck-at commented Jun 26, 2024

  • Provide custom SearchOverlay component
  • Add search overlay to filter tree and tree table
  • Move custom data into the 'data' for filtering in tree table

Closes #23

- Provide custom SearchOverlay component
- Add search overlay to filter tree and tree table
- Move custom data into the 'data' for filtering in tree table

Closes eclipse-cdt-cloud#23
Copy link
Contributor

@jreineckearm jreineckearm left a comment

Choose a reason for hiding this comment

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

Some functional findings

  • Nit: If the search filter causes the vertical scrollbar to disappear, then the find field "jumps" to the right. Feels a little noisy, but maybe something users can live with for now.
  • Nit: When I expand/collapse a group, then I see a progress line at the top of the view. But no DAP requests (I assume it's supposed to cover delays caused by target accesses). Need to double-check if that was there before this PR/the PrimeReact introduction.
  • Search only searches through visible items (and presumably previously expanded children). But we may also want to search through not yet visited items. Exploring the register tree by "random" keywords could be a powerful side effect of this feature. Is this where you hit performance issues?

@@ -25,12 +27,14 @@ export type ComponentTreeProps = {

const PROGRESS_BAR_HIDE_DELAY = 200;

export const ComponentTree = (props: ComponentTreeProps) => {
export const ComponentTree = ({ nodes, selectedNode, isLoading }: ComponentTreeProps) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: expanding the properties here is inconsistent with other components in this repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In general, I prefer deconstructing properties as it makes the code more readable in my opinion. I agree, however, that we should stay consistent and for the purpose of this PR I changed it back to accessing props directly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the updates, @martin-fleck-at !

Thanks for fixing the find box behavior. I still do see a minimal jump of the box by one or two pixels to the left if the scrollbar disappears. That is on Windows. Not overly concerned about that one though.

I can confirm the progress line is gone. Thanks!

I checked again the last item in the list. I have to rephrase the report:
I does find registers by names even if they are invisible due to collapsed groups. However, for bit fields, the behavior is as described.

An example is for the NXP FRDM-K32L3A6 board/SVD file (Cortex-M4):

  • Unfold: CoreDebug -> DHCSR_Read . You can see for example C_HALT.
    image
  • Search for C_HALT. You can see it appearing in the filtered tree.
    image
  • Now collapse any of the two parent groups. The filtered list empties.
    image

I don't know exactly what's involved to change this. Probably worth to address in a separate PR. If fixable with the chosen GUI library.

- Do not spread props
- Ensure search bar keeps position independent from scroll bar
- Introduce slight delay to showing progress bar for short operations
@martin-fleck-at
Copy link
Contributor Author

@jreineckearm I pushed an update that should address your comments. The only thing I couldn't reproduce was the filtering purely based on visible items. Could you provide an example of where that is happening?

@jreineckearm
Copy link
Contributor

@martin-fleck-at , thanks for the updates! I have provided a reproducer for the "invisible items" issue.

@martin-fleck-at
Copy link
Contributor Author

@jreineckearm I investigated the issue and from what I can see the problem occurs when the respective node has never been resolved as part of the children, i.e., the tree does not know about the node since we populate the model lazily on expansion:

public async getCDTTreeItem(element: PeripheralBaseNode): Promise<CDTTreeItem> {
const item = await element.getCDTTreeItem();
if (item.expanded) {
const children = await this.getChildren(element);
if (children) {
item.children = await Promise.all(children.map(c => this.getCDTTreeItem(c)));
}
}
return item;
}

If I resolve all children of all nodes by default, the search works as expected. However, this is where we hit performance issues and everything else becomes quite slow since we do re-generate the model very often. Unfortunately, I'm not sure what the best way forward is. We could introduce a dedicated option in the search to also search "hidden" nodes. However, if we are lucky, maybe switching to Ant Design (#27) is a solution here as well. Please let me know how you would like to proceed with this PR.

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.

Add search capabilities to Peripheral Inspector view
2 participants