From 5a8c3f6a2ba9cf9ce82c980e58aba55247af165f Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 28 Aug 2020 22:52:57 +0200 Subject: [PATCH] removed forgotten console.logs --- src/public/app/widgets/attribute_editor.js | 4 ++-- src/public/app/widgets/note_tree.js | 4 +--- src/public/app/widgets/type_widgets/image.js | 2 +- src/routes/api/recent_changes.js | 2 -- src/services/search/services/search.js | 14 ++++++++------ src/services/utils.js | 7 ++++--- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/public/app/widgets/attribute_editor.js b/src/public/app/widgets/attribute_editor.js index d1113c708..2db6cb480 100644 --- a/src/public/app/widgets/attribute_editor.js +++ b/src/public/app/widgets/attribute_editor.js @@ -394,7 +394,7 @@ export default class AttributeEditorWidget extends TabAwareWidget { } } - showHelpTooltip() {console.log("showHelpTooltip"); + showHelpTooltip() { this.attributeDetailWidget.hide(); this.$editor.tooltip({ @@ -454,7 +454,7 @@ export default class AttributeEditorWidget extends TabAwareWidget { attributeRenderer.renderAttribute(attribute, $attributesContainer, true); } } - + this.textEditor.setData($attributesContainer.html()); if (saved) { diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js index 45f9919da..5e4c3e3fd 100644 --- a/src/public/app/widgets/note_tree.js +++ b/src/public/app/widgets/note_tree.js @@ -977,14 +977,12 @@ export default class NoteTreeWidget extends TabAwareWidget { toastService.showMessage("Auto collapsing notes after inactivity..."); noneCollapsedYet = false; } - - console.log("Auto collapsed", node.data.noteId); } }, false); }, 600 * 1000); } - async entitiesReloadedEvent({loadResults}) {console.log(loadResults); + async entitiesReloadedEvent({loadResults}) { this.activityDetected(); if (loadResults.isEmptyForTree()) { diff --git a/src/public/app/widgets/type_widgets/image.js b/src/public/app/widgets/type_widgets/image.js index 2009fb088..5e5ffc567 100644 --- a/src/public/app/widgets/type_widgets/image.js +++ b/src/public/app/widgets/type_widgets/image.js @@ -127,7 +127,7 @@ class ImageTypeWidget extends TypeWidget { this.$widget.show(); - const noteComplement = await this.tabContext.getNoteComplement();console.log(noteComplement, note); + const noteComplement = await this.tabContext.getNoteComplement(); this.$fileName.text(attributeMap.originalFileName || "?"); this.$fileSize.text(noteComplement.contentLength + " bytes"); diff --git a/src/routes/api/recent_changes.js b/src/routes/api/recent_changes.js index a9254be6d..1a8e1a331 100644 --- a/src/routes/api/recent_changes.js +++ b/src/routes/api/recent_changes.js @@ -55,8 +55,6 @@ function getRecentChanges(req) { recentChanges = recentChanges.slice(0, Math.min(500, recentChanges.length)); - console.log(recentChanges); - for (const change of recentChanges) { if (change.current_isProtected) { if (protectedSessionService.isProtectedSessionAvailable()) { diff --git a/src/services/search/services/search.js b/src/services/search/services/search.js index 495e0b321..1b2b27e71 100644 --- a/src/services/search/services/search.js +++ b/src/services/search/services/search.js @@ -30,7 +30,7 @@ function findNotesWithExpression(expression) { const noteSet = expression.execute(allNoteSet, searchContext); - let searchResults = noteSet.notes + const searchResults = noteSet.notes .map(note => searchContext.noteIdToNotePath[note.noteId] || noteCacheService.getSomePath(note)) .filter(notePathArray => notePathArray.includes(hoistedNoteService.getHoistedNoteId())) .map(notePathArray => new SearchResult(notePathArray)); @@ -70,13 +70,15 @@ function parseQueryToExpression(query, parsingContext) { * @return {SearchResult[]} */ function findNotesWithQuery(query, parsingContext) { - const expression = parseQueryToExpression(query, parsingContext); + return utils.stopWatch(`Search with query "${query}"`, () => { + const expression = parseQueryToExpression(query, parsingContext); - if (!expression) { - return []; - } + if (!expression) { + return []; + } - return findNotesWithExpression(expression); + return findNotesWithExpression(expression); + }); } /** diff --git a/src/services/utils.js b/src/services/utils.js index aecb93999..843b45c48 100644 --- a/src/services/utils.js +++ b/src/services/utils.js @@ -7,6 +7,7 @@ const escape = require('escape-html'); const sanitize = require("sanitize-filename"); const mimeTypes = require('mime-types'); const path = require('path'); +const log = require('./log'); function newEntityId() { return randomString(12); @@ -65,13 +66,13 @@ function prepareSqlForLike(prefix, str, suffix) { } function stopWatch(what, func) { - const start = new Date(); + const start = Date.now(); const ret = func(); - const tookMs = Date.now() - start.getTime(); + const tookMs = Date.now() - start; - console.log(`${what} took ${tookMs}ms`); + log.info(`${what} took ${tookMs}ms`); return ret; }