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

@@ -23,7 +23,21 @@ export const genericHelpers = mixins(showMessage).extend({
convertToDisplayDate (epochTime: number) {
return dateformat(epochTime, 'yyyy-mm-dd HH:MM:ss');
},
displayTimer (msPassed: number, showMs = false): string {
if (msPassed < 60000) {
if (showMs === false) {
return `${Math.floor(msPassed / 1000)} sec.`;
}
return `${msPassed / 1000} sec.`;
}
const secondsPassed = Math.floor(msPassed / 1000);
const minutesPassed = Math.floor(secondsPassed / 60);
const secondsLeft = (secondsPassed - (minutesPassed * 60)).toString().padStart(2, '0');
return `${minutesPassed}:${secondsLeft} min.`;
},
editAllowedCheck (): boolean {
if (this.isReadOnly) {
this.$showMessage({

View File

@@ -161,7 +161,6 @@ export const mouseSelect = mixins(nodeIndex).extend({
const nodeElement = `node-${this.getNodeIndex(node.name)}`;
// @ts-ignore
this.instance.removeFromDragSelection(nodeElement);
},
nodeSelected (node: INodeUi) {
this.$store.commit('addSelectedNode', node);

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;