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

Reactivate filtering by favorites & geometry #623

Merged
merged 8 commits into from
Sep 19, 2023

Conversation

jahow
Copy link
Collaborator

@jahow jahow commented Sep 19, 2023

These features were disabled in #464 .

Filtering by favorites and geometry was reimplemented in a very similar way, with a few structural changes:

  • The favorites service is now part of the GN4 repository lib
  • The auth service is also part of the GN4 lib
    • This is because the favorites service depends on current user info; besides, user info is also something provided by the GN4 backend; in general I think it makes sense to avoid calling GN4 APIs outside of the @geonetwork-ui/api/repository/gn4 lib
    • There is still a feature/auth lib that simply provides the services for showing avatars; we might put other things there in the future so I didn't get rid of it

Fixes #590

Added E2E tests for those two filtering options.

Also fixes a bug where, because now we're "grouping" actions before triggering a new search, actions targeting different search ids could end up being list.

Also fixes a bug where icons in buttons were not correctly sized (missed from 4d7654a)
image

@github-actions
Copy link
Contributor

github-actions bot commented Sep 19, 2023

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

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

@jahow jahow force-pushed the reactivate-filter-geometry-favorites branch from 5be83c4 to 4d739a5 Compare September 19, 2023 12:24
@coveralls
Copy link

Coverage Status

coverage: 83.389% (-4.2%) from 87.585% when pulling 4d739a5 on reactivate-filter-geometry-favorites into 7a2367a on main.

Copy link
Collaborator

@tkohr tkohr left a comment

Choose a reason for hiding this comment

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

Thanks for this recovery @jahow ! Code LGTM and features worked fine when testing them.

Regarding our comment in the default.toml "...all records which do not intersect with the geometry will be excluded", we should maybe change "excluded" to something like "ranked lower" as the results still show up in the search, shouldn't we?

beforeEach(() => {
// this will enable spatial filtering
cy.intercept('GET', '/assets/configuration/default.toml', {
fixture: 'config-with-geometry.toml',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Really handy!

@@ -29,6 +30,48 @@ Cypress.Commands.add('login', () => {
cy.get('[name="gnSigninForm"]').submit()
})

Cypress.Commands.add('clearFavorites', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice, also really handy! I did not know this.

map((action: SearchActions) => new RequestNewResults(action.id))
this.actionsWithNewResults$.pipe(
// this will aggregate actions until the debounceTime ticks
buffer(this.actionsWithNewResults$.pipe(debounceTime(0))),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this buffer/debounceTime?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the idea here is that if you call for instance searchFacade.orderBy('createDate').setPageSize(10) etc., each call to the facade will trigger an action that will eventually trigger a RequestNewResults action. So you end up having many of these, many search requests and potential conflicts.

But because there are several search ids, the grouping is actually quite tricky indeed... I've tried to make this as clear as possible 😬

// once we have a list of actions emitted since last time, we can split them by search id
const requestNewResults = actions
.map((action) => action.id)
.filter((value, index, array) => array.indexOf(value) === index)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Waoh, pretty tricky we need to think of handling this.

@jahow jahow force-pushed the reactivate-filter-geometry-favorites branch from 4d739a5 to d055be3 Compare September 19, 2023 16:12
@jahow
Copy link
Collaborator Author

jahow commented Sep 19, 2023

@tkohr thanks for the review! I adjusted the doc in the config file and also improved the clearFavorites command which was failing in headless mode (Cypress is still very mysterious sometimes...)

@jahow jahow merged commit 033798c into main Sep 19, 2023
5 checks passed
@jahow jahow deleted the reactivate-filter-geometry-favorites branch September 19, 2023 17:18
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.

Reimplement favorites & geometry filtering following the internal data format change
3 participants