|
3 | 3 |
|
4 | 4 | import Loading from '$lib/holocene/loading.svelte';
|
5 | 5 | import { translate } from '$lib/i18n/translate';
|
6 |
| - import { fetchAllRootWorkflows } from '$lib/services/workflow-service'; |
| 6 | + import { |
| 7 | + fetchAllRootWorkflows, |
| 8 | + fetchAllRootWorkflowsCount, |
| 9 | + } from '$lib/services/workflow-service'; |
7 | 10 | import { fullEventHistory } from '$lib/stores/events';
|
8 | 11 | import { namespaces } from '$lib/stores/namespaces';
|
9 | 12 | import { workflowRun } from '$lib/stores/workflow-run';
|
| 13 | + import { getStatusAndCountOfGroup } from '$lib/utilities/get-group-status-and-count'; |
10 | 14 | import { getWorkflowRelationships } from '$lib/utilities/get-workflow-relationships';
|
11 | 15 |
|
| 16 | + import WorkflowCountStatus from '../workflow-status.svelte'; |
| 17 | +
|
12 | 18 | import ContinueAsNewTree from './relationships/continue-as-new-tree.svelte';
|
13 | 19 | import ScheduleTree from './relationships/schedule-tree.svelte';
|
14 | 20 | import WorkflowFamilyTree from './relationships/workflow-family-tree.svelte';
|
|
27 | 33 | );
|
28 | 34 | $: ({ hasRelationships, first, next, previous, scheduleId } =
|
29 | 35 | workflowRelationships);
|
| 36 | +
|
| 37 | + const MAX_UPPER_LIMIT = 3000; |
30 | 38 | </script>
|
31 | 39 |
|
32 | 40 | <div class="flex flex-col gap-4 pb-12">
|
33 | 41 | {#if hasRelationships}
|
34 | 42 | <div class="flex w-full flex-col justify-center gap-4">
|
35 |
| - {#await fetchAllRootWorkflows(namespace, rootWorkflowId, rootRunId)} |
| 43 | + {#await fetchAllRootWorkflowsCount(namespace, rootWorkflowId, rootRunId)} |
36 | 44 | <Loading />
|
37 |
| - {:then root} |
38 |
| - {#if root && !!root.children.length} |
39 |
| - <WorkflowFamilyTree {root} /> |
40 |
| - {/if} |
41 |
| - {#if scheduleId} |
42 |
| - <ScheduleTree {scheduleId} current={runId} {workflowId} {namespace} /> |
43 |
| - {/if} |
44 |
| - {#if first || previous || next} |
45 |
| - <ContinueAsNewTree |
46 |
| - {first} |
47 |
| - {previous} |
48 |
| - {next} |
49 |
| - current={runId} |
50 |
| - {workflowId} |
51 |
| - {namespace} |
52 |
| - /> |
| 45 | + {:then { count, groups }} |
| 46 | + {#if parseInt(count) > MAX_UPPER_LIMIT} |
| 47 | + {@const statusGroups = getStatusAndCountOfGroup(groups)} |
| 48 | + <div class="flex flex-col gap-2 px-8 py-4"> |
| 49 | + <h4 class="text-xl font-medium"> |
| 50 | + {count} Workflows associated to Root Workflow |
| 51 | + </h4> |
| 52 | + <div class="flex flex-wrap items-center gap-1"> |
| 53 | + {#each statusGroups as { count, status } (status)} |
| 54 | + <WorkflowCountStatus |
| 55 | + {status} |
| 56 | + {count} |
| 57 | + big |
| 58 | + test-id="workflow-status-{status}" |
| 59 | + /> |
| 60 | + {/each} |
| 61 | + </div> |
| 62 | + {#if scheduleId} |
| 63 | + <ScheduleTree |
| 64 | + {scheduleId} |
| 65 | + current={runId} |
| 66 | + {workflowId} |
| 67 | + {namespace} |
| 68 | + /> |
| 69 | + {/if} |
| 70 | + {#if first || previous || next} |
| 71 | + <ContinueAsNewTree |
| 72 | + {first} |
| 73 | + {previous} |
| 74 | + {next} |
| 75 | + current={runId} |
| 76 | + {workflowId} |
| 77 | + {namespace} |
| 78 | + /> |
| 79 | + {/if} |
| 80 | + </div> |
| 81 | + {:else} |
| 82 | + {#await fetchAllRootWorkflows(namespace, rootWorkflowId, rootRunId)} |
| 83 | + <Loading /> |
| 84 | + {:then root} |
| 85 | + {#if root && !!root.children.length} |
| 86 | + <WorkflowFamilyTree {root} /> |
| 87 | + {/if} |
| 88 | + {#if scheduleId} |
| 89 | + <ScheduleTree |
| 90 | + {scheduleId} |
| 91 | + current={runId} |
| 92 | + {workflowId} |
| 93 | + {namespace} |
| 94 | + /> |
| 95 | + {/if} |
| 96 | + {#if first || previous || next} |
| 97 | + <ContinueAsNewTree |
| 98 | + {first} |
| 99 | + {previous} |
| 100 | + {next} |
| 101 | + current={runId} |
| 102 | + {workflowId} |
| 103 | + {namespace} |
| 104 | + /> |
| 105 | + {/if} |
| 106 | + {:catch} |
| 107 | + <WorkflowRelationshipsOld /> |
| 108 | + {/await} |
53 | 109 | {/if}
|
54 | 110 | {:catch}
|
55 | 111 | <WorkflowRelationshipsOld />
|
|
0 commit comments