2023-03-16 07:34:13 -07:00
|
|
|
import { Container } from 'typedi';
|
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-06-20 10:13:18 -07:00
|
|
|
import type { IExecutionFlattedDb, IExecutionResponse } from '@/Interfaces';
|
2023-02-21 12:44:46 -08:00
|
|
|
|
|
|
|
export function getStatusUsingPreviousExecutionStatusMethod(
|
2023-06-20 10:13:18 -07:00
|
|
|
execution: IExecutionFlattedDb | IExecutionResponse,
|
2023-02-21 12:44:46 -08:00
|
|
|
): 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-31 04:51:38 -07:00
|
|
|
return license.isAdvancedExecutionFiltersEnabled();
|
2023-03-07 05:18:10 -08:00
|
|
|
}
|