2023-03-16 07:34:13 -07:00
|
|
|
import { Container } from 'typedi';
|
2023-03-07 05:18:10 -08:00
|
|
|
import type { IExecutionFlattedDb } from '@/Interfaces';
|
2023-02-21 12:44:46 -08:00
|
|
|
import type { ExecutionStatus } from 'n8n-workflow';
|
2023-03-16 07:34:13 -07:00
|
|
|
import { License } from '@/License';
|
2023-02-21 12:44:46 -08:00
|
|
|
|
|
|
|
export function getStatusUsingPreviousExecutionStatusMethod(
|
|
|
|
execution: IExecutionFlattedDb,
|
|
|
|
): ExecutionStatus {
|
|
|
|
if (execution.waitTill) {
|
|
|
|
return 'waiting';
|
|
|
|
} else if (execution.stoppedAt === undefined) {
|
|
|
|
return 'running';
|
|
|
|
} else if (execution.finished) {
|
|
|
|
return 'success';
|
|
|
|
} else if (execution.stoppedAt !== null) {
|
|
|
|
return 'failed';
|
|
|
|
} else {
|
|
|
|
return 'unknown';
|
|
|
|
}
|
|
|
|
}
|
2023-03-07 05:18:10 -08:00
|
|
|
|
2023-03-07 09:35:52 -08:00
|
|
|
export function isAdvancedExecutionFiltersEnabled(): boolean {
|
2023-03-16 07:34:13 -07:00
|
|
|
const license = Container.get(License);
|
2023-03-28 08:21:40 -07:00
|
|
|
return license.isAdvancedExecutionFiltersEnabled();
|
2023-03-07 05:18:10 -08:00
|
|
|
}
|