Commit add7b06b authored by serapath's avatar serapath

ADD keeping track of all active filters

parent 51fb91ea
...@@ -426,31 +426,35 @@ class Terminal { ...@@ -426,31 +426,35 @@ class Terminal {
} }
} }
updateJournal (filterEvent) { updateJournal (filterEvent) {
// @TODO: updates `self.data.activeFilters: { commands: {}, input: '' }` var self = this
var value = filterEvent.value var value = filterEvent.value
if (filterEvent.type === 'select') { if (filterEvent.type === 'select') {
console.log(value) self.data.activeFilters.commands[value] = true
// @TODO: add all items with `value === item.cmd`
} else if (filterEvent.type === 'deselect') { } else if (filterEvent.type === 'deselect') {
console.log(value) self.data.activeFilters.commands[value] = false
// @TODO: remove all items with `value === item.cmd`
} else if (filterEvent.type === 'search') { } else if (filterEvent.type === 'search') {
console.log(value) self.data.activeFilters.input = value
} // @TODO: filter all active items with not `match(value, item.args)`
}
_keep (item) { // @TODO: implement a `match(query, args)` function
// @TODO: checks `self.data.activeFilters: { commands: {}, input: '' }`
// @TODO: return false (if item is currently filtered out / irrelevant // make use of:
// according to `self.data.activeFilters`
// self._INDEX.all[item.gidx] // self._INDEX.all[item.gidx]
//
// self._INDEX.allMain // self._INDEX.allMain
// self._INDEX.commands // self._INDEX.commands
// self._INDEX.commandsMain // self._INDEX.commandsMain
// }
// if () }
// self.updateJournal( _keep (item) {
// _INDEX var self = this
// if (self.data.activeFilters.commands[item.root.cmd]) {
return true // false var query = self.data.activeFilters.input
// @TODO: filter item if not `match(value, item.args)`
// @TODO: implement a `match(query, args)` function
if (item.args === query) return true
}
} }
_appendItem (item) { _appendItem (item) {
var self = this var self = this
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment