Add popularLabels computed property.

Returns a list of labels used in the current view,
in order of popularity (most used first).

NOTE: this property is not actually used. It's
technically dead code.
This commit is contained in:
D. Berge
2022-02-27 19:40:07 +01:00
parent 8f4bda011b
commit 7ea0105d9f

View File

@@ -287,6 +287,18 @@ export default {
}
}
return filtered;
},
popularLabels () {
const tuples = this.items.flatMap( i => i.labels )
.filter( l => (this.labels[l]??{})?.model?.user )
.reduce( (acc, cur) => {
return cur in acc ? ++acc[cur][1] : acc[cur]=[cur,1], acc
}, {});
return Object.values(tuples)
.sort( (a, b) => b[1]-a[1] );
},
defaultSequence () {