From 7062cbecf3cf630f69de4bc0002d4b5cd1b9e5c4 Mon Sep 17 00:00:00 2001 From: Alex Tideman Date: Thu, 12 Sep 2024 12:09:58 -0500 Subject: [PATCH 1/2] Fix workflow counts and reactive selectedId --- .../components/event/event-summary-row.svelte | 2 +- .../workflow/workflow-counts.svelte | 40 +++++++++++++++---- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/lib/components/event/event-summary-row.svelte b/src/lib/components/event/event-summary-row.svelte index 1254b2b54..7c04e4289 100644 --- a/src/lib/components/event/event-summary-row.svelte +++ b/src/lib/components/event/event-summary-row.svelte @@ -46,7 +46,7 @@ export let active = false; export let onRowClick: () => void = noop; - let selectedId = isEventGroup(event) + $: selectedId = isEventGroup(event) ? Array.from(event.events.keys()).pop() : event.id; diff --git a/src/lib/components/workflow/workflow-counts.svelte b/src/lib/components/workflow/workflow-counts.svelte index ade01ef7a..3fec3e546 100644 --- a/src/lib/components/workflow/workflow-counts.svelte +++ b/src/lib/components/workflow/workflow-counts.svelte @@ -3,18 +3,25 @@ import { page } from '$app/stores'; - import Link from '$lib/holocene/link.svelte'; import Skeleton from '$lib/holocene/skeleton/index.svelte'; import { workflowStatuses } from '$lib/models/workflow-status'; import { fetchWorkflowCountByExecutionStatus } from '$lib/services/workflow-counts'; + import { workflowFilters } from '$lib/stores/filters'; + import { currentPageKey } from '$lib/stores/pagination'; import { queryWithParentWorkflowId, refresh, workflowCount, } from '$lib/stores/workflows'; - import type { WorkflowStatus } from '$lib/types/workflows'; + import { + SEARCH_ATTRIBUTE_TYPE, + type WorkflowStatus, + } from '$lib/types/workflows'; import { decodePayload } from '$lib/utilities/decode-payload'; + import { toListWorkflowQueryFromFilters } from '$lib/utilities/query/filter-workflow-query'; + import { combineFilters } from '$lib/utilities/query/to-list-workflow-filters'; import { getExponentialBackoffSeconds } from '$lib/utilities/refresh-rate'; + import { updateQueryParameters } from '$lib/utilities/update-query-parameters'; import WorkflowCountStatus from './workflow-count-status.svelte'; @@ -116,16 +123,35 @@ } }; + const onStatusClick = (status) => { + const filter = { + attribute: 'ExecutionStatus', + type: SEARCH_ATTRIBUTE_TYPE.KEYWORD, + value: status, + operator: '', + conditional: '=', + parenthesis: '', + }; + $workflowFilters = [...$workflowFilters, filter]; + const searchQuery = toListWorkflowQueryFromFilters( + combineFilters($workflowFilters), + ); + updateQueryParameters({ + url: $page.url, + parameter: 'query', + value: searchQuery, + allowEmpty: true, + clearParameters: [currentPageKey], + }); + }; + $: query, namespace, $refresh, fetchCounts();
{#each statusGroups as { count, status } (status)} {#if !loading} - + {:else} {/if} From c7ec781a39f8ac0673c5a4fc864279a4dff6436d Mon Sep 17 00:00:00 2001 From: Alex Tideman Date: Thu, 12 Sep 2024 12:31:40 -0500 Subject: [PATCH 2/2] Fix event group link logic --- src/lib/components/event/event-summary-row.svelte | 11 ++++++++++- src/lib/models/event-groups/create-event-group.ts | 4 ++-- src/lib/utilities/get-failed-or-pending.ts | 12 +++++++----- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/lib/components/event/event-summary-row.svelte b/src/lib/components/event/event-summary-row.svelte index 7c04e4289..6c47cd80f 100644 --- a/src/lib/components/event/event-summary-row.svelte +++ b/src/lib/components/event/event-summary-row.svelte @@ -193,7 +193,16 @@
{#each event.eventList as groupEvent} - + {groupEvent.id} {/each} diff --git a/src/lib/models/event-groups/create-event-group.ts b/src/lib/models/event-groups/create-event-group.ts index c3d07d742..897bfe08d 100644 --- a/src/lib/models/event-groups/create-event-group.ts +++ b/src/lib/models/event-groups/create-event-group.ts @@ -121,8 +121,8 @@ const createGroupFor = ( }, get isPending() { return ( - this.pendingActivity || - this.pendingNexusOperation || + !!this.pendingActivity || + !!this.pendingNexusOperation || (isTimerStartedEvent(this.initialEvent) && this.eventList.length === 1) || (isStartChildWorkflowExecutionInitiatedEvent(this.initialEvent) && diff --git a/src/lib/utilities/get-failed-or-pending.ts b/src/lib/utilities/get-failed-or-pending.ts index 059ae0288..baa29bb81 100644 --- a/src/lib/utilities/get-failed-or-pending.ts +++ b/src/lib/utilities/get-failed-or-pending.ts @@ -16,12 +16,13 @@ export const getFailedOrPendingEvents = ( return items.filter( (item) => (isEvent(item) && item.classification === 'Failed') || + (isEvent(item) && item.classification === 'TimedOut') || isPendingActivity(item) || isPendingNexusOperation(item) || (isEventGroup(item) && - (item.pendingActivity || - item.pendingNexusOperation || - item.finalClassification === 'Failed')), + (item.isPending || + item.finalClassification === 'Failed' || + item.finalClassification === 'TimedOut')), ); }; @@ -33,7 +34,8 @@ export const getFailedOrPendingGroups = ( return items.filter( (item) => isEventGroup(item) && - item.eventList.length > 1 && - (item.isPending || item.finalClassification === 'Failed'), + (item.isPending || + item.finalClassification === 'Failed' || + item.finalClassification === 'TimedOut'), ); };