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

Support finding samples with multiple parent matches #1391

Merged
merged 12 commits into from
Jan 15, 2024
Merged

Conversation

XingY
Copy link
Contributor

@XingY XingY commented Jan 11, 2024

Rationale

A sample may have multiple parents from the same data type. This PR adds support to find samples in Sample Finder by matching multiple parents using a new "Equals All Of" filter type. This new filter type will be available for parent cards only and is currently limited to the Name/Id columns.

Related Pull Requests

Changes

  • add support for NOT_IN_EXP_DESCENDANTS_OF_FILTER_TYPE and IN_EXP_ANCESTORS_OF_FILTER_TYPE
  • show equals all for parent card id columns

@XingY XingY marked this pull request as ready for review January 11, 2024 23:58
@XingY XingY requested a review from labkey-susanh January 12, 2024 18:37
}
}

if (missingValueError == true) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (missingValueError == true) {
if (missingValueError) {

});
return 'Missing filter values for: ' + parentMsgs.join('; ') + '.';
}

if (maxMatchAllErrorField)
return (
"A max of 10 values can be selected for 'Equals All Of' filter type for '" + maxMatchAllErrorField + "'."
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"A max of 10 values can be selected for 'Equals All Of' filter type for '" + maxMatchAllErrorField + "'."
"At most 10 values can be selected for 'Equals All Of' filter type for '" + maxMatchAllErrorField + "'."

const filterType =
newFilterType?.value === ANCESTOR_MATCHES_ALL_OF_FILTER_TYPE.getURLSuffix()
? ANCESTOR_MATCHES_ALL_OF_FILTER_TYPE
: resolveFilterType(newFilterType?.value, field);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to incorporate the check for ANCESTOR_MATCHES_ALL into resolveFilterType?

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 point. updated

// skip optimization for ANCESTOR_MATCHES_ALL filter type
if (isAncestorMatchesAllFilter) {
if ((newValue === ALL_VALUE_DISPLAY && !check) || newCheckedValues.length === 0)
return Filter.create(fieldKey, [], ANCESTOR_MATCHES_ALL_OF_FILTER_TYPE);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm probably not reading this properly, but doesn't this result in a "no filter value" error for the filter? Seems like we would return null here but maybe we want to show the error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea is to retain the filter type when user is on Choose Value tab . If we return null, the filter will get automatically get changed to equals (one of) as user starts to select value.

const filterType = filter.getFilterType();
const columnNameSelect = getLegalIdentifier(filter.getColumnName(), tableAlias);
let operatorSql = null;

const values = filterType.parseValue(filter.getValue());

const sqlValues = [];
const negate = filterType.getURLSuffix() === Filter.Types.NOT_IN.getURLSuffix();
const negate = filterType.getURLSuffix() === Filter.Types.NOT_IN.getURLSuffix() && !noNegate;
Copy link
Contributor

Choose a reason for hiding this comment

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

A triple negative! Can we be more positive somehow? The flipNegative from the calling methods reads better to me.

XingY added 4 commits January 15, 2024 12:31
# Conflicts:
#	packages/components/package-lock.json
#	packages/components/package.json
#	packages/components/releaseNotes/components.md
# Conflicts:
#	package-lock.json
#	package.json
@XingY XingY merged commit dff5610 into develop Jan 15, 2024
@XingY XingY deleted the fb_multiAncestors branch January 15, 2024 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants