|
1 | 1 | <script lang="ts"> |
2 | | - import { page } from '$app/stores'; |
| 2 | + import { onMount } from 'svelte'; |
| 3 | +
|
| 4 | + import { page } from '$app/state'; |
3 | 5 |
|
4 | 6 | import EventSummaryRow from '$lib/components/event/event-summary-row.svelte'; |
5 | 7 | import Button from '$lib/holocene/button.svelte'; |
|
9 | 11 | import { eventFilterSort } from '$lib/stores/event-view'; |
10 | 12 | import { fullEventHistory } from '$lib/stores/events'; |
11 | 13 | import { workflowRun } from '$lib/stores/workflow-run'; |
12 | | - import { isNexusOperationScheduledEvent } from '$lib/utilities/is-event-type'; |
13 | 14 |
|
14 | | - $: ({ |
| 15 | + const { |
15 | 16 | id: eventId, |
16 | 17 | namespace, |
17 | 18 | workflow: workflowId, |
18 | 19 | run: runId, |
19 | | - } = $page.params); |
| 20 | + } = $derived(page.params); |
20 | 21 |
|
21 | | - $: ids = [eventId]; |
| 22 | + let ids = $derived([eventId]); |
22 | 23 |
|
23 | 24 | const resetFullHistory = () => { |
24 | 25 | $fullEventHistory = []; |
|
39 | 40 | } |
40 | 41 | }; |
41 | 42 |
|
42 | | - $: fetchEvents(namespace, workflowId, runId); |
43 | | -
|
44 | | - $: ({ workflow } = $workflowRun); |
45 | | - $: pendingActivities = workflow?.pendingActivities; |
46 | | - $: pendingNexusOperations = workflow?.pendingNexusOperations; |
47 | | -
|
48 | | - $: ascendingGroups = groupEvents( |
49 | | - $fullEventHistory, |
50 | | - 'ascending', |
51 | | - pendingActivities, |
52 | | - pendingNexusOperations, |
| 43 | + onMount(() => { |
| 44 | + fetchEvents(namespace, workflowId, runId); |
| 45 | + }); |
| 46 | +
|
| 47 | + const { workflow } = $derived($workflowRun); |
| 48 | + const pendingActivities = $derived(workflow?.pendingActivities); |
| 49 | + const pendingNexusOperations = $derived(workflow?.pendingNexusOperations); |
| 50 | +
|
| 51 | + const ascendingGroups = $derived( |
| 52 | + groupEvents( |
| 53 | + $fullEventHistory, |
| 54 | + 'ascending', |
| 55 | + pendingActivities, |
| 56 | + pendingNexusOperations, |
| 57 | + ), |
53 | 58 | ); |
54 | | - $: groups = |
| 59 | + const groups = $derived( |
55 | 60 | $eventFilterSort === 'ascending' |
56 | 61 | ? ascendingGroups |
57 | | - : [...ascendingGroups].reverse(); |
| 62 | + : [...ascendingGroups].reverse(), |
| 63 | + ); |
58 | 64 |
|
59 | | - $: initialEvent = $fullEventHistory.find( |
60 | | - (e) => |
61 | | - eventId === e.id || |
62 | | - (isNexusOperationScheduledEvent(e) && |
63 | | - eventId === e.attributes?.requestId), |
| 65 | + const initialEvent = $derived( |
| 66 | + $fullEventHistory.find( |
| 67 | + (e) => |
| 68 | + e.id === eventId || |
| 69 | + e.id === |
| 70 | + workflow.workflowExtendedInfo?.requestIdInfos?.[eventId]?.eventId, |
| 71 | + ), |
64 | 72 | ); |
65 | | - $: visibleItems = $fullEventHistory.filter( |
66 | | - (e) => ids.includes(e.id) || e.id === initialEvent?.id, |
| 73 | +
|
| 74 | + const visibleItems = $derived( |
| 75 | + $fullEventHistory.filter( |
| 76 | + (e) => ids.includes(e.id) || e.id === initialEvent?.id, |
| 77 | + ), |
| 78 | + ); |
| 79 | + const loading = $derived(!visibleItems.length); |
| 80 | + const lastEventId = $derived( |
| 81 | + $fullEventHistory[$fullEventHistory.length - 1]?.id, |
67 | 82 | ); |
68 | | - $: loading = !visibleItems.length; |
69 | 83 |
|
70 | 84 | const loadPrevious = () => { |
71 | 85 | const firstId = parseInt(ids[0]); |
|
94 | 108 |
|
95 | 109 | ids = [...ids, ...nextTen]; |
96 | 110 | }; |
97 | | -
|
98 | | - $: lastEventId = $fullEventHistory[$fullEventHistory.length - 1]?.id; |
99 | 111 | </script> |
100 | 112 |
|
101 | 113 | <div |
|
0 commit comments