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 click on "flag icon" for additional filtering #5340

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

Copy link
Author

@basiratkareem basiratkareem Oct 16, 2024

Choose a reason for hiding this comment

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

Hi @svrnm, I implemented your suggestions, but the behavior remained unchanged. I realized that I was using the command npm run serve in the terminal. The issue persists with that command, but when I switched to npm run serve:netlify, the labels function as intended with both the previous commit and the new lines of code. Clicking on the label at any point now initiates a filter search using the label value.

Copy link
Author

Choose a reason for hiding this comment

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

I look forward to your feedback. Thank you.

Copy link
Member

Choose a reason for hiding this comment

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

It's still not working, please take a look in the auto generated preview:

https://deploy-preview-5340--opentelemetry.netlify.app/ecosystem/registry/

If I click on a button (e.g. native of the first element) the search is updated, but if I click another button it's not updated once again

Copy link
Author

Choose a reason for hiding this comment

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

Hi @svrnm,

Thank you for your feedback. I have taken a look at the preview link and that is the same experience on my end when I use the command npm run serve

However, It worked on my end using npm run serve:netlify, but I see there’s still an issue in the Netlify preview. I’ll check the code again and I’ll update you soon. Thank you.

@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
@svrnm
Copy link
Member

svrnm commented Oct 25, 2024

@basiratkareem checking in if you could make some progress here? Today is the last day I can help you with moving this PR forward, so let me know if there is anything I can do to help you

@basiratkareem
Copy link
Author

@basiratkareem checking in if you could make some progress here? Today is the last day I can help you with moving this PR forward, so let me know if there is anything I can do to help you

Hi @svrnm,

Thank you for your continued support and feedback! I aplogiize for the delay response. I’ve made several adjustments to the code, including tweaks to the event handling. Unfortunately, these updates haven’t resolved the issue, and the functionality is still the same as what we both observed in the Netlify preview.

Initially, running npm run serve:netlify gave the expected output on my end. However, after restarting my device and retesting, it’s now producing the same result as npm run serve.

I suspect the issue might be due to the URL updating after the initial click. If there’s anything specific you’d suggest trying or if there’s something I might be missing, I’d be glad to explore it to resolve this within your timeline.

Thank you again for your guidance and patience.

@svrnm
Copy link
Member

svrnm commented Oct 25, 2024

the problem is the following:

  • we show a "#default-body" div if no search has been applied, your code adds the event listeners to the items in that list
  • we show a "#search results" div if search has been applied, they are lazy loaded, so your code is not applied to them.

You might need to update your code in a way that it re-applies the addition of event listeners to the newly created elements after the search was executed

@basiratkareem
Copy link
Author

the problem is the following:

  • we show a "#default-body" div if no search has been applied, your code adds the event listeners to the items in that list
  • we show a "#search results" div if search has been applied, they are lazy loaded, so your code is not applied to them.

You might need to update your code in a way that it re-applies the addition of event listeners to the newly created elements after the search was executed

I will check this out.

@basiratkareem
Copy link
Author

basiratkareem commented Oct 25, 2024

Hello @svrnm, I have added applyTag function to the code and updated the executeSearch function to call applyTag after populating search results.
I have tested the behaviour and it is working as expected. Clicking the labels initiates a search. I look forward to your feedback.

@svrnm
Copy link
Member

svrnm commented Nov 11, 2024

hey @basiratkareem,

I would like to take that PR into the main branch and with that into the project. But we need to rework it a little bit, would you still be interested in that?

Here's what needs to be changed changed: I merged #5328, which introduces a "flag" parameter, so far only for "deprecated", "native" and "first party", not the different CNCF projects, can you make use of that instead of appending it to the search term? We can skip the CNCF projects to simplify it for now.

Thanks.

@svrnm svrnm changed the title [outreachy] Registry: click on label for additional filtering add click on "flag icon" for additional filtering Nov 11, 2024
@svrnm svrnm added ux and removed enhancement New feature or request outreachy Issues for Outreachy Participants labels Nov 11, 2024
@basiratkareem
Copy link
Author

hey @basiratkareem,

I would like to take that PR into the main branch and with that into the project. But we need to rework it a little bit, would you still be interested in that?

Here's what needs to be changed changed: I merged #5328, which introduces a "flag" parameter, so far only for "deprecated", "native" and "first party", not the different CNCF projects, can you make use of that instead of appending it to the search term? We can skip the CNCF projects to simplify it for now.

Thanks.

Hello @svrnm I'm happy to continue working on this. Based on my understanding of your comment:

  1. A similar PR add a "flag" filter to registry  #5328 has been merged, which implemented a flag parameter for the filter.
  2. In PR add a "flag" filter to registry  #5328, I noticed the filter uses a dropdown, similar to the component and types.
  3. My task will be to integrate the flag parameter, ensuring the filter is initiated when the flag button is click without adding the flag value to the search input.

please let me know if I am missing something.

I'll make the necessary changes on my end and provide an update on this. Thank you.

@svrnm
Copy link
Member

svrnm commented Nov 12, 2024

1. A similar PR [add a "flag" filter to registry  #5328](https://github.com/open-telemetry/opentelemetry.io/pull/5328) has been merged, which implemented a flag parameter for the filter.

2. In PR [add a "flag" filter to registry  #5328](https://github.com/open-telemetry/opentelemetry.io/pull/5328), I noticed the filter uses a dropdown, similar to the component and types.

3. My task will be to integrate the flag parameter, ensuring the filter is initiated when the flag button is click without adding the flag value to the search input.

please let me know if I am missing something.

I'll make the necessary changes on my end and provide an update on this. Thank you.

Your understanding is correct 👍

@basiratkareem
Copy link
Author

Hi @svrnm

I’ve integrated the flag parameter into the code, and the filter is now activated when the flag button is clicked. The page is populated accordingly, and the search input field remains unchanged. I’ve also recorded a screen recording to demonstrate the behaviour.

https://www.loom.com/share/3427b2b7965a479c800175b63048d6ba?sid=8db7958f-6ca2-41f5-aa02-2d44d55ac397

Thank you, and please let me know your thoughts!

@svrnm
Copy link
Member

svrnm commented Nov 14, 2024

I took a look at your code, but from what I see you didn't update your branch to be in sync with main, so the changes introduced via #5328 are not part of your work here, it also creates a merge conflict.

Please do the following:

https://www.loom.com/share/3427b2b7965a479c800175b63048d6ba?sid=8db7958f-6ca2-41f5-aa02-2d44d55ac397

Thanks for taking the time to take a video, but not that we automatically create a preview of your work, which is accessible at https://deploy-preview-5340--opentelemetry.netlify.app/ecosystem/registry/, so approvers can try out your work directly.

@basiratkareem
Copy link
Author

I took a look at your code, but from what I see you didn't update your branch to be in sync with main, so the changes introduced via #5328 are not part of your work here, it also creates a merge conflict.

Please do the following:

https://www.loom.com/share/3427b2b7965a479c800175b63048d6ba?sid=8db7958f-6ca2-41f5-aa02-2d44d55ac397

Thanks for taking the time to take a video, but not that we automatically create a preview of your work, which is accessible at https://deploy-preview-5340--opentelemetry.netlify.app/ecosystem/registry/, so approvers can try out your work directly.

Apologies for that. I will follow the steps, make the required updates, and revert as needed. Thank you for your assistance!

@basiratkareem
Copy link
Author

Hi @svrnm, changes implemented in PR #5611

@svrnm svrnm closed this Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

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