Skip to content

Commit c9cb225

Browse files
committed
Add schedule/next/previous/first to viz
1 parent 42bcd55 commit c9cb225

7 files changed

+243
-234
lines changed

Diff for: src/lib/components/workflow/relationships/continue-as-new-node.svelte

-30
This file was deleted.

Diff for: src/lib/components/workflow/relationships/continue-as-new-tree.svelte

-66
This file was deleted.

Diff for: src/lib/components/workflow/relationships/schedule-tree.svelte

-39
This file was deleted.

Diff for: src/lib/components/workflow/relationships/workflow-family-node-tree.svelte

+134-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
66
import type { RootNode } from '$lib/services/workflow-service';
77
import type { WorkflowExecution } from '$lib/types/workflows';
8+
import {
9+
routeForRelationships,
10+
routeForSchedule,
11+
} from '$lib/utilities/route-for';
812
13+
export let fullTree = false;
914
export let root: RootNode;
1015
export let width: number;
1116
export let height: number;
@@ -17,8 +22,11 @@
1722
export let expandAll: boolean;
1823
export let onNodeClick: (node: RootNode, generation: number) => void;
1924
export let activeWorkflow: WorkflowExecution | undefined = undefined;
25+
export let first: string | undefined;
26+
export let previous: string | undefined;
27+
export let next: string | undefined;
2028
21-
$: ({ workflow, run } = $page.params);
29+
$: ({ workflow, run, namespace } = $page.params);
2230
2331
const getPositions = (
2432
width: number,
@@ -128,6 +136,7 @@
128136
{openRuns}
129137
{onNodeClick}
130138
{activeWorkflow}
139+
{fullTree}
131140
/>
132141
{/if}
133142
<line
@@ -196,6 +205,17 @@
196205
font-weight="500">{child.children.length}</text
197206
>
198207
{/if}
208+
{#if !fullTree}
209+
<text
210+
x={childX}
211+
y={!child?.children?.length ? childY + radius : childY - radius}
212+
class="text-center text-lg {!child?.children?.length &&
213+
'[writing-mode:vertical-lr]'}"
214+
fill="currentColor"
215+
text-anchor={!child?.children?.length ? 'start' : 'middle'}
216+
font-weight="500">{child.workflow.id}</text
217+
>
218+
{/if}
199219
</g>
200220
{/each}
201221

@@ -207,6 +227,115 @@
207227
on:click={(e) => nodeClick(e, root)}
208228
on:keypress={(e) => nodeClick(e, root)}
209229
>
230+
{#if root?.scheduleId}
231+
<line
232+
x1={x}
233+
y1={y}
234+
x2={x}
235+
y2={y - 2.5 * radius}
236+
stroke-dasharray="3 2"
237+
class="stroke-slate-100 stroke-2 transition-all duration-300 ease-in-out dark:stroke-slate-800"
238+
/>
239+
<line
240+
x1={x - 5 * radius}
241+
y1={y - 2.5 * radius}
242+
x2={x}
243+
y2={y - 2.5 * radius}
244+
stroke-dasharray="3 2"
245+
class="stroke-slate-100 stroke-2 transition-all duration-300 ease-in-out dark:stroke-slate-800"
246+
/>
247+
<a href={routeForSchedule({ namespace, scheduleId: root.scheduleId })}>
248+
<text
249+
x={x - 5.25 * radius}
250+
y={y - 2.5 * radius}
251+
fill="currentColor"
252+
text-decoration="underline"
253+
text-anchor="end"
254+
font-weight="500">{root.scheduleId}</text
255+
>
256+
</a>
257+
{/if}
258+
{#if next}
259+
<line
260+
x1={x}
261+
y1={y}
262+
x2={x + 4 * radius}
263+
y2={y}
264+
class="stroke-slate-100 stroke-2 transition-all duration-300 ease-in-out dark:stroke-slate-800"
265+
/>
266+
<text
267+
x={x + 4.25 * radius}
268+
y={y - 4}
269+
fill="currentColor"
270+
text-anchor="start"
271+
font-weight="500">Next Execution</text
272+
>
273+
<a href={routeForRelationships({ namespace, workflow, run: next })}>
274+
<text
275+
x={x + 4.25 * radius}
276+
y={y + radius - 4}
277+
fill="currentColor"
278+
text-decoration="underline"
279+
text-anchor="start"
280+
font-weight="500">{next}</text
281+
>
282+
</a>
283+
{/if}
284+
{#if previous}
285+
<line
286+
x1={x}
287+
y1={y}
288+
x2={x - 4 * radius}
289+
y2={y}
290+
class="stroke-slate-100 stroke-2 transition-all duration-300 ease-in-out dark:stroke-slate-800"
291+
/>
292+
<text
293+
x={x - 4.25 * radius}
294+
y={y - 4}
295+
fill="currentColor"
296+
text-anchor="end"
297+
font-weight="500"
298+
>{previous === first ? 'First' : 'Previous'} Execution</text
299+
>
300+
<a href={routeForRelationships({ namespace, workflow, run: previous })}>
301+
<text
302+
href={routeForRelationships({ namespace, workflow, run: previous })}
303+
x={x - 4.25 * radius}
304+
y={y + radius - 4}
305+
fill="currentColor"
306+
text-decoration="underline"
307+
text-anchor="end"
308+
font-weight="500">{previous}</text
309+
>
310+
</a>
311+
{/if}
312+
{#if first && previous !== first}
313+
<line
314+
x1={x - 4 * radius}
315+
y1={y}
316+
x2={radius}
317+
y2={y}
318+
stroke-dasharray="3 2"
319+
class="stroke-slate-100 stroke-2 transition-all duration-300 ease-in-out dark:stroke-slate-800"
320+
/>
321+
<text
322+
x={radius}
323+
y={y - 4}
324+
fill="currentColor"
325+
text-anchor="start"
326+
font-weight="500">First Execution</text
327+
>
328+
<a href={routeForRelationships({ namespace, workflow, run: first })}>
329+
<text
330+
x={radius}
331+
y={y + radius - 4}
332+
fill="currentColor"
333+
text-decoration="underline"
334+
text-anchor="start"
335+
font-weight="500">{first}</text
336+
>
337+
</a>
338+
{/if}
210339
{#if root?.children?.length}
211340
<line
212341
x1={x}
@@ -248,11 +377,12 @@
248377
{#if root?.children?.length}
249378
<text
250379
{x}
251-
y={y - radius * 1.5}
252-
class="text-center font-mono text-lg"
380+
y={y - radius}
381+
class="text-center {fullTree && 'font-mono'} text-lg"
253382
fill="currentColor"
254383
text-anchor="middle"
255-
font-weight="500">{root.children.length}</text
384+
font-weight="500"
385+
>{fullTree ? root.children.length : root.workflow.id}</text
256386
>
257387
{/if}
258388
</g>

0 commit comments

Comments
 (0)