mirror of https://github.com/TriliumNext/Notes
Merge remote-tracking branch 'origin/master'
commit
1640a8aa7d
@ -0,0 +1,33 @@
|
||||
// the history was previously not exposed and the fact they were not cleaned up is rather a side-effect than an intention
|
||||
|
||||
module.exports = () => {
|
||||
const cls = require("../../src/services/cls");
|
||||
const beccaLoader = require("../../src/becca/becca_loader");
|
||||
const becca = require("../../src/becca/becca");
|
||||
|
||||
cls.init(() => {
|
||||
beccaLoader.load();
|
||||
|
||||
// deleting just branches because they might be cloned (and therefore saved) also outside of the hidden subtree
|
||||
|
||||
const searchRoot = becca.getNote('search');
|
||||
|
||||
for (const searchBranch of searchRoot.getChildBranches()) {
|
||||
const searchNote = searchBranch.getNote();
|
||||
|
||||
if (searchNote.type === 'search') {
|
||||
searchBranch.deleteBranch('0206__delete_search_and_sql_console_history');
|
||||
}
|
||||
}
|
||||
|
||||
const sqlConsoleRoot = becca.getNote('sqlConsole');
|
||||
|
||||
for (const sqlConsoleBranch of sqlConsoleRoot.getChildBranches()) {
|
||||
const sqlConsoleNote = sqlConsoleBranch.getNote();
|
||||
|
||||
if (sqlConsoleNote.type === 'code' && sqlConsoleNote.mime === 'text/x-sqlite;schema=trilium') {
|
||||
sqlConsoleBranch.deleteBranch('0206__delete_search_and_sql_console_history');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -0,0 +1,2 @@
|
||||
UPDATE notes SET title = 'SQL Console History' WHERE noteId = 'sqlConsole';
|
||||
UPDATE notes SET title = 'Search History' WHERE noteId = 'search';
|
||||
@ -0,0 +1,44 @@
|
||||
import NoteContextAwareWidget from "../../note_context_aware_widget.js";
|
||||
import server from "../../../services/server.js";
|
||||
|
||||
const TPL = `<div style="height: 100%; display: flex; flex-direction: column;">
|
||||
<style>
|
||||
.backend-log-textarea {
|
||||
flex-grow: 1;
|
||||
width: 100%;
|
||||
border: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<textarea class="backend-log-textarea" readonly="readonly"></textarea>
|
||||
|
||||
<div style="display: flex; justify-content: space-around; margin-top: 10px;">
|
||||
<button class="refresh-backend-log-button btn btn-primary">Refresh</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
export default class ContentLogWidget extends NoteContextAwareWidget {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$backendLogTextArea = this.$widget.find(".backend-log-textarea");
|
||||
this.$refreshBackendLog = this.$widget.find(".refresh-backend-log-button");
|
||||
|
||||
this.$refreshBackendLog.on('click', () => this.load());
|
||||
}
|
||||
|
||||
scrollToBottom() {
|
||||
this.$backendLogTextArea.scrollTop(this.$backendLogTextArea[0].scrollHeight);
|
||||
}
|
||||
|
||||
async refresh() {
|
||||
await this.load();
|
||||
}
|
||||
|
||||
async load() {
|
||||
const backendLog = await server.get('backend-log');
|
||||
|
||||
this.$backendLogTextArea.text(backendLog);
|
||||
|
||||
this.scrollToBottom();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue