Skip to content

Commit 39e6497

Browse files
Assem-UberCopilot
andauthored
feat: Create a grouping utility that only parses new events (#1065)
* grouping utility Signed-off-by: Assem Hafez <assem.hafez@uber.com> * update test cases Signed-off-by: Assem Hafez <assem.hafez@uber.com> * change the api of onChange and add destroy method Signed-off-by: Assem Hafez <assem.hafez@uber.com> * replace getGroups with getState Signed-off-by: Assem Hafez <assem.hafez@uber.com> * call onchange after updating pending events Signed-off-by: Assem Hafez <assem.hafez@uber.com> * use sync processBatch for first page Signed-off-by: Assem Hafez <assem.hafez@uber.com> * Update src/views/workflow-history/helpers/workflow-history-grouper.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply PR comments * Update src/views/workflow-history/helpers/workflow-history-grouper.types.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: Assem Hafez <assem.hafez@uber.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 1054087 commit 39e6497

File tree

4 files changed

+1357
-0
lines changed

4 files changed

+1357
-0
lines changed

src/views/workflow-history/__fixtures__/workflow-history-pending-events.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import type {
33
PendingDecisionTaskStartEvent,
44
} from '../workflow-history.types';
55

6+
import { scheduleActivityTaskEvent } from './workflow-history-activity-events';
7+
import { scheduleDecisionTaskEvent } from './workflow-history-decision-events';
8+
69
export const pendingActivityTaskStartEvent = {
710
eventId: null,
811
computedEventId: 'pending-7',
@@ -94,3 +97,54 @@ export const pendingDecisionTaskStartEventWithStartedState = {
9497
},
9598
},
9699
} as const satisfies PendingDecisionTaskStartEvent;
100+
101+
// Factory functions for creating test data dynamically
102+
103+
export function createPendingActivity(
104+
scheduleId: string,
105+
options?: { activityId?: string }
106+
): PendingActivityTaskStartEvent {
107+
return {
108+
...pendingActivityTaskStartEvent,
109+
computedEventId: `pending-${scheduleId}`,
110+
pendingActivityTaskStartEventAttributes: {
111+
...pendingActivityTaskStartEvent.pendingActivityTaskStartEventAttributes,
112+
scheduleId,
113+
...(options?.activityId && { activityId: options.activityId }),
114+
},
115+
} as PendingActivityTaskStartEvent;
116+
}
117+
118+
export function createPendingDecision(
119+
scheduleId: string
120+
): PendingDecisionTaskStartEvent {
121+
return {
122+
...pendingDecisionTaskStartEvent,
123+
computedEventId: `pending-${scheduleId}`,
124+
pendingDecisionTaskStartEventAttributes: {
125+
...pendingDecisionTaskStartEvent.pendingDecisionTaskStartEventAttributes,
126+
scheduleId,
127+
},
128+
} as PendingDecisionTaskStartEvent;
129+
}
130+
131+
export function createScheduleActivityEvent(
132+
eventId: string,
133+
options?: { activityId?: string }
134+
) {
135+
return {
136+
...scheduleActivityTaskEvent,
137+
eventId,
138+
activityTaskScheduledEventAttributes: {
139+
...scheduleActivityTaskEvent.activityTaskScheduledEventAttributes,
140+
...(options?.activityId && { activityId: options.activityId }),
141+
},
142+
};
143+
}
144+
145+
export function createScheduleDecisionEvent(eventId: string) {
146+
return {
147+
...scheduleDecisionTaskEvent,
148+
eventId,
149+
};
150+
}

0 commit comments

Comments
 (0)