Skip to content

Commit 3888f2a

Browse files
authored
Fix child workflow navigation & compact display extra fields (#82)
* cleaning up code so its more readable what its trying to do and fixing bug for duplicating getHistory api call * adding in eventId and timestamp to kvps * changing order of kvps to match previous version * lint fixes * 3.7.1-beta.0 * 3.7.1
1 parent 5cd8e48 commit 3888f2a

File tree

4 files changed

+55
-20
lines changed

4 files changed

+55
-20
lines changed

client/routes/execution/helpers/get-event-details.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import { getKeyValuePairs } from '../../../helpers';
22

33
const getEventDetails = event => {
4-
const { details, eventId, eventType } = event;
5-
const kvps = getKeyValuePairs(details);
4+
const { details, eventId, eventType, timeStampDisplay } = event;
5+
const kvps = getKeyValuePairs({
6+
timestamp: timeStampDisplay,
7+
eventId,
8+
...details,
9+
});
610

711
return {
812
...details,
913
eventId,
1014
eventType,
1115
kvps,
16+
timestamp: timeStampDisplay,
1217
};
1318
};
1419

client/routes/execution/helpers/get-history-events.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,10 @@ const getHistoryEvents = events => {
1212

1313
return events
1414
.map(event => {
15-
const details = getEventDetails(event);
16-
const eventSummary = getEventSummary(event);
17-
const eventFullDetails = getEventFullDetails(event);
1815
const timestamp = moment(event.timestamp);
1916

2017
return {
2118
...event,
22-
details,
23-
eventSummary,
24-
eventFullDetails,
2519
timestamp,
2620
};
2721
})
@@ -34,6 +28,18 @@ const getHistoryEvents = events => {
3428
timeStampDisplay,
3529
timeElapsedDisplay,
3630
};
31+
})
32+
.map(event => {
33+
const details = getEventDetails(event);
34+
const eventSummary = getEventSummary(event);
35+
const eventFullDetails = getEventFullDetails(event);
36+
37+
return {
38+
...event,
39+
details,
40+
eventSummary,
41+
eventFullDetails,
42+
};
3743
});
3844
};
3945

client/routes/execution/index.vue

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ export default {
8686
);
8787
},
8888
beforeDestroy() {
89-
while (this.unwatch.length) {
90-
this.unwatch.pop()();
91-
}
89+
this.clearWatches();
9290
},
9391
computed: {
9492
baseAPIURL() {
@@ -111,6 +109,36 @@ export default {
111109
},
112110
},
113111
methods: {
112+
clearState() {
113+
this.events = [];
114+
this.isWorkflowRunning = undefined;
115+
this.nextPageToken = undefined;
116+
this.wfError = undefined;
117+
this.wfLoading = true;
118+
this.workflow = undefined;
119+
120+
this.history.error = undefined;
121+
this.history.events = [];
122+
this.history.loading = undefined;
123+
this.history.timelineEvents = [];
124+
125+
this.summary.input = undefined;
126+
this.summary.isWorkflowRunning = undefined;
127+
this.summary.parentWorkflowRoute = undefined;
128+
this.summary.result = undefined;
129+
this.summary.wfStatus = undefined;
130+
this.summary.workflow = undefined;
131+
},
132+
clearWatches() {
133+
while (this.unwatch.length) {
134+
this.unwatch.pop()();
135+
}
136+
},
137+
clearQueryUrlWatch() {
138+
while (this.unwatch.length > 1) {
139+
this.unwatch.pop()();
140+
}
141+
},
114142
fetchHistoryPage(pagedQueryUrl) {
115143
this.history.error = undefined;
116144
@@ -190,10 +218,9 @@ export default {
190218
});
191219
},
192220
onBaseApiUrlChange(baseAPIURL) {
193-
this.events = [];
194-
this.history.events = [];
195-
this.history.timelineEvents = [];
196-
this.nextPageToken = undefined;
221+
this.clearQueryUrlWatch();
222+
this.clearState();
223+
this.wfLoading = true;
197224
198225
return this.$http(baseAPIURL)
199226
.then(
@@ -214,10 +241,7 @@ export default {
214241
this.fetchHistoryPage(queryUrl);
215242
},
216243
setupQueryUrlWatch() {
217-
while (this.unwatch.length > 1) {
218-
this.unwatch.pop()();
219-
}
220-
244+
this.clearQueryUrlWatch();
221245
this.unwatch.push(
222246
this.$watch('queryUrl', this.onQueryUrlChange, { immediate: true })
223247
);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cadence-web",
3-
"version": "3.7.0",
3+
"version": "3.7.1",
44
"description": "Cadence Web UI",
55
"main": "server/index.js",
66
"licence": "MIT",

0 commit comments

Comments
 (0)