mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
correctly use taskId in toasts
This commit is contained in:
parent
9689029c4b
commit
21588829c7
@ -38,27 +38,28 @@ export async function uploadFiles(parentNoteId, files, options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ws.subscribeToMessages(async message => {
|
function makeToast(id, message) {
|
||||||
const toast = {
|
return {
|
||||||
id: "import",
|
id: id,
|
||||||
title: "Import status",
|
title: "Import status",
|
||||||
|
message: message,
|
||||||
icon: "plus"
|
icon: "plus"
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
ws.subscribeToMessages(async message => {
|
||||||
if (message.type === 'task-error' && message.taskType === 'import') {
|
if (message.type === 'task-error' && message.taskType === 'import') {
|
||||||
infoService.closePersistent(toast.id);
|
infoService.closePersistent(message.taskId);
|
||||||
infoService.showError(message.message);
|
infoService.showError(message.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.type === 'task-progress-count' && message.taskType === 'import') {
|
if (message.type === 'task-progress-count' && message.taskType === 'import') {
|
||||||
toast.message = "Import in progress: " + message.progressCount;
|
infoService.showPersistent(makeToast(message.taskId, "Import in progress: " + message.progressCount));
|
||||||
|
|
||||||
infoService.showPersistent(toast);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.type === 'task-succeeded' && message.taskType === 'import') {
|
if (message.type === 'task-succeeded' && message.taskType === 'import') {
|
||||||
toast.message = "Import finished successfully.";
|
const toast = makeToast(message.taskId, "Import finished successfully.");
|
||||||
toast.closeAfter = 5000;
|
toast.closeAfter = 5000;
|
||||||
|
|
||||||
infoService.showPersistent(toast);
|
infoService.showPersistent(toast);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user