Skip to content

0066: Allow plugins to replace project creation choices - #7280

Open
illume wants to merge 9 commits into
kubernetes-sigs:mainfrom
illume:upstream-0066-replaceable-project-creation
Open

0066: Allow plugins to replace project creation choices#7280
illume wants to merge 9 commits into
kubernetes-sigs:mainfrom
illume:upstream-0066-replaceable-project-creation

Conversation

@illume

@illume illume commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Export stable IDs for Headlamp's built-in project creation choices.
  • Let plugins replace either the namespace-based or YAML-based choice by registering a custom creator with the corresponding ID.
  • Keep plugin-provided additional creation choices after the two built-in positions.
  • Add focused unit and end-to-end coverage before the feature commit.
  • Document the public plugin SDK API with responsive before-and-after examples.

Screenshots

Mobile (375 x 812)

Default choices Plugin replacements
Default project creation choices on mobile Plugin-replaced project creation choices on mobile

Source

This ports patch 0066 retained by Azure/aks-desktop#823:
Azure/aks-desktop#823

The original project creation extensibility work was reviewed in Azure/aks-desktop#370 and committed as e68b527ce56e42aa3f6e82d7e41f828b6f0efff3:
Azure/aks-desktop#370
Azure/aks-desktop@e68b527

PR 823 retained the upstreamable patch as embedded commit 9ddff4a9ccfae8f6cdc0a92d14ce2f6fa30a4e9a in its numbered patch series. The upstreamed feature commit preserves Thomas Gamble's authorship and original August 1, 2026 author date, with René Dudfield as co-author.

Improvements over the existing version

  • Prevent the built-in namespace project form from rendering alongside a plugin replacement that uses the built-in new-project ID.
  • Add a React key for additional plugin creation choices.
  • Raise focused NewProjectPopup.tsx branch coverage from 67.18% to 81.33%.
  • Add a Playwright flow for the built-in chooser and YAML navigation.
  • Export the replacement IDs from @kinvolk/headlamp-plugin/lib and document them in the generated API reference.
  • Document the replacement API and usage guidance in the plugin functionality guide.
  • Update the projects example plugin to demonstrate replacing a built-in choice and explain when to append a separate creator instead.

Testing

  • npm run ci-lint
  • npm run tsc
  • CI=1 npm run test -- --coverage (2,740 tests)
  • npx vitest run src/components/project/NewProjectPopup.test.tsx src/components/project/NewProjectPopup.replace.test.tsx --no-cache --coverage.enabled --coverage.include=src/components/project/NewProjectPopup.tsx (15 tests; 81.33% branches)
  • npx vitest run src/plugin/pluginLib.test.ts --no-cache (2 tests)
  • Plugin SDK TypeScript build with runtime and declaration export checks
  • Projects example plugin production build and TypeScript check against the local SDK
  • npm run build-storybook
  • npx playwright test tests/projects.spec.ts --list (1 Chromium test discovered)

The full Playwright flow was not run locally because this environment has no HEADLAMP_TEST_URL, no HEADLAMP_TEST_TOKEN, and no Headlamp server listening on the default port.

Assisted by copilot

@kubernetes-prow
kubernetes-prow Bot requested review from gambtho and skoeva August 16, 2026 06:46
@kubernetes-prow kubernetes-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 16, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: illume

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@kubernetes-prow kubernetes-prow Bot added 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. labels Aug 16, 2026
@illume
illume requested a balanced review from Copilot August 16, 2026 06:48
@illume
illume marked this pull request as draft August 16, 2026 06:48
@kubernetes-prow kubernetes-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds replaceable built-in project creation choices for plugins.

Changes:

  • Exports stable IDs and replacement logic.
  • Preserves additional plugin choices.
  • Adds unit, snapshot, and end-to-end coverage.

Reviewed changes

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

Show a summary per file
File Description
frontend/src/redux/projectsSlice.ts Defines built-in choice IDs.
frontend/src/plugin/registry.tsx Exposes IDs through the registry.
frontend/src/plugin/__snapshots__/pluginLib.snapshot Updates runtime API snapshot.
frontend/src/components/project/NewProjectPopup.tsx Implements choice replacement.
frontend/src/components/project/NewProjectPopup.test.tsx Expands creation-flow coverage.
frontend/src/components/project/NewProjectPopup.replace.test.tsx Tests both replacement IDs.
e2e-tests/tests/projects.spec.ts Tests built-in chooser navigation.

The plugin SDK barrel and generated API documentation still require updates. CI has no failures reported, but several checks remain pending.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread frontend/src/plugin/registry.tsx
Comment thread frontend/src/redux/projectsSlice.ts
illume and others added 7 commits August 16, 2026 11:16
Characterize existing namespace and custom creator paths so later
replacement changes retain at least 80% branch coverage.
Exercise the built-in project chooser and YAML navigation in a browser so
plugin replacement changes keep the user-facing workflow intact.
Expose stable IDs for the built-in choices so plugins can replace them
without duplicating the project creation menu.

Co-authored-by: René Dudfield <renedudfield@microsoft.com>
Expose the built-in replacement IDs through the plugin SDK and generated
API reference so documented imports compile for plugin authors.
Exercise the project chooser from its actual Home tab so the browser test
matches the user-facing route used by Headlamp.
Bundle the folder-star icon used by project creation plugin examples so
the frontend remains functional offline and its icon audit passes.
Show plugin authors how to replace built-in project choices and include
tested before-and-after captures for mobile, medium, and large viewports.
@illume
illume force-pushed the upstream-0066-replaceable-project-creation branch from 317eede to c67ce36 Compare August 16, 2026 09:22
@kubernetes-prow kubernetes-prow Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 16, 2026
@illume
illume marked this pull request as ready for review August 16, 2026 09:32
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 16, 2026
@illume
illume requested a balanced review from Copilot August 16, 2026 09:32
@kubernetes-prow
kubernetes-prow Bot requested a review from yolossn August 16, 2026 09:32
@illume
illume marked this pull request as draft August 16, 2026 09:32
@kubernetes-prow kubernetes-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 14 out of 20 changed files in this pull request and generated no new comments.

Suppressed comments (3)

docs/development/plugins/functionality/index.md:222

  • This repeated API-reference link also targets a path that is not generated. Link to the registerCustomCreateProject anchor in the committed modules/plugin_registry.md output instead.
- API reference: [registerCustomCreateProject](../../api/plugin/registry/functions/registercustomcreateproject)

docs/development/plugins/functionality/index.md:182

  • This API link does not match the committed TypeDoc layout: there is no docs/development/api/plugin/registry/functions/registercustomcreateproject target, while the new function is generated in docs/development/api/modules/plugin_registry.md under the registercustomcreateproject anchor. As written, plugin authors following this link get a missing page. Please point it at the generated module anchor.

This issue also appears on line 222 of the same file.

Add a project creation choice with
[registerCustomCreateProject](../../api/plugin/registry/functions/registercustomcreateproject).

e2e-tests/tests/projects.spec.ts:24

  • Blocking history cleanup: the PR range contains corrective follow-up commits rather than an atomic commit flow. In particular, 7e4086a9 fixes the route introduced by b5c25f29, and a3b4d1f8 adds the SDK export/documentation omitted from the feature commit ddfac238. Please squash/reorder these corrections into the commits they fix so each commit is coherent and reviewable.
  await headlampPage.navigateTopage('/');
  await page.getByRole('tab', { name: 'Projects' }).click();

@illume
illume marked this pull request as ready for review August 16, 2026 10:04
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 16, 2026
illume added 2 commits August 16, 2026 12:11
Keep the mobile before-and-after comparison concise in the plugin guide and
remove the unreferenced medium and large screenshot assets.
Use the public built-in ID in the projects example and explain when plugins
should replace a choice instead of appending another creator.
@illume
illume force-pushed the upstream-0066-replaceable-project-creation branch from 861596f to cca2f81 Compare August 16, 2026 10:35
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. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants