Implement alias filtering across multiple pages
- Introduced an `AliasFilterSelect` component to streamline alias selection in various routes, enhancing user experience. - Refactored alias handling logic to use a single filter mechanism, improving consistency and reducing code duplication. - Updated API calls to utilize the new alias filtering logic, ensuring accurate data retrieval based on user-selected aliases. - Enhanced the loading of available aliases dynamically from aggregated summary data, keeping the interface up-to-date.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<script lang="ts">
|
||||
import * as Select from "$lib/components/ui/select/index.js";
|
||||
|
||||
let {
|
||||
availableAliases = [],
|
||||
value = $bindable("all"),
|
||||
label = "Alias",
|
||||
allLabel = "All nodes"
|
||||
}: {
|
||||
availableAliases: string[];
|
||||
value?: string;
|
||||
label?: string;
|
||||
allLabel?: string;
|
||||
} = $props();
|
||||
|
||||
let selectedLabel = $derived(value === "all" ? allLabel : value);
|
||||
</script>
|
||||
|
||||
<label class="text-xs text-muted-foreground">
|
||||
{label}
|
||||
<Select.Root type="single" bind:value>
|
||||
<Select.Trigger class="mt-1 w-[220px]">
|
||||
{selectedLabel}
|
||||
</Select.Trigger>
|
||||
<Select.Content>
|
||||
<Select.Item value="all">{allLabel}</Select.Item>
|
||||
{#each availableAliases as alias (alias)}
|
||||
<Select.Item value={alias}>{alias}</Select.Item>
|
||||
{/each}
|
||||
</Select.Content>
|
||||
</Select.Root>
|
||||
</label>
|
||||
Reference in New Issue
Block a user