Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions apps/web/src/components/settings/ConnectionsSettings.logic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { describe, expect, it, vi } from "vite-plus/test";
import {
applyWslEnableSelection,
isQrShareableEndpoint,
remoteEnvironmentVersionLabel,
selectQrEndpointOption,
} from "./ConnectionsSettings.logic";

Expand All @@ -15,6 +16,22 @@ const baseWslState: DesktopWslState = {
preflightError: null,
};

describe("remoteEnvironmentVersionLabel", () => {
it("shows the complete connected server version, including nightly suffixes", () => {
expect(remoteEnvironmentVersionLabel("0.0.33-nightly.20260816", true)).toBe(
"v0.0.33-nightly.20260816",
);
});

it("marks a cached disconnected version as last seen", () => {
expect(remoteEnvironmentVersionLabel("0.0.32", false)).toBe("Last seen v0.0.32");
});

it("omits the label before a server version is known", () => {
expect(remoteEnvironmentVersionLabel(null, true)).toBeNull();
});
});

describe("applyWslEnableSelection", () => {
it("clears WSL-only and updates the distro before enabling both backends", async () => {
const calls: Array<string> = [];
Expand Down
9 changes: 9 additions & 0 deletions apps/web/src/components/settings/ConnectionsSettings.logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ import type { AdvertisedEndpoint, DesktopBridge, DesktopWslState } from "@t3tool

type WslEnableBridge = Pick<DesktopBridge, "setWslBackendEnabled" | "setWslDistro" | "setWslOnly">;

export function remoteEnvironmentVersionLabel(
serverVersion: string | null,
isConnected: boolean,
): string | null {
if (serverVersion === null) return null;
const version = `v${serverVersion}`;
return isConnected ? version : `Last seen ${version}`;
}

/**
* A QR code encoding a loopback URL makes the scanning device dial itself, so
* loopback endpoints stay copyable from the endpoint menu but are never
Expand Down
5 changes: 5 additions & 0 deletions apps/web/src/components/settings/ConnectionsSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { resolveDesktopPairingUrl, resolveHostedPairingUrl } from "./pairingUrls
import {
applyWslEnableSelection,
isQrShareableEndpoint,
remoteEnvironmentVersionLabel,
selectQrEndpointOption,
} from "./ConnectionsSettings.logic";
import {
Expand Down Expand Up @@ -1413,6 +1414,10 @@ function SavedBackendListRow({
const metadataBits = [
sshTarget ? `SSH ${formatDesktopSshTarget(sshTarget)}` : null,
environment.relayManaged ? "T3 Connect" : null,
remoteEnvironmentVersionLabel(
environment.serverConfig?.environment.serverVersion ?? null,
isConnected,
),
].filter((value): value is string => value !== null);

// The WSL backend is a desktop-managed local backend (it surfaces as a bearer
Expand Down
Loading