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 Boolean filters to the Data Explorer #2949

Merged
merged 8 commits into from
May 2, 2024
Merged

Conversation

jmcphers
Copy link
Collaborator

@jmcphers jmcphers commented Apr 30, 2024

Intent

Creates "is true" and "is false" filter types and supporting UI code. Part of #2372. Addresses #2946.

image

Approach

Update comm contract; add UI for true/false filters; implementation in Python.

QA Notes

"Is true" and "Is false" test for these exact values rather than "truthy" or "falsy" values (e.g. Null/NA should not be considered true or false).

There is a related bug (which I did not attempt to fix) in the Python backend: currently, a column must contain at least one missing value in order for it to be marked as a boolean. #2950

@jmcphers jmcphers changed the title Add Boolean filter UI Add Boolean filters to the Data Explorer Apr 30, 2024
@jmcphers jmcphers force-pushed the feature/boolean-filter-ui branch from 0fdcaa1 to f444e43 Compare April 30, 2024 22:10
@jmcphers jmcphers requested a review from nstrayer April 30, 2024 22:30
Copy link
Contributor

@nstrayer nstrayer 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 +343 to +350
conditionEntries.push(new DropDownListBoxItem({
identifier: RowFilterDescrType.IS_TRUE,
title: localize(
'positron.addEditRowFilter.conditionIsTrue',
"is true"
),
value: RowFilterDescrType.IS_TRUE
}));
Copy link
Contributor

Choose a reason for hiding this comment

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

The fact these are all the same makes me wonder if a new class could be made for each condition ala how ContextKeyExpression works.
E.g.

export class DropDownListBoxTrue extends DropDownListBoxItem<RowFilterDescrType.IS_TRUE, string> {
	constructor() {
		super(
			{
				identifier: RowFilterDescrType.IS_TRUE,
				title: localize(
					'positron.addEditRowFilter.conditionIsTrue',
					"is true"
				),
				value: RowFilterDescrType.IS_TRUE
			});
	}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Not super applicable to this PR though

Copy link
Contributor

Choose a reason for hiding this comment

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

This whole file is chock full of code duplication. I did a little refactoring a week or two ago to reduce some of it, but it would be good to modularize and make the list of "what filters are supported for each type" more declarative / easier to edit and less ad hoc. Same with the row filter descriptor classes which feel more verbose than is needed

@jmcphers
Copy link
Collaborator Author

jmcphers commented May 2, 2024

@nstrayer thanks for the review!

@jmcphers jmcphers merged commit 467e4c2 into main May 2, 2024
24 checks passed
@jmcphers jmcphers deleted the feature/boolean-filter-ui branch May 2, 2024 19:16
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.

3 participants