mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-11-01 16:15:24 +00:00
feat: option to hide the sidebar after opening a host (#1652)
This commit is contained in:
1 parent
f20d64b4f2
commit
7324982f47
7 files changed
+36
-1
No files matched your search
@@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
## 26.10.2
|
## 26.10.2
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Hide sidebar after opening, in Customize Sidebar, closes the host list once you open a host
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Picking a section lower down in the host editor, like Warpgate, stuttered on the way and sometimes stopped before it got there
|
- Picking a section lower down in the host editor, like Warpgate, stuttered on the way and sometimes stopped before it got there
|
||||||
|
|||||||
@@ -88,6 +88,8 @@ export interface HostSidebarDisplayPreferences extends HostRowFields {
|
|||||||
/** When false, nested folders hide the parent-path breadcrumb before their name. */
|
/** When false, nested folders hide the parent-path breadcrumb before their name. */
|
||||||
showFolderPaths: boolean;
|
showFolderPaths: boolean;
|
||||||
hostClickBehavior: HostClickBehavior;
|
hostClickBehavior: HostClickBehavior;
|
||||||
|
/** When true, the sidebar closes after a host is opened from it. */
|
||||||
|
closeOnOpen: boolean;
|
||||||
/**
|
/**
|
||||||
* Host action id to whether it shows in the row's connect bar. An action
|
* Host action id to whether it shows in the row's connect bar. An action
|
||||||
* missing here follows its own default. Every action stays in the menu.
|
* missing here follows its own default. Every action stays in the menu.
|
||||||
@@ -163,6 +165,7 @@ export function defaultHostSidebarPreferences(): HostSidebarPreferences {
|
|||||||
openOnDoubleClick: false,
|
openOnDoubleClick: false,
|
||||||
showFolderPaths: true,
|
showFolderPaths: true,
|
||||||
hostClickBehavior: "newTab",
|
hostClickBehavior: "newTab",
|
||||||
|
closeOnOpen: false,
|
||||||
barActions: {},
|
barActions: {},
|
||||||
...defaultHostRowFields(),
|
...defaultHostRowFields(),
|
||||||
},
|
},
|
||||||
@@ -274,6 +277,10 @@ export function sanitizeHostSidebarPreferences(
|
|||||||
)
|
)
|
||||||
? (displayObj.hostClickBehavior as HostClickBehavior)
|
? (displayObj.hostClickBehavior as HostClickBehavior)
|
||||||
: defaults.display.hostClickBehavior,
|
: defaults.display.hostClickBehavior,
|
||||||
|
closeOnOpen:
|
||||||
|
typeof displayObj.closeOnOpen === "boolean"
|
||||||
|
? displayObj.closeOnOpen
|
||||||
|
: defaults.display.closeOnOpen,
|
||||||
barActions: sanitizeBarActions(displayObj.barActions),
|
barActions: sanitizeBarActions(displayObj.barActions),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2698,6 +2698,7 @@ export function AppShell({
|
|||||||
if (isMobile) setSidebarOpen(false);
|
if (isMobile) setSidebarOpen(false);
|
||||||
}}
|
}}
|
||||||
onEditHost={editHostInManager}
|
onEditHost={editHostInManager}
|
||||||
|
onCloseSidebar={() => setSidebarOpen(false)}
|
||||||
hostTree={realHostTree ?? undefined}
|
hostTree={realHostTree ?? undefined}
|
||||||
loading={hostsLoading}
|
loading={hostsLoading}
|
||||||
onEditingChange={panelEditingSetter("hosts")}
|
onEditingChange={panelEditingSetter("hosts")}
|
||||||
|
|||||||
@@ -644,6 +644,8 @@
|
|||||||
"actionsClick": "Click to expand/collapse",
|
"actionsClick": "Click to expand/collapse",
|
||||||
"openOnDoubleClick": "Open on double click",
|
"openOnDoubleClick": "Open on double click",
|
||||||
"openOnDoubleClickDesc": "Require a double click to open a host session instead of a single click",
|
"openOnDoubleClickDesc": "Require a double click to open a host session instead of a single click",
|
||||||
|
"closeOnOpen": "Hide sidebar after opening",
|
||||||
|
"closeOnOpenDesc": "Close the sidebar after you open a host from it",
|
||||||
"showFolderPaths": "Show folder paths",
|
"showFolderPaths": "Show folder paths",
|
||||||
"showFolderPathsDesc": "Show the parent folder path above nested subfolder names. Subfolders stay indented either way.",
|
"showFolderPathsDesc": "Show the parent folder path above nested subfolder names. Subfolders stay indented either way.",
|
||||||
"rowDetailsTitle": "Row details",
|
"rowDetailsTitle": "Row details",
|
||||||
|
|||||||
@@ -223,6 +223,20 @@ export function CustomizeSidebarPanel({
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</SettingRow>
|
</SettingRow>
|
||||||
|
<SettingRow
|
||||||
|
label={t("hosts.closeOnOpen")}
|
||||||
|
description={t("hosts.closeOnOpenDesc")}
|
||||||
|
>
|
||||||
|
<FakeSwitch
|
||||||
|
checked={preferences.display.closeOnOpen}
|
||||||
|
onChange={(v) =>
|
||||||
|
update((prev) => ({
|
||||||
|
...prev,
|
||||||
|
display: { ...prev.display, closeOnOpen: v },
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</SettingRow>
|
||||||
<SettingRow
|
<SettingRow
|
||||||
label={t("newUi.sidebar.userProfile.statusColors")}
|
label={t("newUi.sidebar.userProfile.statusColors")}
|
||||||
description={t("newUi.sidebar.userProfile.statusColorsDesc")}
|
description={t("newUi.sidebar.userProfile.statusColorsDesc")}
|
||||||
|
|||||||
@@ -201,6 +201,7 @@ export function HostsPanel({
|
|||||||
hostTree,
|
hostTree,
|
||||||
loading,
|
loading,
|
||||||
active = true,
|
active = true,
|
||||||
|
onCloseSidebar,
|
||||||
}: {
|
}: {
|
||||||
onOpenTab: (
|
onOpenTab: (
|
||||||
host: Host,
|
host: Host,
|
||||||
@@ -217,6 +218,7 @@ export function HostsPanel({
|
|||||||
/** Unused since editing moved to the Manage tab. */
|
/** Unused since editing moved to the Manage tab. */
|
||||||
onEditingChange?: (editing: boolean) => void;
|
onEditingChange?: (editing: boolean) => void;
|
||||||
active?: boolean;
|
active?: boolean;
|
||||||
|
onCloseSidebar?: () => void;
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { statuses, getStatus } = useServerStatus();
|
const { statuses, getStatus } = useServerStatus();
|
||||||
@@ -1044,7 +1046,10 @@ export function HostsPanel({
|
|||||||
).children
|
).children
|
||||||
: []
|
: []
|
||||||
}
|
}
|
||||||
onOpenTab={onOpenTab}
|
onOpenTab={(host, type, options) => {
|
||||||
|
onOpenTab(host, type, options);
|
||||||
|
if (sidebarPrefs.display.closeOnOpen) onCloseSidebar?.();
|
||||||
|
}}
|
||||||
onEditHost={onEditHost}
|
onEditHost={onEditHost}
|
||||||
onShareHost={(host) => setShareModalHost(host)}
|
onShareHost={(host) => setShareModalHost(host)}
|
||||||
query={hostSearch.trim().toLowerCase()}
|
query={hostSearch.trim().toLowerCase()}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ describe("defaultHostSidebarPreferences", () => {
|
|||||||
openOnDoubleClick: false,
|
openOnDoubleClick: false,
|
||||||
showFolderPaths: true,
|
showFolderPaths: true,
|
||||||
hostClickBehavior: "newTab",
|
hostClickBehavior: "newTab",
|
||||||
|
closeOnOpen: false,
|
||||||
barActions: {},
|
barActions: {},
|
||||||
showAddress: true,
|
showAddress: true,
|
||||||
showUsername: true,
|
showUsername: true,
|
||||||
@@ -74,6 +75,7 @@ describe("sanitizeHostSidebarPreferences", () => {
|
|||||||
openOnDoubleClick: true,
|
openOnDoubleClick: true,
|
||||||
showFolderPaths: false,
|
showFolderPaths: false,
|
||||||
hostClickBehavior: "focusExistingDoubleClickNew",
|
hostClickBehavior: "focusExistingDoubleClickNew",
|
||||||
|
closeOnOpen: true,
|
||||||
barActions: { maintenance: true },
|
barActions: { maintenance: true },
|
||||||
showAddress: false,
|
showAddress: false,
|
||||||
showUsername: false,
|
showUsername: false,
|
||||||
|
|||||||
Reference in new issue
Block a user