Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4be07fc242 | ||
|
|
aaacb80f9a | ||
|
|
309750fd25 |
No files matched your search
@@ -13,16 +13,30 @@
|
|||||||
allLabel?: string;
|
allLabel?: string;
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
let selectedLabel = $derived(value === "all" ? allLabel : value);
|
let internalValue = $state(value ?? "all");
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
const next = value ?? "all";
|
||||||
|
if (internalValue !== next) internalValue = next;
|
||||||
|
});
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (internalValue !== "all" && !availableAliases.includes(internalValue)) {
|
||||||
|
internalValue = "all";
|
||||||
|
}
|
||||||
|
if (value !== internalValue) value = internalValue;
|
||||||
|
});
|
||||||
|
|
||||||
|
let selectedLabel = $derived(internalValue === "all" ? allLabel : internalValue);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<label class="text-xs text-muted-foreground">
|
<label class="text-xs text-muted-foreground">
|
||||||
{label}
|
{label}
|
||||||
<Select.Root type="single" bind:value>
|
<Select.Root type="single" bind:value={internalValue}>
|
||||||
<Select.Trigger class="mt-1 w-[220px]">
|
<Select.Trigger class="mt-1 w-[220px]">
|
||||||
{selectedLabel}
|
{selectedLabel}
|
||||||
</Select.Trigger>
|
</Select.Trigger>
|
||||||
<Select.Content>
|
<Select.Content class="z-[1200]">
|
||||||
<Select.Item value="all">{allLabel}</Select.Item>
|
<Select.Item value="all">{allLabel}</Select.Item>
|
||||||
{#each availableAliases as alias (alias)}
|
{#each availableAliases as alias (alias)}
|
||||||
<Select.Item value={alias}>{alias}</Select.Item>
|
<Select.Item value={alias}>{alias}</Select.Item>
|
||||||
|
|||||||
@@ -196,6 +196,20 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function applyAliasIfChanged(nextAlias: string) {
|
||||||
|
const currentAlias = parseAliasFilter(page.url.searchParams.get('aliases'));
|
||||||
|
if (nextAlias === currentAlias) return;
|
||||||
|
const q = new URLSearchParams(page.url.searchParams);
|
||||||
|
if (nextAlias === 'all') q.delete('aliases');
|
||||||
|
else q.set('aliases', nextAlias);
|
||||||
|
const qs = q.toString();
|
||||||
|
await goto(`${page.url.pathname}${qs ? `?${qs}` : ''}`, {
|
||||||
|
replaceState: true,
|
||||||
|
noScroll: true,
|
||||||
|
keepFocus: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let queryKey = $derived(page.url.searchParams.toString());
|
let queryKey = $derived(page.url.searchParams.toString());
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
queryKey;
|
queryKey;
|
||||||
@@ -207,6 +221,11 @@
|
|||||||
void load();
|
void load();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (typeof window === 'undefined') return;
|
||||||
|
void applyAliasIfChanged(aliasFilter);
|
||||||
|
});
|
||||||
|
|
||||||
let staleSeconds = $derived.by(() =>
|
let staleSeconds = $derived.by(() =>
|
||||||
lastSuccessAtMs == null ? null : Math.max(0, Math.floor((nowMs - lastSuccessAtMs) / 1000))
|
lastSuccessAtMs == null ? null : Math.max(0, Math.floor((nowMs - lastSuccessAtMs) / 1000))
|
||||||
);
|
);
|
||||||
@@ -397,11 +416,9 @@
|
|||||||
max="300"
|
max="300"
|
||||||
class="mt-1 h-9 w-28 rounded-md border bg-background px-2 text-sm"
|
class="mt-1 h-9 w-28 rounded-md border bg-background px-2 text-sm"
|
||||||
bind:value={refreshInput}
|
bind:value={refreshInput}
|
||||||
|
onchange={() => void applyControls()}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<Button variant="outline" size="sm" onclick={() => void applyControls()} disabled={loading}>
|
|
||||||
Apply
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if partial}
|
{#if partial}
|
||||||
|
|||||||
@@ -148,6 +148,20 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function applyAliasIfChanged(nextAlias: string) {
|
||||||
|
const currentAlias = parseAliasFilter(page.url.searchParams.get('aliases'));
|
||||||
|
if (nextAlias === currentAlias) return;
|
||||||
|
const q = new URLSearchParams(page.url.searchParams);
|
||||||
|
if (nextAlias === 'all') q.delete('aliases');
|
||||||
|
else q.set('aliases', nextAlias);
|
||||||
|
const qs = q.toString();
|
||||||
|
await goto(`${page.url.pathname}${qs ? `?${qs}` : ''}`, {
|
||||||
|
replaceState: true,
|
||||||
|
noScroll: true,
|
||||||
|
keepFocus: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let queryKey = $derived(page.url.searchParams.toString());
|
let queryKey = $derived(page.url.searchParams.toString());
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
queryKey;
|
queryKey;
|
||||||
@@ -160,6 +174,11 @@
|
|||||||
void load(nextAlias);
|
void load(nextAlias);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (typeof window === 'undefined') return;
|
||||||
|
void applyAliasIfChanged(aliasFilter);
|
||||||
|
});
|
||||||
|
|
||||||
let staleSeconds = $derived.by(() =>
|
let staleSeconds = $derived.by(() =>
|
||||||
lastSuccessAtMs == null ? null : Math.max(0, Math.floor((nowMs - lastSuccessAtMs) / 1000))
|
lastSuccessAtMs == null ? null : Math.max(0, Math.floor((nowMs - lastSuccessAtMs) / 1000))
|
||||||
);
|
);
|
||||||
@@ -221,11 +240,9 @@
|
|||||||
max="300"
|
max="300"
|
||||||
class="mt-1 h-9 w-28 rounded-md border bg-background px-2 text-sm"
|
class="mt-1 h-9 w-28 rounded-md border bg-background px-2 text-sm"
|
||||||
bind:value={refreshInput}
|
bind:value={refreshInput}
|
||||||
|
onchange={() => void applyControls()}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<Button variant="outline" size="sm" onclick={() => void applyControls()} disabled={loading}>
|
|
||||||
Apply
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if partial}
|
{#if partial}
|
||||||
|
|||||||
@@ -349,6 +349,20 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function applyAliasIfChanged(nextAlias: string) {
|
||||||
|
const currentAlias = parseAliasFilter(page.url.searchParams.get('aliases'));
|
||||||
|
if (nextAlias === currentAlias) return;
|
||||||
|
const q = new URLSearchParams(page.url.searchParams);
|
||||||
|
if (nextAlias === 'all') q.delete('aliases');
|
||||||
|
else q.set('aliases', nextAlias);
|
||||||
|
const qs = q.toString();
|
||||||
|
await goto(`${page.url.pathname}${qs ? `?${qs}` : ''}`, {
|
||||||
|
replaceState: true,
|
||||||
|
noScroll: true,
|
||||||
|
keepFocus: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let queryKey = $derived(page.url.searchParams.toString());
|
let queryKey = $derived(page.url.searchParams.toString());
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
queryKey;
|
queryKey;
|
||||||
@@ -361,6 +375,12 @@
|
|||||||
void load();
|
void load();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (typeof window === 'undefined') return;
|
||||||
|
const nextAlias = aliasFilter;
|
||||||
|
void applyAliasIfChanged(nextAlias);
|
||||||
|
});
|
||||||
|
|
||||||
let staleSeconds = $derived.by(() =>
|
let staleSeconds = $derived.by(() =>
|
||||||
lastSuccessAtMs == null ? null : Math.max(0, Math.floor((nowMs - lastSuccessAtMs) / 1000))
|
lastSuccessAtMs == null ? null : Math.max(0, Math.floor((nowMs - lastSuccessAtMs) / 1000))
|
||||||
);
|
);
|
||||||
@@ -427,11 +447,9 @@
|
|||||||
max="300"
|
max="300"
|
||||||
class="mt-1 h-9 w-28 rounded-md border bg-background px-2 text-sm"
|
class="mt-1 h-9 w-28 rounded-md border bg-background px-2 text-sm"
|
||||||
bind:value={refreshInput}
|
bind:value={refreshInput}
|
||||||
|
onchange={() => void applyControls()}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<Button variant="outline" size="sm" onclick={() => void applyControls()} disabled={loading}>
|
|
||||||
Apply
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if partial}
|
{#if partial}
|
||||||
|
|||||||
@@ -199,10 +199,12 @@
|
|||||||
es = next;
|
es = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function applyControls() {
|
async function applyAliasIfChanged(nextAlias: string) {
|
||||||
|
const currentAlias = parseAliasFilter(page.url.searchParams.get('aliases'));
|
||||||
|
if (nextAlias === currentAlias) return;
|
||||||
const q = new URLSearchParams(page.url.searchParams);
|
const q = new URLSearchParams(page.url.searchParams);
|
||||||
if (aliasFilter === 'all') q.delete('aliases');
|
if (nextAlias === 'all') q.delete('aliases');
|
||||||
else q.set('aliases', aliasFilter);
|
else q.set('aliases', nextAlias);
|
||||||
const qs = q.toString();
|
const qs = q.toString();
|
||||||
await goto(`${page.url.pathname}${qs ? `?${qs}` : ''}`, {
|
await goto(`${page.url.pathname}${qs ? `?${qs}` : ''}`, {
|
||||||
replaceState: true,
|
replaceState: true,
|
||||||
@@ -220,6 +222,11 @@
|
|||||||
connectStream(nextAlias);
|
connectStream(nextAlias);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (typeof window === 'undefined') return;
|
||||||
|
void applyAliasIfChanged(aliasFilter);
|
||||||
|
});
|
||||||
|
|
||||||
let staleSeconds = $derived.by(() =>
|
let staleSeconds = $derived.by(() =>
|
||||||
lastEventAtMs == null ? null : Math.max(0, Math.floor((nowMs - lastEventAtMs) / 1000))
|
lastEventAtMs == null ? null : Math.max(0, Math.floor((nowMs - lastEventAtMs) / 1000))
|
||||||
);
|
);
|
||||||
@@ -271,9 +278,6 @@
|
|||||||
|
|
||||||
<div class="mb-4 flex flex-wrap items-end gap-2">
|
<div class="mb-4 flex flex-wrap items-end gap-2">
|
||||||
<AliasFilterSelect availableAliases={availableAliases} bind:value={aliasFilter} />
|
<AliasFilterSelect availableAliases={availableAliases} bind:value={aliasFilter} />
|
||||||
<Button variant="outline" size="sm" onclick={() => void applyControls()}>
|
|
||||||
Apply
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if err}
|
{#if err}
|
||||||
|
|||||||
@@ -92,6 +92,20 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function applyAliasIfChanged(nextAlias: string) {
|
||||||
|
const currentAlias = parseAliasFilter(page.url.searchParams.get('aliases'));
|
||||||
|
if (nextAlias === currentAlias) return;
|
||||||
|
const q = new URLSearchParams(page.url.searchParams);
|
||||||
|
if (nextAlias === 'all') q.delete('aliases');
|
||||||
|
else q.set('aliases', nextAlias);
|
||||||
|
const qs = q.toString();
|
||||||
|
await goto(`${page.url.pathname}${qs ? `?${qs}` : ''}`, {
|
||||||
|
replaceState: true,
|
||||||
|
noScroll: true,
|
||||||
|
keepFocus: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let queryKey = $derived(page.url.searchParams.toString());
|
let queryKey = $derived(page.url.searchParams.toString());
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
queryKey;
|
queryKey;
|
||||||
@@ -104,6 +118,11 @@
|
|||||||
void load();
|
void load();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (typeof window === 'undefined') return;
|
||||||
|
void applyAliasIfChanged(aliasFilter);
|
||||||
|
});
|
||||||
|
|
||||||
let staleSeconds = $derived.by(() =>
|
let staleSeconds = $derived.by(() =>
|
||||||
lastSuccessAtMs == null ? null : Math.max(0, Math.floor((nowMs - lastSuccessAtMs) / 1000))
|
lastSuccessAtMs == null ? null : Math.max(0, Math.floor((nowMs - lastSuccessAtMs) / 1000))
|
||||||
);
|
);
|
||||||
@@ -206,11 +225,9 @@
|
|||||||
max="300"
|
max="300"
|
||||||
class="mt-1 h-9 w-28 rounded-md border bg-background px-2 text-sm"
|
class="mt-1 h-9 w-28 rounded-md border bg-background px-2 text-sm"
|
||||||
bind:value={refreshInput}
|
bind:value={refreshInput}
|
||||||
|
onchange={() => void applyControls()}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<Button variant="outline" size="sm" onclick={() => void applyControls()} disabled={loading}>
|
|
||||||
Apply
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if partial}
|
{#if partial}
|
||||||
|
|||||||
Reference in new issue
Block a user