diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 000000000..797acea53
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/package.json b/package.json
index a0fb97420..c2642e397 100644
--- a/package.json
+++ b/package.json
@@ -57,7 +57,7 @@
"jimp": "0.16.1",
"joplin-turndown-plugin-gfm": "1.0.12",
"jsdom": "16.6.0",
- "mime-types": "2.1.31",
+ "mime-types": "2.1.32",
"multer": "1.4.2",
"node-abi": "2.30.0",
"open": "8.2.1",
@@ -90,7 +90,7 @@
"jsdoc": "3.6.7",
"lorem-ipsum": "2.0.3",
"rcedit": "3.0.1",
- "webpack": "5.46.0",
+ "webpack": "5.47.0",
"webpack-cli": "4.7.2"
},
"optionalDependencies": {
diff --git a/src/public/app/services/entrypoints.js b/src/public/app/services/entrypoints.js
index 191866aaa..bd33aab2c 100644
--- a/src/public/app/services/entrypoints.js
+++ b/src/public/app/services/entrypoints.js
@@ -194,8 +194,7 @@ export default class Entrypoints extends Component {
}
async runActiveNoteCommand() {
- const noteContext = appContext.tabManager.getActiveContext();
- const note = noteContext.note;
+ const {ntxId, note} = appContext.tabManager.getActiveContext();
// ctrl+enter is also used elsewhere so make sure we're running only when appropriate
if (!note || note.type !== 'code') {
@@ -208,9 +207,9 @@ 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 result = await server.post("sql/execute/" + note.noteId);
+ const {results} = await server.post("sql/execute/" + note.noteId);
- this.triggerEvent('sqlQueryResults', {ntxId: noteContext.ntxId, results: result.results});
+ await appContext.triggerEvent('sqlQueryResults', {ntxId: ntxId, results: results});
}
toastService.showMessage("Note executed");
diff --git a/src/public/app/widgets/sql_result.js b/src/public/app/widgets/sql_result.js
index c3c42d192..895b0d1f1 100644
--- a/src/public/app/widgets/sql_result.js
+++ b/src/public/app/widgets/sql_result.js
@@ -8,6 +8,10 @@ const TPL = `
}
+
+ No rows have been returned for this query.
+
+
`;
@@ -21,7 +25,8 @@ export default class SqlResultWidget extends NoteContextAwareWidget {
doRender() {
this.$widget = $(TPL);
- this.$sqlConsoleResultContainer = this.$widget.find('.sql-console-result-container');
+ this.$resultContainer = this.$widget.find('.sql-console-result-container');
+ this.$noRowsAlert = this.$widget.find('.sql-query-no-rows');
}
async sqlQueryResultsEvent({ntxId, results}) {
@@ -29,7 +34,10 @@ export default class SqlResultWidget extends NoteContextAwareWidget {
return;
}
- this.$sqlConsoleResultContainer.empty();
+ this.$noRowsAlert.toggle(results.length === 1 && results[0].length === 0);
+ this.$resultContainer.toggle(results.length > 1 || results[0].length > 0);
+
+ this.$resultContainer.empty();
for (const rows of results) {
if (!rows.length) {
@@ -37,7 +45,7 @@ export default class SqlResultWidget extends NoteContextAwareWidget {
}
const $table = $('');
- this.$sqlConsoleResultContainer.append($table);
+ this.$resultContainer.append($table);
const result = rows[0];
const $row = $("");
diff --git a/src/public/app/widgets/sql_table_schemas.js b/src/public/app/widgets/sql_table_schemas.js
index bf6b9b3a4..d1e4d9e63 100644
--- a/src/public/app/widgets/sql_table_schemas.js
+++ b/src/public/app/widgets/sql_table_schemas.js
@@ -8,6 +8,10 @@ import toastService from "../services/toast.js";
const TPL = `