Skip to content

rewrite PI search functionality#538

Merged
simonLeary42 merged 19 commits intomainfrom
improve-pi-search2
Jan 16, 2026
Merged

rewrite PI search functionality#538
simonLeary42 merged 19 commits intomainfrom
improve-pi-search2

Conversation

@simonLeary42
Copy link
Member

@simonLeary42 simonLeary42 commented Jan 16, 2026

before:

  • submit button is always enabled even if the search query has no match
  • every keypress results in a large number of LDAP queries
  • pi_search.php is located under modal/ despite that it is only used with ajax
  • pi_search.php returns HTML
  • user can search by PI group GID and PI group owner name
  • PI group owner email can be used instead of the PI group GID in HTTP POST

after:

  • submit button is only enabled if the search query has an exact match
  • LDAP queries are cached in the PHP session until next page load
  • pi_search.php is located under ajax/ where it belongs
  • pi_search.php returns JSON
  • user can search by PI group GID, PI group owner name, and PI group owner email
  • only the PI group GID can be used in HTTP POST
Screen.Recording.2026-01-16.at.8.30.51.AM.mov

in the rare scenario where the user's session gets automatically cleaned up by php:

image

I also implemented this in a simpler way where all the PI owner attributes are stored in the browser, but I decided that wasn't a good idea. #535

Future work:

  • remove UnityLdap->getAllPIGroups(), update group_user_request_owner_reminder.php to manually parse attributes

@simonLeary42 simonLeary42 requested a review from Copilot January 16, 2026 13:46
@simonLeary42 simonLeary42 changed the title add cache for pi_search.php using $_SESSION rewrite PI search functionality Jan 16, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the PI search functionality to improve performance by caching PI group data in $_SESSION and relocating the search endpoint from modal/ to ajax/. The submit button now only enables when an exact PI group match is found.

Changes:

  • Moved pi_search.php from modal/ to ajax/ directory
  • Implemented session-based caching of PI group owner information
  • Enhanced submit button behavior to only enable on exact matches

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
webroot/panel/modal/pi_search.php Removed old implementation that performed LDAP queries on every keystroke
webroot/panel/modal/new_pi.php Added session cache initialization and improved JavaScript for exact match validation
webroot/panel/ajax/pi_search.php New implementation using session cache instead of direct LDAP queries

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@simonLeary42 simonLeary42 merged commit 3cf346b into main Jan 16, 2026
3 checks passed
@simonLeary42 simonLeary42 deleted the improve-pi-search2 branch January 16, 2026 19:21
@simonLeary42
Copy link
Member Author

#511

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.

2 participants