mirror of
https://github.com/zadam/trilium.git
synced 2025-12-12 10:24:23 +01:00
chore(toast): fix typecheck issues
This commit is contained in:
parent
21335b1b00
commit
f1d87c29d3
@ -22,6 +22,7 @@ bundleService.getWidgetBundlesByParent().then(async (widgetBundles) => {
|
|||||||
appContext.setLayout(new DesktopLayout(widgetBundles));
|
appContext.setLayout(new DesktopLayout(widgetBundles));
|
||||||
appContext.start().catch((e) => {
|
appContext.start().catch((e) => {
|
||||||
toastService.showPersistent({
|
toastService.showPersistent({
|
||||||
|
id: "critical-error",
|
||||||
title: t("toast.critical-error.title"),
|
title: t("toast.critical-error.title"),
|
||||||
icon: "alert",
|
icon: "alert",
|
||||||
message: t("toast.critical-error.message", { message: e.message })
|
message: t("toast.critical-error.message", { message: e.message })
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import utils from "./utils.js";
|
import utils from "./utils.js";
|
||||||
import server from "./server.js";
|
import server from "./server.js";
|
||||||
import toastService, { type ToastOptions } from "./toast.js";
|
import toastService, { type ToastOptionsWithRequiredId } from "./toast.js";
|
||||||
import froca from "./froca.js";
|
import froca from "./froca.js";
|
||||||
import hoistedNoteService from "./hoisted_note.js";
|
import hoistedNoteService from "./hoisted_note.js";
|
||||||
import ws from "./ws.js";
|
import ws from "./ws.js";
|
||||||
@ -195,11 +195,11 @@ function filterRootNote(branchIds: string[]) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeToast(id: string, message: string): ToastOptions {
|
function makeToast(id: string, message: string): ToastOptionsWithRequiredId {
|
||||||
return {
|
return {
|
||||||
id: id,
|
id,
|
||||||
title: t("branches.delete-status"),
|
title: t("branches.delete-status"),
|
||||||
message: message,
|
message,
|
||||||
icon: "trash"
|
icon: "trash"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -242,7 +242,7 @@ ws.subscribeToMessages(async (message) => {
|
|||||||
|
|
||||||
async function cloneNoteToBranch(childNoteId: string, parentBranchId: string, prefix?: string) {
|
async function cloneNoteToBranch(childNoteId: string, parentBranchId: string, prefix?: string) {
|
||||||
const resp = await server.put<Response>(`notes/${childNoteId}/clone-to-branch/${parentBranchId}`, {
|
const resp = await server.put<Response>(`notes/${childNoteId}/clone-to-branch/${parentBranchId}`, {
|
||||||
prefix: prefix
|
prefix
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
@ -252,7 +252,7 @@ async function cloneNoteToBranch(childNoteId: string, parentBranchId: string, pr
|
|||||||
|
|
||||||
async function cloneNoteToParentNote(childNoteId: string, parentNoteId: string, prefix?: string) {
|
async function cloneNoteToParentNote(childNoteId: string, parentNoteId: string, prefix?: string) {
|
||||||
const resp = await server.put<Response>(`notes/${childNoteId}/clone-to-note/${parentNoteId}`, {
|
const resp = await server.put<Response>(`notes/${childNoteId}/clone-to-note/${parentNoteId}`, {
|
||||||
prefix: prefix
|
prefix
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
|
|||||||
@ -37,6 +37,7 @@ export async function executeBundle(bundle: Bundle, originEntity?: Entity | null
|
|||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
const note = await froca.getNote(bundle.noteId);
|
const note = await froca.getNote(bundle.noteId);
|
||||||
toastService.showPersistent({
|
toastService.showPersistent({
|
||||||
|
id: `custom-script-failure-${note?.noteId}`,
|
||||||
title: t("toast.bundle-error.title"),
|
title: t("toast.bundle-error.title"),
|
||||||
icon: "bx bx-error-circle",
|
icon: "bx bx-error-circle",
|
||||||
message: t("toast.bundle-error.message", {
|
message: t("toast.bundle-error.message", {
|
||||||
@ -108,6 +109,7 @@ async function getWidgetBundlesByParent() {
|
|||||||
const noteId = bundle.noteId;
|
const noteId = bundle.noteId;
|
||||||
const note = await froca.getNote(noteId);
|
const note = await froca.getNote(noteId);
|
||||||
toastService.showPersistent({
|
toastService.showPersistent({
|
||||||
|
id: `custom-script-failure-${noteId}`,
|
||||||
title: t("toast.bundle-error.title"),
|
title: t("toast.bundle-error.title"),
|
||||||
icon: "bx bx-error-circle",
|
icon: "bx bx-error-circle",
|
||||||
message: t("toast.bundle-error.message", {
|
message: t("toast.bundle-error.message", {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import toastService, { type ToastOptions } from "./toast.js";
|
import toastService, { type ToastOptionsWithRequiredId } from "./toast.js";
|
||||||
import server from "./server.js";
|
import server from "./server.js";
|
||||||
import ws from "./ws.js";
|
import ws from "./ws.js";
|
||||||
import utils from "./utils.js";
|
import utils from "./utils.js";
|
||||||
@ -57,11 +57,11 @@ export async function uploadFiles(entityType: string, parentNoteId: string, file
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeToast(id: string, message: string): ToastOptions {
|
function makeToast(id: string, message: string): ToastOptionsWithRequiredId {
|
||||||
return {
|
return {
|
||||||
id: id,
|
id,
|
||||||
title: t("import.import-status"),
|
title: t("import.import-status"),
|
||||||
message: message,
|
message,
|
||||||
icon: "plus"
|
icon: "plus"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import server from "./server.js";
|
import server from "./server.js";
|
||||||
import protectedSessionHolder from "./protected_session_holder.js";
|
import protectedSessionHolder from "./protected_session_holder.js";
|
||||||
import toastService from "./toast.js";
|
import toastService from "./toast.js";
|
||||||
import type { ToastOptions } from "./toast.js";
|
import type { ToastOptionsWithRequiredId } from "./toast.js";
|
||||||
import ws from "./ws.js";
|
import ws from "./ws.js";
|
||||||
import appContext from "../components/app_context.js";
|
import appContext from "../components/app_context.js";
|
||||||
import froca from "./froca.js";
|
import froca from "./froca.js";
|
||||||
@ -97,7 +97,7 @@ async function protectNote(noteId: string, protect: boolean, includingSubtree: b
|
|||||||
await server.put(`notes/${noteId}/protect/${protect ? 1 : 0}?subtree=${includingSubtree ? 1 : 0}`);
|
await server.put(`notes/${noteId}/protect/${protect ? 1 : 0}?subtree=${includingSubtree ? 1 : 0}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeToast(message: Message, title: string, text: string): ToastOptions {
|
function makeToast(message: Message, title: string, text: string): ToastOptionsWithRequiredId {
|
||||||
return {
|
return {
|
||||||
id: message.taskId,
|
id: message.taskId,
|
||||||
title,
|
title,
|
||||||
|
|||||||
@ -169,10 +169,11 @@ export class TypedBasicWidget<T extends TypedComponent<any>> extends TypedCompon
|
|||||||
console.log("Got issue in widget ", this);
|
console.log("Got issue in widget ", this);
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|
||||||
let noteId = this._noteId;
|
const noteId = this._noteId;
|
||||||
if (this._noteId) {
|
if (this._noteId) {
|
||||||
froca.getNote(noteId, true).then((note) => {
|
froca.getNote(noteId, true).then((note) => {
|
||||||
toastService.showPersistent({
|
toastService.showPersistent({
|
||||||
|
id: `custom-widget-failure-${noteId}`,
|
||||||
title: t("toast.widget-error.title"),
|
title: t("toast.widget-error.title"),
|
||||||
icon: "bx bx-error-circle",
|
icon: "bx bx-error-circle",
|
||||||
message: t("toast.widget-error.message-custom", {
|
message: t("toast.widget-error.message-custom", {
|
||||||
@ -182,10 +183,9 @@ export class TypedBasicWidget<T extends TypedComponent<any>> extends TypedCompon
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return;
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
toastService.showPersistent({
|
toastService.showPersistent({
|
||||||
|
id: `custom-widget-failure-${noteId}`,
|
||||||
title: t("toast.widget-error.title"),
|
title: t("toast.widget-error.title"),
|
||||||
icon: "bx bx-error-circle",
|
icon: "bx bx-error-circle",
|
||||||
message: t("toast.widget-error.message-unknown", {
|
message: t("toast.widget-error.message-unknown", {
|
||||||
@ -193,6 +193,7 @@ export class TypedBasicWidget<T extends TypedComponent<any>> extends TypedCompon
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if the widget is enabled. Widgets are enabled by default. Generally setting this to `false` will cause the widget not to be displayed, however it will still be available on the DOM but hidden.
|
* Indicates if the widget is enabled. Widgets are enabled by default. Generally setting this to `false` will cause the widget not to be displayed, however it will still be available on the DOM but hidden.
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import FormRadioGroup from "../react/FormRadioGroup";
|
|||||||
import Modal from "../react/Modal";
|
import Modal from "../react/Modal";
|
||||||
import "./export.css";
|
import "./export.css";
|
||||||
import ws from "../../services/ws";
|
import ws from "../../services/ws";
|
||||||
import toastService, { ToastOptions } from "../../services/toast";
|
import toastService, { type ToastOptionsWithRequiredId } from "../../services/toast";
|
||||||
import utils from "../../services/utils";
|
import utils from "../../services/utils";
|
||||||
import open from "../../services/open";
|
import open from "../../services/open";
|
||||||
import froca from "../../services/froca";
|
import froca from "../../services/froca";
|
||||||
@ -132,11 +132,11 @@ function exportBranch(branchId: string, type: string, format: string, version: s
|
|||||||
}
|
}
|
||||||
|
|
||||||
ws.subscribeToMessages(async (message) => {
|
ws.subscribeToMessages(async (message) => {
|
||||||
function makeToast(id: string, message: string): ToastOptions {
|
function makeToast(id: string, message: string): ToastOptionsWithRequiredId {
|
||||||
return {
|
return {
|
||||||
id: id,
|
id,
|
||||||
title: t("export.export_status"),
|
title: t("export.export_status"),
|
||||||
message: message,
|
message,
|
||||||
icon: "export"
|
icon: "export"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user