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

Update field selection table row actions #1506

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

kiahna-tucker
Copy link
Member

@kiahna-tucker kiahna-tucker commented Mar 11, 2025

Issues

The issues directly below are completely resolved by this PR:
#1503

Changes

1503

The following features are included in this PR:

  • Replace Include row action with Require and Select row actions.

  • Order the row actions as follows starting from left to right: exclude, select, require.

  • Apply the styling of the former Include row action to the new Require and Select row actions.

  • Initialize a field according to the following logic:

    • A field is selected if the recommended flag is true and the field is not listed in the include/require object or exclude array in the binding's fields stanza.

    • A field is required if is listed in the include/require object in the binding's fields stanza.

    • A field is excluded if is listed in the exclude array in the binding's fields stanza.

Tests

Manually tested

Approaches to testing are as follows:

  • scenarios you manually tested

Automated tests

  • unit testing covered

Playwright tests ran locally

  • Admin
  • Captures
  • Collections
  • HomePage
  • Login
  • Materialization

Screenshots

Field selection initialized | recommended true | No existing selections

pr_screenshot-1506-field_actions-recommended_true-init-fop_lreq_lrec-reorder

Field selection initialized | recommended false | No existing selections

pr_screenshot-1506-field_actions-recommended_false-init-fop_lreq_lrec-reorder

@kiahna-tucker kiahna-tucker added the change:planned This is a planned change label Mar 11, 2025
@kiahna-tucker kiahna-tucker marked this pull request as ready for review March 11, 2025 19:36
@kiahna-tucker kiahna-tucker requested a review from a team as a code owner March 11, 2025 19:36
Copy link
Member

Choose a reason for hiding this comment

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

Not for this PR - but for the field selection overhaul in general.

I think we should switch all these functions over to objects we just store the settings in.

Copy link
Member Author

Choose a reason for hiding this comment

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

This thought crossed my mind as well.

Copy link
Member

Choose a reason for hiding this comment

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

I'd say the spirit of this is now generally done with the new alpha colors.

Copy link
Member

@travjenkins travjenkins left a comment

Choose a reason for hiding this comment

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

static code looks good - testing now

Comment on lines 77 to 78
requireOnly ||
(excludeOnly && !recommendFields)
Copy link
Member

Choose a reason for hiding this comment

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

I think if a button is disabled here we should probably show a tooltip?

Copy link
Member

@travjenkins travjenkins left a comment

Choose a reason for hiding this comment

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

lgtm

Comment on lines +35 to +45
[`&.${toggleButtonClasses.disabled}`]: selected
? {
backgroundColor: theme.palette[colorKey].alpha_05,
border: `1px solid ${theme.palette[colorKey].alpha_12}`,
color: theme.palette[colorKey].alpha_26,
}
: {
backgroundColor: 'none',
border: defaultOutline[theme.palette.mode],
color: disabledButtonText[theme.palette.mode],
},
Copy link
Member

Choose a reason for hiding this comment

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

What is the case where selected is true but the class for selected is not applied? Hoping we could get the same styling with more static styling.

Copy link
Member

Choose a reason for hiding this comment

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

This should eventually live somewhere else. We probably want to put all the styled stuff in a single spot near the theme (and break that thing up). We should also probably just use our own ToggleButton that can be outlined or not and then stop using the MUI one all together.

Comment on lines +83 to +100
onClick={() => {
const singleValue =
selection?.mode !== 'default' ? 'default' : null;

const selectionType = evaluateSelectionType(
recommendFields[bindingUUID],
'default',
selection?.mode ?? null,
singleValue
);

setSingleSelection(
bindingUUID,
field,
selectionType,
selection?.meta
);
}}
Copy link
Member

Choose a reason for hiding this comment

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

I think all these onClicks should be shared.

Copy link
Member

Choose a reason for hiding this comment

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

They should also probably use the value from the function args.


<OutlinedToggleButton
color="warning"
selected={selection?.mode === 'require'}
Copy link
Member

Choose a reason for hiding this comment

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

Can we use the `value' prop on the group so we don't have to manage this ourselves?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change:planned This is a planned change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants