date stuff

This commit is contained in:
cupcakearmy 2020-09-19 01:30:42 +02:00
parent f469d78ce3
commit 1bd1913145
No known key found for this signature in database
GPG Key ID: D28129AE5654D9D9
3 changed files with 27 additions and 12 deletions

View File

@ -10,12 +10,15 @@
import { data, countInGroup } from './lib' import { data, countInGroup } from './lib'
import { env } from 'process' import { env } from 'process'
let top = 20
let full = 50
let loading = true let loading = true
let init = false let init = false
let counted let counted
let top = 20
let start = dayjs().subtract(3, 'days').toDate() let start
let end = new Date() let end
let topData = { let topData = {
labels: [], labels: [],
data: [], data: [],
@ -48,8 +51,7 @@
onMount(() => { onMount(() => {
setTimeout(() => { setTimeout(() => {
init = true init = true
// calculate() }, 25)
}, 250)
}) })
</script> </script>
@ -61,10 +63,6 @@
max-width: 50em; max-width: 50em;
} }
/* .date > .spacer {
width: 1em;
} */
.link { .link {
margin-left: 2em; margin-left: 2em;
} }
@ -73,23 +71,31 @@
th { th {
padding: 0.25em; padding: 0.25em;
} }
h3 {
margin-right: 1em;
}
</style> </style>
<Dev /> <Dev />
<div class="top rounded"> <div class="top rounded">
<div class="flex justify-between items-center"> <h1 class="text-6xl mb-4">Ora</h1>
<h2 class="text-4xl">Top {top}</h2> <div class="flex justify-end items-center mb-2">
<h3>Time Range</h3>
<RangeChooser bind:start bind:end /> <RangeChooser bind:start bind:end />
</div> </div>
{#if loading} {#if loading}
<div class="loading loading-lg" /> <div class="loading loading-lg" />
{:else if counted} {:else if counted}
<h2 class="text-2xl">Top {top}</h2>
<b>Chart</b>
<h2 class="text-2xl mt-4">Top {full}</h2>
<table class="table"> <table class="table">
<tr> <tr>
<th>Time Spent</th> <th>Time Spent</th>
<th>Host</th> <th>Host</th>
</tr> </tr>
{#each counted as { host, total, human }} {#each counted.slice(0, 100) as { host, total, human }}
<tr> <tr>
<td>{human}</td> <td>{human}</td>
<td class="link"><a href={'https://' + host}>{host}</a></td> <td class="link"><a href={'https://' + host}>{host}</a></td>

View File

@ -16,4 +16,10 @@
$: output(internal) $: output(internal)
</script> </script>
<style>
input {
width: 9em !important;
}
</style>
<input class="form-input input-sm" type="date" bind:value={internal} {name} /> <input class="form-input input-sm" type="date" bind:value={internal} {name} />

View File

@ -17,6 +17,9 @@
start = new Date(0) start = new Date(0)
end = new Date() end = new Date()
} }
// Init
set('week')()
</script> </script>
<style> <style>