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 connection type dropdown advanced properties #3143

Conversation

emilys314
Copy link
Contributor

@emilys314 emilys314 commented Aug 30, 2024

Completes https://issues.redhat.com/browse/RHOAIENG-10322

Description

  • This adds the "Advanced settings" dropdown / expandable form to the dropdown creation modal. It is defaulted to open when you select the dropdown variant (because there are required options).
  • The single select variant is automatically selected.
  • The table has draggable rows, and they can be deleted and added. A minimum of 1 row will always exist.
  • The "Dropdown item values" is the required field, so an option can exist without a label. In this scenario, I default the label to be the value.
  • The default values will be updated with the list of options from the table row. Blank options will not be added. If an option has a blank value, it will still be added, but the option will be disabled until a value is added.
  • If there are duplicate values in the table, currently the creation will be disabled. There isn't any design on how to handle this yet.
  • If a item has been selected as a default value, and you modify that item (like delete it or change the value), the default value will be removed (so it's not orphaned)

Initial state
image
Single select with options:
image
Multi select with options (and 1 blank option that is omitted):
image
Single select with options (1 is missing a label, a 2nd is missing a value)
image

How Has This Been Tested?

  1. Go to /connectionTypes/create
  2. Add a new field
  3. Select field type of "dropdown"
  4. New changes appear

Test Impact

Jest tests have been added like the other advanced forms to test all the functionality of the component

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.
    @simrandhaliw

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

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress This PR is in WIP state label Aug 30, 2024
Copy link
Contributor

openshift-ci bot commented Aug 30, 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

Copy link

codecov bot commented Aug 30, 2024

Codecov Report

Attention: Patch coverage is 85.33333% with 11 lines in your changes missing coverage. Please review.

Project coverage is 85.16%. Comparing base (18061ba) to head (10bad63).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...manage/advanced/DropdownAdvancedPropertiesForm.tsx 84.44% 7 Missing ⚠️
...c/pages/connectionTypes/manage/manageFieldUtils.ts 50.00% 2 Missing ⚠️
...cepts/connectionTypes/fields/DropdownFormField.tsx 96.00% 1 Missing ⚠️
...anage/advanced/DataFieldAdvancedPropertiesForm.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3143      +/-   ##
==========================================
+ Coverage   85.13%   85.16%   +0.02%     
==========================================
  Files        1250     1251       +1     
  Lines       27272    27332      +60     
  Branches     7209     7233      +24     
==========================================
+ Hits        23219    23276      +57     
- Misses       4053     4056       +3     
Files with missing lines Coverage Δ
...cepts/connectionTypes/fields/DropdownFormField.tsx 84.31% <96.00%> (+4.31%) ⬆️
...anage/advanced/DataFieldAdvancedPropertiesForm.tsx 58.82% <0.00%> (-5.89%) ⬇️
...c/pages/connectionTypes/manage/manageFieldUtils.ts 63.63% <50.00%> (-7.80%) ⬇️
...manage/advanced/DropdownAdvancedPropertiesForm.tsx 84.44% <84.44%> (ø)

... 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 18061ba...10bad63. Read the comment docs.

@emilys314 emilys314 marked this pull request as ready for review August 30, 2024 14:02
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress This PR is in WIP state label Aug 30, 2024
@openshift-ci openshift-ci bot requested review from mturley and ppadti August 30, 2024 14:02
@emilys314 emilys314 force-pushed the connection-type-dropdown-field-advanced-settings branch from 0cd0bc7 to 9f2fd27 Compare August 30, 2024 19:00

React.useEffect(() => {
// TODO: warn user of duplicate values in table
const duplicates = properties.items?.find((item1, index1) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we care if labels are the same? Imo labels should differ. But since we render the value at all times as well it doesn't really matter to have unique labels.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question, maybe we followup alongside the warning of duplicate values

@christianvogt
Copy link
Contributor

/lgtm
/approve

Copy link
Contributor

openshift-ci bot commented Aug 30, 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 57ce8a7 into opendatahub-io:main Aug 30, 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