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

Use query parameters for additional search views in Nuxt #3865

Closed
wants to merge 4 commits into from

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Mar 3, 2024

Fixes

Fixes #3864 by @obulat

Description

This PR updates the frontend implementation to use the query parameters instead of path parameters:

  • /image/tag/cat -> /image/collection?tag=cat
  • /image/source/wikimedia -> /image/collection?source=wikimedia
  • /image/source/wikimedia/creator/me -> /image/collection?source=wikimedia&creator=me

It updates pages, stores, collection middleware and API service.

Pages

The two pages (tag/_tag.vue and source/_vue) with a single collection.vue page (which is duplicated for each media type). The parsing and setting of collectionParams was removed from the setup function and moved to the collection middleware.

Store

getCollectionPath function is updated to create a path using collection path part and relevant query parameters.
This function is used for the source and creator link buttons, tags, the sources table.

API requests

The store collection parameters are converted to an API request URL. For now, before the API changes are implemented, we can use the search without q parameter: the full-text search within tags, creator and source.
The following request URLS are used in this PR:

  • /images?unstable__collection=tag&tags=cat
  • /images?unstable__collection=source&source=flickr
  • /images?unstable__collection=creator&source=flickr&creator=me

The API currently ignores the unstable__collection parameter.
When the API changes are implemented, tags will be replaced with unstable__tag, and from then on the real collections with exact matches and sorted by newest will be returned.

Important limitation
After these changes, the collection pages are not loaded on SSR because the CollectionPage sets the value of results before media is fetched, and server renders an empty result list. The follow-up PR that will use the new VMediaCollection component from #3831, and fix this problem.

Testing Instructions

Make sure that additional_search_views is on on the /preferences page.
Navigate to tags, creator and source views from the single result pages. The client-side navigation should work correctly. Note that there will be times that the page renders only the loading skeletons. This problem will be solved in a separate PR.

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (if applicable).

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@openverse-bot openverse-bot added 🟧 priority: high Stalls work on the project or its dependents ✨ goal: improvement Improvement to an existing user-facing feature 💻 aspect: code Concerns the software code in the repository 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Mar 3, 2024
@github-actions github-actions bot added the 🧱 stack: frontend Related to the Nuxt frontend label Mar 3, 2024
@obulat obulat force-pushed the additional_search_views/frontend-query-params branch from 4bda8a2 to 5c0abc1 Compare March 3, 2024 13:06
@obulat obulat removed the 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work label Mar 3, 2024
@obulat obulat self-assigned this Mar 3, 2024
@obulat obulat force-pushed the additional_search_views/frontend-query-params branch 2 times, most recently from ad981b4 to c135002 Compare March 3, 2024 13:14
@obulat obulat force-pushed the additional_search_views/frontend-query-params branch from c135002 to 99abdf5 Compare March 3, 2024 13:35
@obulat obulat changed the title Additional search views/frontend query params Use query parameters for additional search views in Nuxt Mar 3, 2024
@obulat obulat marked this pull request as ready for review March 3, 2024 13:54
@obulat obulat requested a review from a team as a code owner March 3, 2024 13:54
Signed-off-by: Olga Bulat <[email protected]>
@obulat obulat requested a review from a team as a code owner March 3, 2024 14:29
@obulat obulat closed this Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository ✨ goal: improvement Improvement to an existing user-facing feature 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: frontend Related to the Nuxt frontend
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Replace Additional search views path parameters with query parameters
2 participants