[PR #5463] Refactor CommandMenu to prevent duplicate scripts across categories #5822

Open
opened 2025-11-20 07:07:46 -05:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/community-scripts/ProxmoxVE/pull/5463

State: closed
Merged: Yes


✍️ Description

This pull request refines the CommandMenu component in frontend/src/components/CommandMenu.tsx to ensure that scripts are displayed without duplicates across categories. The changes introduce a mechanism to globally track seen scripts and only render categories containing unique scripts.

Enhancements to script rendering:

Link: #

Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected.
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing functionality in a way that may require updates.
  • 🆕 New script – A fully functional and tested script or script set.
  • 🌍 Website update – Changes to website-related JSON files or metadata.
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, AppName.md, CONTRIBUTING.md, or other docs.

before:
image

after:
image

**Original Pull Request:** https://github.com/community-scripts/ProxmoxVE/pull/5463 **State:** closed **Merged:** Yes --- <!--🛑 New scripts must be submitted to [ProxmoxVED](https://github.com/community-scripts/ProxmoxVED) for testing. PRs without prior testing will be closed. --> ## ✍️ Description This pull request refines the `CommandMenu` component in `frontend/src/components/CommandMenu.tsx` to ensure that scripts are displayed without duplicates across categories. The changes introduce a mechanism to globally track seen scripts and only render categories containing unique scripts. Enhancements to script rendering: * [`frontend/src/components/CommandMenu.tsx`](diffhunk://#diff-fca568a5b1db55ee0757b5deace6840f1ca415a31eab55bdc32d6601d2e8a512L137-R157): Added logic to track scripts globally using a `Set` to prevent duplicates across categories. This ensures that only unique scripts are rendered within each category. * [`frontend/src/components/CommandMenu.tsx`](diffhunk://#diff-fca568a5b1db55ee0757b5deace6840f1ca415a31eab55bdc32d6601d2e8a512L164-R184): Modified the rendering logic to conditionally display categories based on the presence of unique scripts, improving the clarity of the menu. ## 🔗 Related PR / Issue Link: # ## ✅ Prerequisites (**X** in brackets) - [x] **Self-review completed** – Code follows project standards. - [x] **Tested thoroughly** – Changes work as expected. - [x] **No security risks** – No hardcoded secrets, unnecessary privilege escalations, or permission issues. --- ## 🛠️ Type of Change (**X** in brackets) - [x] 🐞 **Bug fix** – Resolves an issue without breaking functionality. - [ ] ✨ **New feature** – Adds new, non-breaking functionality. - [ ] 💥 **Breaking change** – Alters existing functionality in a way that may require updates. - [ ] 🆕 **New script** – A fully functional and tested script or script set. - [ ] 🌍 **Website update** – Changes to website-related JSON files or metadata. - [ ] 🔧 **Refactoring / Code Cleanup** – Improves readability or maintainability without changing functionality. - [ ] 📝 **Documentation update** – Changes to `README`, `AppName.md`, `CONTRIBUTING.md`, or other docs. before: ![image](https://github.com/user-attachments/assets/ee24eb4f-dd08-4911-b203-0b8b803c788a) after: ![image](https://github.com/user-attachments/assets/2602ee44-2168-41a1-8280-35c044fee2c6)
saavagebueno added the pull-request label 2025-11-20 07:07:46 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/ProxmoxVE#5822