Browse Source

Visual indicators of events loaded

Visual indicators: Event kind badges now have colored borders:
    - Green border = Events loaded (with count shown)
    - Red border = Not loaded yet
  2. Hint text: Added explanations below the badges explaining what the colors mean
  3. Event counts: Shows the number of loaded events for each kind in parentheses
master
limina1 9 months ago
parent
commit
dfd542016e
  1. 24
      src/lib/components/EventKindFilter.svelte
  2. 4
      src/lib/navigator/EventNetwork/Settings.svelte
  3. 1
      src/lib/navigator/EventNetwork/index.svelte

24
src/lib/components/EventKindFilter.svelte

@ -4,9 +4,11 @@
import { CloseCircleOutline } from 'flowbite-svelte-icons'; import { CloseCircleOutline } from 'flowbite-svelte-icons';
let { let {
onReload = () => {} onReload = () => {},
eventCounts = {}
} = $props<{ } = $props<{
onReload?: () => void; onReload?: () => void;
eventCounts?: { [kind: number]: number };
}>(); }>();
let newKind = $state(''); let newKind = $state('');
@ -76,16 +78,21 @@
<div class="flex flex-wrap gap-2 items-center"> <div class="flex flex-wrap gap-2 items-center">
{#each $visualizationConfig.allowedKinds as kind} {#each $visualizationConfig.allowedKinds as kind}
{@const isDisabled = $visualizationConfig.disabledKinds.includes(kind)} {@const isDisabled = $visualizationConfig.disabledKinds.includes(kind)}
{@const isLoaded = (eventCounts[kind] || 0) > 0}
{@const borderColor = isLoaded ? 'border-green-500' : 'border-red-500'}
<button <button
class="badge-container {isDisabled ? 'disabled' : ''}" class="badge-container {isDisabled ? 'disabled' : ''} {isLoaded ? 'loaded' : 'not-loaded'}"
onclick={() => toggleKind(kind)} onclick={() => toggleKind(kind)}
title={isDisabled ? `Click to enable ${getKindName(kind)}` : `Click to disable ${getKindName(kind)}`} title={isDisabled ? `Click to enable ${getKindName(kind)}` : `Click to disable ${getKindName(kind)}`}
> >
<Badge <Badge
color="dark" color="dark"
class="flex items-center gap-1 px-2 py-1 {isDisabled ? 'opacity-40' : ''}" class="flex items-center gap-1 px-2 py-1 {isDisabled ? 'opacity-40' : ''} border-2 {borderColor}"
> >
<span class="text-xs">{kind}</span> <span class="text-xs">{kind}</span>
{#if isLoaded}
<span class="text-xs text-gray-400">({eventCounts[kind]})</span>
{/if}
<button <button
onclick={(e) => { onclick={(e) => {
e.stopPropagation(); e.stopPropagation();
@ -158,6 +165,17 @@
</Button> </Button>
</div> </div>
<div class="text-xs text-gray-500 dark:text-gray-400 space-y-1">
<p class="flex items-center gap-2">
<span class="inline-block w-3 h-3 border-2 border-green-500 rounded"></span>
<span>Green border = Events loaded</span>
</p>
<p class="flex items-center gap-2">
<span class="inline-block w-3 h-3 border-2 border-red-500 rounded"></span>
<span>Red border = Not loaded (click Reload to fetch)</span>
</p>
</div>
<label class="flex items-center gap-2 text-xs"> <label class="flex items-center gap-2 text-xs">
<input <input
type="checkbox" type="checkbox"

4
src/lib/navigator/EventNetwork/Settings.svelte

@ -20,6 +20,7 @@
selectedTagType = $bindable("t"), selectedTagType = $bindable("t"),
tagExpansionDepth = $bindable(0), tagExpansionDepth = $bindable(0),
onFetchMissing = () => {}, onFetchMissing = () => {},
eventCounts = {},
} = $props<{ } = $props<{
count: number; count: number;
totalCount: number; totalCount: number;
@ -30,6 +31,7 @@
selectedTagType?: string; selectedTagType?: string;
tagExpansionDepth?: number; tagExpansionDepth?: number;
onFetchMissing?: (ids: string[]) => void; onFetchMissing?: (ids: string[]) => void;
eventCounts?: { [kind: number]: number };
}>(); }>();
let expanded = $state(false); let expanded = $state(false);
@ -154,7 +156,7 @@
</Button> </Button>
</div> </div>
{#if eventTypesExpanded} {#if eventTypesExpanded}
<EventKindFilter onReload={onupdate} /> <EventKindFilter onReload={onupdate} {eventCounts} />
{/if} {/if}
</div> </div>

1
src/lib/navigator/EventNetwork/index.svelte

@ -927,6 +927,7 @@
bind:showTagAnchors bind:showTagAnchors
bind:selectedTagType bind:selectedTagType
bind:tagExpansionDepth bind:tagExpansionDepth
{eventCounts}
/> />
<!-- svelte-ignore a11y_click_events_have_key_events --> <!-- svelte-ignore a11y_click_events_have_key_events -->

Loading…
Cancel
Save