feat: add deep-link support for pod exec/terminal via ?view=exec#4941
Open
justinas-wix wants to merge 2 commits intokubernetes-sigs:mainfrom
Open
feat: add deep-link support for pod exec/terminal via ?view=exec#4941justinas-wix wants to merge 2 commits intokubernetes-sigs:mainfrom
justinas-wix wants to merge 2 commits intokubernetes-sigs:mainfrom
Conversation
Add support for the `?view=exec` query parameter on pod detail pages to auto-launch the terminal/exec Activity panel, mirroring the existing `?view=logs` deep-link support. This enables users to share and bookmark direct links to exec into a specific pod, e.g.: /c/main/pods/default/my-app?view=exec Also refactors the terminal launch logic into a reusable `launchTerminal` callback (consistent with the existing `launchLogs` pattern), which the header action button now reuses instead of inlining. Signed-off-by: justinas-wix <justinask@wix.com> Made-with: Cursor
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: justinas-wix The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
d90fcd6 to
c3183e6
Compare
Add tests for the PodDetails component to verify the auto-launch behavior for both ?view=exec (new) and ?view=logs (existing): - Terminal Activity is launched when ?view=exec is in the URL - Logs Activity is launched when ?view=logs is in the URL - Nothing is launched when no view param is present - Nothing is launched for unrecognized view param values - Terminal is not re-launched on subsequent renders for the same pod - TERMINAL event is dispatched with OPENED status for exec deep-link Signed-off-by: justinas-wix <justinask@wix.com> Made-with: Cursor
c3183e6 to
203aa8c
Compare
Contributor
Author
|
Sorry I have messed up previous PR with squashing to much and then force pushing on top...
Appreciated!!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for the
?view=execquery parameter on pod detail pages to auto-launch the terminal/exec Activity panel, mirroring the existing?view=logsdeep-link support.This enables users to share and bookmark direct links to exec into a specific pod:
Motivation
Headlamp already supports
?view=logsfor deep-linking to pod logs. This is useful for sharing links from alerting systems, CI/CD pipelines, runbooks, and incident management tools. The same capability for exec/terminal is a natural complement — teams often need to quickly exec into a pod to debug an issue flagged by monitoring.Changes
frontend/src/components/pod/Details.tsx:launchTerminalcallback (viauseCallback), mirroring the existinglaunchLogspattern. It callsActivity.launch()with theTerminalcomponent and dispatches theTERMINALevent withOPENEDstatus.useEffectthat watches for?view=execin the URL query parameters and auto-launches the terminal once the pod data is loaded, using a ref (lastAutoLaunchedPodExec) to prevent duplicate launches — the same pattern used for?view=logs.POD_TERMINALheader action button to reuse the newlaunchTerminalcallback instead of inlining theActivity.launch()call, keeping the code DRY and consistent with howlaunchLogsis already used for the logs button.frontend/src/components/pod/Details.test.tsx(new):?view=exec(new) and?view=logs(existing) auto-launch behaviorUsage
/c/main/pods/default/my-app?view=logs/c/main/pods/default/my-app?view=execTest Plan
/c/<cluster>/pods/<namespace>/<pod>?view=exec— terminal Activity panel should auto-open/c/<cluster>/pods/<namespace>/<pod>?view=logs— log viewer should still auto-open (no regression)/c/<cluster>/pods/<namespace>/<pod>(no query param) — neither should auto-opennpx vitest run src/components/pod/Details.test.tsx)