0066: Allow plugins to replace project creation choices - #7280
Conversation
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
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.
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.
317eede to
c67ce36
Compare
There was a problem hiding this comment.
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
registerCustomCreateProjectanchor in the committedmodules/plugin_registry.mdoutput 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/registercustomcreateprojecttarget, while the new function is generated indocs/development/api/modules/plugin_registry.mdunder theregistercustomcreateprojectanchor. 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,
7e4086a9fixes the route introduced byb5c25f29, anda3b4d1f8adds the SDK export/documentation omitted from the feature commitddfac238. 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();
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.
861596f to
cca2f81
Compare
Summary
Screenshots
Mobile (375 x 812)
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
9ddff4a9ccfae8f6cdc0a92d14ce2f6fa30a4e9ain 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
NewProjectPopup.tsxbranch coverage from 67.18% to 81.33%.@kinvolk/headlamp-plugin/liband document them in the generated API reference.Testing
npm run ci-lintnpm run tscCI=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)npm run build-storybooknpx 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, noHEADLAMP_TEST_TOKEN, and no Headlamp server listening on the default port.Assisted by copilot