mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 12:35:46 +03: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));
|
||||
if (req.query.lastStartedAt) {
|
||||
filter.startedAt = LessThan(req.query.lastStartedAt);
|
||||
if (req.query.lastId) {
|
||||
filter.id = LessThan(req.query.lastId);
|
||||
}
|
||||
countFilter.select = ['id'];
|
||||
|
||||
@ -871,7 +871,7 @@ class App {
|
||||
],
|
||||
where: filter,
|
||||
order: {
|
||||
startedAt: "DESC",
|
||||
id: 'DESC',
|
||||
},
|
||||
take: limit,
|
||||
});
|
||||
|
@ -120,7 +120,7 @@ export interface IRestApi {
|
||||
getActiveWorkflows(): Promise<string[]>;
|
||||
getActivationError(id: string): Promise<IActivationError | undefined >;
|
||||
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>;
|
||||
makeRestApiRequest(method: string, endpoint: string, data?: any): Promise<any>; // tslint:disable-line:no-any
|
||||
getSettings(): Promise<IN8nUISettings>;
|
||||
|
@ -333,16 +333,16 @@ export default mixins(
|
||||
this.isDataLoading = true;
|
||||
|
||||
const filter = this.workflowFilter;
|
||||
let lastStartedAt: Date | undefined;
|
||||
let lastId: string | number | undefined;
|
||||
|
||||
if (this.finishedExecutions.length !== 0) {
|
||||
const lastItem = this.finishedExecutions.slice(-1)[0];
|
||||
lastStartedAt = lastItem.startedAt as Date;
|
||||
lastId = lastItem.id;
|
||||
}
|
||||
|
||||
let data: IExecutionsListResponse;
|
||||
try {
|
||||
data = await this.restApi().getPastExecutions(filter, this.requestItemsPerRequest, lastStartedAt);
|
||||
data = await this.restApi().getPastExecutions(filter, this.requestItemsPerRequest, lastId);
|
||||
} catch (error) {
|
||||
this.isDataLoading = false;
|
||||
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
|
||||
// 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 = {};
|
||||
if (filter) {
|
||||
sendData = {
|
||||
filter,
|
||||
lastStartedAt,
|
||||
lastId,
|
||||
limit,
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user