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

Fix(SavedSearch): Force user to validate criteria before saved search #18385

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

stonebuzz
Copy link
Contributor

@stonebuzz stonebuzz commented Nov 26, 2024

Checklist before requesting a review

Please delete options that are not relevant.

  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.
  • I have added tests that prove my fix is effective or that my feature works.
  • This change requires a documentation update.

Description

  • It fixes !35211

Perhaps an alternative to #18376.

After further review, I believe the issue here is that the saved search system expects the user to execute a search based on their criteria at least once (to include them in the URL).

See GenericView.js L102

const bs_modal = new bootstrap.Modal(modal.get(0), {show: false});
modal.on('show.bs.modal', () => {
    const params = JSON.parse(modal.attr('data-params'));
    params['url'] = window.location.pathname + window.location.search;
    modal.find('.modal-body').load(CFG_GLPI.root_doc + '/ajax/savedsearch.php', params);
});

If the user does not execute a search at least once, the default search for the item type is used and saved in the database.

Since I don’t see how to extract the search

image

convert it into a URL as shown here

image

and then pass it to the modal (from GenericView.js L102)

I simply propose checking whether window.location.search is not empty or does not correspond to a search reset (reset=reset).

Screenshots (if appropriate):

@stonebuzz
Copy link
Contributor Author

Awaiting user feedback
!35211

@stonebuzz
Copy link
Contributor Author

image

@stonebuzz stonebuzz marked this pull request as draft December 13, 2024 16:09
@stonebuzz stonebuzz marked this pull request as ready for review December 27, 2024 10:46
js/modules/Search/Table.js Outdated Show resolved Hide resolved
@cedric-anne cedric-anne requested a review from orthagh January 14, 2025 09:03
js/modules/Search/Table.js Outdated Show resolved Hide resolved
js/modules/Search/Table.js Outdated Show resolved Hide resolved
js/modules/Search/Table.js Outdated Show resolved Hide resolved
@stonebuzz stonebuzz requested a review from cconard96 January 15, 2025 10:59
@stonebuzz stonebuzz self-assigned this Jan 15, 2025
@stonebuzz stonebuzz added the ux label Jan 15, 2025
@cedric-anne cedric-anne added this to the 10.0.18 milestone Jan 16, 2025
@cedric-anne cedric-anne merged commit 08df0af into glpi-project:10.0/bugfixes Jan 16, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants