-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathworkflow-history-layout.svelte
88 lines (78 loc) · 2.73 KB
/
workflow-history-layout.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<script lang="ts">
import { beforeNavigate } from '$app/navigation';
import EventSummary from '$lib/components/event/event-summary.svelte';
import InputAndResults from '$lib/components/lines-and-dots/input-and-results.svelte';
import TimelineGraph from '$lib/components/lines-and-dots/svg/timeline-graph.svelte';
import WorkflowError from '$lib/components/lines-and-dots/workflow-error.svelte';
import WorkflowCallStackError from '$lib/components/workflow/workflow-call-stack-error.svelte';
import WorkflowCallbacks from '$lib/components/workflow/workflow-callbacks.svelte';
import { translate } from '$lib/i18n/translate';
import { groupEvents } from '$lib/models/event-groups';
import { clearActives } from '$lib/stores/active-events';
import { eventFilterSort, eventViewType } from '$lib/stores/event-view';
import {
currentEventHistory,
filteredEventHistory,
pauseLiveUpdates,
} from '$lib/stores/events';
import { workflowRun } from '$lib/stores/workflow-run';
import { getWorkflowTaskFailedEvent } from '$lib/utilities/get-workflow-task-failed-event';
$: ({ workflow } = $workflowRun);
$: pendingActivities = workflow?.pendingActivities;
$: pendingNexusOperations = workflow?.pendingNexusOperations;
$: ascendingGroups = groupEvents(
$filteredEventHistory,
'ascending',
pendingActivities,
pendingNexusOperations,
);
$: groups =
$eventFilterSort === 'ascending'
? ascendingGroups
: [...ascendingGroups].reverse();
$: history =
$eventFilterSort === 'ascending'
? $filteredEventHistory
: [...$filteredEventHistory].reverse();
$: workflowTaskFailedError = getWorkflowTaskFailedEvent(
$currentEventHistory,
'ascending',
);
$: $eventViewType, clearActives();
beforeNavigate(() => {
clearActives();
});
$: {
if (!workflow.isRunning && $pauseLiveUpdates) {
$pauseLiveUpdates = false;
}
}
</script>
<div class="flex flex-col gap-0 px-2 pt-4 md:px-4 lg:px-8">
<WorkflowCallStackError />
<div class="flex flex-col gap-2">
<InputAndResults />
{#if workflowTaskFailedError}
<WorkflowError
error={workflowTaskFailedError}
pendingTask={workflow?.pendingWorkflowTask}
/>
{/if}
{#if workflow?.callbacks?.length}
<WorkflowCallbacks callbacks={workflow.callbacks} />
{/if}
<div
class="flex flex-col items-center gap-2 py-2 xl:flex-row xl:justify-between xl:gap-8"
>
<h2>
{translate('workflows.event-history')}
</h2>
</div>
</div>
</div>
<div class="px-2 pb-24 md:px-4 lg:px-8">
<div class="flex w-full flex-col border border-subtle">
<TimelineGraph {workflow} {groups} {workflowTaskFailedError} />
<EventSummary {groups} {history} />
</div>
</div>