;
+mockUseNodeExecutionFiltersState.mockReturnValue({ filters: [], appliedFilters: [] });
+
jest.mock('components/Executions/Tables/NodeExecutionRow', () => ({
NodeExecutionRow: jest.fn(({ nodeExecution }) => (
@@ -46,26 +46,6 @@ const mockNodes = (n: number): dNode[] => {
return nodes;
};
-const mockNodeExecutions = (n: number, phases: NodeExecutionPhase[]): NodeExecution[] => {
- const nodeExecutions: NodeExecution[] = [];
- for (let i = 1; i <= n; i++) {
- nodeExecutions.push({
- closure: {
- createdAt: dateToTimestamp(new Date()),
- outputUri: '',
- phase: phases[i - 1],
- },
- id: {
- executionId: { domain: 'domain', name: 'name', project: 'project' },
- nodeId: `node${i}`,
- },
- inputUri: '',
- scopedId: `n${i}`,
- });
- }
- return nodeExecutions;
-};
-
const mockExecutionsById = (n: number, phases: NodeExecutionPhase[]) => {
const nodeExecutionsById = {};
@@ -89,31 +69,24 @@ const mockExecutionsById = (n: number, phases: NodeExecutionPhase[]) => {
describe('NodeExecutionsTableExecutions > Tables > NodeExecutionsTable', () => {
let queryClient: QueryClient;
- let requestConfig: RequestConfig;
let fixture: ReturnType;
const initialNodes = mockNodes(2);
beforeEach(() => {
- requestConfig = {};
queryClient = createTestQueryClient();
fixture = basicPythonWorkflow.generate();
insertFixture(mockServer, fixture);
fetchWorkflow.mockImplementation(() => Promise.resolve(fixture.workflows.top));
});
- const renderTable = ({ nodeExecutionsById, initialNodes, filteredNodeExecutions }) =>
+ const renderTable = ({ nodeExecutionsById, initialNodes, filteredNodes }) =>
render(
-
-
-
-
-
-
-
+
+
+
+
+
,
);
@@ -121,7 +94,7 @@ describe('NodeExecutionsTableExecutions > Tables > NodeExecutionsTable', () => {
const { queryByText, queryByTestId } = renderTable({
initialNodes: [],
nodeExecutionsById: {},
- filteredNodeExecutions: [],
+ filteredNodes: [],
});
await waitFor(() => queryByText(noExecutionsFoundString));
@@ -130,15 +103,14 @@ describe('NodeExecutionsTableExecutions > Tables > NodeExecutionsTable', () => {
expect(queryByTestId('node-execution-row')).not.toBeInTheDocument();
});
- it('renders NodeExecutionRows with proper nodeExecutions', async () => {
+ it('renders NodeExecutionRows with initialNodes when no filteredNodes were provided', async () => {
const phases = [NodeExecutionPhase.FAILED, NodeExecutionPhase.SUCCEEDED];
const nodeExecutionsById = mockExecutionsById(2, phases);
- const filteredNodeExecutions = mockNodeExecutions(2, phases);
const { queryAllByTestId } = renderTable({
initialNodes,
nodeExecutionsById,
- filteredNodeExecutions,
+ filteredNodes: undefined,
});
await waitFor(() => queryAllByTestId('node-execution-row'));
@@ -154,15 +126,15 @@ describe('NodeExecutionsTableExecutions > Tables > NodeExecutionsTable', () => {
}
});
- it('renders future nodes with UNDEFINED phase', async () => {
- const phases = [NodeExecutionPhase.SUCCEEDED, NodeExecutionPhase.UNDEFINED];
- const nodeExecutionsById = mockExecutionsById(1, phases);
- const filteredNodeExecutions = mockNodeExecutions(1, phases);
+ it('renders NodeExecutionRows with initialNodes even when filterNodes were provided, if appliedFilters is empty', async () => {
+ const phases = [NodeExecutionPhase.FAILED, NodeExecutionPhase.SUCCEEDED];
+ const nodeExecutionsById = mockExecutionsById(2, phases);
+ const filteredNodes = mockNodes(1);
const { queryAllByTestId } = renderTable({
initialNodes,
nodeExecutionsById,
- filteredNodeExecutions,
+ filteredNodes,
});
await waitFor(() => queryAllByTestId('node-execution-row'));
@@ -177,4 +149,33 @@ describe('NodeExecutionsTableExecutions > Tables > NodeExecutionsTable', () => {
expect(renderedPhases[i]).toHaveTextContent(phases[i].toString());
}
});
+
+ it('renders NodeExecutionRows with filterNodes if appliedFilters is not empty', async () => {
+ mockUseNodeExecutionFiltersState.mockReturnValueOnce({
+ filters: [],
+ appliedFilters: [{ key: 'phase', operation: 'value_in', value: ['FAILED', 'SUCCEEDED'] }],
+ });
+
+ const phases = [NodeExecutionPhase.FAILED, NodeExecutionPhase.SUCCEEDED];
+ const nodeExecutionsById = mockExecutionsById(2, phases);
+ const filteredNodes = mockNodes(1);
+
+ const { queryAllByTestId } = renderTable({
+ initialNodes,
+ nodeExecutionsById,
+ filteredNodes,
+ });
+
+ await waitFor(() => queryAllByTestId('node-execution-row'));
+
+ expect(queryAllByTestId('node-execution-row')).toHaveLength(filteredNodes.length);
+ const ids = queryAllByTestId('node-execution-col-id');
+ expect(ids).toHaveLength(filteredNodes.length);
+ const renderedPhases = queryAllByTestId('node-execution-col-phase');
+ expect(renderedPhases).toHaveLength(filteredNodes.length);
+ for (const i in filteredNodes) {
+ expect(ids[i]).toHaveTextContent(filteredNodes[i].id);
+ expect(renderedPhases[i]).toHaveTextContent(phases[i].toString());
+ }
+ });
});
diff --git a/packages/zapp/console/src/components/Executions/constants.ts b/packages/zapp/console/src/components/Executions/constants.ts
index ded16e059..4a24e391a 100644
--- a/packages/zapp/console/src/components/Executions/constants.ts
+++ b/packages/zapp/console/src/components/Executions/constants.ts
@@ -24,60 +24,70 @@ export const workflowExecutionPhaseConstants: {
} = {
[WorkflowExecutionPhase.ABORTED]: {
text: t('aborted'),
+ value: 'ABORTED',
badgeColor: statusColors.SKIPPED,
nodeColor: graphStatusColors.ABORTED,
textColor: negativeTextColor,
},
[WorkflowExecutionPhase.ABORTING]: {
text: t('aborting'),
+ value: 'ABORTING',
badgeColor: statusColors.SKIPPED,
nodeColor: graphStatusColors.ABORTED,
textColor: negativeTextColor,
},
[WorkflowExecutionPhase.FAILING]: {
text: t('failing'),
+ value: 'FAILING',
badgeColor: statusColors.FAILURE,
nodeColor: graphStatusColors.FAILING,
textColor: negativeTextColor,
},
[WorkflowExecutionPhase.FAILED]: {
text: t('failed'),
+ value: 'FAILED',
badgeColor: statusColors.FAILURE,
nodeColor: graphStatusColors.FAILED,
textColor: negativeTextColor,
},
[WorkflowExecutionPhase.QUEUED]: {
text: t('queued'),
+ value: 'QUEUED',
badgeColor: statusColors.QUEUED,
nodeColor: graphStatusColors.QUEUED,
textColor: secondaryTextColor,
},
[WorkflowExecutionPhase.RUNNING]: {
text: t('running'),
+ value: 'RUNNING',
badgeColor: statusColors.RUNNING,
nodeColor: graphStatusColors.RUNNING,
textColor: secondaryTextColor,
},
[WorkflowExecutionPhase.SUCCEEDED]: {
text: t('succeeded'),
+ value: 'SUCCEEDED',
badgeColor: statusColors.SUCCESS,
nodeColor: graphStatusColors.SUCCEEDED,
textColor: positiveTextColor,
},
[WorkflowExecutionPhase.SUCCEEDING]: {
text: t('succeeding'),
+ value: 'SUCCEEDING',
badgeColor: statusColors.SUCCESS,
nodeColor: graphStatusColors.SUCCEEDED,
textColor: positiveTextColor,
},
[WorkflowExecutionPhase.TIMED_OUT]: {
text: t('timedOut'),
+ value: 'TIMED_OUT',
badgeColor: statusColors.FAILURE,
nodeColor: graphStatusColors.FAILED,
textColor: negativeTextColor,
},
[WorkflowExecutionPhase.UNDEFINED]: {
text: t('unknown'),
+ value: 'UNKNOWN',
badgeColor: statusColors.UNKNOWN,
nodeColor: graphStatusColors.UNDEFINED,
textColor: secondaryTextColor,
@@ -90,72 +100,84 @@ export const nodeExecutionPhaseConstants: {
} = {
[NodeExecutionPhase.ABORTED]: {
text: t('aborted'),
+ value: 'ABORTED',
badgeColor: statusColors.FAILURE,
nodeColor: graphStatusColors.ABORTED,
textColor: negativeTextColor,
},
[NodeExecutionPhase.FAILING]: {
text: t('failing'),
+ value: 'FAILING',
badgeColor: statusColors.FAILURE,
nodeColor: graphStatusColors.FAILING,
textColor: negativeTextColor,
},
[NodeExecutionPhase.FAILED]: {
text: t('failed'),
+ value: 'FAILED',
badgeColor: statusColors.FAILURE,
nodeColor: graphStatusColors.FAILED,
textColor: negativeTextColor,
},
[NodeExecutionPhase.QUEUED]: {
text: t('queued'),
+ value: 'QUEUED',
badgeColor: statusColors.RUNNING,
nodeColor: graphStatusColors.QUEUED,
textColor: secondaryTextColor,
},
[NodeExecutionPhase.RUNNING]: {
text: t('running'),
+ value: 'RUNNING',
badgeColor: statusColors.RUNNING,
nodeColor: graphStatusColors.RUNNING,
textColor: secondaryTextColor,
},
[NodeExecutionPhase.DYNAMIC_RUNNING]: {
text: t('running'),
+ value: 'RUNNING',
badgeColor: statusColors.RUNNING,
nodeColor: graphStatusColors.RUNNING,
textColor: secondaryTextColor,
},
[NodeExecutionPhase.SUCCEEDED]: {
text: t('succeeded'),
+ value: 'SUCCEEDED',
badgeColor: statusColors.SUCCESS,
nodeColor: graphStatusColors.SUCCEEDED,
textColor: positiveTextColor,
},
[NodeExecutionPhase.TIMED_OUT]: {
text: t('timedOut'),
+ value: 'TIMED_OUT',
badgeColor: statusColors.FAILURE,
nodeColor: graphStatusColors.FAILED,
textColor: negativeTextColor,
},
[NodeExecutionPhase.SKIPPED]: {
text: t('skipped'),
+ value: 'SKIPPED',
badgeColor: statusColors.UNKNOWN,
nodeColor: graphStatusColors.UNDEFINED,
textColor: secondaryTextColor,
},
[NodeExecutionPhase.RECOVERED]: {
text: t('recovered'),
+ value: 'RECOVERED',
badgeColor: statusColors.SUCCESS,
nodeColor: graphStatusColors.SUCCEEDED,
textColor: positiveTextColor,
},
[NodeExecutionPhase.PAUSED]: {
text: t('paused'),
+ value: 'PAUSED',
badgeColor: statusColors.PAUSED,
nodeColor: graphStatusColors.PAUSED,
textColor: secondaryTextColor,
},
[NodeExecutionPhase.UNDEFINED]: {
text: t('unknown'),
+ value: 'UNKNOWN',
badgeColor: statusColors.UNKNOWN,
nodeColor: graphStatusColors.UNDEFINED,
textColor: secondaryTextColor,
@@ -168,48 +190,56 @@ export const taskExecutionPhaseConstants: {
} = {
[TaskExecutionPhase.ABORTED]: {
text: t('aborted'),
+ value: 'ABORTED',
badgeColor: statusColors.FAILURE,
nodeColor: graphStatusColors.ABORTED,
textColor: negativeTextColor,
},
[TaskExecutionPhase.FAILED]: {
text: t('failed'),
+ value: 'FAILED',
badgeColor: statusColors.FAILURE,
nodeColor: graphStatusColors.FAILED,
textColor: negativeTextColor,
},
[TaskExecutionPhase.WAITING_FOR_RESOURCES]: {
text: t('waiting'),
+ value: 'WAITING',
badgeColor: statusColors.RUNNING,
nodeColor: graphStatusColors.RUNNING,
textColor: secondaryTextColor,
},
[TaskExecutionPhase.QUEUED]: {
text: t('queued'),
+ value: 'QUEUED',
badgeColor: statusColors.RUNNING,
nodeColor: graphStatusColors.QUEUED,
textColor: secondaryTextColor,
},
[TaskExecutionPhase.INITIALIZING]: {
text: t('initializing'),
+ value: 'INITIALIZING',
badgeColor: statusColors.RUNNING,
nodeColor: graphStatusColors.RUNNING,
textColor: secondaryTextColor,
},
[TaskExecutionPhase.RUNNING]: {
text: t('running'),
+ value: 'RUNNING',
badgeColor: statusColors.RUNNING,
nodeColor: graphStatusColors.RUNNING,
textColor: secondaryTextColor,
},
[TaskExecutionPhase.SUCCEEDED]: {
text: t('succeeded'),
+ value: 'SUCCEEDED',
badgeColor: statusColors.SUCCESS,
nodeColor: graphStatusColors.SUCCEEDED,
textColor: positiveTextColor,
},
[TaskExecutionPhase.UNDEFINED]: {
text: t('unknown'),
+ value: 'UNKNOWN',
badgeColor: statusColors.UNKNOWN,
nodeColor: graphStatusColors.UNDEFINED,
textColor: secondaryTextColor,
diff --git a/packages/zapp/console/src/components/Executions/contexts.ts b/packages/zapp/console/src/components/Executions/contexts.ts
index faeb47b6d..e5ca0d492 100644
--- a/packages/zapp/console/src/components/Executions/contexts.ts
+++ b/packages/zapp/console/src/components/Executions/contexts.ts
@@ -1,15 +1,10 @@
-import { RequestConfig } from 'models/AdminEntity/types';
import { Execution, NodeExecution } from 'models/Execution/types';
-import * as React from 'react';
+import { createContext } from 'react';
export interface ExecutionContextData {
execution: Execution;
}
-export const ExecutionContext = React.createContext(
- {} as ExecutionContextData,
-);
+export const ExecutionContext = createContext({} as ExecutionContextData);
-export const NodeExecutionsByIdContext = React.createContext>({});
-
-export const NodeExecutionsRequestConfigContext = React.createContext({});
+export const NodeExecutionsByIdContext = createContext>({});
diff --git a/packages/zapp/console/src/components/Executions/filters/startTimeFilters.ts b/packages/zapp/console/src/components/Executions/filters/startTimeFilters.ts
index bd268a7b8..16847621e 100644
--- a/packages/zapp/console/src/components/Executions/filters/startTimeFilters.ts
+++ b/packages/zapp/console/src/components/Executions/filters/startTimeFilters.ts
@@ -2,8 +2,8 @@ import * as moment from 'moment';
import { FilterOperationName } from 'models/AdminEntity/types';
import { FilterMap } from './types';
-const workflowExecutionStartTimeKey = 'execution_created_at';
-const nodeExecutionStartTimeKey = 'node_execution_created_at';
+const workflowExecutionStartTimeKey = 'created_at';
+const nodeExecutionStartTimeKey = 'created_at';
export type StartTimeFilterKey =
| 'all'
diff --git a/packages/zapp/console/src/components/Executions/filters/statusFilters.ts b/packages/zapp/console/src/components/Executions/filters/statusFilters.ts
index 9cddf0150..7b2293820 100644
--- a/packages/zapp/console/src/components/Executions/filters/statusFilters.ts
+++ b/packages/zapp/console/src/components/Executions/filters/statusFilters.ts
@@ -1,3 +1,7 @@
+import {
+ nodeExecutionPhaseConstants,
+ workflowExecutionPhaseConstants,
+} from 'components/Executions/constants';
import { NodeExecutionPhase, WorkflowExecutionPhase } from 'models/Execution/enums';
import { FilterMap } from './types';
@@ -15,32 +19,32 @@ export const workflowExecutionStatusFilters: FilterMap;
export type ExecutionError = RequiredNonNullable;
@@ -104,7 +99,7 @@ export interface NodeExecutionClosure extends Admin.INodeExecutionClosure {
duration?: Protobuf.Duration;
error?: ExecutionError;
outputUri: string;
- phase: NodeExecutionPhase;
+ phase: Core.NodeExecution.Phase;
startedAt?: Protobuf.ITimestamp;
taskNodeMetadata?: TaskNodeMetadata;
workflowNodeMetadata?: WorkflowNodeMetadata;