ADD keeping track of all active filters

pull/1/head
serapath 7 years ago
parent 51fb91ea68
commit add7b06b41
  1. 40
      src/app/panels/terminal.js

@ -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)`
// @TODO: implement a `match(query, args)` function
// make use of:
// self._INDEX.all[item.gidx]
// self._INDEX.allMain
// self._INDEX.commands
// self._INDEX.commandsMain
} }
} }
_keep (item) { _keep (item) {
// @TODO: checks `self.data.activeFilters: { commands: {}, input: '' }` var self = this
// @TODO: return false (if item is currently filtered out / irrelevant if (self.data.activeFilters.commands[item.root.cmd]) {
// according to `self.data.activeFilters` var query = self.data.activeFilters.input
// self._INDEX.all[item.gidx] // @TODO: filter item if not `match(value, item.args)`
// // @TODO: implement a `match(query, args)` function
// self._INDEX.allMain if (item.args === query) return true
// self._INDEX.commands }
// self._INDEX.commandsMain
//
// if ()
// self.updateJournal(
// _INDEX
//
return true // false
} }
_appendItem (item) { _appendItem (item) {
var self = this var self = this

Loading…
Cancel
Save