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-07 05:18:10 -08:00
|
|
|
import { getLicense } from '@/License';
|
|
|
|
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
|
|
|
|
|
|
|
export function isAdvancedFiltersEnabled(): boolean {
|
|
|
|
const license = getLicense();
|
|
|
|
return config.getEnv('enterprise.features.advancedFilters') || license.isAdvancedFiltersEnabled();
|
|
|
|
}
|