🐛 Fix bug that it did load same executions multiple times

This commit is contained in:
Jan Oberhauser 2019-12-12 20:57:11 +01:00
parent d74f0d9bbd
commit 870961b101
4 changed files with 9 additions and 9 deletions

View file

@ -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,
}); });

View file

@ -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>;

View file

@ -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:');

View file

@ -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,
}; };
} }