Skip to content

Commit

Permalink
change description format within tables
Browse files Browse the repository at this point in the history
  • Loading branch information
pnaik1 committed Sep 12, 2024
1 parent 843e85a commit a3fb9ba
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ class ExperimentsRow extends TableRow {
return this.find().find(`[data-label=Checkbox]`).find('input');
}

findDescription() {
return this.find().findByTestId('table-row-title-description');
}

findExperimentCreatedTime() {
return this.find().find(`[data-label="Created"]`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const mockExperiments = [
buildMockExperimentKF({
display_name: 'Test experiment 1',
experiment_id: '1',
description: 'Test experiment 1',
last_run_created_at: currentTime.toISOString(),
}),
buildMockExperimentKF({
Expand Down Expand Up @@ -86,6 +87,10 @@ describe('Experiments', () => {
it('experiments table time', () => {
experimentsTabs.findActiveTab().click();
const activeExperimentsTable = experimentsTabs.getActiveExperimentsTable();
activeExperimentsTable
.getRowByName('Test experiment 1')
.findDescription()
.should('have.text', 'Test experiment 1');
activeExperimentsTable
.getRowByName('Test experiment 1')
.findExperimentLastRunTime()
Expand Down
9 changes: 4 additions & 5 deletions frontend/src/concepts/pipelines/content/tables/columns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,25 @@ export const experimentColumns: SortableData<ExperimentKFv2>[] = [
label: 'Experiment',
field: 'display_name',
sortable: true,
},
{
label: 'Description',
field: 'description',
sortable: true,
width: 40,
},
{
label: 'Created',
field: 'created_at',
sortable: true,
width: 20,
},
{
label: 'Last run started',
field: 'last_run_created_at',
sortable: true,
width: 20,
},
{
label: 'Last 5 runs',
field: 'last_5_runs',
sortable: false,
width: 20,
},
kebabTableColumn(),
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Link } from 'react-router-dom';
import { ActionsColumn, IAction, Td, Tr } from '@patternfly/react-table';
import { Truncate } from '@patternfly/react-core';
import { ExperimentKFv2, StorageStateKF } from '~/concepts/pipelines/kfTypes';
import { CheckboxTd } from '~/components/table';
import { CheckboxTd, TableRowTitleDescription } from '~/components/table';
import { experimentArchivedRunsRoute, experimentRunsRoute } from '~/routes';
import { usePipelinesAPI } from '~/concepts/pipelines/context';
import { ExperimentCreated, LastExperimentRuns, LastExperimentRunsStarted } from './renderUtils';
Expand All @@ -29,19 +29,25 @@ const ExperimentTableRow: React.FC<ExperimentTableRowProps> = ({
<Tr>
<CheckboxTd id={experiment.experiment_id} isChecked={isChecked} onToggle={onToggleCheck} />
<Td dataLabel="Experiment">
<Link
to={
isArchived
? experimentArchivedRunsRoute(namespace, experiment.experiment_id)
: experimentRunsRoute(namespace, experiment.experiment_id)
<TableRowTitleDescription
title={
<Link
to={
isArchived
? experimentArchivedRunsRoute(namespace, experiment.experiment_id)
: experimentRunsRoute(namespace, experiment.experiment_id)
}
state={{ experiment }}
>
{/* TODO: Remove the custom className after upgrading to PFv6 */}
<Truncate content={experiment.display_name} className="truncate-no-min-width" />
</Link>
}
state={{ experiment }}
>
{/* TODO: Remove the custom className after upgrading to PFv6 */}
<Truncate content={experiment.display_name} className="truncate-no-min-width" />
</Link>
description={experiment.description}
truncateDescriptionLines={2}
/>
</Td>
<Td dataLabel="Description">{experiment.description}</Td>

<Td dataLabel="Created">
<ExperimentCreated experiment={experiment} />
</Td>
Expand Down

0 comments on commit a3fb9ba

Please sign in to comment.