mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
implemented "targetRelationCount" and exposed more of them in order by widget, fixes #1658
This commit is contained in:
parent
2cfd093cae
commit
4160da70be
@ -16,6 +16,11 @@ const TPL = `
|
|||||||
<option value="contentSize">Note content size</option>
|
<option value="contentSize">Note content size</option>
|
||||||
<option value="noteSize">Note content size including revisions</option>
|
<option value="noteSize">Note content size including revisions</option>
|
||||||
<option value="revisionCount">Number of revisions</option>
|
<option value="revisionCount">Number of revisions</option>
|
||||||
|
<option value="childrenCount">Number of children notes</option>
|
||||||
|
<option value="parentCount">Number of clones</option>
|
||||||
|
<option value="ownedLabelCount">Number of labels</option>
|
||||||
|
<option value="ownedRelationCount">Number of relations</option>
|
||||||
|
<option value="targetRelationCount">Number of relations targeting the note</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select name="orderDirection" class="form-control w-auto d-inline">
|
<select name="orderDirection" class="form-control w-auto d-inline">
|
||||||
|
@ -46,6 +46,10 @@ class Attribute {
|
|||||||
|| (this.type === 'relation' && this.name === 'template');
|
|| (this.type === 'relation' && this.name === 'template');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isAutoLink() {
|
||||||
|
return this.type === 'relation' && ['internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink'].includes(this.name);
|
||||||
|
}
|
||||||
|
|
||||||
get note() {
|
get note() {
|
||||||
return this.noteCache.notes[this.noteId];
|
return this.noteCache.notes[this.noteId];
|
||||||
}
|
}
|
||||||
|
@ -319,14 +319,42 @@ class Note {
|
|||||||
return this.attributes.filter(attr => attr.type === 'label').length;
|
return this.attributes.filter(attr => attr.type === 'label').length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get ownedLabelCount() {
|
||||||
|
return this.ownedAttributes.filter(attr => attr.type === 'label').length;
|
||||||
|
}
|
||||||
|
|
||||||
get relationCount() {
|
get relationCount() {
|
||||||
|
return this.attributes.filter(attr => attr.type === 'relation' && !attr.isAutoLink()).length;
|
||||||
|
}
|
||||||
|
|
||||||
|
get relationCountIncludingLinks() {
|
||||||
return this.attributes.filter(attr => attr.type === 'relation').length;
|
return this.attributes.filter(attr => attr.type === 'relation').length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get ownedRelationCount() {
|
||||||
|
return this.ownedAttributes.filter(attr => attr.type === 'relation' && !attr.isAutoLink()).length;
|
||||||
|
}
|
||||||
|
|
||||||
|
get ownedRelationCountIncludingLinks() {
|
||||||
|
return this.ownedAttributes.filter(attr => attr.type === 'relation').length;
|
||||||
|
}
|
||||||
|
|
||||||
|
get targetRelationCount() {
|
||||||
|
return this.targetRelations.filter(attr => !attr.isAutoLink()).length;
|
||||||
|
}
|
||||||
|
|
||||||
|
get targetRelationCountIncludingLinks() {
|
||||||
|
return this.targetRelations.length;
|
||||||
|
}
|
||||||
|
|
||||||
get attributeCount() {
|
get attributeCount() {
|
||||||
return this.attributes.length;
|
return this.attributes.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get ownedAttributeCount() {
|
||||||
|
return this.attributes.length;
|
||||||
|
}
|
||||||
|
|
||||||
get ancestors() {
|
get ancestors() {
|
||||||
if (!this.ancestorCache) {
|
if (!this.ancestorCache) {
|
||||||
const noteIds = new Set();
|
const noteIds = new Set();
|
||||||
|
@ -23,7 +23,13 @@ const PROP_MAPPING = {
|
|||||||
"childrencount": "childrenCount",
|
"childrencount": "childrenCount",
|
||||||
"attributecount": "attributeCount",
|
"attributecount": "attributeCount",
|
||||||
"labelcount": "labelCount",
|
"labelcount": "labelCount",
|
||||||
|
"ownedlabelcount": "ownedLabelCount",
|
||||||
"relationcount": "relationCount",
|
"relationcount": "relationCount",
|
||||||
|
"ownedrelationcount": "ownedRelationCount",
|
||||||
|
"relationcountincludinglinks": "relationCountIncludingLinks",
|
||||||
|
"ownedrelationcountincludinglinks": "ownedRelationCountIncludingLinks",
|
||||||
|
"targetrelationcount": "targetRelationCount",
|
||||||
|
"targetrelationcountincludinglinks": "targetRelationCountIncludingLinks",
|
||||||
"contentsize": "contentSize",
|
"contentsize": "contentSize",
|
||||||
"notesize": "noteSize",
|
"notesize": "noteSize",
|
||||||
"revisioncount": "revisionCount"
|
"revisioncount": "revisionCount"
|
||||||
|
@ -19,7 +19,13 @@ const PROP_MAPPING = {
|
|||||||
"childrencount": "childrenCount",
|
"childrencount": "childrenCount",
|
||||||
"attributecount": "attributeCount",
|
"attributecount": "attributeCount",
|
||||||
"labelcount": "labelCount",
|
"labelcount": "labelCount",
|
||||||
|
"ownedlabelcount": "ownedLabelCount",
|
||||||
"relationcount": "relationCount",
|
"relationcount": "relationCount",
|
||||||
|
"ownedrelationcount": "ownedRelationCount",
|
||||||
|
"relationcountincludinglinks": "relationCountIncludingLinks",
|
||||||
|
"ownedrelationcountincludinglinks": "ownedRelationCountIncludingLinks",
|
||||||
|
"targetrelationcount": "targetRelationCount",
|
||||||
|
"targetrelationcountincludinglinks": "targetRelationCountIncludingLinks",
|
||||||
"contentsize": "contentSize",
|
"contentsize": "contentSize",
|
||||||
"notesize": "noteSize",
|
"notesize": "noteSize",
|
||||||
"revisioncount": "revisionCount"
|
"revisioncount": "revisionCount"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user