-
Notifications
You must be signed in to change notification settings - Fork 14
feat: demo add synth events #332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| import { createEventDispatcher, onMount } from 'svelte'; | ||
| import { SvelteFlow } from '@xyflow/svelte'; | ||
| import '@xyflow/svelte/dist/style.css'; | ||
| import type { createFlowState } from '$lib/stores/pgflow-state-improved.svelte'; | ||
| import type { createFlowState } from '$lib/stores/pgflow-state.svelte'; | ||
| import DAGNode from './DAGNode.svelte'; | ||
| interface Props { | ||
|
|
@@ -163,16 +163,18 @@ | |
| ]); | ||
| function isStepActive(stepSlug: string): boolean { | ||
| const status = flowState.stepStatuses[stepSlug]; | ||
| return status === 'started'; | ||
| // Use reactive step() method from runState | ||
| return flowState.step(stepSlug).status === 'started'; | ||
|
Comment on lines
+166
to
+167
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment here is redundant since the code already clearly shows we're using the step() method. Consider removing the comment to make the code cleaner. Spotted by Graphite Agent (based on CI logs) |
||
| } | ||
| function isStepCompleted(stepSlug: string): boolean { | ||
| return flowState.stepStatuses[stepSlug] === 'completed'; | ||
| // Use reactive step() method from runState | ||
| return flowState.step(stepSlug).status === 'completed'; | ||
| } | ||
| function isStepFailed(stepSlug: string): boolean { | ||
| return flowState.stepStatuses[stepSlug] === 'failed'; | ||
| // Use reactive step() method from runState | ||
| return flowState.step(stepSlug).status === 'failed'; | ||
| } | ||
| function isEdgeActive(source: string, target: string): boolean { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| <script lang="ts"> | ||
| import type { createFlowState } from '$lib/stores/pgflow-state-improved.svelte'; | ||
| import type { createFlowState } from '$lib/stores/pgflow-state.svelte'; | ||
| import { codeToHtml } from 'shiki'; | ||
| import { SvelteMap } from 'svelte/reactivity'; | ||
|
|
@@ -45,7 +45,7 @@ | |
| // Clear cache when flow resets (events list becomes empty or significantly changes) | ||
| let lastEventCount = $state(0); | ||
| $effect(() => { | ||
| const currentEventCount = flowState.events.length; | ||
| const currentEventCount = flowState.timeline.length; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure the timeline implementation uses SvelteDate instead of the built-in Date class for reactivity. If the timeline is created in pgflow-state.svelte, make sure all Date instances are replaced with SvelteDate there. Spotted by Graphite Agent (based on CI logs) |
||
| // If events list was cleared or reduced significantly, clear the cache | ||
| if (currentEventCount === 0 || currentEventCount < lastEventCount - 5) { | ||
| highlightedEvents = new SvelteMap(); | ||
|
|
@@ -54,23 +54,11 @@ | |
| lastEventCount = currentEventCount; | ||
| }); | ||
| // Get relative time from flow start | ||
| function formatRelativeTime(timestamp: Date, firstEventTimestamp: Date): string { | ||
| const diffMs = timestamp.getTime() - firstEventTimestamp.getTime(); | ||
| const seconds = (diffMs / 1000).toFixed(3); | ||
| return `+${seconds}s`; | ||
| } | ||
| // Get display status from event_type (use the status part for badge coloring) | ||
| function getEventStatus(eventType: string): string { | ||
| return eventType.split(':')[1] || 'unknown'; | ||
| } | ||
| // Get full event name for display | ||
| function getEventDisplayName(eventType: string): string { | ||
| return eventType; | ||
| } | ||
| // Get color class for event name based on status | ||
| function getEventColor(eventType: string): string { | ||
| const status = getEventStatus(eventType); | ||
|
|
@@ -87,15 +75,16 @@ | |
| return 'text-muted-foreground'; | ||
| } | ||
| } | ||
| </script> | ||
|
|
||
| <div class="flex flex-col h-full min-w-0"> | ||
| {#if flowState.events.length > 0} | ||
| {#if flowState.timeline.length > 0} | ||
| <!-- Table-like headers --> | ||
| <div | ||
| class="flex items-center gap-2 px-3 py-1 border-b border-muted text-xs font-semibold text-muted-foreground" | ||
| > | ||
| <div class="w-[80px] text-left">TIME</div> | ||
| <div class="w-[120px] text-left">TIME</div> | ||
| <div class="w-[140px] text-left">EVENT</div> | ||
| <div class="flex-1 text-left">STEP</div> | ||
| <div class="w-[32px]"></div> | ||
|
|
@@ -104,16 +93,14 @@ | |
| {/if} | ||
|
|
||
| <div class="flex-1 overflow-y-auto overflow-x-hidden space-y-1 min-w-0"> | ||
| {#if flowState.events.length === 0} | ||
| {#if flowState.timeline.length === 0} | ||
| <p class="text-sm text-muted-foreground text-center py-8"> | ||
| No events yet. Start a flow to see events. | ||
| </p> | ||
| {:else} | ||
| {@const firstEventTimestamp = flowState.events[0]?.timestamp} | ||
| {#each flowState.events as event, index (index)} | ||
| {#each flowState.timeline as event, index (index)} | ||
| {@const eventType = event.event_type} | ||
| {@const stepSlug = event.data?.step_slug} | ||
| {@const eventDisplayName = getEventDisplayName(eventType)} | ||
| {@const stepSlug = event.step_slug} | ||
| {@const eventColor = getEventColor(eventType)} | ||
| {@const isExpanded = expandedEventIndices.has(index)} | ||
| {@const isHighlighted = stepSlug && hoveredStep === stepSlug} | ||
|
|
@@ -127,11 +114,18 @@ | |
| class="flex items-center gap-2 w-full text-left px-1 rounded transition-colors hover:bg-muted/20" | ||
| onclick={(e) => toggleEvent(index, e)} | ||
| > | ||
| <code class="w-[80px] text-base text-muted-foreground font-mono text-left" | ||
| >{formatRelativeTime(event.timestamp, firstEventTimestamp)}</code | ||
| > | ||
| <div class="w-[120px] flex flex-col text-left"> | ||
| <code class="text-base text-muted-foreground font-mono" | ||
| >{event.cumulativeDisplay}</code | ||
| > | ||
| {#if event.deltaMs > 0} | ||
| <code class="text-xs text-muted-foreground/70 font-mono" | ||
| >{event.deltaDisplay}</code | ||
| > | ||
| {/if} | ||
| </div> | ||
| <code class="w-[140px] text-base font-semibold font-mono {eventColor}"> | ||
| {eventDisplayName} | ||
| {eventType} | ||
| </code> | ||
| {#if stepSlug} | ||
| <code | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace 'void flowState.run' with a proper$effect block or use $ : to track the dependency. For example: '$: ({ run } = flowState);' or create an $effect that uses flowState.run properly.
Spotted by Graphite Agent (based on CI logs)

Is this helpful? React 👍 or 👎 to let us know.