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

[outreachy] Registry: click on label for additional filtering #5340

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

Conversation

basiratkareem
Copy link

@basiratkareem basiratkareem commented Oct 8, 2024

Task
This update allows users to filter records by clicking on a tag (like native, sandbox, etc.), enabling quicker access to filtered records without needing to use the search bar.
closes #5312

Implementation

  • Replaced <span> tags with <button> elements in layouts/partials/ecosystem/registry/entry.html
  • Applied existing Bootstrap styles for consistency with the rest of the project.
  • Added a function applyTagFilter in assets/js/registrySearch.js to handle the filter action when a tag is clicked.
  • Added a title to the buttons(tags). On hover, each button displays "Click to filter by [tag name]".

Result
The tags native, first party integration, sandbox, graduated, and deprecated are now clickable buttons.
Clicking a tag immediately filters the records in the OpenTelemetry registry based on the selected tag, enhancing the filtering experience.

…l and deprecated) into clickable buttons to filter record based on the tag
@basiratkareem basiratkareem requested a review from a team as a code owner October 8, 2024 00:05
Copy link

linux-foundation-easycla bot commented Oct 8, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@basiratkareem basiratkareem changed the title [outreachy] Registry: click on tag for additional filtering #5312 [outreachy] Registry: click on tag for additional filtering Oct 8, 2024
Copy link
Member

@svrnm svrnm left a comment

Choose a reason for hiding this comment

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

great start, a few notes!


{{ if $isNative -}}
<button type="button" class="badge rounded-pill text-bg-success text-white"
onclick="document.getElementById('input-s').value = 'native'; document.getElementById('input-language').value = 'all';document.getElementById('input-component').value = 'all';document.getElementById('searchForm').submit();">
Copy link
Member

Choose a reason for hiding this comment

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

Can you move the javascript code into a dedicated file? Since it is related to it, you can put it into https://github.com/open-telemetry/opentelemetry.io/blob/main/assets/js/registrySearch.js

I suggest that you add some data--tag to the elements and then select them in javascript:

<button type=button" data-filter-value="native" class="...">...native</button>

and then something like

document.querySelectorAll('[data-filter-value]').forEach(element => ...)

Also, provide a tooltip or something that says "click to filter by..."

Copy link
Author

Choose a reason for hiding this comment

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

I appreciate your feedback. I will update the code accordingly.

Copy link
Author

Choose a reason for hiding this comment

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

Hello @svrnm I’ve implemented the recommended changes. However, I observed an issue: after clicking a tag and the results page is rendered, clicking the tag again or another doesn’t trigger a new search. The reset button has to be clicked before the tag filter can work again.

Screenshot 2024-10-13 at 1 37 18 AM

Copy link
Member

Choose a reason for hiding this comment

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

@basiratkareem can you append the label to the existing search term instead of setting/replacing it. This way someone can have an existing search word and refine their search with adding one of the labels. The only thing you might want to check for if the label is already included in the search string so it's not added twice

@svrnm svrnm added enhancement New feature or request registry outreachy Issues for Outreachy Participants labels Oct 8, 2024
@svrnm svrnm changed the title [outreachy] Registry: click on tag for additional filtering [outreachy] Registry: click on label for additional filtering Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request outreachy Issues for Outreachy Participants registry
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

[outreachy] Registry: click on tag for additional filtering
2 participants