Skip to content

Commit

Permalink
Fix UX issues on archived experiment runs table
Browse files Browse the repository at this point in the history
  • Loading branch information
DaoDaoNoCode committed Jun 17, 2024
1 parent c9ec3f9 commit 1cb17a4
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,21 @@ class PipelineRunsRow extends TableRow {
findColumnName(name: string) {
return this.find().find(`[data-label=Name]`).contains(name);
}
}

findColumnVersion(name: string) {
return this.find().find(`[data-label="Pipeline"]`).contains(name);
class PipelineRunTableRow extends PipelineRunsRow {
findKebabAction(name: string): Cypress.Chainable<JQuery<HTMLElement>> {
this.find().findKebab().click();
return cy.findByTestId('pipeline-run-table-row-actions').findByRole('menuitem', { name });
}
}

class PipelineRunJobTableRow extends PipelineRunsRow {
findStatusSwitchByRowName() {
return this.find().findByTestId('job-status-switch');
}
}

class PipelineRunsTable {
protected testId = '';

Expand All @@ -33,12 +39,6 @@ class PipelineRunsTable {
return cy.findByTestId(this.testId);
}

getRowByName(name: string) {
return new PipelineRunsRow(() =>
this.find().find(`[data-label=Name]`).contains(name).parents('tr'),
);
}

shouldRowNotBeVisible(name: string) {
this.find()
.parents()
Expand Down Expand Up @@ -120,6 +120,12 @@ class ActiveRunsTable extends PipelineRunsTable {
mockGetActiveRuns(runs: PipelineRunKFv2[], namespace: string, times?: number) {
return this.mockGetRuns(runs, [], namespace, times);
}

getRowByName(name: string) {
return new PipelineRunTableRow(() =>
this.find().find(`[data-label=Name]`).contains(name).parents('tr'),
);
}
}
class ArchivedRunsTable extends PipelineRunsTable {
constructor() {
Expand All @@ -129,13 +135,25 @@ class ArchivedRunsTable extends PipelineRunsTable {
mockGetArchivedRuns(runs: PipelineRunKFv2[], namespace: string, times?: number) {
return this.mockGetRuns([], runs, namespace, times);
}

getRowByName(name: string) {
return new PipelineRunTableRow(() =>
this.find().find(`[data-label=Name]`).contains(name).parents('tr'),
);
}
}

class PipelineRunJobTable extends PipelineRunsTable {
constructor() {
super('schedules');
}

getRowByName(name: string) {
return new PipelineRunJobTableRow(() =>
this.find().find(`[data-label=Name]`).contains(name).parents('tr'),
);
}

findEmptyState() {
return cy.findByTestId('schedules-empty-state');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ const PipelineRunTableRow: React.FC<PipelineRunTableRowProps> = ({
{customCells}
{hasRowActions && (
<Td isActionCell dataLabel="Kebab">
<ActionsColumn items={actions} />
<ActionsColumn
data-testid="pipeline-run-table-row-actions"
items={actions}
popperProps={{ appendTo: () => document.body, position: 'right' }}
/>
<RestoreRunModal
isOpen={isRestoreModalOpen}
runs={[run]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,22 @@ import { ExperimentRunsContext } from '~/pages/pipelines/global/experiments/Expe
export const ExperimentRunsListBreadcrumb: React.FC = () => {
const { experiment } = React.useContext(ExperimentRunsContext);

const displayName = experiment?.display_name || 'Loading...';

return (
<Breadcrumb>
<BreadcrumbItem>
<Link to={experimentsRootPath}>Experiments</Link>
</BreadcrumbItem>

<BreadcrumbItem isActive style={{ maxWidth: 300 }}>
<Truncate content={experiment?.display_name || 'Loading...'} />
{experiment?.storage_state === StorageStateKF.ARCHIVED && <Label>Archived</Label>}
{/* A hack solution to get rid of the minWidth set on PF Truncate component
So we can show correct spacing between the title and the label
The min width is set to 12 characters:
https://github.com/patternfly/patternfly/blob/9499f0a70a18f51474285752a04928958d901829/src/patternfly/components/Truncate/truncate.scss#L4 */}
{displayName.length > 12 ? <Truncate content={displayName} /> : <>{displayName}</>}
</BreadcrumbItem>
{experiment?.storage_state === StorageStateKF.ARCHIVED && <Label>Archived</Label>}
</Breadcrumb>
);
};

0 comments on commit 1cb17a4

Please sign in to comment.