mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
added "backend log" dialog
This commit is contained in:
parent
cf6f04defb
commit
156f040880
14
package-lock.json
generated
14
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"version": "0.37.8",
|
"version": "0.38.0-beta",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -6996,9 +6996,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"glob": {
|
"glob": {
|
||||||
"version": "7.1.4",
|
"version": "7.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||||
"integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
|
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"fs.realpath": "^1.0.0",
|
"fs.realpath": "^1.0.0",
|
||||||
"inflight": "^1.0.4",
|
"inflight": "^1.0.4",
|
||||||
@ -9307,9 +9307,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sqlite3": {
|
"sqlite3": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-4.1.1.tgz",
|
||||||
"integrity": "sha512-RvqoKxq+8pDHsJo7aXxsFR18i+dU2Wp5o12qAJOV5LNcDt+fgJsc2QKKg3sIRfXrN9ZjzY1T7SNe/DFVqAXjaw==",
|
"integrity": "sha512-CvT5XY+MWnn0HkbwVKJAyWEMfzpAPwnTiB3TobA5Mri44SrTovmmh499NPQP+gatkeOipqPlBLel7rn4E/PCQg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"nan": "^2.12.1",
|
"nan": "^2.12.1",
|
||||||
"node-pre-gyp": "^0.11.0",
|
"node-pre-gyp": "^0.11.0",
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
"session-file-store": "1.3.1",
|
"session-file-store": "1.3.1",
|
||||||
"simple-node-logger": "18.12.23",
|
"simple-node-logger": "18.12.23",
|
||||||
"sqlite": "3.0.3",
|
"sqlite": "3.0.3",
|
||||||
"sqlite3": "4.1.0",
|
"sqlite3": "4.1.1",
|
||||||
"string-similarity": "3.0.0",
|
"string-similarity": "3.0.0",
|
||||||
"tar-stream": "2.1.0",
|
"tar-stream": "2.1.0",
|
||||||
"turndown": "5.0.3",
|
"turndown": "5.0.3",
|
||||||
|
32
src/public/javascripts/dialogs/backend_log.js
Normal file
32
src/public/javascripts/dialogs/backend_log.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import server from "../services/server.js";
|
||||||
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
|
const $dialog = $("#backend-log-dialog");
|
||||||
|
const $backendLogTextArea = $("#backend-log-textarea");
|
||||||
|
const $refreshBackendLog = $("#refresh-backend-log-button");
|
||||||
|
|
||||||
|
export async function showDialog() {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
|
$dialog.modal();
|
||||||
|
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
function scrollToBottom() {
|
||||||
|
$backendLogTextArea.scrollTop($backendLogTextArea[0].scrollHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function load() {
|
||||||
|
const backendLog = await server.get('backend-log');
|
||||||
|
|
||||||
|
$backendLogTextArea.text(backendLog);
|
||||||
|
|
||||||
|
scrollToBottom();
|
||||||
|
}
|
||||||
|
|
||||||
|
$refreshBackendLog.on('click', load);
|
||||||
|
|
||||||
|
$dialog.on('shown.bs.modal', scrollToBottom);
|
@ -17,6 +17,7 @@ const JUMP_TO_NOTE = "../dialogs/jump_to_note.js";
|
|||||||
const NOTE_SOURCE = "../dialogs/note_source.js";
|
const NOTE_SOURCE = "../dialogs/note_source.js";
|
||||||
const RECENT_CHANGES = "../dialogs/recent_changes.js";
|
const RECENT_CHANGES = "../dialogs/recent_changes.js";
|
||||||
const SQL_CONSOLE = "../dialogs/sql_console.js";
|
const SQL_CONSOLE = "../dialogs/sql_console.js";
|
||||||
|
const BACKEND_LOG = "../dialogs/backend_log.js";
|
||||||
const ATTRIBUTES = "../dialogs/attributes.js";
|
const ATTRIBUTES = "../dialogs/attributes.js";
|
||||||
const HELP = "../dialogs/help.js";
|
const HELP = "../dialogs/help.js";
|
||||||
const NOTE_INFO = "../dialogs/note_info.js";
|
const NOTE_INFO = "../dialogs/note_info.js";
|
||||||
@ -95,6 +96,10 @@ function registerEntrypoints() {
|
|||||||
$("#open-sql-console-button").on('click', showSqlConsoleDialog);
|
$("#open-sql-console-button").on('click', showSqlConsoleDialog);
|
||||||
keyboardActionService.setGlobalActionHandler("ShowSQLConsole", showSqlConsoleDialog);
|
keyboardActionService.setGlobalActionHandler("ShowSQLConsole", showSqlConsoleDialog);
|
||||||
|
|
||||||
|
const showBackendLogDialog = () => import(BACKEND_LOG).then(d => d.showDialog());
|
||||||
|
$("#show-backend-log-button").on('click', showBackendLogDialog);
|
||||||
|
keyboardActionService.setGlobalActionHandler("ShowBackendLog", showBackendLogDialog);
|
||||||
|
|
||||||
$("#show-about-dialog-button").on('click', () => import(ABOUT).then(d => d.showDialog()));
|
$("#show-about-dialog-button").on('click', () => import(ABOUT).then(d => d.showDialog()));
|
||||||
|
|
||||||
if (utils.isElectron()) {
|
if (utils.isElectron()) {
|
||||||
|
15
src/routes/api/backend_log.js
Normal file
15
src/routes/api/backend_log.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const dateUtils = require('../../services/date_utils');
|
||||||
|
const {LOG_DIR} = require('../../services/data_dir.js');
|
||||||
|
|
||||||
|
async function getBackendLog() {
|
||||||
|
const file = `${LOG_DIR}/trilium-${dateUtils.localNowDate()}.log`;
|
||||||
|
|
||||||
|
return fs.readFileSync(file, 'utf8');
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
getBackendLog
|
||||||
|
};
|
@ -35,6 +35,7 @@ const linkMapRoute = require('./api/link_map');
|
|||||||
const clipperRoute = require('./api/clipper');
|
const clipperRoute = require('./api/clipper');
|
||||||
const similarNotesRoute = require('./api/similar_notes');
|
const similarNotesRoute = require('./api/similar_notes');
|
||||||
const keysRoute = require('./api/keys');
|
const keysRoute = require('./api/keys');
|
||||||
|
const backendLogRoute = require('./api/backend_log');
|
||||||
|
|
||||||
const log = require('../services/log');
|
const log = require('../services/log');
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
@ -247,6 +248,8 @@ function register(app) {
|
|||||||
apiRoute(GET, '/api/keyboard-actions', keysRoute.getKeyboardActions);
|
apiRoute(GET, '/api/keyboard-actions', keysRoute.getKeyboardActions);
|
||||||
apiRoute(GET, '/api/keyboard-shortcuts-for-notes', keysRoute.getShortcutsForNotes);
|
apiRoute(GET, '/api/keyboard-shortcuts-for-notes', keysRoute.getShortcutsForNotes);
|
||||||
|
|
||||||
|
apiRoute(GET, '/api/backend-log', backendLogRoute.getBackendLog);
|
||||||
|
|
||||||
app.use('', router);
|
app.use('', router);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,6 +225,11 @@ const DEFAULT_KEYBOARD_ACTIONS = [
|
|||||||
defaultShortcuts: ["Alt+O"],
|
defaultShortcuts: ["Alt+O"],
|
||||||
description: "Shows SQL Console dialog"
|
description: "Shows SQL Console dialog"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
actionName: "ShowBackendLog",
|
||||||
|
defaultShortcuts: [],
|
||||||
|
description: "Shows Backend Log dialog"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
actionName: "ShowHelp",
|
actionName: "ShowHelp",
|
||||||
defaultShortcuts: ["F1"],
|
defaultShortcuts: ["F1"],
|
||||||
|
@ -81,6 +81,12 @@
|
|||||||
<kbd data-kb-action="ShowSQLConsole"></kbd>
|
<kbd data-kb-action="ShowSQLConsole"></kbd>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<a class="dropdown-item" id="show-backend-log-button">
|
||||||
|
<span class="bx bx-empty"></span>
|
||||||
|
Show backend log
|
||||||
|
<kbd data-kb-action="ShowBackendLog"></kbd>
|
||||||
|
</a>
|
||||||
|
|
||||||
<a class="dropdown-item" id="reload-frontend-button" title="Reload can help with some visual glitches without restarting the whole app.">
|
<a class="dropdown-item" id="reload-frontend-button" title="Reload can help with some visual glitches without restarting the whole app.">
|
||||||
<span class="bx bx-empty"></span>
|
<span class="bx bx-empty"></span>
|
||||||
Reload frontend
|
Reload frontend
|
||||||
@ -187,6 +193,7 @@
|
|||||||
<% include dialogs/link_map.ejs %>
|
<% include dialogs/link_map.ejs %>
|
||||||
<% include dialogs/clone_to.ejs %>
|
<% include dialogs/clone_to.ejs %>
|
||||||
<% include dialogs/move_to.ejs %>
|
<% include dialogs/move_to.ejs %>
|
||||||
|
<% include dialogs/backend_log.ejs %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
18
src/views/dialogs/backend_log.ejs
Normal file
18
src/views/dialogs/backend_log.ejs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<div id="backend-log-dialog" class="modal fade mx-auto" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog modal-xl" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Backend log</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<textarea id="backend-log-textarea" readonly="readonly" style="min-height: 600px; width: 100%;"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button id="refresh-backend-log-button" class="btn btn-primary">Refresh</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -2,6 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
<link rel="shortcut icon" href="favicon.ico">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
<title>Trilium Notes</title>
|
<title>Trilium Notes</title>
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="images/app-icons/ios/apple-touch-icon.png">
|
<link rel="apple-touch-icon" sizes="180x180" href="images/app-icons/ios/apple-touch-icon.png">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user