Functional host filter.

This commit is contained in:
Ryan Breen
2023-02-14 21:14:17 -05:00
parent ccc17fbaa8
commit 14a20dd13d
3 changed files with 28 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
import Alpine from 'alpinejs';
import { sortByIndex } from './db';
import { getHosts, sortByIndex } from './db';
import { KINDS } from './utils';
Alpine.data('eventLog', () => ({
@@ -8,6 +8,8 @@ Alpine.data('eventLog', () => ({
view: 'created_at',
max: 100,
sort: 'asc',
allHosts: [],
host: '',
// date view
fromCreatedAt: '2008-10-31',
@@ -30,6 +32,7 @@ Alpine.data('eventLog', () => ({
this.max
);
this.events = events;
getHosts().then(hosts => (this.allHosts = hosts));
},
quickKindSelect() {
@@ -60,6 +63,9 @@ Alpine.data('eventLog', () => ({
case 'kind':
return IDBKeyRange.bound(this.fromKind, this.toKind);
case 'host':
if (this.host.length === 0) return null;
return IDBKeyRange.only(this.host);
default:
return null;
}