Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Commit

Permalink
Show pending activitties as History events
Browse files Browse the repository at this point in the history
  • Loading branch information
feedmeapples committed May 4, 2021
1 parent 6ed16d0 commit d7c4f85
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
18 changes: 18 additions & 0 deletions client/routes/workflow/helpers/get-events-from-pending-activity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const getEventsFromPendingActivity = (activities, idOffset) => {
if (!activities) {
return [];
}

if (Number.isInteger(idOffset)) {
idOffset = Number(idOffset);
}

return activities.map((a, i) => ({
details: a,
eventId: idOffset + i + 1,
eventTime: a.scheduledTime,
eventType: 'ActivityTaskStarted',
}));
};

export default getEventsFromPendingActivity;
1 change: 1 addition & 0 deletions client/routes/workflow/helpers/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export { default as getEventDetails } from './get-event-details';
export { default as getEventFullDetails } from './get-event-full-details';
export { default as getEventSummary } from './get-event-summary';
export { default as getEventsFromPendingActivity } from './get-events-from-pending-activity';
export { default as getHistoryEvents } from './get-history-events';
export { default as getHistoryTimelineEvents } from './get-history-timeline-events';
export { default as getSummary } from './get-summary';
Expand Down
6 changes: 4 additions & 2 deletions client/routes/workflow/history.vue
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ export default {
'runId',
'showGraph',
'timelineEvents',
'pendingEvents',
'workflowId',
],
created() {
Expand Down Expand Up @@ -356,8 +357,9 @@ export default {
}.json`;
},
filteredEvents() {
const { eventId, eventType } = this;
const formattedEvents = this.events.map(event => ({
const { eventId, eventType, pendingEvents } = this;
const events = [...this.events, ...pendingEvents];
const formattedEvents = events.map(event => ({
...event,
expanded: event.eventId === eventId,
}));
Expand Down
10 changes: 10 additions & 0 deletions client/routes/workflow/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
name="history"
:baseAPIURL="baseAPIURL"
:events="history.events"
:pendingEvents="history.pendingEvents"
:loading="history.loading"
:timelineEvents="history.timelineEvents"
@onNotification="onNotification"
Expand Down Expand Up @@ -73,6 +74,7 @@ import {
getHistoryEvents,
getHistoryTimelineEvents,
getSummary,
getEventsFromPendingActivity,
} from './helpers';
import { NOTIFICATION_TYPE_ERROR } from '~constants';
import { getErrorMessage } from '~helpers';
Expand All @@ -92,6 +94,7 @@ export default {
history: {
events: [],
pendingEvents: [],
loading: undefined,
timelineEvents: [],
},
Expand Down Expand Up @@ -225,6 +228,13 @@ export default {
this.events = this.events.concat(events);
this.history.events = getHistoryEvents(this.events);
this.history.pendingEvents = getHistoryEvents(
getEventsFromPendingActivity(
this.workflow.pendingActivities,
this.history.events.length
)
);
this.history.timelineEvents = getHistoryTimelineEvents(
this.history.events
);
Expand Down

0 comments on commit d7c4f85

Please sign in to comment.