Quick select for kind.
This commit is contained in:
@@ -52,6 +52,16 @@
|
|||||||
<input type="date" id="toCreatedAt" x-model="toCreatedAt" class="input" @change="reload">
|
<input type="date" id="toCreatedAt" x-model="toCreatedAt" class="input" @change="reload">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div x-show="view === 'kind'">
|
||||||
|
<label for="kindShortcut">Quick Select</label>
|
||||||
|
<select id="kindShortcut" class="input" @change="quickKindSelect" x-model="quickKind">
|
||||||
|
<option></option>
|
||||||
|
<template x-for="k in kinds">
|
||||||
|
<option :value="k[0]" x-text="k[1]"></option>
|
||||||
|
</template>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div x-show="view === 'kind'">
|
<div x-show="view === 'kind'">
|
||||||
<label for="fromKind">From</label>
|
<label for="fromKind">From</label>
|
||||||
<input type="number" id="fromKind" x-model.number="fromKind" class="input" @change="reload">
|
<input type="number" id="fromKind" x-model.number="fromKind" class="input" @change="reload">
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import Alpine from 'alpinejs';
|
import Alpine from 'alpinejs';
|
||||||
import { sortByIndex } from './db';
|
import { sortByIndex } from './db';
|
||||||
|
import { KINDS } from './utils';
|
||||||
|
|
||||||
Alpine.data('eventLog', () => ({
|
Alpine.data('eventLog', () => ({
|
||||||
|
kinds: KINDS,
|
||||||
events: [],
|
events: [],
|
||||||
view: 'created_at',
|
view: 'created_at',
|
||||||
max: 100,
|
max: 100,
|
||||||
@@ -12,6 +14,7 @@ Alpine.data('eventLog', () => ({
|
|||||||
toCreatedAt: new Date().toISOString().split('T')[0],
|
toCreatedAt: new Date().toISOString().split('T')[0],
|
||||||
|
|
||||||
// kind view
|
// kind view
|
||||||
|
quickKind: '',
|
||||||
fromKind: 0,
|
fromKind: 0,
|
||||||
toKind: 50000,
|
toKind: 50000,
|
||||||
|
|
||||||
@@ -29,6 +32,16 @@ Alpine.data('eventLog', () => ({
|
|||||||
this.events = events;
|
this.events = events;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
quickKindSelect() {
|
||||||
|
if (this.quickKind === '') return;
|
||||||
|
const i = parseInt(this.quickKind);
|
||||||
|
this.fromKind = i;
|
||||||
|
this.toKind = i;
|
||||||
|
this.reload();
|
||||||
|
},
|
||||||
|
|
||||||
|
// Properties
|
||||||
|
|
||||||
get fromTime() {
|
get fromTime() {
|
||||||
let dt = new Date(this.fromCreatedAt);
|
let dt = new Date(this.fromCreatedAt);
|
||||||
return Math.floor(dt.getTime() / 1000);
|
return Math.floor(dt.getTime() / 1000);
|
||||||
|
|||||||
Reference in New Issue
Block a user