chore(options/etapi): update help

This commit is contained in:
Elian Doran 2025-11-02 22:08:42 +02:00
parent 4526455486
commit 947330ed73
No known key found for this signature in database
3 changed files with 7 additions and 15 deletions

View File

@ -1453,10 +1453,6 @@
"etapi": { "etapi": {
"title": "ETAPI", "title": "ETAPI",
"description": "ETAPI is a REST API used to access Trilium instance programmatically, without UI.", "description": "ETAPI is a REST API used to access Trilium instance programmatically, without UI.",
"see_more": "See more details in the {{- link_to_wiki}} and the {{- link_to_openapi_spec}} or the {{- link_to_swagger_ui }}.",
"wiki": "wiki",
"openapi_spec": "ETAPI OpenAPI spec",
"swagger_ui": "ETAPI Swagger UI",
"create_token": "Create new ETAPI token", "create_token": "Create new ETAPI token",
"existing_tokens": "Existing tokens", "existing_tokens": "Existing tokens",
"no_tokens_yet": "There are no tokens yet. Click on the button above to create one.", "no_tokens_yet": "There are no tokens yet. Click on the button above to create one.",

View File

@ -2,7 +2,7 @@ import type { ComponentChildren } from "preact";
import { CSSProperties } from "preact/compat"; import { CSSProperties } from "preact/compat";
interface OptionsSectionProps { interface OptionsSectionProps {
title?: string; title?: ComponentChildren;
children: ComponentChildren; children: ComponentChildren;
noCard?: boolean; noCard?: boolean;
style?: CSSProperties; style?: CSSProperties;

View File

@ -11,6 +11,7 @@ import dialog from "../../../services/dialog";
import { formatDateTime } from "../../../utils/formatters"; import { formatDateTime } from "../../../utils/formatters";
import ActionButton from "../../react/ActionButton"; import ActionButton from "../../react/ActionButton";
import { useTriliumEvent } from "../../react/hooks"; import { useTriliumEvent } from "../../react/hooks";
import HelpButton from "../../react/HelpButton";
type RenameTokenCallback = (tokenId: string, oldName: string) => Promise<void>; type RenameTokenCallback = (tokenId: string, oldName: string) => Promise<void>;
type DeleteTokenCallback = (tokenId: string, name: string ) => Promise<void>; type DeleteTokenCallback = (tokenId: string, name: string ) => Promise<void>;
@ -48,19 +49,13 @@ export default function EtapiSettings() {
message: t("etapi.token_created_message"), message: t("etapi.token_created_message"),
defaultValue: authToken defaultValue: authToken
}); });
}, []); }, []);
return ( return (
<OptionsSection title={t("etapi.title")}> <OptionsSection title={t("etapi.title")}>
<FormText> <FormText>
{t("etapi.description")}<br /> {t("etapi.description")}
<RawHtml <HelpButton helpPage="pgxEVkzLl1OP" />
html={t("etapi.see_more", {
link_to_wiki: `<a class="tn-link" href="https://triliumnext.github.io/Docs/Wiki/etapi.html">${t("etapi.wiki")}</a>`,
// TODO: We use window.open src/public/app/services/link.ts -> prevents regular click behavior on "a" element here because it's a relative path
link_to_openapi_spec: `<a class="tn-link" onclick="window.open('etapi/etapi.openapi.yaml')" href="etapi/etapi.openapi.yaml">${t("etapi.openapi_spec")}</a>`,
link_to_swagger_ui: `<a class="tn-link" href="#_help_f3xpgx6H01PW">${t("etapi.swagger_ui")}</a>`
})} />
</FormText> </FormText>
<Button <Button
@ -68,6 +63,7 @@ export default function EtapiSettings() {
text={t("etapi.create_token")} text={t("etapi.create_token")}
onClick={createTokenCallback} onClick={createTokenCallback}
/> />
<hr /> <hr />
<h5>{t("etapi.existing_tokens")}</h5> <h5>{t("etapi.existing_tokens")}</h5>
@ -123,7 +119,7 @@ function TokenList({ tokens }: { tokens: EtapiToken[] }) {
text={t("etapi.rename_token")} text={t("etapi.rename_token")}
onClick={() => renameCallback(etapiTokenId, name)} onClick={() => renameCallback(etapiTokenId, name)}
/> />
<ActionButton <ActionButton
icon="bx bx-trash" icon="bx bx-trash"
text={t("etapi.delete_token")} text={t("etapi.delete_token")}