mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-13 05:47:31 -08:00
🐛 Fix bug that it did load same executions multiple times
This commit is contained in:
parent
d74f0d9bbd
commit
870961b101
|
@ -853,8 +853,8 @@ class App {
|
||||||
}
|
}
|
||||||
|
|
||||||
const countFilter = JSON.parse(JSON.stringify(filter));
|
const countFilter = JSON.parse(JSON.stringify(filter));
|
||||||
if (req.query.lastStartedAt) {
|
if (req.query.lastId) {
|
||||||
filter.startedAt = LessThan(req.query.lastStartedAt);
|
filter.id = LessThan(req.query.lastId);
|
||||||
}
|
}
|
||||||
countFilter.select = ['id'];
|
countFilter.select = ['id'];
|
||||||
|
|
||||||
|
@ -871,7 +871,7 @@ class App {
|
||||||
],
|
],
|
||||||
where: filter,
|
where: filter,
|
||||||
order: {
|
order: {
|
||||||
startedAt: "DESC",
|
id: 'DESC',
|
||||||
},
|
},
|
||||||
take: limit,
|
take: limit,
|
||||||
});
|
});
|
||||||
|
|
|
@ -120,7 +120,7 @@ export interface IRestApi {
|
||||||
getActiveWorkflows(): Promise<string[]>;
|
getActiveWorkflows(): Promise<string[]>;
|
||||||
getActivationError(id: string): Promise<IActivationError | undefined >;
|
getActivationError(id: string): Promise<IActivationError | undefined >;
|
||||||
getCurrentExecutions(filter: object): Promise<IExecutionsCurrentSummaryExtended[]>;
|
getCurrentExecutions(filter: object): Promise<IExecutionsCurrentSummaryExtended[]>;
|
||||||
getPastExecutions(filter: object, limit: number, lastStartedAt?: Date): Promise<IExecutionsListResponse>;
|
getPastExecutions(filter: object, limit: number, lastId?: string | number): Promise<IExecutionsListResponse>;
|
||||||
stopCurrentExecution(executionId: string): Promise<IExecutionsStopData>;
|
stopCurrentExecution(executionId: string): Promise<IExecutionsStopData>;
|
||||||
makeRestApiRequest(method: string, endpoint: string, data?: any): Promise<any>; // tslint:disable-line:no-any
|
makeRestApiRequest(method: string, endpoint: string, data?: any): Promise<any>; // tslint:disable-line:no-any
|
||||||
getSettings(): Promise<IN8nUISettings>;
|
getSettings(): Promise<IN8nUISettings>;
|
||||||
|
|
|
@ -333,16 +333,16 @@ export default mixins(
|
||||||
this.isDataLoading = true;
|
this.isDataLoading = true;
|
||||||
|
|
||||||
const filter = this.workflowFilter;
|
const filter = this.workflowFilter;
|
||||||
let lastStartedAt: Date | undefined;
|
let lastId: string | number | undefined;
|
||||||
|
|
||||||
if (this.finishedExecutions.length !== 0) {
|
if (this.finishedExecutions.length !== 0) {
|
||||||
const lastItem = this.finishedExecutions.slice(-1)[0];
|
const lastItem = this.finishedExecutions.slice(-1)[0];
|
||||||
lastStartedAt = lastItem.startedAt as Date;
|
lastId = lastItem.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
let data: IExecutionsListResponse;
|
let data: IExecutionsListResponse;
|
||||||
try {
|
try {
|
||||||
data = await this.restApi().getPastExecutions(filter, this.requestItemsPerRequest, lastStartedAt);
|
data = await this.restApi().getPastExecutions(filter, this.requestItemsPerRequest, lastId);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.isDataLoading = false;
|
this.isDataLoading = false;
|
||||||
this.$showError(error, 'Problem loading workflows', 'There was a problem loading the workflows:');
|
this.$showError(error, 'Problem loading workflows', 'There was a problem loading the workflows:');
|
||||||
|
|
|
@ -269,12 +269,12 @@ export const restApi = Vue.extend({
|
||||||
|
|
||||||
// Returns all saved executions
|
// Returns all saved executions
|
||||||
// TODO: For sure needs some kind of default filter like last day, with max 10 results, ...
|
// TODO: For sure needs some kind of default filter like last day, with max 10 results, ...
|
||||||
getPastExecutions: (filter: object, limit: number, lastStartedAt?: Date): Promise<IExecutionsListResponse> => {
|
getPastExecutions: (filter: object, limit: number, lastId?: string | number): Promise<IExecutionsListResponse> => {
|
||||||
let sendData = {};
|
let sendData = {};
|
||||||
if (filter) {
|
if (filter) {
|
||||||
sendData = {
|
sendData = {
|
||||||
filter,
|
filter,
|
||||||
lastStartedAt,
|
lastId,
|
||||||
limit,
|
limit,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue