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-03-29 09:00:29 -07:00
|
|
|
import config from '@/config';
|
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-29 09:00:29 -07:00
|
|
|
return (
|
|
|
|
config.getEnv('enterprise.features.advancedExecutionFilters') ||
|
|
|
|
license.isAdvancedExecutionFiltersEnabled()
|
|
|
|
);
|
2023-03-07 05:18:10 -08:00
|
|
|
}
|