mirror of
https://github.com/zadam/trilium.git
synced 2025-11-08 06:15:48 +01:00
add possibility to debug search queries by logging expression tree, #1655
This commit is contained in:
35
src/public/app/widgets/search_options/debug.js
Normal file
35
src/public/app/widgets/search_options/debug.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import AbstractSearchOption from "./abstract_search_option.js";
|
||||
|
||||
const TPL = `
|
||||
<tr data-search-option-conf="debug">
|
||||
<td colSpan="2">
|
||||
<span class="bx bx-bug"></span>
|
||||
|
||||
Debug
|
||||
</td>
|
||||
<td class="button-column">
|
||||
<div class="dropdown help-dropdown">
|
||||
<span class="bx bx-help-circle icon-action" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span>
|
||||
<div class="dropdown-menu dropdown-menu-right p-4">
|
||||
<p>Debug will print extra debugging information into the console to aid in debugging complex queries.</p>
|
||||
|
||||
<p>To access the debug information, execute query and click on "Show backend log" in top left corner.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span class="bx bx-x icon-action search-option-del"></span>
|
||||
</td>
|
||||
</tr>`;
|
||||
|
||||
export default class Debug extends AbstractSearchOption {
|
||||
static get optionName() { return "debug" };
|
||||
static get attributeType() { return "label" };
|
||||
|
||||
static async create(noteId) {
|
||||
await AbstractSearchOption.setAttribute(noteId,'label', 'debug');
|
||||
}
|
||||
|
||||
doRender() {
|
||||
return $(TPL);
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import OrderBy from "../search_options/order_by.js";
|
||||
import SearchScript from "../search_options/search_script.js";
|
||||
import Limit from "../search_options/limit.js";
|
||||
import DeleteNoteRevisionsSearchAction from "../search_actions/delete_note_revisions.js";
|
||||
import Debug from "../search_options/debug.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="search-definition-widget">
|
||||
@@ -113,6 +114,11 @@ const TPL = `
|
||||
limit
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn btn-sm" data-search-option-add="debug" title="Debug will print extra debugging information into the console to aid in debugging complex queries">
|
||||
<span class="bx bx-bug"></span>
|
||||
debug
|
||||
</button>
|
||||
|
||||
<div class="dropdown" style="display: inline-block;">
|
||||
<button class="btn btn-sm dropdown-toggle action-add-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="bx bxs-zap"></span>
|
||||
@@ -173,7 +179,8 @@ const OPTION_CLASSES = [
|
||||
FastSearch,
|
||||
IncludeArchivedNotes,
|
||||
OrderBy,
|
||||
Limit
|
||||
Limit,
|
||||
Debug
|
||||
];
|
||||
|
||||
const ACTION_CLASSES = {};
|
||||
|
||||
Reference in New Issue
Block a user