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

Proper support for domain_filter in the select all/some input (multi form input) #2397

Closed
RFSH opened this issue Feb 5, 2024 · 0 comments
Closed
Assignees
Labels
bug investigation required Requires some initial investigation

Comments

@RFSH
Copy link
Member

RFSH commented Feb 5, 2024

Summary

The domain_filter allows data modelers to limit the options in a foreign key input. This can be done by writing a static filter or using the currently selected values in the form. But since the "select all/some" input doesn't belong to any of the forms, we cannot support domain_filter in all the cases.

The simplest solution is disabling the "select all/some" button when the foreign key column has domain_filter. But that would be too limiting, and in this issue, we would like to explore ways to support both simultaneously. This would be useful for PDB, as we discussed here.

Details

I will focus on foreign key columns with domain_filter in the following. Foreign key columns without this annotation should continue to offer the "select all/some" feature without any changes.

As long as the computed domain_filter (or more generally the Reference.uri) in all the forms is the same, we should be able to support domain_filter in "select some/all" input. So, we could compute the domain_filter for all the forms and disable the "select some/all" toggle button if some forms had a different value. But that would mean we have to rerender the KeyColumn component on each user input, which would slow the page down.

After discussing this, we decided to show an error when users attempt to open the foreign key picker instead. We will only run this expensive operation when users click on the foreign key. We are also going to leave the error and only reevaluate when users click again (after each click, we're showing a spinner since calculating it might be slow).

Error message

We should add pattern_sources property to domain_filter so data-modelers can list the columns that are used in the pattern. And then use them to show an error like this:

This feature is constrained by "x", "y", and "z". Make sure all the records you want to set "Asym Id" for, have the same values for those fields. Try again after upadting those fields.

If this property is missing, the error should be:

This feature is constrained by other fields (hint: `domain_filter_string`). Make sure all the records you want to set "Asym Id" for, have the same values for those fields. Try again after upadting those fields.

P.S. While discussing this, we realized that even if users don't use the "select all/some", the final selected values might not match the domain_filters. So, as part of a separate task, we should also do similar checks before attempting to save (#2401).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug investigation required Requires some initial investigation
Projects
None yet
Development

No branches or pull requests

1 participant