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 connections section to project details #3183

Conversation

emilys314
Copy link
Contributor

Closes https://issues.redhat.com/browse/RHOAIENG-11554

Description

Replaces the "Data connections" section if the new connections type flag is on. Right now it's backwards compatible with existing data connections for viewing. But add / edit / delete will come in later PRs.

image
image

How Has This Been Tested?

  1. make sure the disableConnectionTypes flag is set to false
  2. go to a project, and select the "Connections" tab

Test Impact

Some basics tests added

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)

If you have UI changes:

  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change.

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

Copy link
Contributor

openshift-ci bot commented Sep 10, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress This PR is in WIP state label Sep 10, 2024
@emilys314 emilys314 marked this pull request as ready for review September 10, 2024 19:20
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress This PR is in WIP state label Sep 10, 2024
Copy link

codecov bot commented Sep 10, 2024

Codecov Report

Attention: Patch coverage is 93.54839% with 4 lines in your changes missing coverage. Please review.

Project coverage is 85.29%. Comparing base (917b4af) to head (90c37b7).
Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
...screens/detail/connections/ConnectionsTableRow.tsx 88.88% 2 Missing ⚠️
...eens/detail/connections/connectionsTableColumns.ts 83.33% 1 Missing ⚠️
...jects/screens/detail/connections/useConnections.ts 87.50% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3183      +/-   ##
==========================================
+ Coverage   85.27%   85.29%   +0.01%     
==========================================
  Files        1258     1263       +5     
  Lines       27689    27751      +62     
  Branches     7372     7390      +18     
==========================================
+ Hits        23611    23669      +58     
- Misses       4078     4082       +4     
Files with missing lines Coverage Δ
.../src/components/table/TableRowTitleDescription.tsx 100.00% <100.00%> (+5.88%) ⬆️
frontend/src/concepts/connectionTypes/types.ts 100.00% <100.00%> (ø)
frontend/src/concepts/design/utils.ts 90.22% <100.00%> (+0.30%) ⬆️
...ntend/src/pages/projects/ProjectDetailsContext.tsx 93.65% <100.00%> (+0.10%) ⬆️
...c/pages/projects/screens/detail/ProjectDetails.tsx 96.66% <100.00%> (+0.37%) ⬆️
...cts/screens/detail/connections/ConnectionsList.tsx 100.00% <100.00%> (ø)
...ts/screens/detail/connections/ConnectionsTable.tsx 100.00% <100.00%> (ø)
...rontend/src/pages/projects/screens/detail/const.ts 100.00% <ø> (ø)
...rontend/src/pages/projects/screens/detail/types.ts 100.00% <100.00%> (ø)
...eens/detail/connections/connectionsTableColumns.ts 83.33% <83.33%> (ø)
... and 2 more

... and 12 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 917b4af...90c37b7. Read the comment docs.

Comment on lines 82 to 96
...(connectionTypesEnabled
? [
{
id: ProjectSectionID.CONNECTIONS,
title: 'Connections',
component: <ConnectionsList />,
},
]
: [
{
id: ProjectSectionID.DATA_CONNECTIONS,
title: 'Data connections',
component: <DataConnectionsList />,
},
]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now keep both present as I want to use the existing data connection tab for testing.

/>
</Td>
<Td dataLabel="Type">{obj.metadata.annotations['opendatahub.io/connection-type']}</Td>
<Td dataLabel="Compatibility">-</Td>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Omit compatibility as a whole until we're ready to support this feature from the admin side as well.

Comment on lines 6 to 22
const connections: Connection[] = [
{
kind: 'Secret',
apiVersion: 'v1',
metadata: {
name: 'connection1',
namespace: 'ds-project',
labels: { 'opendatahub.io/dashboard': 'true', 'opendatahub.io/managed': 'true' },
annotations: {
'opendatahub.io/connection-type': 's3',
'openshift.io/display-name': 'connection1',
'openshift.io/description': 'desc1',
},
},
data: {},
},
];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using mockDataConnection instead or creating your own new mock util?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old type of DataConnection doesn't fully line up. I can relax some of the properties in Connection and make them nullish which helps. But then the data property is a pain to properly convert, since it's an enum of the AwsKeys.

I could just do the following (but the description annotation doesn't exist in DataConnection):

export const mockConnection = (args: MockDataConnectionType): Connection =>
  mockDataConnection(args).data as unknown as Connection;

(And yes the .data is needed because that is actually the SecretKind)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make a new mock util for these connection and then we can eventually remove the old data connection mock and types.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. I made frontend/src/__mocks__/mockConnection.ts

(I'm still not 100% sure on if it should be it's own file or part connection types, like mockConnectionType.ts, but it is it's own file)

description={obj.metadata.annotations['openshift.io/description']}
/>
</Td>
<Td dataLabel="Type">{obj.metadata.annotations['opendatahub.io/connection-type']}</Td>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're going to want to resolve this type to a connection type to pull its display name. Fallback should be the annotation value if the type fails to resolve.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. I decided to just pull all the connection types upfront on going to this subsection, since it's going to be used a lot anyways. Then pass it down for wherever it's needed.
So that network request has been added to the pages isLoading and loadError, which the page could technically work even if it failed, but it probably makes sense to have still.

image

@emilys314 emilys314 force-pushed the project-details-connections-list branch from 3d0fe83 to c059291 Compare September 11, 2024 21:06
@emilys314 emilys314 force-pushed the project-details-connections-list branch from c059291 to 90c37b7 Compare September 11, 2024 22:21
@christianvogt
Copy link
Contributor

/lgtm
/approve

Copy link
Contributor

openshift-ci bot commented Sep 12, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christianvogt

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 06e065b into opendatahub-io:main Sep 12, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants