Push active executions to clients to remove manual reload

This commit is contained in:
Jan Oberhauser
2019-07-24 14:25:30 +02:00
parent a9453806b8
commit 2d8038669a
12 changed files with 294 additions and 161 deletions

View File

@@ -1,6 +1,8 @@
import {
IExecutionsCurrentSummaryExtended,
IPushData,
IPushDataExecutionFinished,
IPushDataExecutionStarted,
IPushDataNodeExecuteAfter,
IPushDataNodeExecuteBefore,
IPushDataTestWebhook,
@@ -100,7 +102,7 @@ export const pushConnection = mixins(
return;
}
if (['executionFinished', 'nodeExecuteAfter', 'nodeExecuteBefore'].includes(receivedData.type)) {
if (['nodeExecuteAfter', 'nodeExecuteBefore'].includes(receivedData.type)) {
if (this.$store.getters.isActionActive('workflowRunning') === false) {
// No workflow is running so ignore the messages
return;
@@ -119,6 +121,19 @@ export const pushConnection = mixins(
// The workflow finished executing
const pushData = receivedData.data as IPushDataExecutionFinished;
this.$store.commit('finishActiveExecution', pushData);
if (this.$store.getters.isActionActive('workflowRunning') === false) {
// No workflow is running so ignore the messages
return;
}
if (this.$store.getters.activeExecutionId !== pushData.executionIdActive) {
// The workflow which did finish execution did not get started
// by this session so ignore
return;
}
const runDataExecuted = pushData.data;
if (runDataExecuted.finished !== true) {
@@ -149,6 +164,19 @@ export const pushConnection = mixins(
// Set the node execution issues on all the nodes which produced an error so that
// it can be displayed in the node-view
this.updateNodesExecutionIssues();
} else if (receivedData.type === 'executionStarted') {
const pushData = receivedData.data as IPushDataExecutionStarted;
const executionData: IExecutionsCurrentSummaryExtended = {
idActive: pushData.executionId,
finished: false,
mode: pushData.mode,
startedAt: pushData.startedAt,
workflowId: pushData.workflowId,
workflowName: pushData.workflowName,
};
this.$store.commit('addActiveExecution', executionData);
} else if (receivedData.type === 'nodeExecuteAfter') {
// A node finished to execute. Add its data
const pushData = receivedData.data as IPushDataNodeExecuteAfter;