Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add projects' descriptions to projects list view #3174

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions frontend/src/__tests__/cypress/cypress/pages/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class NotebookRow extends TableRow {
}

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

findEnableSwitch() {
return this.find().pfSwitch('notebook-status-switch');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { asProjectAdminUser } from '~/__tests__/cypress/cypress/utils/mockUsers'
import { notebookConfirmModal } from '~/__tests__/cypress/cypress/pages/workbench';
import { testPagination } from '~/__tests__/cypress/cypress/utils/pagination';

const mockProject = mockProjectK8sResource({});
const mockProject = mockProjectK8sResource({ description: 'Mock description' });
const initIntercepts = () => {
cy.interceptK8sList(ProjectModel, mockK8sResourceList([mockProject]));
};
Expand Down Expand Up @@ -73,7 +73,9 @@ describe('Data science projects details', () => {
initIntercepts();
projectListPage.visit();
projectListPage.shouldHaveProjects();
projectListPage.getProjectRow('Test Project').find().should('exist');
const projectRow = projectListPage.getProjectRow('Test Project');
projectRow.find().should('exist');
projectRow.findDescription().should('contain.text', 'Mock description');
});

it('should delete project', () => {
Expand Down
10 changes: 7 additions & 3 deletions frontend/src/pages/projects/screens/projects/ProjectLink.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import * as React from 'react';
import { Link } from 'react-router-dom';
import { Link, LinkProps } from 'react-router-dom';
import { getDisplayNameFromK8sResource } from '~/concepts/k8s/utils';
import { ProjectKind } from '~/k8sTypes';

type ProjectLinkProps = {
project: ProjectKind;
};

const ProjectLink: React.FC<ProjectLinkProps> = ({ project }) => {
const ProjectLink: React.FC<Omit<LinkProps, 'to'> & ProjectLinkProps> = ({ project, ...props }) => {
const projectName = getDisplayNameFromK8sResource(project);

return <Link to={`/projects/${project.metadata.name}`}>{projectName}</Link>;
return (
<Link to={`/projects/${project.metadata.name}`} {...props}>
{projectName}
</Link>
);
};

export default ProjectLink;
33 changes: 26 additions & 7 deletions frontend/src/pages/projects/screens/projects/ProjectTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
import { useNavigate } from 'react-router-dom';
import { ProjectKind } from '~/k8sTypes';
import useProjectTableRowItems from '~/pages/projects/screens/projects/useProjectTableRowItems';
import ResourceNameTooltip from '~/components/ResourceNameTooltip';
import { getProjectOwner } from '~/concepts/projects/utils';
import useProjectNotebookStates from '~/pages/projects/notebook/useProjectNotebookStates';
import NotebookRouteLink from '~/pages/projects/notebook/NotebookRouteLink';
import CanEnableElyraPipelinesCheck from '~/concepts/pipelines/elyra/CanEnableElyraPipelinesCheck';
import NotebookStateStatus from '~/pages/projects/screens/projects/NotebookStateStatus';
import { getDisplayNameFromK8sResource } from '~/concepts/k8s/utils';
import ProjectLink from './ProjectLink';
import { getDescriptionFromK8sResource, getDisplayNameFromK8sResource } from '~/concepts/k8s/utils';
import { TableRowTitleDescription } from '~/components/table';
import ResourceNameTooltip from '~/components/ResourceNameTooltip';
import ProjectLink from '~/pages/projects/screens/projects/ProjectLink';

type ProjectTableRowProps = {
obj: ProjectKind;
Expand Down Expand Up @@ -47,10 +48,28 @@
>
{index === 0 ? (
<Td dataLabel="Name" rowSpan={notebookStates.length || 1}>
<ResourceNameTooltip resource={project}>
<ProjectLink project={project} />
</ResourceNameTooltip>
{owner && <Text component={TextVariants.small}>{owner}</Text>}
<TableRowTitleDescription
title={
<ResourceNameTooltip resource={project}>
<ProjectLink
project={project}
style={{
fontSize: 'var(--pf-v5-global--FontSize--md)',
fontWeight: 'var(--pf-v5-global--FontWeight--normal)',
}}
/>
</ResourceNameTooltip>
}
christianvogt marked this conversation as resolved.
Show resolved Hide resolved
description={getDescriptionFromK8sResource(project)}
truncateDescriptionLines={2}
subtitle={
owner ? (
<div>
<Text component={TextVariants.small}>{owner}</Text>
</div>
) : undefined

Check warning on line 70 in frontend/src/pages/projects/screens/projects/ProjectTableRow.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/pages/projects/screens/projects/ProjectTableRow.tsx#L70

Added line #L70 was not covered by tests
}
/>
</Td>
) : null}
{index === 0 ? (
Expand Down
Loading