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
rename info service to toast service
zadam78f5b7b288b3
diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.htmlindex 203bd234ea..cecb664e8c 100644--- a/docs/frontend_api/services_frontend_script_api.js.html+++ b/docs/frontend_api/services_frontend_script_api.js.html@@ -29,7 +29,7 @@<pre class="prettyprint source linenums"><code>import treeService from './tree.js';import server from './server.js';import utils from './utils.js';-import infoService from './info.js';+import toastService from './toast.js';import linkService from './link.js';import treeCache from './tree_cache.js';import noteDetailService from './note_detail.js';@@ -272,7 +272,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte* @method* @param {string} message*/- this.showMessage = infoService.showMessage;+ this.showMessage = toastService.showMessage;/*** Show error message to the user.@@ -280,7 +280,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte* @method* @param {string} message*/- this.showError = infoService.showError;+ this.showError = toastService.showError;/*** Refresh treediff --git a/src/public/javascripts/dialogs/attributes.js b/src/public/javascripts/dialogs/attributes.jsindex 651c9ddbe5..80b8d8723d 100644--- a/src/public/javascripts/dialogs/attributes.js+++ b/src/public/javascripts/dialogs/attributes.js@@ -1,6 +1,6 @@import noteDetailService from '../services/note_detail.js';import server from '../services/server.js';-import infoService from "../services/info.js";+import toastService from "../services/toast.js";import treeUtils from "../services/tree_utils.js";import attributeAutocompleteService from "../services/attribute_autocomplete.js";import utils from "../services/utils.js";@@ -168,7 +168,7 @@ function AttributesModel() {await showAttributes(attributes);- infoService.showMessage("Attributes have been saved.");+ toastService.showMessage("Attributes have been saved.");const ctx = noteDetailService.getActiveTabContext();diff --git a/src/public/javascripts/dialogs/branch_prefix.js b/src/public/javascripts/dialogs/branch_prefix.jsindex a8762ec9fb..4c31c135a2 100644--- a/src/public/javascripts/dialogs/branch_prefix.js+++ b/src/public/javascripts/dialogs/branch_prefix.js@@ -2,7 +2,7 @@ import treeService from '../services/tree.js';import server from '../services/server.js';import treeCache from "../services/tree_cache.js";import treeUtils from "../services/tree_utils.js";-import infoService from "../services/info.js";+import toastService from "../services/toast.js";import utils from "../services/utils.js";const $dialog = $("#branch-prefix-dialog");@@ -38,7 +38,7 @@ async function savePrefix() {$dialog.modal('hide');- infoService.showMessage("Branch prefix has been saved.");+ toastService.showMessage("Branch prefix has been saved.");}$form.submit(() => {diff --git a/src/public/javascripts/dialogs/export.js b/src/public/javascripts/dialogs/export.jsindex f491de5bd6..4415740344 100644--- a/src/public/javascripts/dialogs/export.js+++ b/src/public/javascripts/dialogs/export.js@@ -1,7 +1,7 @@import treeUtils from "../services/tree_utils.js";import utils from "../services/utils.js";import ws from "../services/ws.js";-import infoService from "../services/info.js";+import toastService from "../services/toast.js";const $dialog = $("#export-dialog");const $form = $("#export-form");@@ -122,16 +122,16 @@ ws.subscribeToMessages(async message => {}if (message.type === 'task-error') {- infoService.closePersistent(message.taskId);- infoService.showError(message.message);+ toastService.closePersistent(message.taskId);+ toastService.showError(message.message);}else if (message.type === 'task-progress-count') {- infoService.showPersistent(makeToast(message.taskId, "Export in progress: " + message.progressCount));+ toastService.showPersistent(makeToast(message.taskId, "Export in progress: " + message.progressCount));}else if (message.type === 'task-succeeded') {const toast = makeToast(message.taskId, "Import finished successfully.");toast.closeAfter = 5000;- infoService.showPersistent(toast);+ toastService.showPersistent(toast);}});\ No newline at end of filediff --git a/src/public/javascripts/dialogs/markdown_import.js b/src/public/javascripts/dialogs/markdown_import.jsindex f56c779524..081dc090f0 100644--- a/src/public/javascripts/dialogs/markdown_import.js+++ b/src/public/javascripts/dialogs/markdown_import.js@@ -1,5 +1,5 @@import libraryLoader from "../services/library_loader.js";-import infoService from "../services/info.js";+import toastService from "../services/toast.js";import utils from "../services/utils.js";import noteDetailService from "../services/note_detail.js";@@ -22,7 +22,7 @@ async function convertMarkdownToHtml(text) {textEditor.model.insertContent(modelFragment, textEditor.model.document.selection);- infoService.showMessage("Markdown content has been imported into the document.");+ toastService.showMessage("Markdown content has been imported into the document.");}export async function importMarkdownInline() {diff --git a/src/public/javascripts/dialogs/options/advanced.js b/src/public/javascripts/dialogs/options/advanced.jsindex ae61df3d7b..1f773daa02 100644--- a/src/public/javascripts/dialogs/options/advanced.js+++ b/src/public/javascripts/dialogs/options/advanced.js@@ -1,5 +1,5 @@import server from "../../services/server.js";-import infoService from "../../services/info.js";+import toastService from "../../services/toast.js";export default class AdvancedOptions {constructor() {@@ -13,26 +13,26 @@ export default class AdvancedOptions {this.$forceFullSyncButton.click(async () => {await server.post('sync/force-full-sync');- infoService.showMessage("Full sync triggered");+ toastService.showMessage("Full sync triggered");});this.$fillSyncRowsButton.click(async () => {await server.post('sync/fill-sync-rows');- infoService.showMessage("Sync rows filled successfully");+ toastService.showMessage("Sync rows filled successfully");});this.$anonymizeButton.click(async () => {await server.post('anonymization/anonymize');- infoService.showMessage("Created anonymized database");+ toastService.showMessage("Created anonymized database");});this.$cleanupSoftDeletedButton.click(async () => {if (confirm("Do you really want to clean up soft-deleted items?")) {await server.post('cleanup/cleanup-soft-deleted-items');- infoService.showMessage("Soft deleted items have been cleaned up");+ toastService.showMessage("Soft deleted items have been cleaned up");}});@@ -40,14 +40,14 @@ export default class AdvancedOptions {if (confirm("Do you really want to clean up unused images?")) {await server.post('cleanup/cleanup-unused-images');- infoService.showMessage("Unused images have been cleaned up");+ toastService.showMessage("Unused images have been cleaned up");}});this.$vacuumDatabaseButton.click(async () => {await server.post('cleanup/vacuum-database');- infoService.showMessage("Database has been vacuumed");+ toastService.showMessage("Database has been vacuumed");});}}\ No newline at end of filediff --git a/src/public/javascripts/dialogs/options/change_password.js b/src/public/javascripts/dialogs/options/change_password.jsindex 5770e63ee0..a55a222bce 100644--- a/src/public/javascripts/dialogs/options/change_password.js+++ b/src/public/javascripts/dialogs/options/change_password.js@@ -1,6 +1,6 @@import server from "../../services/server.js";import protectedSessionHolder from "../../services/protected_session_holder.js";-import infoService from "../../services/info.js";+import toastService from "../../services/toast.js";export default class ChangePasswordOptions {constructor() {@@ -39,7 +39,7 @@ export default class ChangePasswordOptions {protectedSessionHolder.resetProtectedSession();}else {- infoService.showError(result.message);+ toastService.showError(result.message);}});diff --git a/src/public/javascripts/dialogs/options/other.js b/src/public/javascripts/dialogs/options/other.jsindex 98eaafd0a8..52b6fe7f48 100644--- a/src/public/javascripts/dialogs/options/other.js+++ b/src/public/javascripts/dialogs/options/other.js@@ -1,6 +1,6 @@import optionsService from "../../services/options.js";import server from "../../services/server.js";-import infoService from "../../services/info.js";+import toastService from "../../services/toast.js";export default class ProtectedSessionOptions {constructor() {@@ -12,14 +12,14 @@ export default class ProtectedSessionOptions {this.$spellCheckEnabled.change(() => {const opts = { 'spellCheckEnabled': this.$spellCheckEnabled.is(":checked") ? "true" : "false" };- server.put('options', opts).then(() => infoService.showMessage("Options change have been saved."));+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));return false;});this.$spellCheckLanguageCode.change(() => {const opts = { 'spellCheckLanguageCode': this.$spellCheckLanguageCode.val() };- server.put('options', opts).then(() => infoService.showMessage("Options change have been saved."));+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));return false;});@@ -30,7 +30,7 @@ export default class ProtectedSessionOptions {server.put('options', { 'protectedSessionTimeout': protectedSessionTimeout }).then(() => {optionsService.reloadOptions();- infoService.showMessage("Options change have been saved.");+ toastService.showMessage("Options change have been saved.");});return false;@@ -38,7 +38,7 @@ export default class ProtectedSessionOptions {this.$noteRevisionsTimeInterval.change(() => {const opts = { 'noteRevisionSnapshotTimeInterval': this.$noteRevisionsTimeInterval.val() };- server.put('options', opts).then(() => infoService.showMessage("Options change have been saved."));+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));return false;});diff --git a/src/public/javascripts/dialogs/options/sync.js b/src/public/javascripts/dialogs/options/sync.jsindex 379886d653..d69b311be9 100644--- a/src/public/javascripts/dialogs/options/sync.js+++ b/src/public/javascripts/dialogs/options/sync.js@@ -1,5 +1,5 @@import server from "../../services/server.js";-import infoService from "../../services/info.js";+import toastService from "../../services/toast.js";export default class SyncOptions {constructor() {@@ -15,10 +15,10 @@ export default class SyncOptions {const result = await server.post('sync/test');if (result.success) {- infoService.showMessage(result.message);+ toastService.showMessage(result.message);}else {- infoService.showError("Sync server handshake failed, error: " + result.message);+ toastService.showError("Sync server handshake failed, error: " + result.message);}});}@@ -36,7 +36,7 @@ export default class SyncOptions {'syncProxy': this.$syncProxy.val()};- server.put('options', opts).then(() => infoService.showMessage("Options change have been saved."));+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));return false;}diff --git a/src/public/javascripts/dialogs/sql_console.js b/src/public/javascripts/dialogs/sql_console.jsindex c7a6b6a07b..0c1f634682 100644--- a/src/public/javascripts/dialogs/sql_console.js+++ b/src/public/javascripts/dialogs/sql_console.js@@ -1,6 +1,6 @@import libraryLoader from '../services/library_loader.js';import server from '../services/server.js';-import infoService from "../services/info.js";+import toastService from "../services/toast.js";import utils from "../services/utils.js";const $dialog = $("#sql-console-dialog");@@ -63,11 +63,11 @@ async function execute() {});if (!result.success) {- infoService.showError(result.error);+ toastService.showError(result.error);return;}else {- infoService.showMessage("Query was executed successfully.");+ toastService.showMessage("Query was executed successfully.");}const rows = result.rows;diff --git a/src/public/javascripts/services/branches.js b/src/public/javascripts/services/branches.jsindex 7e07c1fec9..c9702bd7db 100644--- a/src/public/javascripts/services/branches.js+++ b/src/public/javascripts/services/branches.js@@ -1,7 +1,7 @@import treeService from './tree.js';import utils from './utils.js';import server from './server.js';-import infoService from "./info.js";+import toastService from "./toast.js";import treeCache from "./tree_cache.js";import treeUtils from "./tree_utils.js";import hoistedNoteService from "./hoisted_note.js";@@ -272,15 +272,15 @@ ws.subscribeToMessages(async message => {}if (message.type === 'task-error') {- infoService.closePersistent(message.taskId);- infoService.showError(message.message);+ toastService.closePersistent(message.taskId);+ toastService.showError(message.message);} else if (message.type === 'task-progress-count') {- infoService.showPersistent(makeToast(message.taskId, "Delete notes in progress: " + message.progressCount));+ toastService.showPersistent(makeToast(message.taskId, "Delete notes in progress: " + message.progressCount));} else if (message.type === 'task-succeeded') {const toast = makeToast(message.taskId, "Delete finished successfully.");toast.closeAfter = 5000;- infoService.showPersistent(toast);+ toastService.showPersistent(toast);}});diff --git a/src/public/javascripts/services/bundle.js b/src/public/javascripts/services/bundle.jsindex 15f55cd38e..95d973085e 100644--- a/src/public/javascripts/services/bundle.js+++ b/src/public/javascripts/services/bundle.js@@ -1,6 +1,6 @@import ScriptContext from "./script_context.js";import server from "./server.js";-import infoService from "./info.js";+import toastService from "./toast.js";async function getAndExecuteBundle(noteId, originEntity = null) {const bundle = await server.get('script/bundle/' + noteId);@@ -17,7 +17,7 @@ async function executeBundle(bundle, originEntity, tabContext, $container) {}.call(apiContext));}catch (e) {- infoService.showAndLogError(`Execution of ${bundle.noteId} failed with error: ${e.message}`);+ toastService.showAndLogError(`Execution of ${bundle.noteId} failed with error: ${e.message}`);}}diff --git a/src/public/javascripts/services/clipboard.js b/src/public/javascripts/services/clipboard.jsindex 245bca80ab..a13c335ed9 100644--- a/src/public/javascripts/services/clipboard.js+++ b/src/public/javascripts/services/clipboard.js@@ -1,7 +1,7 @@import treeUtils from "./tree_utils.js";import treeChangesService from "./branches.js";import cloningService from "./cloning.js";-import infoService from "./info.js";+import toastService from "./toast.js";let clipboardIds = [];let clipboardMode = null;@@ -26,7 +26,7 @@ async function pasteAfter(node) {// just do nothing}else {- infoService.throwError("Unrecognized clipboard mode=" + clipboardMode);+ toastService.throwError("Unrecognized clipboard mode=" + clipboardMode);}}@@ -54,7 +54,7 @@ async function pasteInto(node) {// just do nothing}else {- infoService.throwError("Unrecognized clipboard mode=" + mode);+ toastService.throwError("Unrecognized clipboard mode=" + mode);}}@@ -62,14 +62,14 @@ function copy(nodes) {clipboardIds = nodes.map(node => node.data.noteId);clipboardMode = 'copy';- infoService.showMessage("Note(s) have been copied into clipboard.");+ toastService.showMessage("Note(s) have been copied into clipboard.");}function cut(nodes) {clipboardIds = nodes.map(node => node.key);clipboardMode = 'cut';- infoService.showMessage("Note(s) have been cut into clipboard.");+ toastService.showMessage("Note(s) have been cut into clipboard.");}function isEmpty() {diff --git a/src/public/javascripts/services/frontend_script_api.js b/src/public/javascripts/services/frontend_script_api.jsindex 95f6d95324..dc5ef7f529 100644--- a/src/public/javascripts/services/frontend_script_api.js+++ b/src/public/javascripts/services/frontend_script_api.js@@ -1,7 +1,7 @@import treeService from './tree.js';import server from './server.js';import utils from './utils.js';-import infoService from './info.js';+import toastService from './toast.js';import linkService from './link.js';import treeCache from './tree_cache.js';import noteDetailService from './note_detail.js';@@ -246,7 +246,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte* @method* @param {string} message*/- this.showMessage = infoService.showMessage;+ this.showMessage = toastService.showMessage;/*** Show error message to the user.@@ -254,7 +254,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte* @method* @param {string} message*/- this.showError = infoService.showError;+ this.showError = toastService.showError;/*** Refresh treediff --git a/src/public/javascripts/services/import.js b/src/public/javascripts/services/import.jsindex 7c3c907839..b2c4110225 100644--- a/src/public/javascripts/services/import.js+++ b/src/public/javascripts/services/import.js@@ -1,4 +1,4 @@-import infoService from "./info.js";+import toastService from "./toast.js";import treeService from "./tree.js";import server from "./server.js";import ws from "./ws.js";@@ -53,15 +53,15 @@ ws.subscribeToMessages(async message => {}if (message.type === 'task-error') {- infoService.closePersistent(message.taskId);- infoService.showError(message.message);+ toastService.closePersistent(message.taskId);+ toastService.showError(message.message);} else if (message.type === 'task-progress-count') {- infoService.showPersistent(makeToast(message.taskId, "Import in progress: " + message.progressCount));+ toastService.showPersistent(makeToast(message.taskId, "Import in progress: " + message.progressCount));} else if (message.type === 'task-succeeded') {const toast = makeToast(message.taskId, "Import finished successfully.");toast.closeAfter = 5000;- infoService.showPersistent(toast);+ toastService.showPersistent(toast);await treeService.reloadNote(message.parentNoteId);diff --git a/src/public/javascripts/services/note_detail_code.js b/src/public/javascripts/services/note_detail_code.jsindex d692ffccd7..f464458a82 100644--- a/src/public/javascripts/services/note_detail_code.js+++ b/src/public/javascripts/services/note_detail_code.js@@ -1,6 +1,6 @@import libraryLoader from "./library_loader.js";import bundleService from "./bundle.js";-import infoService from "./info.js";+import toastService from "./toast.js";import server from "./server.js";import noteDetailService from "./note_detail.js";import utils from "./utils.js";@@ -102,7 +102,7 @@ class NoteDetailCode {await server.post('script/run/' + this.ctx.note.noteId);}- infoService.showMessage("Note executed");+ toastService.showMessage("Note executed");}onNoteChange(func) {diff --git a/src/public/javascripts/services/note_detail_image.js b/src/public/javascripts/services/note_detail_image.jsindex f0dc2e9c64..c6ac8417f8 100644--- a/src/public/javascripts/services/note_detail_image.js+++ b/src/public/javascripts/services/note_detail_image.js@@ -1,5 +1,5 @@import utils from "./utils.js";-import infoService from "./info.js";+import toastService from "./toast.js";import server from "./server.js";class NoteDetailImage {@@ -28,10 +28,10 @@ class NoteDetailImage {const success = document.execCommand('copy');if (success) {- infoService.showMessage("Image copied to the clipboard");+ toastService.showMessage("Image copied to the clipboard");}else {- infoService.showAndLogError("Could not copy the image to clipboard.");+ toastService.showAndLogError("Could not copy the image to clipboard.");}}finally {diff --git a/src/public/javascripts/services/note_detail_relation_map.js b/src/public/javascripts/services/note_detail_relation_map.jsindex 3465671161..016e0a7f36 100644--- a/src/public/javascripts/services/note_detail_relation_map.js+++ b/src/public/javascripts/services/note_detail_relation_map.js@@ -4,7 +4,7 @@ import linkService from "./link.js";import libraryLoader from "./library_loader.js";import treeService from "./tree.js";import contextMenuWidget from "./context_menu.js";-import infoService from "./info.js";+import toastService from "./toast.js";import attributeAutocompleteService from "./attribute_autocomplete.js";const uniDirectionalOverlays = [@@ -134,7 +134,7 @@ class NoteDetailRelationMap {target: 'into'});- infoService.showMessage("Click on canvas to place new note");+ toastService.showMessage("Click on canvas to place new note");// reloading tree so that the new note appears there// no need to wait for it to finish@@ -576,7 +576,7 @@ class NoteDetailRelationMap {const exists = this.mapData.notes.some(n => n.noteId === note.noteId);if (exists) {- infoService.showError(`Note "${note.title}" is already in the diagram.`);+ toastService.showError(`Note "${note.title}" is already in the diagram.`);continue;}diff --git a/src/public/javascripts/services/protected_session.js b/src/public/javascripts/services/protected_session.jsindex 860d7de140..237bbebdc6 100644--- a/src/public/javascripts/services/protected_session.js+++ b/src/public/javascripts/services/protected_session.js@@ -3,7 +3,7 @@ import noteDetailService from './note_detail.js';import utils from './utils.js';import server from './server.js';import protectedSessionHolder from './protected_session_holder.js';-import infoService from "./info.js";+import toastService from "./toast.js";import ws from "./ws.js";const $enterProtectedSessionButton = $("#enter-protected-session-button");@@ -38,7 +38,7 @@ async function setupProtectedSession(password) {const response = await enterProtectedSessionOnServer(password);if (!response.success) {- infoService.showError("Wrong password.", 3000);+ toastService.showError("Wrong password.", 3000);return;}@@ -60,7 +60,7 @@ async function setupProtectedSession(password) {$enterProtectedSessionButton.hide();$leaveProtectedSessionButton.show();- infoService.showMessage("Protected session has been started.");+ toastService.showMessage("Protected session has been started.");}async function enterProtectedSessionOnServer(password) {@@ -90,7 +90,7 @@ async function unprotectNoteAndSendToServer() {const activeNote = noteDetailService.getActiveNote();if (!activeNote.isProtected) {- infoService.showAndLogError(`Note ${activeNote.noteId} is not protected`);+ toastService.showAndLogError(`Note ${activeNote.noteId} is not protected`);return;}@@ -139,15 +139,15 @@ ws.subscribeToMessages(async message => {const protectingLabel = message.data.protect ? "Protecting" : "Unprotecting";if (message.type === 'task-error') {- infoService.closePersistent(message.taskId);- infoService.showError(message.message);+ toastService.closePersistent(message.taskId);+ toastService.showError(message.message);} else if (message.type === 'task-progress-count') {- infoService.showPersistent(makeToast(message, protectingLabel,protectingLabel + " in progress: " + message.progressCount));+ toastService.showPersistent(makeToast(message, protectingLabel,protectingLabel + " in progress: " + message.progressCount));} else if (message.type === 'task-succeeded') {const toast = makeToast(message, protectingLabel, protectingLabel + " finished successfully.");toast.closeAfter = 3000;- infoService.showPersistent(toast);+ toastService.showPersistent(toast);}});diff --git a/src/public/javascripts/services/search_notes.js b/src/public/javascripts/services/search_notes.jsindex e37df3818e..b23b9de07f 100644--- a/src/public/javascripts/services/search_notes.js+++ b/src/public/javascripts/services/search_notes.js@@ -1,7 +1,7 @@import treeService from './tree.js';import treeCache from "./tree_cache.js";import server from './server.js';-import infoService from "./info.js";+import toastService from "./toast.js";const $searchInput = $("input[name='search-text']");const $resetSearchButton = $("#reset-search-button");@@ -73,7 +73,7 @@ async function doSearch(searchText) {}if (searchText.trim().length === 0) {- infoService.showMessage("Please enter search criteria first.");+ toastService.showMessage("Please enter search criteria first.");$searchInput.focus();@@ -85,7 +85,7 @@ async function doSearch(searchText) {const response = await server.get('search/' + encodeURIComponent(searchText));if (!response.success) {- infoService.showError("Search failed.", 3000);+ toastService.showError("Search failed.", 3000);return;}@@ -105,7 +105,7 @@ async function doSearch(searchText) {// have at least some feedback which is good especially in situations// when the result list does not change with a query- infoService.showMessage("Search finished successfully.");+ toastService.showMessage("Search finished successfully.");}async function saveSearch() {@@ -139,7 +139,7 @@ async function refreshSearch() {activeNode.load(true);activeNode.setExpanded(true);- infoService.showMessage("Saved search note refreshed.");+ toastService.showMessage("Saved search note refreshed.");}function init() {diff --git a/src/public/javascripts/services/server.js b/src/public/javascripts/services/server.jsindex 3ab8a118c7..6cfcc9a6c9 100644--- a/src/public/javascripts/services/server.js+++ b/src/public/javascripts/services/server.js@@ -1,5 +1,5 @@import utils from './utils.js';-import infoService from "./info.js";+import toastService from "./toast.js";const REQUEST_LOGGING_ENABLED = false;@@ -87,8 +87,8 @@ async function ajax(url, method, data) {return await $.ajax(options).catch(e => {const message = "Error when calling " + method + " " + url + ": " + e.status + " - " + e.statusText;- infoService.showError(message);- infoService.throwError(message);+ toastService.showError(message);+ toastService.throwError(message);});}diff --git a/src/public/javascripts/services/sync.js b/src/public/javascripts/services/sync.jsindex bff13bbe48..c5b16a3bd7 100644--- a/src/public/javascripts/services/sync.js+++ b/src/public/javascripts/services/sync.js@@ -1,18 +1,18 @@import server from './server.js';-import infoService from "./info.js";+import toastService from "./toast.js";async function syncNow() {const result = await server.post('sync/now');if (result.success) {- infoService.showMessage("Sync finished successfully.");+ toastService.showMessage("Sync finished successfully.");}else {if (result.message.length > 50) {result.message = result.message.substr(0, 50);}- infoService.showError("Sync failed: " + result.message);+ toastService.showError("Sync failed: " + result.message);}}@@ -21,7 +21,7 @@ $("#sync-now-button").click(syncNow);async function forceNoteSync(noteId) {await server.post('sync/force-note-sync/' + noteId);- infoService.showMessage("Note added to sync queue.");+ toastService.showMessage("Note added to sync queue.");}export default {diff --git a/src/public/javascripts/services/info.js b/src/public/javascripts/services/toast.jssimilarity index 100%rename from src/public/javascripts/services/info.jsrename to src/public/javascripts/services/toast.jsdiff --git a/src/public/javascripts/services/tree.js b/src/public/javascripts/services/tree.jsindex df2c148a74..9386d8e7f0 100644--- a/src/public/javascripts/services/tree.js+++ b/src/public/javascripts/services/tree.js@@ -7,7 +7,7 @@ import treeUtils from './tree_utils.js';import utils from './utils.js';import server from './server.js';import treeCache from './tree_cache.js';-import infoService from "./info.js";+import toastService from "./toast.js";import treeBuilder from "./tree_builder.js";import treeKeyBindings from "./tree_keybindings.js";import Branch from '../entities/branch.js';@@ -295,7 +295,7 @@ async function getSomeNotePath(note) {const parents = await cur.getParentNotes();if (!parents.length) {- infoService.throwError(`Can't find parents for note ${cur.noteId}`);+ toastService.throwError(`Can't find parents for note ${cur.noteId}`);return;}@@ -695,7 +695,7 @@ async function createNote(node, parentNoteId, target, extraOptions = {}) {node.renderTitle();}else {- infoService.throwError("Unrecognized target: " + target);+ toastService.throwError("Unrecognized target: " + target);}clearSelectedNodes(); // to unmark previously active node@@ -853,7 +853,7 @@ async function duplicateNote(noteId, parentNoteId) {await activateNote(note.noteId);const origNote = await treeCache.getNote(noteId);- infoService.showMessage(`Note "${origNote.title}" has been duplicated`);+ toastService.showMessage(`Note "${origNote.title}" has been duplicated`);}diff --git a/src/public/javascripts/services/tree_cache.js b/src/public/javascripts/services/tree_cache.jsindex 88ab03df0f..9c94a911de 100644--- a/src/public/javascripts/services/tree_cache.js+++ b/src/public/javascripts/services/tree_cache.js@@ -1,7 +1,7 @@import utils from "./utils.js";import Branch from "../entities/branch.js";import NoteShort from "../entities/note_short.js";-import infoService from "./info.js";+import toastService from "./toast.js";import ws from "./ws.js";import server from "./server.js";@@ -197,7 +197,7 @@ class TreeCache {const branchId = this.childParentToBranch[key];if (!branchId) {- infoService.throwError("Cannot find branch for child-parent=" + key);+ toastService.throwError("Cannot find branch for child-parent=" + key);}return branchId;diff --git a/src/public/javascripts/services/ws.js b/src/public/javascripts/services/ws.jsindex 19df68ae4c..fbfab86eac 100644--- a/src/public/javascripts/services/ws.js+++ b/src/public/javascripts/services/ws.js@@ -1,5 +1,5 @@import utils from './utils.js';-import infoService from "./info.js";+import toastService from "./toast.js";import treeService from "./tree.js";const $outstandingSyncsCount = $("#outstanding-syncs-count");@@ -65,10 +65,10 @@ function handleMessage(event) {$outstandingSyncsCount.html(message.outstandingSyncs);}else if (message.type === 'sync-hash-check-failed') {- infoService.showError("Sync check failed!", 60000);+ toastService.showError("Sync check failed!", 60000);}else if (message.type === 'consistency-checks-failed') {- infoService.showError("Consistency checks failed! See logs for details.", 50 * 60000);+ toastService.showError("Consistency checks failed! See logs for details.", 50 * 60000);}}