Skip to content

fix(devices): show Connect button after disconnect and refresh auth token on reconnect#3159

Open
nmgaston wants to merge 2 commits intodevice-management-toolkit:mainfrom
nmgaston:fixKVMDisconnectStatus
Open

fix(devices): show Connect button after disconnect and refresh auth token on reconnect#3159
nmgaston wants to merge 2 commits intodevice-management-toolkit:mainfrom
nmgaston:fixKVMDisconnectStatus

Conversation

@nmgaston
Copy link
Contributor

@nmgaston nmgaston commented Mar 3, 2026

NOTE: Use with Console PR: device-management-toolkit/console#820

PR Checklist

  • Unit Tests have been added for new changes
  • API tests have been updated if applicable
  • All commented code has been removed
  • If you've added a dependency, you've ensured license is compatible with Apache 2.0 and clearly outlined the added dependency.

What are you changing?

Fixes the KVM Connect button not reappearing after an unexpected AMT disconnect.

  • kvm.component.html: Updated the Connect button condition from deviceState() === 0 to (deviceState() === 0 || !deviceKVMConnection()) && !isLoading() so the button is shown whenever the KVM is not connected, regardless of device state.
  • kvm.component.ts:
    • deviceKVMStatus(0): Added deviceKVMConnection.set(false) when AMT drops the connection unexpectedly, so the UI correctly reflects the disconnected state.
    • connect(): Resets readyToLoadKvm and deviceKVMConnection to false before reconnecting, and refreshes the auth token via getRedirectionExpirationToken in case it expired.

Anything the reviewer should know when reviewing this PR?

The root cause was that after an unexpected KVM disconnect (event 0 not triggered by the user), deviceKVMConnection remained true, causing the Connect button to stay hidden. The fix ensures the signal is always in sync with the actual connection state.

The Connect button condition also now covers the case where deviceState hasn't yet been set to 0 but the connection is known to be down.

If the there are associated PRs in other repositories, please link them here (i.e. device-management-toolkit/repo#365 )

device-management-toolkit/console#820

@nmgaston nmgaston force-pushed the fixKVMDisconnectStatus branch from 86e05bb to c03cdf4 Compare March 3, 2026 02:20
@nmgaston nmgaston changed the title fix(kvm): show Connect button after disconnect and refresh auth token on reconnect fix(devices): show Connect button after disconnect and refresh auth token on reconnect Mar 3, 2026
@nmgaston nmgaston marked this pull request as ready for review March 3, 2026 21:13
@nmgaston nmgaston requested a review from rsdmike March 3, 2026 21:13
rsdmike
rsdmike previously approved these changes Mar 9, 2026
@nmgaston nmgaston force-pushed the fixKVMDisconnectStatus branch 2 times, most recently from 50e5fe5 to 7a5fa93 Compare March 10, 2026 19:41
@nmgaston nmgaston requested a review from rsdmike March 10, 2026 19:50
@rsdmike
Copy link
Member

rsdmike commented Mar 10, 2026

Hey @nmgaston , were you able to give this a try with the cloud version to make sure this continues to work in both environments? If not, let me know and I can try it.

@nmgaston nmgaston force-pushed the fixKVMDisconnectStatus branch from 7a5fa93 to be11de5 Compare March 10, 2026 22:06
@nmgaston
Copy link
Contributor Author

Hey @nmgaston , were you able to give this a try with the cloud version to make sure this continues to work in both environments? If not, let me know and I can try it.

Actually, I'll test it. I have a feeling I will also need to make changes in MPS/RPS for this as a bulk of the fix was actually in console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Console UI does not reflect KVM disconnect after AMT closes idle session (~3 minutes inactivity)

2 participants