mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 15:15:24 +00:00
feat: point core frontend snippets pickers at the plugin (B2)
This commit is contained in:
1 parent
e07221eaf3
commit
1eac0f54b0
22 files changed
+170
-2968
No files matched your search
@@ -66,8 +66,10 @@ type ApiErrorLike = {
|
||||
};
|
||||
};
|
||||
|
||||
// user-snippets rather than the snippets plugin's own id: this is a tab key
|
||||
// in this admin panel's own local state, not a lookup into the plugin registry.
|
||||
type ManageTabId =
|
||||
"account" | "hosts" | "credentials" | "snippets" | "sessions" | "danger";
|
||||
"account" | "hosts" | "credentials" | "user-snippets" | "sessions" | "danger";
|
||||
|
||||
type ManagedSnippet = {
|
||||
id: number;
|
||||
@@ -253,7 +255,7 @@ export function AdminUserManagePanel({
|
||||
{ id: "account", label: t("admin.manageTabAccount") },
|
||||
{ id: "hosts", label: t("admin.manageTabHosts") },
|
||||
{ id: "credentials", label: t("admin.manageTabCredentials") },
|
||||
{ id: "snippets", label: t("admin.manageTabSnippets") },
|
||||
{ id: "user-snippets", label: t("admin.manageTabSnippets") },
|
||||
{ id: "sessions", label: t("admin.manageTabSessions") },
|
||||
{ id: "danger", label: t("admin.manageTabDanger") },
|
||||
];
|
||||
@@ -996,7 +998,7 @@ export function AdminUserManagePanel({
|
||||
</div>
|
||||
))}
|
||||
|
||||
{activeTab === "snippets" &&
|
||||
{activeTab === "user-snippets" &&
|
||||
(!dataUnlocked ? (
|
||||
lockedNotice
|
||||
) : (
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -524,7 +524,6 @@ export function UserProfilePanel({
|
||||
pinAppRail?: boolean | null;
|
||||
expandAppRailOnHover?: boolean | null;
|
||||
showPinAppRailButton?: boolean | null;
|
||||
foldersCollapsed?: boolean | null;
|
||||
confirmSnippetExecution?: boolean | null;
|
||||
disableUpdateCheck?: boolean | null;
|
||||
confirmTabClose?: boolean | null;
|
||||
@@ -708,12 +707,10 @@ export function UserProfilePanel({
|
||||
const [showPinAppRailButton, setShowPinAppRailButton] = useState(() =>
|
||||
readRailPreference("showPinAppRailButton"),
|
||||
);
|
||||
// Read values are unused now that the Snippets settings UI lives in
|
||||
// SnippetsPanel.tsx; the setters still back the cloud-sync/reset/snapshot
|
||||
// machinery for these two localStorage-backed prefs below.
|
||||
const [_foldersCollapsed, setFoldersCollapsed] = useState(
|
||||
() => localStorage.getItem("defaultSnippetFoldersCollapsed") !== "false",
|
||||
);
|
||||
// Read value is unused; the setter still backs the cloud-sync/reset/
|
||||
// snapshot machinery for this localStorage-backed pref below. The
|
||||
// folder-collapse setting itself now lives in the snippets plugin's own
|
||||
// user settings.
|
||||
const [_confirmSnippetExecution, setConfirmSnippetExecution] = useState(
|
||||
() => localStorage.getItem("confirmSnippetExecution") === "true",
|
||||
);
|
||||
@@ -850,7 +847,6 @@ export function UserProfilePanel({
|
||||
"pinAppRail",
|
||||
"expandAppRailOnHover",
|
||||
"showPinAppRailButton",
|
||||
"defaultSnippetFoldersCollapsed",
|
||||
"snippetShowCommands",
|
||||
"confirmSnippetExecution",
|
||||
"disableUpdateCheck",
|
||||
@@ -926,13 +922,6 @@ export function UserProfilePanel({
|
||||
);
|
||||
window.dispatchEvent(new Event("showPinAppRailButtonChanged"));
|
||||
}
|
||||
if (prefs.foldersCollapsed != null) {
|
||||
setFoldersCollapsed(prefs.foldersCollapsed);
|
||||
localStorage.setItem(
|
||||
"defaultSnippetFoldersCollapsed",
|
||||
String(prefs.foldersCollapsed),
|
||||
);
|
||||
}
|
||||
if (prefs.confirmSnippetExecution != null) {
|
||||
setConfirmSnippetExecution(prefs.confirmSnippetExecution);
|
||||
localStorage.setItem(
|
||||
@@ -1007,8 +996,6 @@ export function UserProfilePanel({
|
||||
setShowPinAppRailButton(false);
|
||||
localStorage.setItem("showPinAppRailButton", "false");
|
||||
window.dispatchEvent(new Event("showPinAppRailButtonChanged"));
|
||||
setFoldersCollapsed(true);
|
||||
localStorage.removeItem("defaultSnippetFoldersCollapsed");
|
||||
setConfirmSnippetExecution(false);
|
||||
localStorage.setItem("confirmSnippetExecution", "false");
|
||||
setDisableUpdateCheck(false);
|
||||
@@ -1032,7 +1019,6 @@ export function UserProfilePanel({
|
||||
pinAppRail: false,
|
||||
expandAppRailOnHover: true,
|
||||
showPinAppRailButton: false,
|
||||
foldersCollapsed: true,
|
||||
confirmSnippetExecution: false,
|
||||
disableUpdateCheck: false,
|
||||
confirmTabClose: false,
|
||||
@@ -1121,18 +1107,6 @@ export function UserProfilePanel({
|
||||
localStorage.setItem("showPinAppRailButton", String(restoredShowPinButton));
|
||||
window.dispatchEvent(new Event("showPinAppRailButtonChanged"));
|
||||
|
||||
const restoredFolders =
|
||||
restore("defaultSnippetFoldersCollapsed", null) !== "false";
|
||||
setFoldersCollapsed(restoredFolders);
|
||||
const snapFolders = hasSnap
|
||||
? snap["defaultSnippetFoldersCollapsed"]
|
||||
: localStorage.getItem("defaultSnippetFoldersCollapsed");
|
||||
if (snapFolders == null) {
|
||||
localStorage.removeItem("defaultSnippetFoldersCollapsed");
|
||||
} else {
|
||||
localStorage.setItem("defaultSnippetFoldersCollapsed", snapFolders);
|
||||
}
|
||||
|
||||
const restoredConfirmSnippet =
|
||||
restore("confirmSnippetExecution", "false") === "true";
|
||||
setConfirmSnippetExecution(restoredConfirmSnippet);
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
KeyRound,
|
||||
LayoutPanelLeft,
|
||||
Network,
|
||||
Play,
|
||||
Plug,
|
||||
ScrollText,
|
||||
Server,
|
||||
@@ -132,15 +131,6 @@ export const RAIL_ITEMS: RailItemDef[] = [
|
||||
labelKey: "nav.sftp",
|
||||
separatorAfter: true,
|
||||
},
|
||||
{
|
||||
id: "snippets",
|
||||
icon: Play,
|
||||
labelKey: "nav.snippets",
|
||||
separatorAfter: true,
|
||||
mobilePrimary: true,
|
||||
promotable: true,
|
||||
rightDockable: true,
|
||||
},
|
||||
{
|
||||
id: "macros",
|
||||
icon: Braces,
|
||||
|
||||
Reference in new issue
Block a user