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

Editor: Add a search filters summary component #1037

Merged
merged 21 commits into from
Dec 11, 2024

Conversation

tkohr
Copy link
Collaborator

@tkohr tkohr commented Nov 13, 2024

Description

This PR introduces components to display currently selected search filter values in a zone below the search filters.

To-dos:

  • format date
  • format user
  • finish UI
  • tests

Screenshots

image

Quality Assurance Checklist

  • Commit history is devoid of any merge commits and readable to facilitate reviews
  • If new logic ⚙️ is introduced: unit tests were added
  • If new user stories 🤏 are introduced: E2E tests were added
  • If new UI components 🕹️ are introduced: corresponding stories in Storybook were created
  • If breaking changes 🪚 are introduced: add the breaking change label
  • If bugs 🐞 are fixed: add the backport <release branch> label
  • The documentation website 📚 has received the love it deserves

Copy link
Contributor

github-actions bot commented Nov 13, 2024

Affected libs: api-repository, feature-catalog, feature-record, feature-router, feature-search, feature-map, feature-editor, feature-auth, common-domain, api-metadata-converter, ui-search, feature-dataviz, common-fixtures, util-shared, ui-elements, feature-notifications, ui-catalog, ui-widgets, ui-inputs, ui-layout, ui-map, ui-dataviz,
Affected apps: metadata-editor, datahub, demo, webcomponents, map-viewer, search, datafeeder, metadata-converter, data-platform,

  • 🚀 Build and deploy storybook and demo on GitHub Pages
  • 📦 Build and push affected docker images

Copy link
Contributor

github-actions bot commented Nov 13, 2024

📷 Screenshots are here!

@tkohr tkohr mentioned this pull request Nov 14, 2024
10 tasks
@jahow jahow added this to the 2.4.0 milestone Nov 14, 2024
Copy link
Collaborator

@jahow jahow left a comment

Choose a reason for hiding this comment

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

Thanks! I did put some comments on what's already there, I'm not 100% sure what is the best way, let me know if you have better ideas!

@tkohr
Copy link
Collaborator Author

tkohr commented Nov 14, 2024

Thanks for the suggestions @jahow, I'll have a look how to refactor things this way.

Copy link
Collaborator

@jahow jahow left a comment

Choose a reason for hiding this comment

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

Thank you, this looks really good! Just a few final comments but it works well in the app and I think the implementation makes a lot of sense now.

libs/feature/search/src/lib/utils/service/fields.ts Outdated Show resolved Hide resolved
"
>
<mat-icon class="material-symbols-outlined leading-[1.1]">close</mat-icon>
<mat-icon class="material-symbols-outlined">close</mat-icon>
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm, we should't have mat-icons anymore :)

@tkohr tkohr force-pushed the me-search-filters-summary branch from 5ff9f51 to 2671c55 Compare November 26, 2024 09:23
@tkohr tkohr marked this pull request as ready for review November 26, 2024 10:47
Copy link
Collaborator

@Angi-Kinas Angi-Kinas left a comment

Choose a reason for hiding this comment

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

Thank you @tkohr, this will improve the usability of the filters quite a lot!

The code looks good to me.
While testing I had some behaviors that we might need to have a look at:

  • If we use user= as a query param, we get an empty badge
    image

  • If we do the same with changeDate, we see an empty search filters summary component with the "reset" button
    image

And as mentioned to you before, the filters are only working as expected on "Metadata records" but not on "My Records". I think this is more important than the issues mentioned above. When this is fixed, you can merge from my side 🚀

@@ -42,8 +44,8 @@ export function expandQueryParams(
} else if (isDateUrl(value)) {
const [start, end] = value.split('..')
expanded[key] = {
...(start && { start: new Date(start) }),
...(end && { end: new Date(end) }),
...(start && { start: new Date(`${start}T00:00:00`) }),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess T00:00:00 stands for the time... Is the time necessary here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, good point, the time is necessary here to prevent timezone issues. Actually, the URL does indeed not include the time as it is not needed, but as a Date in the app has a time it's set to midnight when it's read from the URL. Then, within the app, the date is handled in the local time of the browser and when it's written to the browser it's "cut" again. If we don't handle the time within the app, there are conflicts between the date chosen in the datepicker and the one encoded in the URL and sent to elasticsearch.

You can test it by switching the timezone of your browser. I discovered the issue since cypress is not running in the same timezone in the CI as my machine.

tkohr added 19 commits December 5, 2024 14:11
…method to simplify template

and align badges
move one common formatUserInfo() to utils at the same time
and use fieldname 'user' in component
treat dates in local timezone in app and without time in URL
…lters summary

fix waiting for this.searchFacade.searchFilters$ via ngOnInit at the same time
both is needed for use in myRecords.component
@tkohr tkohr force-pushed the me-search-filters-summary branch from 2601dac to 508983b Compare December 5, 2024 13:21
@tkohr
Copy link
Collaborator Author

tkohr commented Dec 5, 2024

Thank you @tkohr, this will improve the usability of the filters quite a lot!

The code looks good to me. While testing I had some behaviors that we might need to have a look at:

Thanks for the review and the testing @Angi-Kinas !

Good catches! I've added two commits to fix the errors you encountered. The first one (8302b76) allows to define filters that should be ignored by the summary component (like the active owner filter on the myRecords page, for example).

Both PRs are rebased again. Could you have a final look and approve the PRs if all is good for you?

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Angi-Kinas
Copy link
Collaborator

@tkohr thank you for addressing my comments. The issue with the empty value for a filter seems to be fixed 👍

While testing the feature on the "My Records" tab, I encountered two other issues:

  • when filtering on the last updated date, no query param is added to the url
  • when resetting the filters, it also resets the owner filter of the "My Records" page

I think addressing these issues will take some more time and could be worked on in a separate ticket. It would take additional complexity out of this PR. What do you think?

@tkohr
Copy link
Collaborator Author

tkohr commented Dec 10, 2024

Thanks for your additional tests and pointing out the resetting bug @Angi-Kinas !

While testing the feature on the "My Records" tab, I encountered two other issues:

* when filtering on the last updated date, no query param is added to the url

This is actually expected, as the myRecords search state is not a router search state. Only one router search state is possible per app, which is bound to the allRecords within the editor.

* when resetting the filters, it also resets the `owner` filter of the "My Records" page

Good catch, I've added 01d9e22 to also ignore the filters from the FILTER_SUMMARY_IGNORE_LIST token when clearing filters.

Crossing fingers that everything works fine now 🤞

@tkohr tkohr force-pushed the me-search-filters-summary branch from 01d9e22 to 75ca16b Compare December 10, 2024 15:16
Copy link
Collaborator

@Angi-Kinas Angi-Kinas left a comment

Choose a reason for hiding this comment

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

Thanks @tkohr for the adaption and the hard work on this feature!
Now the filters work as expected :) 🚀

@tkohr tkohr merged commit 3d963c2 into me-date-filter Dec 11, 2024
13 checks passed
@tkohr tkohr deleted the me-search-filters-summary branch December 11, 2024 08:46
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.

4 participants