enable stale data in execution run

This commit is contained in:
Mutasem 2022-03-31 11:26:45 +02:00
parent 665f826119
commit 8edb68dbff
3 changed files with 34 additions and 7 deletions

View file

@ -98,6 +98,12 @@ declare module 'jsplumb' {
}
}
declare module 'n8n-workflow' {
export interface ITaskData {
updatedAt?: number;
}
}
// EndpointOptions from jsplumb seems incomplete and wrong so we define an own one
export interface IEndpointOptions {
anchor?: any; // tslint:disable-line:no-any
@ -962,7 +968,7 @@ export type IFormBoxConfig = {
export interface ITab {
value: string | number;
label?: string;
href?: string,
href?: string;
icon?: string;
align?: 'right';
};
}

View file

@ -270,7 +270,6 @@ export default mixins(
MAX_DISPLAY_ITEMS_AUTO_ALL,
currentPage: 1,
pageSize: 10,
staleData: false,
};
},
mounted() {
@ -312,7 +311,7 @@ export default mixins(
node (): INodeUi | null {
return this.$store.getters.activeNode;
},
runMetadata () {
runTaskData(): ITaskData | null {
if (!this.node || this.workflowExecution === null) {
return null;
}
@ -327,12 +326,28 @@ export default mixins(
return null;
}
const taskData: ITaskData = runData[this.node.name][this.runIndex];
return runData[this.node.name][this.runIndex];
},
runMetadata (): {executionTime: number, startTime: string} | null {
if (!this.runTaskData) {
return null;
}
return {
executionTime: taskData.executionTime,
startTime: new Date(taskData.startTime).toLocaleString(),
executionTime: this.runTaskData.executionTime,
startTime: new Date(this.runTaskData.startTime).toLocaleString(),
};
},
staleData (): boolean {
if (!this.node || !this.runTaskData || !this.runTaskData.updatedAt) {
return false;
}
const updatedAt = this.runTaskData.updatedAt;
const runAt = this.runTaskData.startTime;
return updatedAt > runAt;
},
dataCount (): number {
return this.getDataCount(this.runIndex, this.outputIndex);
},

View file

@ -470,6 +470,12 @@ export const store = new Vuex.Store({
state.stateIsDirty = true;
Vue.set(node, 'parameters', updateInformation.value);
if (state.workflowExecutionData && state.workflowExecutionData.data.resultData.runData[node.name]) {
const nodeRuns = state.workflowExecutionData.data.resultData.runData[node.name];
nodeRuns.forEach((node) => {
Vue.set(node, 'updatedAt', new Date().getTime());
});
}
},
// Node-Index