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

Fix workbench new connection env warning / editing new connection / and save failure handling #3462

Merged

Conversation

emilys314
Copy link
Contributor

@emilys314 emilys314 commented Nov 11, 2024

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

Description

When creating a new connection is created, it uses the connection made from assembleConnection which has its data inside stringData not data so check those.

So this fixes 3 different issues oddly:

  1. When creating a new connection to attach, it would not warn of duplicate env variables in the table anymore. This was because the assembleConnection() put the data into stringData not data
  2. When saving a (new) connection, it would always add the new connection to the table, even if there was a failure. There was no success gate for adding it.
  3. If you tried editing a connection you just created, it would not load the existing data you just entered, because it was in stringData

All of these are fixed by using the response of the save / replace and verifying it was successful

Before:
image
After:
image

Note the fields
before:
image
after:
image

image
image

How Has This Been Tested?

Duplicate env:

  1. Create / edit a workbench
  2. Attach an existing connection
  3. Create a new connection of the same type as the existing one and click save
  4. See there is now a warning

Connection saving success gate:

  1. Create / edit a workbench
  2. Create a new connection and save it
  3. Create another connection with the same name and save it
  4. You'll see an error, close the modal.
  5. With the fix, now that connection was not added to the table

Editing a new connection:

  1. Create / edit a workbench
  2. Create a new connection and save it
  3. Edit the connection
  4. Make sure env var data has been populated with what you entered in step 2

Test Impact

No updates, it's a bit tedious to test these edge cases since it requires a few steps across different components.

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

codecov bot commented Nov 11, 2024

Codecov Report

Attention: Patch coverage is 36.36364% with 7 lines in your changes missing coverage. Please review.

Project coverage is 85.66%. Comparing base (e85d7a1) to head (43045d5).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...ens/spawner/connections/ConnectionsFormSection.tsx 36.36% 7 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3462   +/-   ##
=======================================
  Coverage   85.66%   85.66%           
=======================================
  Files        1347     1347           
  Lines       30670    30676    +6     
  Branches     8550     8554    +4     
=======================================
+ Hits        26272    26278    +6     
  Misses       4398     4398           
Files with missing lines Coverage Δ
...ens/spawner/connections/ConnectionsFormSection.tsx 79.77% <36.36%> (-1.94%) ⬇️

... and 5 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 e85d7a1...43045d5. Read the comment docs.

@christianvogt
Copy link
Contributor

Editing an existing connection ends up with a duplicate entry in the table.

@emilys314
Copy link
Contributor Author

Editing an existing connection ends up with a duplicate entry in the table.

Fixed, a 4th issue.

  1. Create / edit a workbench
  2. Have an existing connection on the workbench
  3. Edit the existing connection and save it (update the description and fields)
  4. Save the connection
  5. Make sure the description is updated in the table, and the fields are updated when editing again

@christianvogt
Copy link
Contributor

works as expected

/lgtm
/approve

Copy link
Contributor

openshift-ci bot commented Nov 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 4066b69 into opendatahub-io:main Nov 12, 2024
6 checks passed
manaswinidas pushed a commit to manaswinidas/odh-dashboard that referenced this pull request Nov 13, 2024
openshift-merge-bot bot pushed a commit that referenced this pull request Nov 13, 2024
* Upversion Dashboard

* Check and use response of connection saving (#3462)

(cherry picked from commit 4066b69)

* enable connection types by default (#3452)

(cherry picked from commit c575d1f)

---------

Co-authored-by: Emily Samoylov <[email protected]>
Co-authored-by: Christian Vogt <[email protected]>
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