Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions src/lib/components/lines-and-dots/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import type { WorkflowStatus } from '$lib/types/workflows';

const DEFAULT_STROKE_COLOR = 'currentColor';

const EVENT_GROUP_COLOR = 'var(--color-content-brand)';

const WORKFLOW_ACTION_COLOR_VARIABLES = {
workflow: 'var(--color-action-workflow)',
activity: 'var(--color-action-activity)',
Expand Down Expand Up @@ -50,16 +52,22 @@ export const getStatusStrokeColor = (
status: WorkflowStatus | EventClassification | 'Delayed',
): string => (status && STATUS_STROKE_COLORS[status]) ?? DEFAULT_STROKE_COLOR;

const CATEGORY_STROKE_COLORS: Record<
EventTypeCategory | 'pending' | 'retry' | 'marker' | 'command',
string
> = {
type StrokeCategory =
| EventTypeCategory
| 'pending'
| 'retry'
| 'marker'
| 'command'
| 'event-group';

const CATEGORY_STROKE_COLORS: Record<StrokeCategory, string> = {
timer: WORKFLOW_ACTION_COLOR_VARIABLES.timer,
signal: WORKFLOW_ACTION_COLOR_VARIABLES.signal,
activity: WORKFLOW_ACTION_COLOR_VARIABLES.activity,
workflow: WORKFLOW_ACTION_COLOR_VARIABLES.workflow,
marker: colorScales.neutral[1],
command: colorScales.neutral[1],
'event-group': EVENT_GROUP_COLOR,
'child-workflow': WORKFLOW_ACTION_COLOR_VARIABLES.workflow,
update: colorScales.persimmon[8],
pending: colorScales['slate-blue'][8],
Expand All @@ -69,9 +77,8 @@ const CATEGORY_STROKE_COLORS: Record<
other: DEFAULT_STROKE_COLOR,
};

export const getCategoryStrokeColor = (
category: EventTypeCategory | 'pending' | 'retry' | 'marker' | 'command',
): string => CATEGORY_STROKE_COLORS[category] ?? DEFAULT_STROKE_COLOR;
export const getCategoryStrokeColor = (category: StrokeCategory): string =>
CATEGORY_STROKE_COLORS[category] ?? DEFAULT_STROKE_COLOR;

export type DotColors = { readonly fill: string; readonly stroke: string };

Expand Down Expand Up @@ -172,7 +179,7 @@ export function strokeColor({
delayed = false,
}: {
status?: WorkflowStatus | 'none';
category?: EventTypeCategory | 'pending' | 'retry';
category?: EventTypeCategory | 'pending' | 'retry' | 'event-group';
classification?: EventClassification;
delayed?: boolean;
}): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
import { prefersReducedMotion } from 'svelte/motion';
import { fade, slide } from 'svelte/transition';

import type { Snippet } from 'svelte';

import type { EventGroupOption } from '$lib/services/grouped-event-buffer';

import EventGroupFilterMenu from './event-group-filter-menu.svelte';

let { options }: { options: EventGroupOption[] } = $props();
let { options, toggle }: { options: EventGroupOption[]; toggle?: Snippet } =
$props();

const transitionDuration = $derived(prefersReducedMotion.current ? 0 : 150);
</script>
Expand All @@ -17,6 +20,7 @@
transition:slide={{ axis: 'x', duration: transitionDuration }}
>
<div class="flex" transition:fade={{ duration: transitionDuration }}>
{@render toggle?.()}
<EventGroupFilterMenu {options} />
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@
<Menu
id="event-group-filter-menu"
keepOpen
usePortal
position="right"
class="w-[280px] min-w-0 max-w-[calc(100dvw-1rem)] md:w-[380px]"
class="w-[280px] min-w-0 md:w-[380px]"
>
{#if $open}
<li role="none" class="p-2">
Expand All @@ -161,13 +162,18 @@
{#if matchingOptions.length}
{#each visibleOptions as option (option.group.key)}
{@const label = labelFor(option)}
<MenuItem onclick={() => toggle(option.group.key)} class="min-w-0">
<MenuItem
onclick={() => toggle(option.group.key)}
class="min-w-0"
data-track-text="event-group"
>
{#snippet leading()}
<Checkbox
onclick={() => toggle(option.group.key)}
checked={selectedKeys.has(option.group.key)}
{label}
labelHidden
data-track-text="event-group"
/>
{/snippet}
<div class="flex min-w-0 flex-1 items-center gap-2">
Expand Down
27 changes: 13 additions & 14 deletions src/lib/components/lines-and-dots/event-type-filter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
compactEventTypeOptions,
} from '$lib/models/event-history/get-event-categorization';
import { clearActiveGroups } from '$lib/stores/active-events';
import { eventViewType } from '$lib/stores/event-view';
import { eventStatusFilter, eventTypeFilter } from '$lib/stores/filters';
import { temporalVersion } from '$lib/stores/versions';
import { updateEventFilterParams } from '$lib/utilities/event-filter-params';
Expand All @@ -28,9 +27,10 @@

interface Props {
compact?: boolean;
statusFilterAvailable?: boolean;
}

let { compact = false }: Props = $props();
let { compact = false, statusFilterAvailable = true }: Props = $props();

const open = writable(false);

Expand Down Expand Up @@ -85,13 +85,10 @@
};

const onPendingClick = () => {
const statusFilter = !$eventStatusFilter;
$eventTypeFilter = defaultOptions;
$eventStatusFilter = !$eventStatusFilter;
updateEventFilterParams(
page.url,
{ categories: null, statusFilter: !$eventStatusFilter },
goto,
);
$eventStatusFilter = statusFilter;
updateEventFilterParams(page.url, { categories: null, statusFilter }, goto);
Comment thread
laurakwhit marked this conversation as resolved.
Resolved
};

const onNoneClick = () => {
Expand All @@ -105,13 +102,14 @@
};

const filterActive = $derived(
$eventTypeFilter.length < defaultOptions.length,
($eventStatusFilter && statusFilterAvailable) ||
$eventTypeFilter.length < defaultOptions.length,
);
</script>

<MenuContainer {open}>
<MenuButton
controls="status-menu"
controls="event-type-filter"
size="sm"
variant="tertiary"
class="rounded-none"
Expand All @@ -127,10 +125,11 @@
<span class="hidden text-sm md:block">{translate('common.filter')}</span>
</MenuButton>
<Menu
id="event-type-menu"
id="event-type-filter"
keepOpen
usePortal
position="right"
class="w-[220px] md:w-[360px]"
class="w-[220px] min-w-0 md:w-[360px]"
>
<MenuItem data-testid={translate('common.all')} onclick={onAllClick}>
{#snippet leading()}
Expand All @@ -145,7 +144,7 @@
{/snippet}
{translate('common.all')}
</MenuItem>
{#if $eventViewType !== 'json'}
{#if statusFilterAvailable}
<MenuItem
data-testid={translate('common.pending-and-failed')}
description={translate('common.pending-and-failed-description')}
Expand All @@ -156,7 +155,7 @@
<Checkbox
onChange={onPendingClick}
checked={$eventStatusFilter}
label={translate('common.all')}
label={translate('common.pending-and-failed')}
labelHidden
class="mt-px"
/>
Expand Down
12 changes: 12 additions & 0 deletions src/lib/components/lines-and-dots/timeline-graph/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,15 @@ export const ROW_HEIGHT = BASE_RADIUS * 4;
export const GUTTER = BASE_RADIUS * 8;
export const RADIUS = BASE_RADIUS * 1.5;
export const DOT_STROKE = 2;
export const EVENT_GROUP_LINE_HEIGHT = 4;
export const EVENT_GROUP_CAP_HEIGHT = 14;
export const EVENT_GROUP_CAP_WIDTH = 2;
export const EVENT_GROUP_HEADER_MIN_HEIGHT = 32;
export const EVENT_GROUP_HEADER_SPACING = 16;
export const EVENT_GROUP_FOOTER_SPACING = 16;
export const EVENT_GROUP_ROW_OVERFLOW = Math.max(
0,
(RADIUS * 3 - ROW_HEIGHT) / 2,
);
export const EVENT_GROUP_INSET = 8;
export const EVENT_GROUP_BORDER_WIDTH = 2;
Loading
Loading