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

AdHocFiltersCombobox: Collapse filter combobox #961

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

Conversation

Sergej-Vlasov
Copy link
Contributor

@Sergej-Vlasov Sergej-Vlasov commented Nov 8, 2024

Filters UI collapse functionality

Implementation in grafana/grafana grafana/grafana#98411

Screen.Recording.2024-11-08.at.11.24.49.mov

CONSIDERATIONS:

  1. This is not entirely accurate when there are more variables on the same line (due to filter box growing) see in depth explanation -> AdHocFiltersCombobox: Collapse filters to save space #962

  2. Perhaps worth adding extra setting collapseThreshold or have collapseFilters as boolean | number to allow more fine grain control on what pixel width to start collapse due to above

📦 Published PR as canary version: 5.36.1--canary.961.12544951331.0

✨ Test out this PR locally via:

npm install @grafana/[email protected]
npm install @grafana/[email protected]
# or 
yarn add @grafana/[email protected]
yarn add @grafana/[email protected]

@torkelo
Copy link
Member

torkelo commented Dec 17, 2024

I think something like this is really needed

@Sergej-Vlasov
Copy link
Contributor Author

@torkelo will clean up and finalise this over the next few days. This behaviour will be controlled via variable setting collapseFilters.

@Sergej-Vlasov Sergej-Vlasov added type/enhancement New feature or request area/variables Issues related to variables system in scenes patch Increment the patch version when merged release Create a release when this pr is merged labels Dec 30, 2024
@Sergej-Vlasov Sergej-Vlasov marked this pull request as ready for review December 30, 2024 10:02
@Sergej-Vlasov Sergej-Vlasov changed the title AdHocFiltersCombobox: POC for filter combobox collapse AdHocFiltersCombobox: Collapse filter combobox Dec 30, 2024
/**
* Flag that will collapse combobox filters when they become too long
*/
collapseFilters?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The first thing that comes to my mind is: Shouldn't this be something to control from the component rather than the variable declaration?

This is pure UI behavior. It is weird to create a SceneObject variable to represent the AdHoc filter and indicate that it is collapsible. Have you considered any other approach that allows you to configure this in the variables control, for example?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to go with this implementation because it does not involve any major design changes and offers persistence between reloads. Other approaches would struggle with persistence especially when this is opt in behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/variables Issues related to variables system in scenes patch Increment the patch version when merged release Create a release when this pr is merged type/enhancement New feature or request
Projects
Status: 🔍 In review
Development

Successfully merging this pull request may close these issues.

3 participants