-
Notifications
You must be signed in to change notification settings - Fork 167
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
Add connections section to project details #3183
Conversation
Skipping CI for Draft Pull Request. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ 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
... and 12 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
...(connectionTypesEnabled | ||
? [ | ||
{ | ||
id: ProjectSectionID.CONNECTIONS, | ||
title: 'Connections', | ||
component: <ConnectionsList />, | ||
}, | ||
] | ||
: [ | ||
{ | ||
id: ProjectSectionID.DATA_CONNECTIONS, | ||
title: 'Data connections', | ||
component: <DataConnectionsList />, | ||
}, | ||
]), |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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.
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: {}, | ||
}, | ||
]; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
frontend/src/pages/projects/screens/detail/connections/types.ts
Outdated
Show resolved
Hide resolved
description={obj.metadata.annotations['openshift.io/description']} | ||
/> | ||
</Td> | ||
<Td dataLabel="Type">{obj.metadata.annotations['opendatahub.io/connection-type']}</Td> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
3d0fe83
to
c059291
Compare
c059291
to
90c37b7
Compare
/lgtm |
[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 |
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.
How Has This Been Tested?
disableConnectionTypes
flag is set tofalse
Test Impact
Some basics tests added
Request review criteria:
Self checklist (all need to be checked):
If you have UI changes:
After the PR is posted & before it merges:
main