Skip to content

Commit 3220307

Browse files
Update groupDetailsEntries logic in ungrouped view as well
Signed-off-by: Adhitya Mamallan <[email protected]>
1 parent 23f73b7 commit 3220307

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

src/views/workflow-history-v2/workflow-history-ungrouped-event/workflow-history-ungrouped-event.tsx

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import workflowHistoryEventFilteringTypeColorsConfig from '../config/workflow-hi
1313
import generateHistoryGroupDetails from '../helpers/generate-history-group-details';
1414
import WorkflowHistoryDetailsRow from '../workflow-history-details-row/workflow-history-details-row';
1515
import getEventGroupFilteringType from '../workflow-history-event-group/helpers/get-event-group-filtering-type';
16+
import getSummaryTabContentEntry from '../workflow-history-event-group/helpers/get-summary-tab-content-entry';
1617
import getFormattedEventsDuration from '../workflow-history-event-group-duration/helpers/get-formatted-events-duration';
1718
import WorkflowHistoryGroupDetails from '../workflow-history-group-details/workflow-history-group-details';
1819

@@ -50,6 +51,33 @@ export default function WorkflowHistoryUngroupedEvent({
5051
([eventId]) => eventId === eventInfo.id
5152
)?.[1].eventDetails;
5253

54+
const groupSummaryDetails = useMemo(
55+
() =>
56+
summaryDetailsEntries.flatMap(
57+
([_eventId, { eventDetails }]) => eventDetails
58+
),
59+
[summaryDetailsEntries]
60+
);
61+
62+
const groupDetailsEntriesWithSummary = useMemo(
63+
() => [
64+
...(groupSummaryDetails.length > 0 && groupDetailsEntries.length > 1
65+
? [
66+
getSummaryTabContentEntry({
67+
groupId: eventInfo.eventGroup.firstEventId ?? 'unknown',
68+
summaryDetails: groupSummaryDetails,
69+
}),
70+
]
71+
: []),
72+
...groupDetailsEntries,
73+
],
74+
[
75+
eventInfo.eventGroup.firstEventId,
76+
groupDetailsEntries,
77+
groupSummaryDetails,
78+
]
79+
);
80+
5381
return (
5482
<Panel
5583
title={
@@ -119,19 +147,7 @@ export default function WorkflowHistoryUngroupedEvent({
119147
<styled.GroupDetailsNameSpacer />
120148
<styled.GroupDetailsContainer>
121149
<WorkflowHistoryGroupDetails
122-
groupDetailsEntries={[
123-
[
124-
`summary_${eventInfo.eventGroup.firstEventId}`,
125-
{
126-
eventDetails: summaryDetailsEntries.flatMap(
127-
([_, eventSummaryDetails]) =>
128-
eventSummaryDetails.eventDetails
129-
),
130-
eventLabel: 'Summary',
131-
},
132-
],
133-
...groupDetailsEntries,
134-
]}
150+
groupDetailsEntries={groupDetailsEntriesWithSummary}
135151
initialEventId={eventInfo.id}
136152
workflowPageParams={decodedPageUrlParams}
137153
onClose={() => toggleIsExpanded()}

0 commit comments

Comments
 (0)