Add navbar terminate action for active cloud sessions#322
Merged
Conversation
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.
Description
This PR implements issue #316, allowing users to forcibly terminate an active cloud session from the navbar while the app is idle. Previously, users could only resume sessions but had no way to close a stuck session without connecting to it.
Main changes:
Shared stop helper (
src/renderer/src/App.tsx): ExtractedstopSessionByTargetto centralize session stop request assembly and auth token handling; reused by both the existing in-stream stop flow and the new navbar terminate flow.Navbar terminate handler (
src/renderer/src/App.tsx): AddedhandleTerminateNavbarSessionwith user confirmation viawindow.confirm, guarded against concurrent resume/terminate/play actions, loading state (isTerminatingNavbarSession), error handling, and automatic refresh of the active session list after completion.Race prevention (
src/renderer/src/App.tsx): IntroducednavbarSessionActionInFlightRefto track "resume" or "terminate" operations in-flight; guards inhandleResumeFromNavbar,handleTerminateNavbarSession, andhandlePlayGameprevent overlapping actions.ActiveSessionInfo extension (
src/shared/gfn.ts,src/main/gfn/cloudmatch.ts): AddedstreamingBaseUrlfield to the active session payload so terminate requests can include the correct base URL without requiring new backend plumbing.Navbar UI (
src/renderer/src/components/Navbar.tsx): Replaced the standalone resume button with a flexnavbar-session-actionscontainer containing paired Resume (green) and Terminate (red) buttons; both show loading spinners during their respective operations and are disabled during conflicting actions.Styling (
src/renderer/src/styles.css): Added.navbar-session-terminateand.navbar-session-actionsvariants with error-tone gradients on hover/focus; responsive rules hide the Terminate label on narrower screens; controller-mode size adjustments applied.