Skip to content

Build your personal knowledge base with Trilium Notes

added subtree note count into info widget

zadamec2f8ec79671
diff --git a/src/public/app/widgets/collapsible_widgets/note_info.js b/src/public/app/widgets/collapsible_widgets/note_info.js
index c204590fed..8c677c4a1f 100644
--- a/src/public/app/widgets/collapsible_widgets/note_info.js
+++ b/src/public/app/widgets/collapsible_widgets/note_info.js
@@ -50,7 +50,7 @@ const TPL = `
<span class="note-sizes-wrapper">
<span class="note-size"></span>
- (subtree size: <span class="subtree-size"></span>)
+ <span class="subtree-size"></span>
</span>
</td>
</tr>
@@ -88,8 +88,14 @@ export default class NoteInfoWidget extends CollapsibleWidget {
const noteSizeResp = await server.get(`stats/note-size/${this.noteId}`);
this.$noteSize.text(this.formatSize(noteSizeResp.noteSize));
- const subTreeSizeResp = await server.get(`stats/subtree-size/${this.noteId}`);
- this.$subTreeSize.text(this.formatSize(subTreeSizeResp.subTreeSize));
+ const subTreeResp = await server.get(`stats/subtree-size/${this.noteId}`);
+
+ if (subTreeResp.subTreeNoteCount > 1) {
+ this.$subTreeSize.text("(subtree size: " + this.formatSize(subTreeResp.subTreeSize) + ` in ${subTreeResp.subTreeNoteCount} notes)`);
+ }
+ else {
+ this.$subTreeSize.text("");
+ }
});
}
diff --git a/src/routes/api/stats.js b/src/routes/api/stats.js
index 610acd4cc3..1bd0303673 100644
--- a/src/routes/api/stats.js
+++ b/src/routes/api/stats.js
@@ -50,7 +50,8 @@ function getSubtreeSize(req) {
)`);
return {
- subTreeSize
+ subTreeSize,
+ subTreeNoteCount: subTreeNoteIds.length
};
}