var t = `
`
export default {
emits: ['finder-open'],
data() {
return {
counts: {},
stats: [
['notes', 'Notes', 'All notes', '/api/raw/list?color=true&prefix=label&sort=alpha'],
['labels', 'Label notes', 'Notes with one-word titles', '/api/raw/list?color=true&labels=true&sort=alpha'],
['orphans', 'Orphan notes', 'Notes without incoming or outgoing links', '/api/raw/list?color=true&orphans=true&sort=alpha'],
['links', 'Links', 'Count of links', '/api/raw/links?color=true'],
['dangling', 'Dangling links', 'Count of broken links', '/api/raw/links?color=true&dangling=true'],
['lines', 'Lines', 'Count of lines spanning all notes', '/api/raw/lines?color=true&prefix=title'],
['words', 'Words', 'Count of words spanning all notes', null],
['chars', 'Characters', 'Count of characters spanning all notes', null],
],
}
},
methods: {
getCounts() {
fetch('/api/raw/stats')
.then(r => r.ok ? r.text() : r.text().then(e => Promise.reject(e)))
.then(text => {
this.counts = text.trim().split('\n').reduce((dict, line) => {
const [key, val] = line.split(' '); dict[key] = val;
return dict;
}, {});
})
.catch(e => {
console.error(e.Error);
});
},
},
created() {
this.getCounts();
},
template: t
}