Skip to content

Conversation

joaquimrocha
Copy link
Contributor

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

  1. Check out the example in the project example plugin

@k8s-ci-robot k8s-ci-robot requested a review from ashu8912 August 29, 2025 19:39
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested a review from skoeva August 29, 2025 19:39
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 29, 2025
@k8s-ci-robot
Copy link
Contributor

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.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 29, 2025
@joaquimrocha joaquimrocha requested review from yolossn and removed request for ashu8912 and skoeva August 29, 2025 19:40
@joaquimrocha joaquimrocha force-pushed the allow-to-override-project-list branch from 7920cd1 to 4984ef5 Compare September 1, 2025 09:21
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 1, 2025
@illume illume requested a review from Copilot September 1, 2025 18:05
Copy link
Contributor

@Copilot 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 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 ProjectListProcessor functionality 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);
Copy link
Preview

Copilot AI Sep 1, 2025

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.

Suggested change
console.log('Final projects:', projects);

Copilot uses AI. Check for mistakes.

let processor: ProjectListProcessor = action.payload as ProjectListProcessor;
if (typeof action.payload === 'function') {
processor = {
id: `generated-id-${Date.now().toString(36)}`,
Copy link
Preview

Copilot AI Sep 1, 2025

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.

Copilot uses AI. Check for mistakes.

Comment on lines +88 to +94
id: `generated-id-${Date.now().toString(36)}`,
processor: action.payload,
};
}

if (!processor.id) {
processor.id = `generated-id-${Date.now().toString(36)}`;
Copy link
Preview

Copilot AI Sep 1, 2025

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.

Suggested change
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()}`;

Copilot uses AI. Check for mistakes.

@illume illume marked this pull request as draft September 26, 2025 10:56
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. projects size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants