mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-01-18 13:07:58 +00:00
Implement logs autoreload
This commit is contained in:
parent
1f8984766b
commit
49d5022027
@ -4,6 +4,7 @@
|
||||
import ObjectViewer from '$components/objectviewer.svelte';
|
||||
import input from '$lib/actions/input';
|
||||
import { BrowserOpenURL } from '$wails/runtime/runtime';
|
||||
import { onDestroy } from 'svelte';
|
||||
|
||||
export let host;
|
||||
|
||||
@ -15,9 +16,17 @@
|
||||
let copySucceeded = false;
|
||||
let autoReloadInterval = 0;
|
||||
let objectViewerData;
|
||||
let interval;
|
||||
$: filter && refresh();
|
||||
$: busy = !logs && !error && 'Requesting logs…';
|
||||
|
||||
$: if (autoReloadInterval) {
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
interval = setInterval(refresh, autoReloadInterval * 1000);
|
||||
}
|
||||
|
||||
async function refresh() {
|
||||
let _logs = [];
|
||||
({ logs: _logs, total, error } = await host.getLogs(filter));
|
||||
@ -44,6 +53,12 @@
|
||||
copySucceeded = true;
|
||||
setTimeout(() => copySucceeded = false, 1500);
|
||||
}
|
||||
|
||||
onDestroy(() => {
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="stats">
|
||||
|
Loading…
Reference in New Issue
Block a user