Skip to content

Commit

Permalink
enable stale data in execution run
Browse files Browse the repository at this point in the history
  • Loading branch information
mutdmour committed Mar 31, 2022
1 parent 665f826 commit 8edb68d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
10 changes: 8 additions & 2 deletions packages/editor-ui/src/Interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -962,7 +968,7 @@ export type IFormBoxConfig = {
export interface ITab {
value: string | number;
label?: string;
href?: string,
href?: string;
icon?: string;
align?: 'right';
};
}
25 changes: 20 additions & 5 deletions packages/editor-ui/src/components/RunData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ export default mixins(
MAX_DISPLAY_ITEMS_AUTO_ALL,
currentPage: 1,
pageSize: 10,
staleData: false,
};
},
mounted() {
Expand Down Expand Up @@ -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;
}
Expand All @@ -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);
},
Expand Down
6 changes: 6 additions & 0 deletions packages/editor-ui/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8edb68d

Please sign in to comment.