Newer
Older
/* global Vue */
window.app = new Vue({
el: '#app',
data: {
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
},
steps() {
return this.all_processors.reduce((all, processor) => {
all.push(...processor.steps.filter(step => all.indexOf(step) == -1))
return all
}, [])
},
categories() {
return this.all_processors.reduce((all, processor) => {
all.push(...processor.categories.filter(category => all.indexOf(category) == -1))
return all
}, [])
},
all_processors() {
return this.repos_raw.reduce((all, repo) => {
if (repo.ocrd_tool)
all.push(...Object.values(repo.ocrd_tool.tools).map(tool => {
tool.part_of = repo.org_plus_name
return tool
}))
return all
}, [])
},
processors() {
return this.all_processors.filter(tool => {
for (let step_filter of this.step_filter) {
if (tool.steps.indexOf(step_filter) == -1)
return false
}
for (let category_filter of this.category_filter) {
if (tool.categories.indexOf(category_filter) == -1)
return false
}
return true
})
}
},
mounted() {
this.fetchRepoData()
},
methods: {
fetchRepoData() {
fetch('repos.json').then(resp => resp.json()).then(repos => this.repos.push(...repos))
toggleStepFilter(v) {
if (v in this.step_filter) {
this.step_filter = this.step_filter.splice(this.step_filter.indexOf(v), 1)
} else {
this.step_filter.push(v)
}
}