From a3fb9bae887faaf409847b18ca811f6a034bf5fa Mon Sep 17 00:00:00 2001 From: pnaik1 Date: Tue, 10 Sep 2024 16:58:53 +0530 Subject: [PATCH] change description format within tables --- .../cypress/pages/pipelines/experiments.ts | 4 +++ .../tests/mocked/pipelines/experiments.cy.ts | 5 ++++ .../pipelines/content/tables/columns.ts | 9 +++--- .../tables/experiment/ExperimentTableRow.tsx | 30 +++++++++++-------- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/frontend/src/__tests__/cypress/cypress/pages/pipelines/experiments.ts b/frontend/src/__tests__/cypress/cypress/pages/pipelines/experiments.ts index e846a60f58..1fc668317b 100644 --- a/frontend/src/__tests__/cypress/cypress/pages/pipelines/experiments.ts +++ b/frontend/src/__tests__/cypress/cypress/pages/pipelines/experiments.ts @@ -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"]`); } diff --git a/frontend/src/__tests__/cypress/cypress/tests/mocked/pipelines/experiments.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/mocked/pipelines/experiments.cy.ts index 9db7f85102..aa78c39989 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/mocked/pipelines/experiments.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/mocked/pipelines/experiments.cy.ts @@ -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({ @@ -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() diff --git a/frontend/src/concepts/pipelines/content/tables/columns.ts b/frontend/src/concepts/pipelines/content/tables/columns.ts index 978b054dbe..3bda774f4b 100644 --- a/frontend/src/concepts/pipelines/content/tables/columns.ts +++ b/frontend/src/concepts/pipelines/content/tables/columns.ts @@ -65,26 +65,25 @@ export const experimentColumns: SortableData[] = [ 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(), ]; diff --git a/frontend/src/concepts/pipelines/content/tables/experiment/ExperimentTableRow.tsx b/frontend/src/concepts/pipelines/content/tables/experiment/ExperimentTableRow.tsx index 178ad80c64..7408d6104d 100644 --- a/frontend/src/concepts/pipelines/content/tables/experiment/ExperimentTableRow.tsx +++ b/frontend/src/concepts/pipelines/content/tables/experiment/ExperimentTableRow.tsx @@ -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'; @@ -29,19 +29,25 @@ const ExperimentTableRow: React.FC = ({ - + {/* TODO: Remove the custom className after upgrading to PFv6 */} + + } - state={{ experiment }} - > - {/* TODO: Remove the custom className after upgrading to PFv6 */} - - + description={experiment.description} + truncateDescriptionLines={2} + /> - {experiment.description} +