Skip to content

SOL: "Disconnect SOL" button never flips back to "Connect SOL" after manual disconnect #3475

Description

@shaoboon

Summary

After clicking Disconnect SOL on the SOL (Serial-over-LAN) tab, the redirection session is correctly torn down (the <amt-sol> terminal unmounts), but the toolbar button remains labeled "Disconnect SOL" instead of flipping back to "Connect SOL". This makes it impossible to manually reconnect via the button after a manual disconnect — the user has to navigate away and back to the SOL tab to reconnect.

Found while writing e2e coverage for the SOL feature against a real AMT device (device-management-toolkit/e2e-testing); confirmed as a deterministic logic bug (not a timing flake) by reading the component/template source, and reproduced live against real hardware.

Steps to reproduce

  1. Open a device's SOL tab (SOL auto-connects on load).
  2. Wait for the terminal to connect (button shows "Disconnect SOL").
  3. Click Disconnect SOL.

Expected: the button flips to "Connect SOL" (matching the equivalent KVM behavior).
Actual: the button still reads "Disconnect SOL", even though the terminal/session is actually disconnected.

Root cause

In sol.component.ts:

disconnect(): void {
  this.isDisconnecting = true
  this.deviceConnection.set(false)
}

deviceStatus(event: any): void {
  this.deviceState.set(event)
  if (event === 3) {
    this.isLoading.set(false)
  } else if (event === 0) {
    this.isLoading.set(false)
    if (!this.isDisconnecting) {
      this.displayError(
        'Connecting to SOL failed. Only one session per device is allowed. Also ensure that your token is valid and you have access.'
      )
    }
    this.isDisconnecting = false
  }
}

When the child <amt-sol> reports deviceStatus(0) (disconnected), isLoading is set to false. But in sol.component.html, the "Connect SOL" button condition is:

@if (deviceState() === 0 && isLoading() !== false) {
  <!-- Connect SOL -->
} @else if (deviceState() !== 2 && isLoading()) {
  <!-- Loading -->
} @else {
  <!-- Disconnect SOL -->
}

deviceState() === 0 && isLoading() !== false can never be true at the moment a real disconnect completes, because isLoading was just explicitly set to false in the same deviceStatus(0) branch that set deviceState to 0. So the button always falls through to the @else branch ("Disconnect SOL") after a disconnect.

Comparison with KVM (which does not have this bug)

The equivalent KVM button condition in kvm.component.html additionally checks the connection flag itself, not just deviceState/isLoading:

@if ((deviceState() === 0 || !deviceKVMConnection()) && !isLoading()) {
  <!-- Connect KVM -->
}

The || !deviceKVMConnection() clause is what makes KVM's button correctly flip back to "Connect KVM" after a manual disconnect. SOL's template is missing the equivalent || !deviceConnection() clause.

Suggested fix

Add the same || !deviceConnection() clause to the SOL "Connect SOL" condition in sol.component.html, mirroring the KVM pattern:

@if ((deviceState() === 0 || !deviceConnection()) && isLoading() !== false) {

(Exact boolean form to be reconciled with the second/loading branch during implementation — the key point is a manual disconnect should be reflected via deviceConnection() as well as deviceState().)

Environment

  • Confirmed on sample-web-ui enterprise build talking to Console, against a real Intel AMT device (Admin Control Mode, AMT 18.1.x).
  • Not timing-dependent — reproduces on every manual disconnect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Priority 2 - Medium

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions