Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Issue listing executions with Postgres #4856

Merged
merged 1 commit into from
Dec 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions packages/cli/src/executions/executions.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,19 @@ export class ExecutionsService {
return { count, estimated: false };
}

static massageFilters(filter: IDataObject): void {
if (filter) {
if (filter.waitTill === true) {
filter.waitTill = Not(IsNull());
// eslint-disable-next-line @typescript-eslint/no-unnecessary-boolean-literal-compare
} else if (filter.finished === false) {
filter.waitTill = IsNull();
} else {
delete filter.waitTill;
}
}
}

static async getExecutionsList(req: ExecutionRequest.GetAll): Promise<IExecutionsListResponse> {
const sharedWorkflowIds = await this.getWorkflowIdsForUser(req.user);
if (sharedWorkflowIds.length === 0) {
Expand Down Expand Up @@ -215,19 +228,14 @@ export class ExecutionsService {
.take(limit)
.where(findWhere);

const countFilter = deepCopy(filter ?? {});

if (filter) {
if (filter.waitTill === true) {
filter.waitTill = Not(IsNull());
// eslint-disable-next-line @typescript-eslint/no-unnecessary-boolean-literal-compare
} else if (filter.finished === false) {
filter.waitTill = IsNull();
} else {
delete filter.waitTill;
}
this.massageFilters(filter as IDataObject);
query = query.andWhere(filter);
}

const countFilter = deepCopy(filter ?? {});
this.massageFilters(countFilter as IDataObject);
countFilter.id = Not(In(executingWorkflowIds));

const executions = await query.getMany();
Expand Down