Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zadam committed Dec 21, 2021
1 parent b30792a commit 1e84722
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/public/app/services/entrypoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,13 @@ export default class Entrypoints extends Component {
} else if (note.mime.endsWith("env=backend")) {
await server.post('script/run/' + note.noteId);
} else if (note.mime === 'text/x-sqlite;schema=trilium') {
const {results} = await server.post("sql/execute/" + note.noteId);
const resp = await server.post("sql/execute/" + note.noteId);

await appContext.triggerEvent('sqlQueryResults', {ntxId: ntxId, results: results});
if (!resp.success) {
alert("Error occurred while executing SQL query: " + resp.message);
}

await appContext.triggerEvent('sqlQueryResults', {ntxId: ntxId, results: resp.results});
}

toastService.showMessage("Note executed");
Expand Down
4 changes: 4 additions & 0 deletions src/public/app/services/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ async function resolveNotePathToSegments(notePath, hoistedNoteId = 'root', logEr
if (someNotePath) { // in case it's root the path may be empty
const pathToRoot = someNotePath.split("/").reverse().slice(1);

if (!pathToRoot.includes("root")) {
pathToRoot.push('root');
}

for (const noteId of pathToRoot) {
effectivePathSegments.push(noteId);
}
Expand Down
3 changes: 2 additions & 1 deletion src/services/consistency_checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ class ConsistencyChecks {
FROM branches
WHERE noteId = ?
and parentNoteId = ?
and isDeleted = 0`, [noteId, parentNoteId]);
and isDeleted = 0
ORDER BY utcDateCreated`, [noteId, parentNoteId]);

const branches = branchIds.map(branchId => becca.getBranch(branchId));

Expand Down
1 change: 1 addition & 0 deletions src/services/special_notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function getHiddenRoot() {

if (!hidden) {
hidden = noteService.createNewNote({
branchId: 'hidden',
noteId: 'hidden',
title: 'hidden',
type: 'text',
Expand Down

0 comments on commit 1e84722

Please sign in to comment.