Skip to content

Commit 02b92ca

Browse files
Pass entire event metadata to ungrouped history view (#952)
Pass entire event metadata to ungrouped history view, instead of just the status and status label. This will come in use later for a future PR.
1 parent 88a5010 commit 02b92ca

File tree

6 files changed

+83
-17
lines changed

6 files changed

+83
-17
lines changed

src/views/workflow-history/helpers/__tests__/compare-ungrouped-events.test.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,25 @@ describe(compareUngroupedEvents.name, () => {
1616
status: 'COMPLETED' as WorkflowEventStatus,
1717
statusLabel: 'Completed',
1818
event: startWorkflowExecutionEvent,
19+
eventMetadata: {
20+
label: 'Completed',
21+
status: 'COMPLETED' as WorkflowEventStatus,
22+
timeMs: 1704067200000,
23+
timeLabel: 'Completed at 2024-01-01 12:00:00',
24+
},
1925
};
2026
const eventB = {
2127
id: '2',
2228
label: 'Event B',
2329
status: 'COMPLETED' as WorkflowEventStatus,
2430
statusLabel: 'Completed',
2531
event: startWorkflowExecutionEvent,
32+
eventMetadata: {
33+
label: 'Completed',
34+
status: 'COMPLETED' as WorkflowEventStatus,
35+
timeMs: 1704067200000,
36+
timeLabel: 'Completed at 2024-01-01 12:00:00',
37+
},
2638
};
2739

2840
expect(compareUngroupedEvents(eventA, eventB)).toBe(-1);
@@ -37,13 +49,25 @@ describe(compareUngroupedEvents.name, () => {
3749
status: 'COMPLETED' as WorkflowEventStatus,
3850
statusLabel: 'Completed',
3951
event: startWorkflowExecutionEvent,
52+
eventMetadata: {
53+
label: 'Completed',
54+
status: 'COMPLETED' as WorkflowEventStatus,
55+
timeMs: 1704067200000,
56+
timeLabel: 'Completed at 2024-01-01 12:00:00',
57+
},
4058
};
4159
const pendingEvent = {
4260
id: '1',
4361
label: 'Pending Event',
4462
status: 'WAITING' as WorkflowEventStatus,
4563
statusLabel: 'Waiting',
4664
event: pendingActivityTaskStartEvent,
65+
eventMetadata: {
66+
label: 'Waiting',
67+
status: 'WAITING' as WorkflowEventStatus,
68+
timeMs: null,
69+
timeLabel: 'Pending',
70+
},
4771
};
4872

4973
expect(compareUngroupedEvents(nonPendingEvent, pendingEvent)).toBe(-1);
@@ -63,6 +87,12 @@ describe(compareUngroupedEvents.name, () => {
6387
...pendingActivityTaskStartEvent,
6488
eventTime: eventTimeA,
6589
},
90+
eventMetadata: {
91+
label: 'Waiting',
92+
status: 'WAITING' as WorkflowEventStatus,
93+
timeMs: 1000000,
94+
timeLabel: 'Waiting at 1970-01-01 00:16:40',
95+
},
6696
};
6797
const pendingEventB = {
6898
id: '2',
@@ -73,6 +103,12 @@ describe(compareUngroupedEvents.name, () => {
73103
...pendingDecisionTaskStartEvent,
74104
eventTime: eventTimeB,
75105
},
106+
eventMetadata: {
107+
label: 'Waiting',
108+
status: 'WAITING' as WorkflowEventStatus,
109+
timeMs: 2000000,
110+
timeLabel: 'Waiting at 1970-01-01 00:33:20',
111+
},
76112
};
77113

78114
expect(compareUngroupedEvents(pendingEventA, pendingEventB)).toBe(-1000000);
@@ -90,6 +126,12 @@ describe(compareUngroupedEvents.name, () => {
90126
...pendingActivityTaskStartEvent,
91127
eventTime: null,
92128
},
129+
eventMetadata: {
130+
label: 'Waiting',
131+
status: 'WAITING' as WorkflowEventStatus,
132+
timeMs: null,
133+
timeLabel: 'Pending',
134+
},
93135
};
94136
const pendingEventB = {
95137
id: '2',
@@ -100,6 +142,12 @@ describe(compareUngroupedEvents.name, () => {
100142
...pendingDecisionTaskStartEvent,
101143
eventTime: null,
102144
},
145+
eventMetadata: {
146+
label: 'Waiting',
147+
status: 'WAITING' as WorkflowEventStatus,
148+
timeMs: null,
149+
timeLabel: 'Pending',
150+
},
103151
};
104152

105153
expect(compareUngroupedEvents(pendingEventA, pendingEventB)).toBe(0);

src/views/workflow-history/workflow-history-ungrouped-event/__tests__/workflow-history-ungrouped-event.test.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,25 +95,37 @@ jest.mock(
9595
const mockEventInfo: WorkflowHistoryUngroupedEventInfo = {
9696
id: '1',
9797
label: 'Workflow Execution Started',
98-
status: 'COMPLETED',
99-
statusLabel: 'Completed',
10098
event: startWorkflowExecutionEvent,
99+
eventMetadata: {
100+
label: 'Completed',
101+
status: 'COMPLETED',
102+
timeMs: 1704067200000,
103+
timeLabel: 'Mock time label',
104+
},
101105
};
102106

103107
const mockPendingActivityEventInfo: WorkflowHistoryUngroupedEventInfo = {
104108
id: 'pending-7',
105109
label: 'Activity Task Started',
106-
status: 'WAITING',
107-
statusLabel: 'Pending',
108110
event: pendingActivityTaskStartEvent,
111+
eventMetadata: {
112+
label: 'Pending',
113+
status: 'WAITING',
114+
timeMs: null,
115+
timeLabel: 'Pending',
116+
},
109117
};
110118

111119
const mockPendingDecisionEventInfo: WorkflowHistoryUngroupedEventInfo = {
112120
id: 'pending-7',
113121
label: 'Decision Task Started',
114-
status: 'WAITING',
115-
statusLabel: 'Pending',
116122
event: pendingDecisionTaskStartEvent,
123+
eventMetadata: {
124+
label: 'Pending',
125+
status: 'WAITING',
126+
timeMs: null,
127+
timeLabel: 'Pending',
128+
},
117129
};
118130

119131
const mockDecodedPageUrlParams: WorkflowPageTabsParams = {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ export default function WorkflowHistoryUngroupedEvent({
6262
<WorkflowHistoryEventStatusBadge
6363
statusReady={true}
6464
size="small"
65-
status={eventInfo.status}
65+
status={eventInfo.eventMetadata.status}
6666
/>
67-
{eventInfo.statusLabel}
67+
{eventInfo.eventMetadata.label}
6868
{retries ? (
6969
<Badge
7070
overrides={overrides.badge}

src/views/workflow-history/workflow-history-ungrouped-event/workflow-history-ungrouped-event.types.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { type Timestamp } from '@/__generated__/proto-ts/google/protobuf/Timesta
22
import { type HistoryEvent } from '@/__generated__/proto-ts/uber/cadence/api/v1/HistoryEvent';
33
import { type WorkflowPageTabsParams } from '@/views/workflow-page/workflow-page-tabs/workflow-page-tabs.types';
44

5-
import { type WorkflowEventStatus } from '../workflow-history-event-status-badge/workflow-history-event-status-badge.types';
65
import {
6+
type HistoryGroupEventMetadata,
77
type PendingActivityTaskStartEvent,
88
type PendingDecisionTaskStartEvent,
99
} from '../workflow-history.types';
@@ -12,12 +12,11 @@ export type WorkflowHistoryUngroupedEventInfo = {
1212
id: string;
1313
label: string;
1414
shortLabel?: string;
15-
status: WorkflowEventStatus;
16-
statusLabel: string;
1715
event:
1816
| HistoryEvent
1917
| PendingDecisionTaskStartEvent
2018
| PendingActivityTaskStartEvent;
19+
eventMetadata: HistoryGroupEventMetadata;
2120
canReset?: boolean;
2221
};
2322

src/views/workflow-history/workflow-history-ungrouped-table/__tests__/workflow-history-ungrouped-table.test.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,24 @@ const mockEventsInfo: WorkflowHistoryUngroupedEventInfo[] = [
3939
{
4040
id: '1',
4141
label: 'Workflow Execution Started',
42-
status: 'COMPLETED',
43-
statusLabel: 'Completed',
4442
event: startWorkflowExecutionEvent,
43+
eventMetadata: {
44+
label: 'Completed',
45+
status: 'COMPLETED',
46+
timeMs: 1704067200000,
47+
timeLabel: 'Mock time label',
48+
},
4549
},
4650
{
4751
id: '2',
4852
label: 'Decision Task Scheduled',
49-
status: 'COMPLETED',
50-
statusLabel: 'Completed',
5153
event: scheduleDecisionTaskEvent,
54+
eventMetadata: {
55+
label: 'Completed',
56+
status: 'COMPLETED',
57+
timeMs: 1704067200000,
58+
timeLabel: 'Mock time label',
59+
},
5260
},
5361
];
5462

src/views/workflow-history/workflow-history.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,9 @@ export default function WorkflowHistory({ params }: Props) {
174174
.map(([_, group]) => [
175175
...group.events.map((event, index) => ({
176176
event,
177+
eventMetadata: group.eventsMetadata[index],
177178
label: group.label,
178179
shortLabel: group.shortLabel,
179-
status: group.eventsMetadata[index].status,
180-
statusLabel: group.eventsMetadata[index].label,
181180
id: event.eventId ?? event.computedEventId,
182181
canReset: group.resetToDecisionEventId === event.eventId,
183182
})),

0 commit comments

Comments
 (0)