Skip to content

Commit

Permalink
Remove Cancelled and Paused from pipeline runs status filter
Browse files Browse the repository at this point in the history
  • Loading branch information
DaoDaoNoCode committed Aug 30, 2024
1 parent fe69f9c commit 6a047e4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const mockActiveRuns = [
},
experiment_id: 'test-experiment-1',
created_at: '2024-02-10T00:00:00Z',
state: RuntimeStateKF.CANCELED,
state: RuntimeStateKF.PENDING,
}),
];

Expand Down Expand Up @@ -524,22 +524,39 @@ describe('Pipeline runs', () => {
activeRunsTable.findRows().should('have.length', 1);
activeRunsTable.getRowByName('Test active run 2').find().should('exist');

// Mock runs (filtered by a status of 'CANCELED')
// Mock runs (filtered by a status of 'PENDING')
activeRunsTable.mockGetActiveRuns(
mockActiveRuns.filter((mockRun) => mockRun.state === RuntimeStateKF.CANCELED),
mockActiveRuns.filter((mockRun) => mockRun.state === RuntimeStateKF.PENDING),
projectName,
1,
);
// Select a filter value of 'CANCELED'
// Select a filter value of 'PENDING'
pipelineRunsGlobal
.findActiveRunsToolbar()
.within(() =>
pipelineRunFilterBar.selectStatusByName(runtimeStateLabels[RuntimeStateKF.CANCELED]),
pipelineRunFilterBar.selectStatusByName(runtimeStateLabels[RuntimeStateKF.PENDING]),
);

// Verify only rows with the selected status exist
activeRunsTable.findRows().should('have.length', 1);
activeRunsTable.getRowByName('Test active run 3').find().should('exist');

// Verify no "Canceled" and "Paused" status filter
pipelineRunsGlobal.findActiveRunsToolbar().within(() => {
pipelineRunFilterBar.findStatusSelect().click();
pipelineRunFilterBar
.findStatusSelect()
.get(`[data-testid="${runtimeStateLabels[RuntimeStateKF.SKIPPED]}"]`)
.should('exist');
pipelineRunFilterBar
.findStatusSelect()
.get(`[data-testid="${runtimeStateLabels[RuntimeStateKF.PAUSED]}"]`)
.should('not.exist');
pipelineRunFilterBar
.findStatusSelect()
.get(`[data-testid="${runtimeStateLabels[RuntimeStateKF.CANCELED]}"]`)
.should('not.exist');
});
});

it('Sort by Name', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ const PipelineRunTableToolbar: React.FC<PipelineRunTableToolbarProps> = ({
}) => {
const { versions } = React.useContext(PipelineRunVersionsContext);
const { experimentId, pipelineVersionId } = useParams();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { [RuntimeStateKF.RUNTIME_STATE_UNSPECIFIED]: unspecifiedState, ...statusRuntimeStates } =
runtimeStateLabels;
/* eslint-disable @typescript-eslint/no-unused-vars */
const {
[RuntimeStateKF.RUNTIME_STATE_UNSPECIFIED]: unspecifiedState,
[RuntimeStateKF.PAUSED]: pausedState,
[RuntimeStateKF.CANCELED]: cancelledState,
...statusRuntimeStates
} = runtimeStateLabels;
/* eslint-enable @typescript-eslint/no-unused-vars */
const isExperimentsAvailable = useIsAreaAvailable(SupportedArea.PIPELINE_EXPERIMENTS).status;

const defaultFilterOptions = React.useMemo(
Expand Down

0 comments on commit 6a047e4

Please sign in to comment.