fix(desktop): tighten WSL environment affordances per review
- Connections settings: disable Connect/Disconnect and Remove on the WSL backend's row. It's a desktop-managed local backend, not a remote environment you connect to or remove here, and reconcile would just re-create a removed one. Added a tooltip pointing at the WSL on/off setting that actually manages its lifecycle. - Command palette: drop the dedicated "Open WSL folder" command. The generic "Add project" flow already offers the WSL-vs-Windows environment picker, so a WSL-only shortcut with no Windows counterpart was redundant and asymmetric.
This commit is contained in:
1 parent
6ad3acccd1
commit
185032bd17
2 files changed
+44
-48
No files matched your search
@@ -480,15 +480,6 @@ function OpenCommandPaletteDialog() {
|
||||
savedEnvironmentRegistry,
|
||||
savedEnvironmentRuntimeById,
|
||||
]);
|
||||
const wslAddProjectEnvironmentOption = useMemo(
|
||||
() =>
|
||||
addProjectEnvironmentOptions.find((option) =>
|
||||
isDesktopLocalWslInstance(
|
||||
savedEnvironmentRegistry[option.environmentId]?.desktopLocal?.instanceId,
|
||||
),
|
||||
) ?? null,
|
||||
[addProjectEnvironmentOptions, savedEnvironmentRegistry],
|
||||
);
|
||||
const defaultAddProjectEnvironmentId = addProjectEnvironmentOptions[0]?.environmentId ?? null;
|
||||
const browseEnvironmentId = addProjectEnvironmentId ?? defaultAddProjectEnvironmentId;
|
||||
const browseEnvironmentPlatform = useMemo(() => {
|
||||
@@ -1074,21 +1065,6 @@ function OpenCommandPaletteDialog() {
|
||||
},
|
||||
});
|
||||
|
||||
if (wslAddProjectEnvironmentOption) {
|
||||
actionItems.push({
|
||||
kind: "action",
|
||||
value: "action:add-project:wsl-folder",
|
||||
searchTerms: ["add project", "open", "wsl", "linux", "ubuntu", "folder", "directory"],
|
||||
title: "Open WSL folder",
|
||||
description: wslAddProjectEnvironmentOption.label,
|
||||
icon: <FolderPlusIcon className={ITEM_ICON_CLASS} />,
|
||||
keepOpen: true,
|
||||
run: async () => {
|
||||
startAddProjectBrowse(wslAddProjectEnvironmentOption.environmentId);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
actionItems.push({
|
||||
kind: "action",
|
||||
value: "action:settings",
|
||||
|
||||
@@ -1511,6 +1511,40 @@ function SavedBackendListRow({
|
||||
: null,
|
||||
].filter((value): value is string => value !== null);
|
||||
|
||||
// The WSL backend is a desktop-managed local backend (instanceId "wsl:<distro>"),
|
||||
// not a remote environment you connect to or remove here — its lifecycle is driven
|
||||
// by the WSL on/off + distro picker on this page. Disabling Connect/Disconnect/Remove
|
||||
// avoids confusing no-ops (reconcile would just re-create a removed WSL env).
|
||||
const isWslEnvironment = record.desktopLocal?.instanceId?.startsWith("wsl:") === true;
|
||||
const actionButtons = (
|
||||
<span className="flex items-center gap-2">
|
||||
<Button
|
||||
size="xs"
|
||||
variant="outline"
|
||||
disabled={isWslEnvironment || (isConnected ? isDisconnecting : isConnecting)}
|
||||
onClick={() =>
|
||||
void (isConnected ? onDisconnect(environmentId) : onConnect(environmentId))
|
||||
}
|
||||
>
|
||||
{isConnected
|
||||
? isDisconnecting
|
||||
? "Disconnecting…"
|
||||
: "Disconnect"
|
||||
: isConnecting
|
||||
? "Connecting…"
|
||||
: "Connect"}
|
||||
</Button>
|
||||
<Button
|
||||
size="xs"
|
||||
variant="destructive-outline"
|
||||
disabled={isWslEnvironment || removingEnvironmentId === environmentId}
|
||||
onClick={() => void onRemove(environmentId)}
|
||||
>
|
||||
{removingEnvironmentId === environmentId ? "Removing…" : "Remove"}
|
||||
</Button>
|
||||
</span>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={ITEM_ROW_CLASSNAME}>
|
||||
<div className={ITEM_ROW_INNER_CLASSNAME}>
|
||||
@@ -1543,30 +1577,16 @@ function SavedBackendListRow({
|
||||
) : null}
|
||||
</div>
|
||||
<div className="flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end">
|
||||
<Button
|
||||
size="xs"
|
||||
variant="outline"
|
||||
disabled={isConnected ? isDisconnecting : isConnecting}
|
||||
onClick={() =>
|
||||
void (isConnected ? onDisconnect(environmentId) : onConnect(environmentId))
|
||||
}
|
||||
>
|
||||
{isConnected
|
||||
? isDisconnecting
|
||||
? "Disconnecting…"
|
||||
: "Disconnect"
|
||||
: isConnecting
|
||||
? "Connecting…"
|
||||
: "Connect"}
|
||||
</Button>
|
||||
<Button
|
||||
size="xs"
|
||||
variant="destructive-outline"
|
||||
disabled={removingEnvironmentId === environmentId}
|
||||
onClick={() => void onRemove(environmentId)}
|
||||
>
|
||||
{removingEnvironmentId === environmentId ? "Removing…" : "Remove"}
|
||||
</Button>
|
||||
{isWslEnvironment ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger render={actionButtons} />
|
||||
<TooltipPopup side="top" className="max-w-80 whitespace-pre-wrap leading-tight">
|
||||
The WSL backend is managed by the WSL setting above — turn it on or off there.
|
||||
</TooltipPopup>
|
||||
</Tooltip>
|
||||
) : (
|
||||
actionButtons
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user