Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/options: make Space Usage a standalone tool, remove it from Content Manager
Adorian Doran9a773af0a5ff
diff --git a/apps/client/src/components/app_context.ts b/apps/client/src/components/app_context.tsindex 882008d8bd..19acf8542c 100644--- a/apps/client/src/components/app_context.ts+++ b/apps/client/src/components/app_context.ts@@ -344,6 +344,7 @@ export type CommandMappings = {};showSQLConsole: CommandData;showBackendLog: CommandData;+ showSpaceUsage: CommandData;showCheatsheet: CommandData;showShortcutHints: CommandData;showHelp: CommandData;diff --git a/apps/client/src/components/root_command_executor.ts b/apps/client/src/components/root_command_executor.tsindex 7f008d168e..68fc72b8e0 100644--- a/apps/client/src/components/root_command_executor.ts+++ b/apps/client/src/components/root_command_executor.ts@@ -101,6 +101,10 @@ export default class RootCommandExecutor extends Component {await appContext.tabManager.openTabWithNoteWithHoisting("_backendLog", { activate: true });}+ async showSpaceUsageCommand() {+ await appContext.tabManager.openTabWithNoteWithHoisting("_spaceUsage", { activate: true });+ }+async showHelpCommand() {await this.showAndHoistSubtree("_help");}diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 17243d009a..a0752f5e1b 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -1083,6 +1083,7 @@"configure_launchbar": "Configure Launchbar","show_shared_notes_subtree": "Show Shared Notes Subtree","show_deleted_notes": "Show Deleted Notes",+ "show_space_usage": "Show Space Usage","advanced": "Advanced","open_dev_tools": "Open Dev Tools","open_sql_console": "Open SQL Console",@@ -3072,9 +3073,7 @@"sort_by_title": "Title","sort_by_date_created": "Creation date","no_items": "No active content found.",- "no_items_hint": "Scripts, themes, templates and snippets you create will be listed here.",- "section_active_content": "Active Content & Templates",- "section_space_usage": "Space Usage"+ "no_items_hint": "Scripts, themes, templates and snippets you create will be listed here."},"space_usage": {"loading": "Measuring space usage...",diff --git a/apps/client/src/widgets/buttons/global_menu.tsx b/apps/client/src/widgets/buttons/global_menu.tsxindex 334886b50b..ca97c77e34 100644--- a/apps/client/src/widgets/buttons/global_menu.tsx+++ b/apps/client/src/widgets/buttons/global_menu.tsx@@ -54,6 +54,7 @@ export default function GlobalMenu({ isHorizontalLayout }: { isHorizontalLayout:<MenuItem command="openNewWindow" icon="bx bx-window-open" text={t("global_menu.open_new_window")} /><MenuItem command="showShareSubtree" icon="bx bx-share-alt" text={t("global_menu.show_shared_notes_subtree")} /><MenuItem command="showDeletedNotes" icon="bx bx-trash-alt" text={t("global_menu.show_deleted_notes")} />+ <KeyboardActionMenuItem command="showSpaceUsage" icon="bx bx-pie-chart-alt-2" text={t("global_menu.show_space_usage")} /><FormDropdownDivider /><ZoomControls parentComponent={parentComponent} />diff --git a/apps/client/src/widgets/type_widgets/ContentWidget.tsx b/apps/client/src/widgets/type_widgets/ContentWidget.tsxindex 70d4fc0e41..50f1724259 100644--- a/apps/client/src/widgets/type_widgets/ContentWidget.tsx+++ b/apps/client/src/widgets/type_widgets/ContentWidget.tsx@@ -4,7 +4,7 @@ import AppearanceSettings from "./options/appearance";import ShortcutSettings from "./options/shortcuts";import TextNoteSettings from "./options/text_notes";import CodeNoteSettings from "./options/code_notes";-import ContentManagerSettings from "./options/content_manager";+import ActiveContentSettings from "./options/active_content";import MediaSettings from "./options/media";import SpellcheckSettings from "./options/spellcheck";import PasswordSettings from "./options/password";@@ -21,16 +21,17 @@ import LlmSettings from "./options/llm";import "./ContentWidget.css";import { t } from "../../services/i18n";import BackendLog from "./code/BackendLog";+import SpaceUsage from "./space_usage";export type OptionPages = "_optionsAppearance" | "_optionsShortcuts" | "_optionsTextNotes" | "_optionsCodeNotes" | "_optionsContentManager" | "_optionsMedia" | "_optionsSpellcheck" | "_optionsPassword" | "_optionsEtapi" | "_optionsBackup" | "_optionsDatabase" | "_optionsSync" | "_optionsDesktop" | "_optionsOther" | "_optionsLocalization" | "_optionsSecurity" | "_optionsAdvanced" | "_optionsLlm";/** The page behind each of these notes. Exported for the options search, which renders them all. */-export const CONTENT_WIDGETS: Record<OptionPages | "_backendLog", (props: TypeWidgetProps) => JSX.Element> = {+export const CONTENT_WIDGETS: Record<OptionPages | "_backendLog" | "_spaceUsage", (props: TypeWidgetProps) => JSX.Element> = {_optionsAppearance: AppearanceSettings,_optionsShortcuts: ShortcutSettings,_optionsTextNotes: TextNoteSettings,_optionsCodeNotes: CodeNoteSettings,- _optionsContentManager: ContentManagerSettings,+ _optionsContentManager: ActiveContentSettings,_optionsMedia: MediaSettings,_optionsSpellcheck: SpellcheckSettings,_optionsPassword: PasswordSettings,@@ -44,7 +45,8 @@ export const CONTENT_WIDGETS: Record<OptionPages | "_backendLog", (props: TypeWi_optionsSecurity: SecuritySettings,_optionsAdvanced: AdvancedSettings,_optionsLlm: LlmSettings,- _backendLog: BackendLog+ _backendLog: BackendLog,+ _spaceUsage: SpaceUsage}/**diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/active_content.css b/apps/client/src/widgets/type_widgets/options/active_content.csssimilarity index 73%rename from apps/client/src/widgets/type_widgets/options/content_manager/active_content.cssrename to apps/client/src/widgets/type_widgets/options/active_content.cssindex 9562c616f0..3148e41218 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/active_content.css+++ b/apps/client/src/widgets/type_widgets/options/active_content.css@@ -1,3 +1,15 @@+/* One scrolling list of every category rather than a stack of cards: the page spans the pane, and+ its single block needs no space after it. Full width: the split resolves the cap for tabs, the+ header inner for the settings dialog. */+.note-split.options:has(.active-content-toolbar),+.note-detail-content-widget-content:has(.active-content-toolbar) {+ --options-card-max-width: 100%;+}++.note-detail-content-widget-content.options:has(.active-content-toolbar) > *:not(.options-page-header) {+ margin-bottom: 0;+}+/* Lives in the sticky page header, which supplies its own spacing. */.active-content-toolbar {display: flex;@@ -70,3 +82,8 @@opacity: 0.7;}+/* Reads as secondary to the page title above it. Set on the buttons, which carry their own font+ size and so would not inherit one from the group. */+.active-content-view-choice button {+ font-size: 0.85em;+}diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/active_content.spec.tsx b/apps/client/src/widgets/type_widgets/options/active_content.spec.tsxsimilarity index 94%rename from apps/client/src/widgets/type_widgets/options/content_manager/active_content.spec.tsxrename to apps/client/src/widgets/type_widgets/options/active_content.spec.tsxindex 59d378a164..44899a93d2 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/active_content.spec.tsx+++ b/apps/client/src/widgets/type_widgets/options/active_content.spec.tsx@@ -14,7 +14,7 @@ const mocks = vi.hoisted(() => ({saved: [] as [ string, string ][]}));-vi.mock("../../../../services/i18n", () => ({ t: (key: string) => key }));+vi.mock("../../../services/i18n", () => ({ t: (key: string) => key }));/** The data layer is stubbed out: what each category holds, and whether a note counts as enabled, is@@ -22,7 +22,7 @@ vi.mock("../../../../services/i18n", () => ({ t: (key: string) => key }));* covers. What is left here — and what these cases are about — is which of the page's states is* shown for a given answer.*/-vi.mock("../../../../services/active_content", () => ({+vi.mock("../../../services/active_content", () => ({CONTENT_CATEGORIES: [{ id: "templates", titleKey: "content_manager.category_templates", filter: "#template" },{ id: "scripts", titleKey: "content_manager.category_scripts", filter: "#run" }@@ -46,7 +46,7 @@ vi.mock("../../../../services/active_content", () => ({* hooks that draw each row's detail and its menu, so the stub calls them the way the real list does.* A row's note is only ever read for its id here, the rest being this page's own business.*/-vi.mock("../../../collections/legacy/ListOrGridView", () => {+vi.mock("../../collections/legacy/ListOrGridView", () => {// One object per id, kept: a row re-reads its setting whenever the note it was handed changes,// and a fresh object each render would look like a different note every time.const notes = new Map<string, { noteId: string }>();@@ -77,7 +77,7 @@ vi.mock("../../../collections/legacy/ListOrGridView", () => {});// The row menu reaches for the tab manager as it opens a note; nothing here presses it.-vi.mock("../../../../components/app_context", () => ({+vi.mock("../../../components/app_context", () => ({default: {tabManager: {openContextWithNote: vi.fn(),@@ -87,12 +87,12 @@ vi.mock("../../../../components/app_context", () => ({}}));-vi.mock("../components/OptionsPageHeader", () => ({+vi.mock("./components/OptionsPageHeader", () => ({default: ({ below }: { below?: preact.ComponentChildren }) => <div className="header-stub">{below}</div>}));-vi.mock("../../../react/hooks", async (importOriginal) => ({- ...(await importOriginal<typeof import("../../../react/hooks")>()),+vi.mock("../../react/hooks", async (importOriginal) => ({+ ...(await importOriginal<typeof import("../../react/hooks")>()),useTriliumOption: (name: string) => [mocks.stored[name] ?? "",(value: string) => void mocks.saved.push([ name, value ])@@ -102,7 +102,7 @@ vi.mock("../../../react/hooks", async (importOriginal) => ({import ActiveContent from "./active_content";/** Only the fields the page itself reads; the rest of a type widget's props are the host's business. */-const PAGE_PROPS = { note: { noteId: "_optionsContentManager" }, sectionSwitcher: null } as unknown as ComponentProps<typeof ActiveContent>;+const PAGE_PROPS = { note: { noteId: "_optionsContentManager" } } as unknown as ComponentProps<typeof ActiveContent>;let host: HTMLElement;@@ -239,7 +239,7 @@ describe("arranging the same items another way", () => {it("writes the chosen arrangement back, so the page opens the same way next time", async () => {await open();- const [ , location ] = [ ...host.querySelectorAll<HTMLElement>(".content-manager-view-choice button") ];+ const [ , location ] = [ ...host.querySelectorAll<HTMLElement>(".active-content-view-choice button") ];await act(async () => location?.click());expect(mocks.saved).toContainEqual([ "contentManagerViewMode", "location" ]);diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/active_content.tsx b/apps/client/src/widgets/type_widgets/options/active_content.tsxsimilarity index 94%rename from apps/client/src/widgets/type_widgets/options/content_manager/active_content.tsxrename to apps/client/src/widgets/type_widgets/options/active_content.tsxindex a151b56ffd..75909871c9 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/active_content.tsx+++ b/apps/client/src/widgets/type_widgets/options/active_content.tsx@@ -2,8 +2,8 @@ import "./active_content.css";import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";-import appContext from "../../../../components/app_context";-import type FNote from "../../../../entities/fnote";+import appContext from "../../../components/app_context";+import type FNote from "../../../entities/fnote";import {buildLocationTree,CONTENT_CATEGORIES,@@ -15,23 +15,23 @@ import {type LocationNode,resolveProperties,setCategoryEnabled-} from "../../../../services/active_content";-import attributeService from "../../../../services/attributes";-import branches from "../../../../services/branches";-import debounce from "../../../../services/debounce";-import { t } from "../../../../services/i18n";-import { isMobile } from "../../../../services/utils";-import { ListView, type ListViewOptions } from "../../../collections/legacy/ListOrGridView";-import { Badge } from "../../../react/Badge";-import Dropdown from "../../../react/Dropdown";-import { FormListItem } from "../../../react/FormList";-import FormTextBox from "../../../react/FormTextBox";-import FormToggle from "../../../react/FormToggle";-import { useTriliumEvent, useTriliumOption } from "../../../react/hooks";-import NoItems from "../../../react/NoItems";-import SegmentedChoice from "../../../react/SegmentedChoice";-import OptionsPageHeader from "../components/OptionsPageHeader";-import type { ContentManagerSectionProps } from "./index";+} from "../../../services/active_content";+import attributeService from "../../../services/attributes";+import branches from "../../../services/branches";+import debounce from "../../../services/debounce";+import { t } from "../../../services/i18n";+import { isMobile } from "../../../services/utils";+import { ListView, type ListViewOptions } from "../../collections/legacy/ListOrGridView";+import { Badge } from "../../react/Badge";+import Dropdown from "../../react/Dropdown";+import { FormListItem } from "../../react/FormList";+import FormTextBox from "../../react/FormTextBox";+import FormToggle from "../../react/FormToggle";+import { useTriliumEvent, useTriliumOption } from "../../react/hooks";+import NoItems from "../../react/NoItems";+import SegmentedChoice from "../../react/SegmentedChoice";+import type { TypeWidgetProps } from "../type_widget";+import OptionsPageHeader from "./components/OptionsPageHeader";const NOOP = () => {};@@ -182,7 +182,7 @@ const LIST_OPTIONS: ListViewOptions = {pageSize: 50};-export default function ActiveContent({ note, sectionSwitcher }: ContentManagerSectionProps) {+export default function ActiveContent({ note }: TypeWidgetProps) {const [ sortOrder, setSortOrder ] = useTriliumOption("contentManagerSortOrder");const [ viewMode, setViewMode ] = useTriliumOption("contentManagerViewMode");const [ typedFilter, setTypedFilter ] = useState("");@@ -214,7 +214,7 @@ export default function ActiveContent({ note, sectionSwitcher }: ContentManagerS<>{/* In the header's own row rather than the page body, so the controls stay put as thelist scrolls beneath them. */}- <OptionsPageHeader actions={sectionSwitcher} below={+ <OptionsPageHeader below={<div className="active-content-toolbar"><div className="input-group active-content-filter"><FormTextBox@@ -235,7 +235,7 @@ export default function ActiveContent({ note, sectionSwitcher }: ContentManagerS</div><span className="active-content-toolbar-label">{t("content_manager.view_mode")}</span><SegmentedChoice- className="content-manager-view-choice"+ className="active-content-view-choice"options={VIEW_MODES}currentValue={viewMode}onChange={(newValue) => void setViewMode(newValue)}diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/index.css b/apps/client/src/widgets/type_widgets/options/content_manager/index.cssdeleted file mode 100644index 93293349d2..0000000000--- a/apps/client/src/widgets/type_widgets/options/content_manager/index.css+++ /dev/null@@ -1,23 +0,0 @@-/* The header's action slot right-aligns what it holds, which suits page-level actions. This switch- is the page's primary navigation rather than an action, so it leads the row instead: the auto- margin on its trailing side pushes it back to the start. */-.content-manager-section-switcher {- margin-inline-end: auto;-}--/* Full width: the split resolves the cap for tabs, the header inner for the settings dialog. */-.note-split.options:has(.content-manager-section-switcher),-.note-detail-content-widget-content:has(.content-manager-section-switcher) {- --options-card-max-width: 100%;-}--/* One scrolling list rather than a stack of cards, so it needs no space after it. */-.note-detail-content-widget-content.options:has(.content-manager-section-switcher) > *:not(.options-page-header) {- margin-bottom: 0;-}--/* Each section's own view choice reads as secondary to the section switch above it. Set on the- buttons, which carry their own font size and so would not inherit one from the group. */-.content-manager-view-choice button {- font-size: 0.85em;-}diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/index.spec.tsx b/apps/client/src/widgets/type_widgets/options/content_manager/index.spec.tsxdeleted file mode 100644index 4c6c87e8c4..0000000000--- a/apps/client/src/widgets/type_widgets/options/content_manager/index.spec.tsx+++ /dev/null@@ -1,51 +0,0 @@-import { render } from "preact";-import { afterEach, describe, expect, it, vi } from "vitest";--// The sections themselves pull in the whole listing/treemap machinery, and this is about which one-// the shell picks — stubs are enough to tell them apart.-vi.mock("./active_content", () => ({- default: () => <div className="active-content-stub" />-}));--vi.mock("./space_usage", () => ({- default: () => <div className="space-usage-stub" />-}));--// Import AFTER the mocks (vi.mock is hoisted, but the component import must resolve the mocked deps).-import type { TypeWidgetProps } from "../../type_widget";-import ContentManagerSettings, { requestContentManagerSection } from "./index";--let container: HTMLDivElement | undefined;--/** Opens the page as navigating to it would, and answers which section it landed on. */-function openPage() {- container = document.createElement("div");- document.body.appendChild(container);- render(<ContentManagerSettings {...({} as TypeWidgetProps)} />, container);-- return container.querySelector(".space-usage-stub") ? "spaceUsage" : "activeContent";-}--afterEach(() => {- if (container) {- render(null, container);- container.remove();- container = undefined;- }-});--describe("Content Manager section choice", () => {- it("opens on Active Content, and on the requested section once asked", () => {- expect(openPage()).toBe("activeContent");-- requestContentManagerSection("spaceUsage");- expect(openPage()).toBe("spaceUsage");- });-- it("forgets the request once taken, so opening the page again starts over", () => {- requestContentManagerSection("spaceUsage");- expect(openPage()).toBe("spaceUsage");-- expect(openPage()).toBe("activeContent");- });-});diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/index.tsx b/apps/client/src/widgets/type_widgets/options/content_manager/index.tsxdeleted file mode 100644index 16550cc0f1..0000000000--- a/apps/client/src/widgets/type_widgets/options/content_manager/index.tsx+++ /dev/null@@ -1,64 +0,0 @@-import "./index.css";--import type { ComponentChildren } from "preact";-import { useState } from "preact/hooks";--import { t } from "../../../../services/i18n";-import SegmentedChoice from "../../../react/SegmentedChoice";-import type { TypeWidgetProps } from "../../type_widget";-import ActiveContent from "./active_content";-import SpaceUsage from "./space_usage";--export type ContentManagerSection = "activeContent" | "spaceUsage";--/** What the shell hands each section: the page's own props plus the switcher between sections. */-export interface ContentManagerSectionProps extends TypeWidgetProps {- /**- * Rendered by the section inside its own header's title row, so the choice stays visible while- * the section's content scrolls beneath it.- */- sectionSwitcher: ComponentChildren;-}--/**- * The Content Manager page: a shell hosting the Active Content listing and the Space Usage tooling,- * switched by a segmented button. Each section owns its header and toolbar — the shell holds nothing- * but the choice, which starts over on Active Content each time the page opens, unless the page was- * opened by a link asking for a particular section.- */-export default function ContentManagerSettings(props: TypeWidgetProps) {- const [ section, setSection ] = useState<ContentManagerSection>(takeRequestedSection);- const sectionSwitcher = (- <div className="content-manager-section-switcher">- <SegmentedChoice options={SECTIONS} currentValue={section} onChange={setSection} />- </div>- );-- return section === "spaceUsage"- ? <SpaceUsage {...props} sectionSwitcher={sectionSwitcher} />- : <ActiveContent {...props} sectionSwitcher={sectionSwitcher} />;-}--const SECTIONS: { value: ContentManagerSection, label: string }[] = [- { value: "activeContent", label: t("content_manager.section_active_content") },- { value: "spaceUsage", label: t("content_manager.section_space_usage") }-];--/** The section a link asked for, until the page renders and takes it. */-let requestedSection: ContentManagerSection | null = null;--/**- * Asks the page to open on a given section, for links pointing at a section rather than at the page- * itself (the "Related actions" entry in Options → Other). The request is taken by the next render- * and forgotten, so opening the page any other way still starts on Active Content.- */-export function requestContentManagerSection(section: ContentManagerSection) {- requestedSection = section;-}--function takeRequestedSection(): ContentManagerSection {- const requested = requestedSection ?? "activeContent";-- requestedSection = null;- return requested;-}diff --git a/apps/client/src/widgets/type_widgets/options/database.spec.tsx b/apps/client/src/widgets/type_widgets/options/database.spec.tsxindex 6e2a8ed95c..a957496978 100644--- a/apps/client/src/widgets/type_widgets/options/database.spec.tsx+++ b/apps/client/src/widgets/type_widgets/options/database.spec.tsx@@ -88,8 +88,11 @@ const server = vi.hoisted(() => ({vi.mock("../../../services/server", () => ({ default: server }));/** Deleting is asked about first; the answer is the test's to give. */-const dialog = vi.hoisted(() => ({ confirm: vi.fn(async () => true) }));-vi.mock("../../../services/dialog", () => ({ default: dialog }));+const dialog = vi.hoisted(() => ({ confirm: vi.fn(async () => true), closeActiveDialog: vi.fn() }));+vi.mock("../../../services/dialog", () => ({ default: dialog, closeActiveDialog: dialog.closeActiveDialog }));++const appContext = vi.hoisted(() => ({ triggerCommand: vi.fn(async () => {}) }));+vi.mock("../../../components/app_context", () => ({ default: appContext }));const toast = vi.hoisted(() => ({showMessage: vi.fn(),@@ -102,19 +105,10 @@ vi.mock("./components/OptionsPageHeader", () => ({ default: () => null }));// Maintenance hands over to the Content Manager, which needs a note context to navigate with. Only// that hook is replaced: the card rows still need the rest of the module, ID generation included.-const noteContext = vi.hoisted(() => ({ setNote: vi.fn(async () => {}) }));-vi.mock("../../react/hooks", async (importOriginal) => ({- ...(await importOriginal<typeof import("../../react/hooks")>()),- useNoteContext: () => ({ noteContext })-}));--const contentManager = vi.hoisted(() => ({ requestContentManagerSection: vi.fn() }));-vi.mock("./content_manager", () => contentManager);-// Opening the real dialog would measure the whole database and draw its charts; what this page// answers for is that it opens one, and what it does with the answer.const cleanup = vi.hoisted(() => ({ showCleanupDialog: vi.fn(async () => 1234 as number | null) }));-vi.mock("./content_manager/space_usage/cleanup_dialog", () => cleanup);+vi.mock("../space_usage/cleanup_dialog", () => cleanup);import DatabaseSettings from "./database";@@ -147,8 +141,8 @@ beforeEach(() => {standalone.enabled = false;BACKUPS = [ { mtime: new Date("2026-01-01T10:00:00Z") }, { mtime: new Date("2026-01-02T10:00:00Z") } ];ANONYMIZED = [ ANONYMIZED_COPY ];- noteContext.setNote.mockClear();- contentManager.requestContentManagerSection.mockClear();+ dialog.closeActiveDialog.mockClear();+ appContext.triggerCommand.mockClear();cleanup.showCleanupDialog.mockReset().mockResolvedValue(1234);server.get.mockClear();server.post.mockClear();@@ -256,17 +250,17 @@ describe("what the database is", () => {});describe("database maintenance", () => {- it("hands the two tools over to the Content Manager rather than repeating them", async () => {+ it("hands the two tools over to Space Usage rather than repeating them", async () => {renderPage();await settle();button("analyze-space-usage-button")?.click();await settle();- // The Content Manager opens on Active Content unless asked otherwise, and the page is- // reached through this page's own note context — Options can itself be a dialog.- expect(contentManager.requestContentManagerSection).toHaveBeenCalledWith("spaceUsage");- expect(noteContext.setNote).toHaveBeenCalledWith("_optionsContentManager", { keepActiveDialog: true });+ // Space Usage stands on its own, so it opens in a tab; Options can itself be a dialog, and+ // one left standing would cover the tab it just opened.+ expect(appContext.triggerCommand).toHaveBeenCalledWith("showSpaceUsage");+ expect(dialog.closeActiveDialog).toHaveBeenCalled();button("cleanup-button")?.click();await settle();diff --git a/apps/client/src/widgets/type_widgets/options/database.tsx b/apps/client/src/widgets/type_widgets/options/database.tsxindex dcc67e2f1f..e146146a7a 100644--- a/apps/client/src/widgets/type_widgets/options/database.tsx+++ b/apps/client/src/widgets/type_widgets/options/database.tsx@@ -12,9 +12,10 @@ import { useCallback, useEffect, useState } from "preact/hooks";import type React from "react";import { Trans } from "react-i18next";+import appContext from "../../../components/app_context";import { isBackupDownloadSupported } from "../../../services/backup_download";import { summarizeBackups } from "../../../services/database_files";-import dialogService from "../../../services/dialog";+import dialogService, { closeActiveDialog } from "../../../services/dialog";import { t } from "../../../services/i18n";import server from "../../../services/server";import {@@ -30,13 +31,11 @@ import Admonition from "../../react/Admonition";import Button from "../../react/Button";import { Card, OptionCardSection } from "../../react/Card";import DirectoryLink, { FileLink } from "../../react/DirectoryLink";-import { useNoteContext } from "../../react/hooks";import { useFetch } from "../../react/use_fetch";+import { showCleanupDialog } from "../space_usage/cleanup_dialog";import DatabaseFileList from "./components/DatabaseFileList";import OptionsPageHeader from "./components/OptionsPageHeader";import RelatedSettings from "./components/RelatedSettings";-import { requestContentManagerSection } from "./content_manager";-import { showCleanupDialog } from "./content_manager/space_usage/cleanup_dialog";/*** What can be done to the knowledge base as a whole, rather than to anything inside it: keeping the@@ -177,12 +176,10 @@ const BACKUP_PAGE_LINK = "#root/_hidden/_options/_optionsBackup";* Keeping the database in good order: finding out what it is spent on, taking back what is no longer* needed, and the checks and repairs that act on the file itself rather than on what is kept in it.*- * The first two hand over to the tools that do the work — the Content Manager's space usage section- * and its cleanup dialog — which is why they are named here rather than duplicated.+ * The first two hand over to the tools that do the work, the Space Usage page and the cleanup+ * dialog, which is why they are named here rather than duplicated.*/function MaintenanceOptions({ onDatabaseChanged }: { onDatabaseChanged: () => void }) {- const { noteContext } = useNoteContext();-return (<Card heading={t("database.maintenance")}><OptionCardSection@@ -214,12 +211,10 @@ function MaintenanceOptions({ onDatabaseChanged }: { onDatabaseChanged: () => votext={t("database.analyze_space_usage_button")}size="micro"onClick={() => {- // The Content Manager opens on Active Content unless asked otherwise,- // and navigating by hand rather than by link is what lets us ask first.- requestContentManagerSection("spaceUsage");- // Kept in whichever context this page is shown in — the settings dialog- // holds a note context of its own, outside the tab manager.- void noteContext?.setNote("_optionsContentManager", { keepActiveDialog: true });+ // A tab of its own rather than this page's context: the tool outlives the+ // settings that sent the user to it, so the dialog stands down first.+ closeActiveDialog();+ void appContext.triggerCommand("showSpaceUsage");}}/></OptionCardSection>diff --git a/apps/client/src/widgets/type_widgets/options/other.tsx b/apps/client/src/widgets/type_widgets/options/other.tsxindex 4b4657ea08..00f7d78d22 100644--- a/apps/client/src/widgets/type_widgets/options/other.tsx+++ b/apps/client/src/widgets/type_widgets/options/other.tsx@@ -1,316 +1,319 @@-import "./other.css";--import { SANITIZER_DEFAULT_ALLOWED_TAGS } from "@triliumnext/commons";--import { t } from "../../../services/i18n";-import search from "../../../services/search";-import server from "../../../services/server";-import toast from "../../../services/toast";-import Button from "../../react/Button";-import { Card, CardSection, OptionCardSection } from "../../react/Card";-import { FormTextBoxWithUnit } from "../../react/FormTextBox";-import FormToggle from "../../react/FormToggle";-import { useNoteContext, useTriliumOption, useTriliumOptionBool, useTriliumOptionJson } from "../../react/hooks";-import OptionsPageHeader from "./components/OptionsPageHeader";-import RelatedSettings from "./components/RelatedSettings";-import TimeSelector from "./components/TimeSelector";-import { requestContentManagerSection } from "./content_manager";--export default function OtherSettings() {- return (- <>- <OptionsPageHeader />- <SearchSettings />- <NoteErasureTimeout />- <AttachmentErasureTimeout />- <RevisionSettings />- <HtmlImportTags />- <ShareSettings />- <NetworkSettings />- <RelatedActions />- </>- );-}--function RelatedActions() {- const { noteContext } = useNoteContext();-- return (- <RelatedSettings- title={t("settings.related_actions")}- items={[- {- title: t("settings.related_space_usage"),- description: t("settings.related_space_usage_description"),- targetPage: "_optionsContentManager",- onClick: (e) => {- // The Content Manager opens on Active Content unless asked otherwise, and- // navigating here rather than by the href is what lets us ask first.- e.preventDefault();- e.stopPropagation();- requestContentManagerSection("spaceUsage");- // Kept in whichever context this page is shown in — the settings dialog- // holds a note context of its own, outside the tab manager.- void noteContext?.setNote("_optionsContentManager", { keepActiveDialog: true });- }- }- ]}- />- );-}--function SearchSettings() {- const [ fuzzyEnabled, setFuzzyEnabled ] = useTriliumOptionBool("searchEnableFuzzyMatching");- const [ autocompleteFuzzy, setAutocompleteFuzzy ] = useTriliumOptionBool("searchAutocompleteFuzzy");-- return (- <Card heading={t("search.title")}>- <OptionCardSection- name="search-fuzzy-matching"- label={t("search.fuzzy_matching_label")}- description={t("search.fuzzy_matching_description")}- >- <FormToggle currentValue={fuzzyEnabled} onChange={setFuzzyEnabled} />- </OptionCardSection>-- <OptionCardSection- name="search-autocomplete-fuzzy"- label={t("search.autocomplete_fuzzy_label")}- description={t("search.autocomplete_fuzzy_description")}- >- <FormToggle currentValue={autocompleteFuzzy} onChange={setAutocompleteFuzzy} />- </OptionCardSection>- </Card>- );-}--function NoteErasureTimeout() {- return (- <Card- heading={t("note_erasure_timeout.note_erasure_timeout_title")}- description={t("note_erasure_timeout.description")}- >- <OptionCardSection- name="erase-entities-after"- label={t("note_erasure_timeout.erase_notes_after")}- description={t("note_erasure_timeout.erase_notes_after_description")}- >- <TimeSelector- name="erase-entities-after"- optionValueId="eraseEntitiesAfterTimeInSeconds" optionTimeScaleId="eraseEntitiesAfterTimeScale"- />- </OptionCardSection>-- <OptionCardSection- label={t("note_erasure_timeout.erase_deleted_notes_now")}- description={t("note_erasure_timeout.manual_erasing_description")}- >- <Button- name="erase-deleted-notes-now-button"- text={t("note_erasure_timeout.erase_now_button")}- size="micro"- onClick={() => {- server.post("notes/erase-deleted-notes-now").then(() => {- toast.showMessage(t("note_erasure_timeout.deleted_notes_erased"));- });- }}- />- </OptionCardSection>- </Card>- );-}--function AttachmentErasureTimeout() {- return (- <Card- heading={t("attachment_erasure_timeout.attachment_erasure_timeout")}- description={t("attachment_erasure_timeout.description")}- >- <OptionCardSection- name="erase-unused-attachments-after"- label={t("attachment_erasure_timeout.erase_attachments_after")}- description={t("attachment_erasure_timeout.erase_attachments_after_description")}- >- <TimeSelector- name="erase-unused-attachments-after"- optionValueId="eraseUnusedAttachmentsAfterSeconds" optionTimeScaleId="eraseUnusedAttachmentsAfterTimeScale"- />- </OptionCardSection>-- <OptionCardSection- label={t("attachment_erasure_timeout.erase_unused_attachments_now")}- description={t("attachment_erasure_timeout.manual_erasing_description")}- >- <Button- name="erase-unused-attachments-now-button"- text={t("attachment_erasure_timeout.erase_now_button")}- size="micro"- onClick={() => {- server.post("notes/erase-unused-attachments-now").then(() => {- toast.showMessage(t("attachment_erasure_timeout.unused_attachments_erased"));- });- }}- />- </OptionCardSection>- </Card>- );-}--function RevisionSettings() {- const [ revisionSnapshotNumberLimit, setRevisionSnapshotNumberLimit ] = useTriliumOption("revisionSnapshotNumberLimit");- const [ revisionIgnoreNamedSnapshots, setRevisionIgnoreNamedSnapshots ] = useTriliumOptionBool("revisionIgnoreNamedSnapshots");-- return (- <Card heading={t("revisions_snapshot.title")}>- <OptionCardSection- name="revision-snapshot-time-interval"- label={t("revisions_snapshot_interval.snapshot_time_interval_label")}- description={t("revisions_snapshot_interval.note_revisions_snapshot_description_short")}- >- <TimeSelector- name="revision-snapshot-time-interval"- optionValueId="revisionSnapshotTimeInterval" optionTimeScaleId="revisionSnapshotTimeIntervalTimeScale"- minimumSeconds={10}- />- </OptionCardSection>-- <OptionCardSection- name="revision-snapshot-number-limit"- label={t("revisions_snapshot_limit.snapshot_number_limit_label")}- description={t("revisions_snapshot_limit.note_revisions_snapshot_limit_description_short")}- >- <FormTextBoxWithUnit- type="number" min={-1}- currentValue={revisionSnapshotNumberLimit}- unit={t("revisions_snapshot_limit.snapshot_number_limit_unit")}- onBlur={value => {- const newValue = parseInt(value, 10);- if (!isNaN(newValue) && newValue >= -1) {- setRevisionSnapshotNumberLimit(newValue);- }- }}- />- </OptionCardSection>-- <OptionCardSection- name="revision-keep-named-snapshots"- label={t("revisions_snapshot_limit.keep_named_revisions_label")}- description={t("revisions_snapshot_limit.keep_named_revisions_description")}- >- <FormToggle currentValue={revisionIgnoreNamedSnapshots} onChange={setRevisionIgnoreNamedSnapshots} />- </OptionCardSection>-- <OptionCardSection- label={t("revisions_snapshot_limit.erase_excess_revision_snapshots")}- description={t("revisions_snapshot_limit.erase_excess_revision_snapshots_description")}- >- <Button- name="erase-excess-revisions-button"- text={t("revisions_snapshot_limit.erase_now_button")}- size="micro"- // A negative limit keeps every snapshot, so nothing is excess and the erasure- // would report success having dropped nothing. Offered again as soon as a- // limit is set.- disabled={parseInt(revisionSnapshotNumberLimit, 10) < 0}- onClick={async () => {- await server.post("revisions/erase-all-excess-revisions");- toast.showMessage(t("revisions_snapshot_limit.erase_excess_revision_snapshots_prompt"));- }}- />- </OptionCardSection>- </Card>- );-}--function HtmlImportTags() {- const [ allowedHtmlTags, setAllowedHtmlTags ] = useTriliumOptionJson<readonly string[]>("allowedHtmlTags");- const parsedValue = allowedHtmlTags.join(" ");-- return (- <Card- heading={t("import.html_import_tags.title")}- description={t("import.html_import_tags.description")}- >- <CardSection className="other-html-tags">- <textarea- className="allowed-html-tags"- spellcheck={false}- placeholder={t("import.html_import_tags.placeholder")}- value={parsedValue}- onBlur={e => {- const tags = e.currentTarget.value- .split(/[\n,\s]+/) // Split on newlines, commas, or spaces- .map((tag) => tag.trim())- .filter((tag) => tag.length > 0);- setAllowedHtmlTags(tags);- }}- />-- <Button- name="reset-allowed-html-tags-button"- text={t("import.html_import_tags.reset_button")}- size="micro"- onClick={() => setAllowedHtmlTags(SANITIZER_DEFAULT_ALLOWED_TAGS)}- />- </CardSection>- </Card>- );-}--function ShareSettings() {- const [ redirectBareDomain, setRedirectBareDomain ] = useTriliumOptionBool("redirectBareDomain");- const [ showLogInShareTheme, setShowLogInShareTheme ] = useTriliumOptionBool("showLoginInShareTheme");-- return (- <Card heading={t("share.title")}>- <OptionCardSection- name="redirect-bare-domain"- label={t("share.redirect_bare_domain")}- description={t("share.redirect_bare_domain_description")}- >- <FormToggle- currentValue={redirectBareDomain}- onChange={async value => {- if (value) {- const shareRootNotes = await search.searchForNotes("#shareRoot");- const sharedShareRootNote = shareRootNotes.find((note) => note.isShared());-- if (sharedShareRootNote) {- toast.showMessage(t("share.share_root_found", { noteTitle: sharedShareRootNote.title }));- } else if (shareRootNotes.length > 0) {- toast.showError(t("share.share_root_not_shared", { noteTitle: shareRootNotes[0].title }));- } else {- toast.showError(t("share.share_root_not_found"));- }- }- setRedirectBareDomain(value);- }}- />- </OptionCardSection>-- <OptionCardSection- name="show-login-in-share-theme"- label={t("share.show_login_link")}- description={t("share.show_login_link_description")}- >- <FormToggle currentValue={showLogInShareTheme} onChange={setShowLogInShareTheme} />- </OptionCardSection>- </Card>- );-}--function NetworkSettings() {- const [ checkForUpdates, setCheckForUpdates ] = useTriliumOptionBool("checkForUpdates");-- return (- <Card heading={t("network_connections.network_connections_title")}>- <OptionCardSection- name="check-for-updates"- label={t("network_connections.check_for_updates")}- description={t("network_connections.check_for_updates_description")}- >- <FormToggle currentValue={checkForUpdates} onChange={setCheckForUpdates} />- </OptionCardSection>- </Card>- );-}+import "./other.css";++import { SANITIZER_DEFAULT_ALLOWED_TAGS } from "@triliumnext/commons";++import appContext from "../../../components/app_context";+import { closeActiveDialog } from "../../../services/dialog";+import { t } from "../../../services/i18n";+import search from "../../../services/search";+import server from "../../../services/server";+import toast from "../../../services/toast";+import Button from "../../react/Button";+import { Card, CardSection, OptionCardSection } from "../../react/Card";+import { FormTextBoxWithUnit } from "../../react/FormTextBox";+import FormToggle from "../../react/FormToggle";+import { useTriliumOption, useTriliumOptionBool, useTriliumOptionJson } from "../../react/hooks";+import OptionsPageHeader from "./components/OptionsPageHeader";+import RelatedSettings from "./components/RelatedSettings";+import TimeSelector from "./components/TimeSelector";++export default function OtherSettings() {+ return (+ <>+ <OptionsPageHeader />+ <SearchSettings />+ <NoteErasureTimeout />+ <AttachmentErasureTimeout />+ <RevisionSettings />+ <HtmlImportTags />+ <ShareSettings />+ <NetworkSettings />+ <RelatedActions />+ </>+ );+}++function RelatedActions() {+ return (+ <RelatedSettings+ title={t("settings.related_actions")}+ items={[+ {+ title: t("settings.related_space_usage"),+ description: t("settings.related_space_usage_description"),+ targetNoteId: "_spaceUsage",+ onClick: (e) => {+ // Opened as the tool it is, in a tab of its own, rather than followed as a+ // link into the hidden subtree; stopping the event keeps the global link+ // handler (link.ts goToLink) from navigating by the href instead.+ e.preventDefault();+ e.stopPropagation();+ // The tool outlives the settings that sent the user to it.+ closeActiveDialog();+ void appContext.triggerCommand("showSpaceUsage");+ }+ }+ ]}+ />+ );+}++function SearchSettings() {+ const [ fuzzyEnabled, setFuzzyEnabled ] = useTriliumOptionBool("searchEnableFuzzyMatching");+ const [ autocompleteFuzzy, setAutocompleteFuzzy ] = useTriliumOptionBool("searchAutocompleteFuzzy");++ return (+ <Card heading={t("search.title")}>+ <OptionCardSection+ name="search-fuzzy-matching"+ label={t("search.fuzzy_matching_label")}+ description={t("search.fuzzy_matching_description")}+ >+ <FormToggle currentValue={fuzzyEnabled} onChange={setFuzzyEnabled} />+ </OptionCardSection>++ <OptionCardSection+ name="search-autocomplete-fuzzy"+ label={t("search.autocomplete_fuzzy_label")}+ description={t("search.autocomplete_fuzzy_description")}+ >+ <FormToggle currentValue={autocompleteFuzzy} onChange={setAutocompleteFuzzy} />+ </OptionCardSection>+ </Card>+ );+}++function NoteErasureTimeout() {+ return (+ <Card+ heading={t("note_erasure_timeout.note_erasure_timeout_title")}+ description={t("note_erasure_timeout.description")}+ >+ <OptionCardSection++ name="erase-entities-after"+ label={t("note_erasure_timeout.erase_notes_after")}+ description={t("note_erasure_timeout.erase_notes_after_description")}+ >+ <TimeSelector+ name="erase-entities-after"+ optionValueId="eraseEntitiesAfterTimeInSeconds" optionTimeScaleId="eraseEntitiesAfterTimeScale"+ />+ </OptionCardSection>++ <OptionCardSection+ label={t("note_erasure_timeout.erase_deleted_notes_now")}+ description={t("note_erasure_timeout.manual_erasing_description")}+ >+ <Button+ name="erase-deleted-notes-now-button"+ text={t("note_erasure_timeout.erase_now_button")}+ size="micro"+ onClick={() => {+ server.post("notes/erase-deleted-notes-now").then(() => {+ toast.showMessage(t("note_erasure_timeout.deleted_notes_erased"));+ });+ }}+ />+ </OptionCardSection>+ </Card>+ );+}++function AttachmentErasureTimeout() {+ return (+ <Card+ heading={t("attachment_erasure_timeout.attachment_erasure_timeout")}+ description={t("attachment_erasure_timeout.description")}+ >+ <OptionCardSection++ name="erase-unused-attachments-after"+ label={t("attachment_erasure_timeout.erase_attachments_after")}+ description={t("attachment_erasure_timeout.erase_attachments_after_description")}+ >+ <TimeSelector+ name="erase-unused-attachments-after"+ optionValueId="eraseUnusedAttachmentsAfterSeconds" optionTimeScaleId="eraseUnusedAttachmentsAfterTimeScale"+ />+ </OptionCardSection>++ <OptionCardSection+ label={t("attachment_erasure_timeout.erase_unused_attachments_now")}+ description={t("attachment_erasure_timeout.manual_erasing_description")}+ >+ <Button+ name="erase-unused-attachments-now-button"+ text={t("attachment_erasure_timeout.erase_now_button")}+ size="micro"+ onClick={() => {+ server.post("notes/erase-unused-attachments-now").then(() => {+ toast.showMessage(t("attachment_erasure_timeout.unused_attachments_erased"));+ });+ }}+ />+ </OptionCardSection>+ </Card>+ );+}++function RevisionSettings() {+ const [ revisionSnapshotNumberLimit, setRevisionSnapshotNumberLimit ] = useTriliumOption("revisionSnapshotNumberLimit");+ const [ revisionIgnoreNamedSnapshots, setRevisionIgnoreNamedSnapshots ] = useTriliumOptionBool("revisionIgnoreNamedSnapshots");++ return (+ <Card heading={t("revisions_snapshot.title")}>+ <OptionCardSection++ name="revision-snapshot-time-interval"+ label={t("revisions_snapshot_interval.snapshot_time_interval_label")}+ description={t("revisions_snapshot_interval.note_revisions_snapshot_description_short")}+ >+ <TimeSelector+ name="revision-snapshot-time-interval"+ optionValueId="revisionSnapshotTimeInterval" optionTimeScaleId="revisionSnapshotTimeIntervalTimeScale"+ minimumSeconds={10}+ />+ </OptionCardSection>++ <OptionCardSection++ name="revision-snapshot-number-limit"+ label={t("revisions_snapshot_limit.snapshot_number_limit_label")}+ description={t("revisions_snapshot_limit.note_revisions_snapshot_limit_description_short")}+ >+ <FormTextBoxWithUnit+ type="number" min={-1}+ currentValue={revisionSnapshotNumberLimit}+ unit={t("revisions_snapshot_limit.snapshot_number_limit_unit")}+ onBlur={value => {+ const newValue = parseInt(value, 10);+ if (!isNaN(newValue) && newValue >= -1) {+ setRevisionSnapshotNumberLimit(newValue);+ }+ }}+ />+ </OptionCardSection>++ <OptionCardSection+ name="revision-keep-named-snapshots"+ label={t("revisions_snapshot_limit.keep_named_revisions_label")}+ description={t("revisions_snapshot_limit.keep_named_revisions_description")}+ >+ <FormToggle currentValue={revisionIgnoreNamedSnapshots} onChange={setRevisionIgnoreNamedSnapshots} />+ </OptionCardSection>++ <OptionCardSection+ label={t("revisions_snapshot_limit.erase_excess_revision_snapshots")}+ description={t("revisions_snapshot_limit.erase_excess_revision_snapshots_description")}+ >+ <Button+ name="erase-excess-revisions-button"+ text={t("revisions_snapshot_limit.erase_now_button")}+ size="micro"+ // A negative limit keeps every snapshot, so nothing is excess and the erasure+ // would report success having dropped nothing. Offered again as soon as a+ // limit is set.+ disabled={parseInt(revisionSnapshotNumberLimit, 10) < 0}+ onClick={async () => {+ await server.post("revisions/erase-all-excess-revisions");+ toast.showMessage(t("revisions_snapshot_limit.erase_excess_revision_snapshots_prompt"));+ }}+ />+ </OptionCardSection>+ </Card>+ );+}++function HtmlImportTags() {+ const [ allowedHtmlTags, setAllowedHtmlTags ] = useTriliumOptionJson<readonly string[]>("allowedHtmlTags");+ const parsedValue = allowedHtmlTags.join(" ");++ return (+ <Card+ heading={t("import.html_import_tags.title")}+ description={t("import.html_import_tags.description")}+ >+ <CardSection className="other-html-tags">+ <textarea+ className="allowed-html-tags"+ spellcheck={false}+ placeholder={t("import.html_import_tags.placeholder")}+ value={parsedValue}+ onBlur={e => {+ const tags = e.currentTarget.value+ .split(/[\n,\s]+/) // Split on newlines, commas, or spaces+ .map((tag) => tag.trim())+ .filter((tag) => tag.length > 0);+ setAllowedHtmlTags(tags);+ }}+ />++ <Button+ name="reset-allowed-html-tags-button"+ text={t("import.html_import_tags.reset_button")}+ size="micro"+ onClick={() => setAllowedHtmlTags(SANITIZER_DEFAULT_ALLOWED_TAGS)}+ />+ </CardSection>+ </Card>+ );+}++function ShareSettings() {+ const [ redirectBareDomain, setRedirectBareDomain ] = useTriliumOptionBool("redirectBareDomain");+ const [ showLogInShareTheme, setShowLogInShareTheme ] = useTriliumOptionBool("showLoginInShareTheme");++ return (+ <Card heading={t("share.title")}>+ <OptionCardSection+ name="redirect-bare-domain"+ label={t("share.redirect_bare_domain")}+ description={t("share.redirect_bare_domain_description")}+ >+ <FormToggle+ currentValue={redirectBareDomain}+ onChange={async value => {+ if (value) {+ const shareRootNotes = await search.searchForNotes("#shareRoot");+ const sharedShareRootNote = shareRootNotes.find((note) => note.isShared());++ if (sharedShareRootNote) {+ toast.showMessage(t("share.share_root_found", { noteTitle: sharedShareRootNote.title }));+ } else if (shareRootNotes.length > 0) {+ toast.showError(t("share.share_root_not_shared", { noteTitle: shareRootNotes[0].title }));+ } else {+ toast.showError(t("share.share_root_not_found"));+ }+ }+ setRedirectBareDomain(value);+ }}+ />+ </OptionCardSection>++ <OptionCardSection+ name="show-login-in-share-theme"+ label={t("share.show_login_link")}+ description={t("share.show_login_link_description")}+ >+ <FormToggle currentValue={showLogInShareTheme} onChange={setShowLogInShareTheme} />+ </OptionCardSection>+ </Card>+ );+}++function NetworkSettings() {+ const [ checkForUpdates, setCheckForUpdates ] = useTriliumOptionBool("checkForUpdates");++ return (+ <Card heading={t("network_connections.network_connections_title")}>+ <OptionCardSection+ name="check-for-updates"+ label={t("network_connections.check_for_updates")}+ description={t("network_connections.check_for_updates_description")}+ >+ <FormToggle currentValue={checkForUpdates} onChange={setCheckForUpdates} />+ </OptionCardSection>+ </Card>+ );+}diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/browse.css b/apps/client/src/widgets/type_widgets/space_usage/browse.csssimilarity index 100%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/browse.cssrename to apps/client/src/widgets/type_widgets/space_usage/browse.cssdiff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/browse.spec.tsx b/apps/client/src/widgets/type_widgets/space_usage/browse.spec.tsxsimilarity index 97%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/browse.spec.tsxrename to apps/client/src/widgets/type_widgets/space_usage/browse.spec.tsxindex 5ebf6c1d0e..78022de281 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/browse.spec.tsx+++ b/apps/client/src/widgets/type_widgets/space_usage/browse.spec.tsx@@ -3,7 +3,7 @@ import { type ComponentChildren, render } from "preact";import { useState } from "preact/hooks";import { afterEach, describe, expect, it, vi } from "vitest";-import type { DonutRing } from "../../../../react/charts/DonutChart";+import type { DonutRing } from "../../react/charts/DonutChart";import type { UsageSegmentData } from "./donut_segments";interface CapturedDonutProps {@@ -30,7 +30,7 @@ vi.mock("./context_menu", () => ({openSpaceUsageContextMenu: (...args: unknown[]) => mocks.openContextMenu(...args)}));-vi.mock("../../../../react/use_fetch", () => ({+vi.mock("../../react/use_fetch", () => ({useFetch: (url: string) => {mocks.fetchedUrls.push(url);return { data: mocks.usage, failed: mocks.failed, loading: mocks.loading };@@ -47,13 +47,13 @@ vi.mock("./note_usage_donut", () => ({segmentTooltip: (kind: string, title: string, size: number) => `${kind}:${title}:${size}`}));-vi.mock("../../../../react/ActionButton", () => ({+vi.mock("../../react/ActionButton", () => ({default: ({ className, disabled, onClick }: { className?: string, disabled?: boolean, onClick?: () => void }) => (<button type="button" className={`back-stub ${className ?? ""}`} disabled={disabled} onClick={onClick} />)}));-vi.mock("../../../../../services/froca", () => ({+vi.mock("../../../services/froca", () => ({default: {getNotes: async (noteIds: string[]) => noteIds.map((noteId) => ({ noteId, title: `title:${noteId}` }))}diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/browse.tsx b/apps/client/src/widgets/type_widgets/space_usage/browse.tsxsimilarity index 95%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/browse.tsxrename to apps/client/src/widgets/type_widgets/space_usage/browse.tsxindex 780aafdc75..84846f687d 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/browse.tsx+++ b/apps/client/src/widgets/type_widgets/space_usage/browse.tsx@@ -4,12 +4,12 @@ import type { SpaceUsageNoteResponse } from "@triliumnext/commons";import { Fragment } from "preact";import { useCallback, useEffect, useMemo, useState } from "preact/hooks";-import froca from "../../../../../services/froca";-import { t } from "../../../../../services/i18n";-import { formatSize } from "../../../../../services/utils";-import ActionButton from "../../../../react/ActionButton";-import type { DonutRing } from "../../../../react/charts/DonutChart";-import { useFetch } from "../../../../react/use_fetch";+import froca from "../../../services/froca";+import { t } from "../../../services/i18n";+import { formatSize } from "../../../services/utils";+import ActionButton from "../../react/ActionButton";+import type { DonutRing } from "../../react/charts/DonutChart";+import { useFetch } from "../../react/use_fetch";import { type ContentChangedHandler, openSpaceUsageContextMenu } from "./context_menu";import { buildChildrenSegments, type UsageSegmentData } from "./donut_segments";import { deletedEntitiesLabel } from "./labels";diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.css b/apps/client/src/widgets/type_widgets/space_usage/cleanup_dialog.csssimilarity index 100%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.cssrename to apps/client/src/widgets/type_widgets/space_usage/cleanup_dialog.cssdiff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.spec.tsx b/apps/client/src/widgets/type_widgets/space_usage/cleanup_dialog.spec.tsxsimilarity index 97%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.spec.tsxrename to apps/client/src/widgets/type_widgets/space_usage/cleanup_dialog.spec.tsxindex 936ecfb9f9..d8b5068d92 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.spec.tsx+++ b/apps/client/src/widgets/type_widgets/space_usage/cleanup_dialog.spec.tsx@@ -3,8 +3,8 @@ import { useEffect } from "preact/hooks";import { act } from "preact/test-utils";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";-import { t } from "../../../../../services/i18n";-import { formatSize } from "../../../../../services/utils";+import { t } from "../../../services/i18n";+import { formatSize } from "../../../services/utils";// Hoisted with the mocks that read them: a `vi.mock` factory runs before any plain module constant.const {@@ -62,7 +62,7 @@ const mocks = vi.hoisted(() => ({closePersistent: vi.fn()}));-vi.mock("../../../../../services/options", () => ({+vi.mock("../../../services/options", () => ({default: {get: () => mocks.storedOption,getInt: mocks.getInt,@@ -71,7 +71,7 @@ vi.mock("../../../../../services/options", () => ({}}));-vi.mock("../../../../../services/server", () => {+vi.mock("../../../services/server", () => {// The aggressive reading and the trimmed one differ only in the retention they were asked for,// which is what the URL carries. Everything else the client loads on the way past is answered// emptily rather than with a usage payload it would choke on.@@ -116,7 +116,7 @@ vi.mock("../../../../../services/server", () => {// i18next is never initialised for these tests, and answers `undefined` to everything until it is —// which would make every comparison against a t() call below true of any two messages at all. Keys// and their interpolations stand in for the sentences, so that a wrong one reads as wrong.-vi.mock("../../../../../services/i18n", () => ({+vi.mock("../../../services/i18n", () => ({t: (key: string, params?: Record<string, unknown>) => (params ? `${key} ${JSON.stringify(params)}` : key),translationsInitializedPromise: Promise.resolve(),initLocale: async () => {},@@ -127,7 +127,7 @@ vi.mock("../../../../../services/i18n", () => ({// The compression step is followed over the websocket rather than answered by the request, so the// socket is where its counting has to be driven from.-vi.mock("../../../../../services/ws", () => {+vi.mock("../../../services/ws", () => {const subscribeToMessages = (listener: (message: unknown) => void) => void mocks.listeners.push(listener);const unsubscribeToMessage = (listener: (message: unknown) => void) =>void mocks.listeners.splice(mocks.listeners.indexOf(listener), 1);@@ -137,8 +137,8 @@ vi.mock("../../../../../services/ws", () => {return { subscribeToMessages, unsubscribeToMessage, default: { subscribeToMessages, unsubscribeToMessage } };});-vi.mock("../../../../../services/dialog", () => ({ default: { confirm: mocks.confirm } }));-vi.mock("../../../../../services/toast", () => ({+vi.mock("../../../services/dialog", () => ({ default: { confirm: mocks.confirm } }));+vi.mock("../../../services/toast", () => ({default: {showMessage: mocks.showMessage,showPersistent: mocks.showPersistent,@@ -148,7 +148,7 @@ vi.mock("../../../../../services/toast", () => ({// The real modal reports its close once the animation is done; the stub reports it as soon as it is// told to hide, which is the signal the dialog's own flow keys off.-vi.mock("../../../../react/Modal", () => ({+vi.mock("../../react/Modal", () => ({default: function ModalStub({ children, footer, show, onHidden }: {children: ComponentChildren, footer: ComponentChildren, show: boolean, onHidden: () => void}) {diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.tsx b/apps/client/src/widgets/type_widgets/space_usage/cleanup_dialog.tsxsimilarity index 95%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.tsxrename to apps/client/src/widgets/type_widgets/space_usage/cleanup_dialog.tsxindex d61999ffe2..c3cd636d11 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.tsx+++ b/apps/client/src/widgets/type_widgets/space_usage/cleanup_dialog.tsx@@ -5,26 +5,26 @@ import clsx from "clsx";import { render } from "preact";import { useEffect, useMemo, useRef, useState } from "preact/hooks";-import dialogService from "../../../../../services/dialog";-import { t } from "../../../../../services/i18n";-import toast from "../../../../../services/toast";-import { formatSize, isStandalone } from "../../../../../services/utils";-import type { ImageCompressionToolOptions } from "../../../../dialogs/image_compression/image_compression_options";+import dialogService from "../../../services/dialog";+import { t } from "../../../services/i18n";+import toast from "../../../services/toast";+import { formatSize, isStandalone } from "../../../services/utils";+import type { ImageCompressionToolOptions } from "../../dialogs/image_compression/image_compression_options";import {JpegHandlingSection,PngHandlingSection,ResizeImageSection-} from "../../../../dialogs/image_compression/image_compression_sections";-import { ExtendedAdmonition } from "../../../../react/Admonition";-import Button from "../../../../react/Button";-import { Card, CardSection } from "../../../../react/Card";-import DonutChart, { type DonutRing } from "../../../../react/charts/DonutChart";-import ContextualHelp from "../../../../react/ContextualHelp";-import FormTextBox from "../../../../react/FormTextBox";-import FormToggle from "../../../../react/FormToggle";-import { useDebouncedValue, useTriliumOptionJson } from "../../../../react/hooks";-import Modal from "../../../../react/Modal";-import { useFetch } from "../../../../react/use_fetch";+} from "../../dialogs/image_compression/image_compression_sections";+import { ExtendedAdmonition } from "../../react/Admonition";+import Button from "../../react/Button";+import { Card, CardSection } from "../../react/Card";+import DonutChart, { type DonutRing } from "../../react/charts/DonutChart";+import ContextualHelp from "../../react/ContextualHelp";+import FormTextBox from "../../react/FormTextBox";+import FormToggle from "../../react/FormToggle";+import { useDebouncedValue, useTriliumOptionJson } from "../../react/hooks";+import Modal from "../../react/Modal";+import { useFetch } from "../../react/use_fetch";import {CLEANUP_ITEMS,type CleanupPhase,diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_operation.spec.ts b/apps/client/src/widgets/type_widgets/space_usage/cleanup_operation.spec.tssimilarity index 98%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_operation.spec.tsrename to apps/client/src/widgets/type_widgets/space_usage/cleanup_operation.spec.tsindex 96eece0d1b..4a43ca1d94 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_operation.spec.ts+++ b/apps/client/src/widgets/type_widgets/space_usage/cleanup_operation.spec.ts@@ -28,11 +28,11 @@ const mocks = vi.hoisted(() => ({get: vi.fn()}));-vi.mock("../../../../../services/options", () => ({ default: { getInt: mocks.getInt, is: mocks.is } }));+vi.mock("../../../services/options", () => ({ default: { getInt: mocks.getInt, is: mocks.is } }));// The run reaches for the long-timeout variants throughout: every request it makes is a// whole-database operation. The timeout itself is dropped here, leaving (url, data) as the calls// under test.-vi.mock("../../../../../services/server", () => ({+vi.mock("../../../services/server", () => ({default: {// The whole-database operations reach for the long-timeout variants; recording the outcome// is an ordinary write and keeps the default. Both funnel here, so the assertions below read@@ -49,13 +49,13 @@ vi.mock("../../../../../services/server", () => ({// The compression step is followed over the websocket rather than answered by the request, so the// socket is where its counting has to be driven from.-vi.mock("../../../../../services/ws", () => ({+vi.mock("../../../services/ws", () => ({subscribeToMessages: (listener: (message: unknown) => void) => void mocks.listeners.push(listener),unsubscribeToMessage: (listener: (message: unknown) => void) =>void mocks.listeners.splice(mocks.listeners.indexOf(listener), 1)}));-import type { ImageCompressionToolOptions } from "../../../../dialogs/image_compression/image_compression_options";+import type { ImageCompressionToolOptions } from "../../dialogs/image_compression/image_compression_options";import {type CleanupPhase,type CleanupProgress,diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_operation.ts b/apps/client/src/widgets/type_widgets/space_usage/cleanup_operation.tssimilarity index 98%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_operation.tsrename to apps/client/src/widgets/type_widgets/space_usage/cleanup_operation.tsindex bd228161c5..c546621b4b 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_operation.ts+++ b/apps/client/src/widgets/type_widgets/space_usage/cleanup_operation.ts@@ -5,14 +5,14 @@ import type {VacuumDatabaseResponse} from "@triliumnext/commons";-import optionService from "../../../../../services/options";-import server from "../../../../../services/server";-import { newCompressionTaskId, runImageCompression } from "../../../../dialogs/image_compression/image_compression_operation";+import optionService from "../../../services/options";+import server from "../../../services/server";+import { newCompressionTaskId, runImageCompression } from "../../dialogs/image_compression/image_compression_operation";import {CONSERVATIVE_IMAGE_COMPRESSION_DEFAULTS,type ImageCompressionToolOptions,readImageCompressionOptions-} from "../../../../dialogs/image_compression/image_compression_options";+} from "../../dialogs/image_compression/image_compression_options";/** The cleanup's items, in the order they are both listed and drawn. */export const CLEANUP_ITEMS = [diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/context_menu.spec.ts b/apps/client/src/widgets/type_widgets/space_usage/context_menu.spec.tssimilarity index 95%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/context_menu.spec.tsrename to apps/client/src/widgets/type_widgets/space_usage/context_menu.spec.tsindex 46000d84a3..5751d06f93 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/context_menu.spec.ts+++ b/apps/client/src/widgets/type_widgets/space_usage/context_menu.spec.ts@@ -1,11 +1,11 @@import { afterEach, describe, expect, it, vi } from "vitest";-import type FNote from "../../../../../entities/fnote";+import type FNote from "../../../entities/fnote";import type {ContextMenuEvent,MenuCommandItem,MenuItem-} from "../../../../../menus/context_menu";+} from "../../../menus/context_menu";const mocks = vi.hoisted(() => ({shown: undefined as { items: MenuItem<never>[] } | undefined,@@ -28,7 +28,7 @@ const mocks = vi.hoisted(() => ({confirm: vi.fn(async (..._args: unknown[]) => true)}));-vi.mock("../../../../../menus/context_menu", () => ({+vi.mock("../../../menus/context_menu", () => ({default: {show: async (options: { items: MenuItem<never>[] }) => {mocks.shown = options;@@ -36,7 +36,7 @@ vi.mock("../../../../../menus/context_menu", () => ({}}));-vi.mock("../../../../../services/froca", () => ({+vi.mock("../../../services/froca", () => ({default: {getNote: async (noteId: string) => mocks.notes.get(noteId) ?? null,getBranchId: async (parentNoteId: string, noteId: string) =>@@ -44,37 +44,37 @@ vi.mock("../../../../../services/froca", () => ({}}));-vi.mock("../../../../../services/branches", () => ({+vi.mock("../../../services/branches", () => ({default: { deleteNotes: (...args: unknown[]) => mocks.deleteNotes(...args) }}));-vi.mock("../../../../../services/open", () => ({+vi.mock("../../../services/open", () => ({downloadFileNote: (...args: unknown[]) => mocks.downloadFileNote(...args)}));-vi.mock("../../../../../services/server", () => ({+vi.mock("../../../services/server", () => ({default: { post: (...args: unknown[]) => mocks.post(...args) }}));// Stubbed rather than rendered: what belongs here is that the menu opens it, and the dialog's own// spec covers what it then does.-vi.mock("../../../../dialogs/image_compression/image_compression_dialog", () => ({+vi.mock("../../dialogs/image_compression/image_compression_dialog", () => ({showImageCompressionDialog: (...args: unknown[]) => mocks.showCompressionDialog(...args)}));-vi.mock("../../../../../services/toast", () => ({+vi.mock("../../../services/toast", () => ({default: { showMessage: (...args: unknown[]) => mocks.showMessage(...args) }}));-vi.mock("../../../../../services/options", () => ({+vi.mock("../../../services/options", () => ({default: { getInt: () => mocks.revisionLimit }}));-vi.mock("../../../../../services/dialog", () => ({+vi.mock("../../../services/dialog", () => ({default: { confirm: (...args: unknown[]) => mocks.confirm(...args) }}));-vi.mock("../../../../../components/app_context", () => ({+vi.mock("../../../components/app_context", () => ({default: {triggerCommand: mocks.triggerCommand,tabManager: {diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/context_menu.ts b/apps/client/src/widgets/type_widgets/space_usage/context_menu.tssimilarity index 94%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/context_menu.tsrename to apps/client/src/widgets/type_widgets/space_usage/context_menu.tsindex b8ce566236..d07ef0dd3c 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/context_menu.ts+++ b/apps/client/src/widgets/type_widgets/space_usage/context_menu.ts@@ -1,18 +1,18 @@-import appContext from "../../../../../components/app_context";-import type FNote from "../../../../../entities/fnote";+import appContext from "../../../components/app_context";+import type FNote from "../../../entities/fnote";import contextMenu, {type ContextMenuEvent,type MenuItem-} from "../../../../../menus/context_menu";-import branches from "../../../../../services/branches";-import dialog from "../../../../../services/dialog";-import froca from "../../../../../services/froca";-import { t } from "../../../../../services/i18n";-import { downloadFileNote } from "../../../../../services/open";-import options from "../../../../../services/options";-import server from "../../../../../services/server";-import toast from "../../../../../services/toast";-import { showImageCompressionDialog } from "../../../../dialogs/image_compression/image_compression_dialog";+} from "../../../menus/context_menu";+import branches from "../../../services/branches";+import dialog from "../../../services/dialog";+import froca from "../../../services/froca";+import { t } from "../../../services/i18n";+import { downloadFileNote } from "../../../services/open";+import options from "../../../services/options";+import server from "../../../services/server";+import toast from "../../../services/toast";+import { showImageCompressionDialog } from "../../dialogs/image_compression/image_compression_dialog";const ROOT_NOTE_ID = "root";diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/donut_segments.spec.ts b/apps/client/src/widgets/type_widgets/space_usage/donut_segments.spec.tssimilarity index 100%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/donut_segments.spec.tsrename to apps/client/src/widgets/type_widgets/space_usage/donut_segments.spec.tsdiff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/donut_segments.ts b/apps/client/src/widgets/type_widgets/space_usage/donut_segments.tssimilarity index 98%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/donut_segments.tsrename to apps/client/src/widgets/type_widgets/space_usage/donut_segments.tsindex b3cba33ab3..86e35f3314 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/donut_segments.ts+++ b/apps/client/src/widgets/type_widgets/space_usage/donut_segments.ts@@ -1,6 +1,6 @@import type { SpaceUsageNoteResponse } from "@triliumnext/commons";-import type { DonutSegment } from "../../../../react/charts/DonutChart";+import type { DonutSegment } from "../../react/charts/DonutChart";import { hueOf } from "./overview_model";/** What a donut segment stands for; the bucket segments ("others", "deleted") name neither. */diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.css b/apps/client/src/widgets/type_widgets/space_usage/index.csssimilarity index 62%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.cssrename to apps/client/src/widgets/type_widgets/space_usage/index.cssindex 0e93914f00..d7b62cbd80 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.css+++ b/apps/client/src/widgets/type_widgets/space_usage/index.css@@ -1,39 +1,39 @@-/* The section replaces the page's scrolling with a viewport-filling layout: flex chains from the- scroll container down to the section, in a tab (.scrolling-container) and in the settings dialog- (.modal-body) alike. Active Content keeps the default scrolling page — these rules only bite- while the Space Usage section is mounted. */-.scrolling-container:has(.space-usage-section),-.options-dialog .modal-body:has(.space-usage-section) {+/* The page replaces the note's scrolling with a viewport-filling layout: the flex chain runs from+ the scroll container down to the section, so the charts get the pane's full height. */+.scrolling-container:has(.space-usage-page) {display: flex;flex-direction: column;overflow: hidden;}-.note-detail:has(.space-usage-section),-.note-detail:has(.space-usage-section) .note-detail-content-widget,-.note-detail:has(.space-usage-section) .note-detail-content-widget-content {+.note-detail:has(.space-usage-page),+.note-detail:has(.space-usage-page) .note-detail-content-widget,+.note-detail:has(.space-usage-page) .note-detail-content-widget-content {display: flex;flex: 1 1 auto;flex-direction: column;min-height: 0;}-/* Lives in the sticky page header, which supplies its own spacing. The view choice sits at the- trailing edge, opposite the section switch that leads the row above it. */+/* The page itself does not scroll (whichever view is on show scrolls inside itself), so the bar+ holds its place as a fixed-size flex item. The rule under it separates it from that view. */.space-usage-toolbar {display: flex;+ flex: 0 0 auto;justify-content: flex-end;align-items: center;gap: 0.5em;+ border-bottom: 1px solid var(--main-border-color);+ padding-bottom: 10px;}-/* Second selector only to outweigh the dialog's own 2em (OptionsDialog.css). */-.space-usage-section:has(.space-usage-overview) .options-page-header,-.modal.options-dialog .space-usage-section:has(.space-usage-overview) .options-page-header {- margin-bottom: 0;+/* Reads as secondary to the note's own title above it. Set on the buttons, which carry their own+ font size and so would not inherit one from the group. */+.space-usage-view-choice button {+ font-size: 0.85em;}-.space-usage-section {+.space-usage-page {display: flex;flex: 1 1 auto;flex-direction: column;diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.spec.tsx b/apps/client/src/widgets/type_widgets/space_usage/index.spec.tsxsimilarity index 81%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.spec.tsxrename to apps/client/src/widgets/type_widgets/space_usage/index.spec.tsxindex 7070d1111b..a77867f94e 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.spec.tsx+++ b/apps/client/src/widgets/type_widgets/space_usage/index.spec.tsx@@ -1,21 +1,21 @@import type { SpaceUsageOverviewResponse } from "@triliumnext/commons";-import { type ComponentChildren, render } from "preact";+import { render } from "preact";import { afterEach, describe, expect, it, vi } from "vitest";-import { t } from "../../../../../services/i18n";-import { formatSize } from "../../../../../services/utils";+import { t } from "../../../services/i18n";+import { formatSize } from "../../../services/utils";const mocks = vi.hoisted(() => ({overview: undefined as unknown,failed: false,loading: false,- /** The token the section last asked each view to measure at. */+ /** The token the page last asked each view to measure at. */overviewToken: undefined as number | undefined,browseToken: undefined as number | undefined,reportBrowseLoading: undefined as ((loading: boolean) => void) | undefined}));-vi.mock("../../../../react/use_fetch", () => ({+vi.mock("../../react/use_fetch", () => ({useFetch: (_url: string, refreshToken: number) => {mocks.overviewToken = refreshToken;return { data: mocks.overview, failed: mocks.failed, loading: mocks.loading };@@ -41,21 +41,8 @@ vi.mock("./overview", () => ({)}));-vi.mock("../../components/OptionsPageHeader", () => ({- default: ({ actions, below }: { actions?: ComponentChildren, below?: ComponentChildren }) => (- <div className="header-stub">{actions}{below}</div>- )-}));--import type { ContentManagerSectionProps } from "../index";import SpaceUsage from "./index";-// Only the switcher matters to this section; the note-context plumbing of TypeWidgetProps is the-// shell's business and stays unused here.-const SECTION_PROPS = {- sectionSwitcher: <span className="switcher-stub" />-} as unknown as ContentManagerSectionProps;-const OVERVIEW: SpaceUsageOverviewResponse = {content: { size: 4000, noteCount: 12, attachmentsSize: 300, revisionsSize: 200 },notes: [],@@ -68,9 +55,9 @@ const OVERVIEW: SpaceUsageOverviewResponse = {let container: HTMLDivElement | undefined;-function renderSection() {+function renderPage() {container = document.body.appendChild(document.createElement("div"));- render(<SpaceUsage {...SECTION_PROPS} />, container);+ render(<SpaceUsage />, container);return container;}@@ -92,20 +79,19 @@ afterEach(() => {mocks.reportBrowseLoading = undefined;});-describe("SpaceUsage section", () => {+describe("SpaceUsage page", () => {it("shows the loading state without a status line until the overview arrives", () => {mocks.overview = undefined;- const probe = renderSection();+ const probe = renderPage();expect(probe.querySelector(".space-usage-loading")).not.toBeNull();expect(probe.querySelector(".space-usage-status")).toBeNull();- expect(probe.querySelector(".switcher-stub")).not.toBeNull();});it("says so when the overview could not be measured, rather than measuring on", () => {mocks.overview = undefined;mocks.failed = true;- const probe = renderSection();+ const probe = renderPage();expect(probe.querySelector(".space-usage-loading")).toBeNull();expect(probe.querySelector(".no-items")).not.toBeNull();@@ -113,7 +99,7 @@ describe("SpaceUsage section", () => {it("renders the overview with the two-part status line", () => {mocks.overview = OVERVIEW;- const probe = renderSection();+ const probe = renderPage();expect(probe.querySelector(".overview-stub")).not.toBeNull();expect(probe.querySelector(".browse-stub")).toBeNull();@@ -134,12 +120,12 @@ describe("SpaceUsage section", () => {it("switches to Browse and back, leaving the whole-database totals behind", async () => {mocks.overview = OVERVIEW;- const probe = renderSection();+ const probe = renderPage();// Labels depend on the (uninitialized) test i18n; the inactive button is the other view.// Scoped to the view group so the refresh button beside it is never mistaken for one.const inactiveViewButton = () =>- [ ...probe.querySelectorAll<HTMLButtonElement>(".content-manager-view-choice button") ]+ [ ...probe.querySelectorAll<HTMLButtonElement>(".space-usage-view-choice button") ].find((button) => !button.classList.contains("active"));inactiveViewButton()?.dispatchEvent(new MouseEvent("click", { bubbles: true }));@@ -158,7 +144,7 @@ describe("SpaceUsage section", () => {it("lands Browse on the note the map asked details for, rather than back at the root", async () => {mocks.overview = OVERVIEW;- const probe = renderSection();+ const probe = renderPage();probe.querySelector(".overview-stub")?.dispatchEvent(new MouseEvent("click", { bubbles: true }));await flushRender();@@ -170,14 +156,14 @@ describe("SpaceUsage section", () => {it("asks both views for a fresh reading when refresh is pressed, and only then", async () => {mocks.overview = OVERVIEW;- const probe = renderSection();+ const probe = renderPage();const refresh = () => probe.querySelector<HTMLButtonElement>(".space-usage-refresh");const initialToken = mocks.overviewToken ?? 0;// Switching views re-renders everything below; measuring must not restart because of it —// it is far too expensive to repeat whenever something on the page happens to change.- [ ...probe.querySelectorAll<HTMLButtonElement>(".content-manager-view-choice button") ][1]+ [ ...probe.querySelectorAll<HTMLButtonElement>(".space-usage-view-choice button") ][1]?.dispatchEvent(new MouseEvent("click", { bubbles: true }));await flushRender();expect(mocks.overviewToken).toBe(initialToken);@@ -195,15 +181,15 @@ describe("SpaceUsage section", () => {mocks.overview = OVERVIEW;mocks.loading = true;- expect(renderSection().querySelector<HTMLButtonElement>(".space-usage-refresh")?.disabled).toBe(true);+ expect(renderPage().querySelector<HTMLButtonElement>(".space-usage-refresh")?.disabled).toBe(true);});it("keeps it out for Browse's own reading too, which it cannot see otherwise", async () => {mocks.overview = OVERVIEW;- const probe = renderSection();+ const probe = renderPage();const refresh = () => probe.querySelector<HTMLButtonElement>(".space-usage-refresh");- [ ...probe.querySelectorAll<HTMLButtonElement>(".content-manager-view-choice button") ][1]+ [ ...probe.querySelectorAll<HTMLButtonElement>(".space-usage-view-choice button") ][1]?.dispatchEvent(new MouseEvent("click", { bubbles: true }));await flushRender();expect(refresh()?.disabled).toBe(false);diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.tsx b/apps/client/src/widgets/type_widgets/space_usage/index.tsxsimilarity index 67%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.tsxrename to apps/client/src/widgets/type_widgets/space_usage/index.tsxindex 7848d9459e..e1211a8577 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.tsx+++ b/apps/client/src/widgets/type_widgets/space_usage/index.tsx@@ -3,14 +3,12 @@ import "./index.css";import type { SpaceUsageOverviewResponse } from "@triliumnext/commons";import { useCallback, useMemo, useRef, useState } from "preact/hooks";-import { t } from "../../../../../services/i18n";-import { formatSize } from "../../../../../services/utils";-import ActionButton from "../../../../react/ActionButton";-import { useStaticTooltip } from "../../../../react/hooks";-import SegmentedChoice from "../../../../react/SegmentedChoice";-import { useFetch } from "../../../../react/use_fetch";-import OptionsPageHeader from "../../components/OptionsPageHeader";-import type { ContentManagerSectionProps } from "../index";+import { t } from "../../../services/i18n";+import { formatSize } from "../../../services/utils";+import ActionButton from "../../react/ActionButton";+import { useStaticTooltip } from "../../react/hooks";+import SegmentedChoice from "../../react/SegmentedChoice";+import { useFetch } from "../../react/use_fetch";import Browse from "./browse";import { showCleanupDialog } from "./cleanup_dialog";import Overview from "./overview";@@ -21,7 +19,7 @@ const OVERVIEW_LIMIT = 500;type SpaceUsageView = "overview" | "browse";-export default function SpaceUsage({ sectionSwitcher }: ContentManagerSectionProps) {+export default function SpaceUsage() {const [ view, setView ] = useState<SpaceUsageView>("overview");// Bumped by the refresh button. Both views read it, so one press re-measures whatever is on// screen; a number rather than a callback, which would change identity on every render here and@@ -46,38 +44,38 @@ export default function SpaceUsage({ sectionSwitcher }: ContentManagerSectionPro`space-usage/overview?limit=${OVERVIEW_LIMIT}`, refreshToken);return (- <div className="space-usage-section">- <OptionsPageHeader actions={sectionSwitcher} below={- <div className="space-usage-toolbar">- <SegmentedChoice- className="content-manager-view-choice"- options={VIEWS}- currentValue={view}- onChange={setView}- />- {/* Boxicons ships no broom; the brush is the nearest thing it has. The charts- re-measure once the dialog is done, having just been made wrong by it. */}- <ActionButton- className="space-usage-cleanup"- icon="bx bx-brush-alt"- text={t("space_usage.cleanup_title")}- onClick={() => void showCleanupDialog().then((reclaimed) => {- if (reclaimed !== null) {- refresh();- }- })}- />- {/* Measuring is expensive, so a reading is taken when asked for rather than- kept live — and the button stays out while one is being taken. */}- <ActionButton- className="space-usage-refresh"- icon="bx bx-refresh"- text={t("space_usage.refresh")}- disabled={loading || browseLoading}- onClick={refresh}- />- </div>- } />+ <div className="space-usage-page">+ {/* Above the views rather than in the note's own title row, so the controls stay put as+ whichever view is on show is redrawn beneath them. */}+ <div className="space-usage-toolbar">+ <SegmentedChoice+ className="space-usage-view-choice"+ options={VIEWS}+ currentValue={view}+ onChange={setView}+ />+ {/* Boxicons ships no broom; the brush is the nearest thing it has. The charts+ re-measure once the dialog is done, having just been made wrong by it. */}+ <ActionButton+ className="space-usage-cleanup"+ icon="bx bx-brush-alt"+ text={t("space_usage.cleanup_title")}+ onClick={() => void showCleanupDialog().then((reclaimed) => {+ if (reclaimed !== null) {+ refresh();+ }+ })}+ />+ {/* Measuring is expensive, so a reading is taken when asked for rather than kept+ live — and the button stays out while one is being taken. */}+ <ActionButton+ className="space-usage-refresh"+ icon="bx bx-refresh"+ text={t("space_usage.refresh")}+ disabled={loading || browseLoading}+ onClick={refresh}+ />+ </div>{view === "browse" && (<Browse@@ -128,8 +126,8 @@ export default function SpaceUsage({ sectionSwitcher }: ContentManagerSectionPro*/function StatusEntry({ text, hint }: { text: string, hint: string }) {const ref = useRef<HTMLSpanElement>(null);- // `tooltip-top` is the app's "above everything" layer, which the status line needs: the content- // manager's own active-content overlay stands above the base tooltip layer.+ // The page's own chart tooltips ride the app's "above everything" layer (see chart_tooltip);+ // the line joins them, so a hint opened here is not covered by one drifting down from the map.useStaticTooltip(ref, useMemo(() => ({ title: hint, placement: "top", customClass: "tooltip-top" }),[ hint ]diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/labels.spec.ts b/apps/client/src/widgets/type_widgets/space_usage/labels.spec.tssimilarity index 94%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/labels.spec.tsrename to apps/client/src/widgets/type_widgets/space_usage/labels.spec.tsindex 6149ab00c9..350456ab69 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/labels.spec.ts+++ b/apps/client/src/widgets/type_widgets/space_usage/labels.spec.ts@@ -4,7 +4,7 @@ const mocks = vi.hoisted(() => ({t: vi.fn((key: string) => key)}));-vi.mock("../../../../../services/i18n", () => ({ t: mocks.t }));+vi.mock("../../../services/i18n", () => ({ t: mocks.t }));import { deletedEntitiesLabel } from "./labels";diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/labels.ts b/apps/client/src/widgets/type_widgets/space_usage/labels.tssimilarity index 94%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/labels.tsrename to apps/client/src/widgets/type_widgets/space_usage/labels.tsindex 146a979a96..37a2198c97 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/labels.ts+++ b/apps/client/src/widgets/type_widgets/space_usage/labels.ts@@ -1,6 +1,6 @@import type { SpaceUsageDeletedNotes } from "@triliumnext/commons";-import { t } from "../../../../../services/i18n";+import { t } from "../../../services/i18n";/*** "0 deleted notes, 2 deleted attachments" — what the deleted bucket's size is actually spread over.diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/note_usage_donut.css b/apps/client/src/widgets/type_widgets/space_usage/note_usage_donut.csssimilarity index 100%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/note_usage_donut.cssrename to apps/client/src/widgets/type_widgets/space_usage/note_usage_donut.cssdiff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/note_usage_donut.spec.tsx b/apps/client/src/widgets/type_widgets/space_usage/note_usage_donut.spec.tsxsimilarity index 97%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/note_usage_donut.spec.tsxrename to apps/client/src/widgets/type_widgets/space_usage/note_usage_donut.spec.tsxindex c9932d083b..dfc91b09af 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/note_usage_donut.spec.tsx+++ b/apps/client/src/widgets/type_widgets/space_usage/note_usage_donut.spec.tsx@@ -2,14 +2,14 @@ import type { SpaceUsageNoteResponse } from "@triliumnext/commons";import { render } from "preact";import { afterEach, describe, expect, it, vi } from "vitest";-import { t } from "../../../../../services/i18n";-import { formatSize } from "../../../../../services/utils";+import { t } from "../../../services/i18n";+import { formatSize } from "../../../services/utils";const mocks = vi.hoisted(() => ({triggerCommand: vi.fn()}));-vi.mock("../../../../../components/app_context", () => ({+vi.mock("../../../components/app_context", () => ({default: {triggerCommand: mocks.triggerCommand,tabManager: { getActiveContext: () => ({ hoistedNoteId: "hoistedNote" }) }@@ -18,7 +18,7 @@ vi.mock("../../../../../components/app_context", () => ({// Uninitialized, the real `t` answers undefined for every key — which would silently drop anything// the component only renders when its wording resolves, the contextual-help icon included.-vi.mock("../../../../../services/i18n", () => ({+vi.mock("../../../services/i18n", () => ({t: (key: string) => key}));diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/note_usage_donut.tsx b/apps/client/src/widgets/type_widgets/space_usage/note_usage_donut.tsxsimilarity index 96%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/note_usage_donut.tsxrename to apps/client/src/widgets/type_widgets/space_usage/note_usage_donut.tsxindex cf6fcddd6e..550b0a0310 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/note_usage_donut.tsx+++ b/apps/client/src/widgets/type_widgets/space_usage/note_usage_donut.tsx@@ -7,10 +7,10 @@ import { useMemo } from "preact/hooks";import type React from "react";import { Trans } from "react-i18next";-import { t } from "../../../../../services/i18n";-import { formatSize } from "../../../../../services/utils";-import DonutChart, { type DonutRing } from "../../../../react/charts/DonutChart";-import ContextualHelp from "../../../../react/ContextualHelp";+import { t } from "../../../services/i18n";+import { formatSize } from "../../../services/utils";+import DonutChart, { type DonutRing } from "../../react/charts/DonutChart";+import ContextualHelp from "../../react/ContextualHelp";import { quickEditAttachment, quickEditNote } from "./context_menu";import {buildCompositionSegments,diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/overview.spec.tsx b/apps/client/src/widgets/type_widgets/space_usage/overview.spec.tsxsimilarity index 96%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/overview.spec.tsxrename to apps/client/src/widgets/type_widgets/space_usage/overview.spec.tsxindex 80a1179c9f..1624ba8e96 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/overview.spec.tsx+++ b/apps/client/src/widgets/type_widgets/space_usage/overview.spec.tsx@@ -11,7 +11,7 @@ const mocks = vi.hoisted(() => ({contentChanged: vi.fn()}));-vi.mock("../../../../../components/app_context", () => ({+vi.mock("../../../components/app_context", () => ({default: {triggerCommand: mocks.triggerCommand,tabManager: { getActiveContext: () => null }@@ -28,12 +28,12 @@ vi.mock("./context_menu", async (importOriginal) => ({// The treemap container never gets a real layout under happy-dom; the rest of the hooks are the// real ones.-vi.mock("../../../../react/hooks", async (importOriginal) => ({- ...await importOriginal<typeof import("../../../../react/hooks")>(),+vi.mock("../../react/hooks", async (importOriginal) => ({+ ...await importOriginal<typeof import("../../react/hooks")>(),useElementSize: () => ({ width: 400, height: 300 })}));-vi.mock("../../../../../services/froca", () => ({+vi.mock("../../../services/froca", () => ({default: {getNotes: async (noteIds: string[]) =>noteIds.map((noteId) => ({ noteId, getIcon: () => `tn-icon bx bx-${noteId}` }))diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/overview.tsx b/apps/client/src/widgets/type_widgets/space_usage/overview.tsxsimilarity index 95%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/overview.tsxrename to apps/client/src/widgets/type_widgets/space_usage/overview.tsxindex b64f3ea299..1cd1fe6b76 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/overview.tsx+++ b/apps/client/src/widgets/type_widgets/space_usage/overview.tsx@@ -1,10 +1,10 @@import type { SpaceUsageOverviewResponse } from "@triliumnext/commons";import { useEffect, useMemo, useState } from "preact/hooks";-import froca from "../../../../../services/froca";-import { t } from "../../../../../services/i18n";-import { formatSize } from "../../../../../services/utils";-import Treemap, { type TreemapItem } from "../../../../react/charts/Treemap";+import froca from "../../../services/froca";+import { t } from "../../../services/i18n";+import { formatSize } from "../../../services/utils";+import Treemap, { type TreemapItem } from "../../react/charts/Treemap";import {type ContentChangedHandler,openDeletedNotesContextMenu,diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/overview_model.spec.ts b/apps/client/src/widgets/type_widgets/space_usage/overview_model.spec.tssimilarity index 99%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/overview_model.spec.tsrename to apps/client/src/widgets/type_widgets/space_usage/overview_model.spec.tsindex 2b98c44330..48b2dfd8c2 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/overview_model.spec.ts+++ b/apps/client/src/widgets/type_widgets/space_usage/overview_model.spec.ts@@ -1,7 +1,7 @@import type { SpaceUsageOverviewNote, SpaceUsageOverviewResponse } from "@triliumnext/commons";import { describe, expect, it } from "vitest";-import type { TreemapItem } from "../../../../react/charts/Treemap";+import type { TreemapItem } from "../../react/charts/Treemap";import { buildOverviewModel, hueOf, type OverviewCell } from "./overview_model";function entry(noteId: string, notePath: string[], sizes: Partial<SpaceUsageOverviewNote> = {}): SpaceUsageOverviewNote {diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/overview_model.ts b/apps/client/src/widgets/type_widgets/space_usage/overview_model.tssimilarity index 99%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/overview_model.tsrename to apps/client/src/widgets/type_widgets/space_usage/overview_model.tsindex fbed2b50ac..b676d9594f 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/overview_model.ts+++ b/apps/client/src/widgets/type_widgets/space_usage/overview_model.ts@@ -1,6 +1,6 @@import type { SpaceUsageBucket, SpaceUsageOverviewNote, SpaceUsageOverviewResponse } from "@triliumnext/commons";-import type { TreemapItem } from "../../../../react/charts/Treemap";+import type { TreemapItem } from "../../react/charts/Treemap";const ROOT_NOTE_ID = "root";diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/placeholder.tsx b/apps/client/src/widgets/type_widgets/space_usage/placeholder.tsxsimilarity index 84%rename from apps/client/src/widgets/type_widgets/options/content_manager/space_usage/placeholder.tsxrename to apps/client/src/widgets/type_widgets/space_usage/placeholder.tsxindex 5c9af91d5b..b23a8655a8 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/placeholder.tsx+++ b/apps/client/src/widgets/type_widgets/space_usage/placeholder.tsx@@ -1,5 +1,5 @@-import { t } from "../../../../../services/i18n";-import NoItems from "../../../../react/NoItems";+import { t } from "../../../services/i18n";+import NoItems from "../../react/NoItems";/*** What a view stands in with before it has anything to draw. Measuring is the usual case; a failurediff --git a/apps/server/src/assets/translations/en/server.json b/apps/server/src/assets/translations/en/server.jsonindex 698f133055..28877c7606 100644--- a/apps/server/src/assets/translations/en/server.json+++ b/apps/server/src/assets/translations/en/server.json@@ -38,6 +38,7 @@"show-deleted-notes": "Show \"Deleted Notes\" dialog","show-sql-console": "Open \"SQL Console\" page","show-backend-log": "Open \"Backend Log\" page",+ "show-space-usage": "Open the \"Space Usage\" page","show-help": "Open the built-in User Guide","show-cheatsheet": "Show a modal with common keyboard operations","show-shortcut-hints": "Show keyboard shortcuts for the focused widget",@@ -128,6 +129,7 @@"show-deleted-notes": "Show Deleted Notes","show-sql-console": "Show SQL Console","show-backend-log": "Show Backend Log",+ "show-space-usage": "Show Space Usage","show-help": "Show Help","show-cheatsheet": "Show Cheatsheet","show-shortcut-hints": "Show Shortcut Hints",@@ -258,6 +260,7 @@"task-state-attr-is-completed": "Counts as completed","task-state-attr-color": "Color","task-state-attr-is-hidden": "Hidden from list",+ "space-usage-title": "Space Usage","backend-log-title": "Backend Log","custom-dictionary-title": "Custom Dictionary","user-hidden-title": "User Hidden",diff --git a/packages/commons/src/lib/keyboard_actions_interface.ts b/packages/commons/src/lib/keyboard_actions_interface.tsindex 6e1393ad93..2a0ee53858 100644--- a/packages/commons/src/lib/keyboard_actions_interface.ts+++ b/packages/commons/src/lib/keyboard_actions_interface.ts@@ -56,6 +56,7 @@ const enum KeyboardActionNamesEnum {showDeletedNotes,showSQLConsole,showBackendLog,+ showSpaceUsage,showCheatsheet,showShortcutHints,showHelp,diff --git a/packages/trilium-core/src/services/hidden_subtree.ts b/packages/trilium-core/src/services/hidden_subtree.tsindex b6e07a370a..7bc354f384 100644--- a/packages/trilium-core/src/services/hidden_subtree.ts+++ b/packages/trilium-core/src/services/hidden_subtree.ts@@ -130,6 +130,16 @@ function buildHiddenSubtreeDefinition(helpSubtree: HiddenSubtreeItem[]): HiddenS}]},+ {+ id: "_spaceUsage",+ title: t("hidden-subtree.space-usage-title"),+ type: "contentWidget",+ icon: "bx-pie-chart-alt-2",+ attributes: [+ { type: "label", name: "keepCurrentHoisting" },+ { type: "label", name: "fullContentWidth" }+ ]+ },{id: "_backendLog",title: t("hidden-subtree.backend-log-title"),diff --git a/packages/trilium-core/src/services/keyboard_actions.ts b/packages/trilium-core/src/services/keyboard_actions.tsindex a83f44c4e5..8a0cebc32a 100644--- a/packages/trilium-core/src/services/keyboard_actions.ts+++ b/packages/trilium-core/src/services/keyboard_actions.ts@@ -472,6 +472,14 @@ function getDefaultKeyboardActions() {description: t("keyboard_actions.show-backend-log"),scope: "window"},+ {+ friendlyName: t("keyboard_action_names.show-space-usage"),+ actionName: "showSpaceUsage",+ iconClass: "bx bx-pie-chart-alt-2",+ defaultShortcuts: [],+ description: t("keyboard_actions.show-space-usage"),+ scope: "window"+ },{friendlyName: t("keyboard_action_names.show-help"),actionName: "showHelp",