-
Notifications
You must be signed in to change notification settings - Fork 462
Allow to override project list #3850
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
base: allow-to-override-project-list
Are you sure you want to change the base?
Allow to override project list #3850
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: joaquimrocha The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Signed-off-by: Joaquim Rocha <joaquim.rocha@microsoft.com>
Signed-off-by: Joaquim Rocha <joaquim.rocha@microsoft.com>
7920cd1 to
4984ef5
Compare
There was a problem hiding this 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 implements a plugin system that allows customization of the project list discovery mechanism. Plugins can now register processors to extend, filter, or completely override how projects are discovered and displayed.
Key changes:
- Introduces
ProjectListProcessorfunctionality with registration mechanism - Makes project details tab icons optional to improve API flexibility
- Provides example implementation showing how to extend project lists with custom projects
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/headlamp-plugin/src/index.ts | Exports new project list processor types and registration function |
| plugins/examples/projects/src/index.tsx | Demonstrates project list processor usage and fixes property references |
| plugins/examples/projects/README.md | Documents the new project list processor feature |
| frontend/src/redux/projectsSlice.ts | Implements Redux state management for project list processors |
| frontend/src/plugin/registry.tsx | Adds registration function for project list processors |
| frontend/src/components/project/ProjectList.tsx | Integrates processor execution into project discovery logic |
| frontend/src/components/project/ProjectDetails.tsx | Handles optional icons in project details tabs |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| } | ||
| } | ||
|
|
||
| console.log('Final projects:', projects); |
Copilot
AI
Sep 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug console.log statement should be removed from production code.
| console.log('Final projects:', projects); |
| let processor: ProjectListProcessor = action.payload as ProjectListProcessor; | ||
| if (typeof action.payload === 'function') { | ||
| processor = { | ||
| id: `generated-id-${Date.now().toString(36)}`, |
Copilot
AI
Sep 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Date.now() for ID generation could create duplicate IDs if multiple processors are registered simultaneously. Consider using crypto.randomUUID() or a counter-based approach for guaranteed uniqueness.
| id: `generated-id-${Date.now().toString(36)}`, | ||
| processor: action.payload, | ||
| }; | ||
| } | ||
|
|
||
| if (!processor.id) { | ||
| processor.id = `generated-id-${Date.now().toString(36)}`; |
Copilot
AI
Sep 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Date.now() for ID generation could create duplicate IDs if multiple processors are registered simultaneously. Consider using crypto.randomUUID() or a counter-based approach for guaranteed uniqueness.
| id: `generated-id-${Date.now().toString(36)}`, | |
| processor: action.payload, | |
| }; | |
| } | |
| if (!processor.id) { | |
| processor.id = `generated-id-${Date.now().toString(36)}`; | |
| id: `generated-id-${crypto.randomUUID()}`, | |
| processor: action.payload, | |
| }; | |
| } | |
| if (!processor.id) { | |
| processor.id = `generated-id-${crypto.randomUUID()}`; |
Summary
This PR allows plugins to override the list of projects, so they can implement projects however they like and they can list them in the project list.
Steps to Test