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

Status filter checkboxes #310

Merged
merged 9 commits into from
Mar 25, 2024

Conversation

nknguyenhc
Copy link
Contributor

@nknguyenhc nknguyenhc commented Mar 19, 2024

Summary:

Fixes #296

Type of change:

  • ✨ New Feature/ Enhancement

Changes Made:

  • Change Filter::status type from string to string[]
  • Revise dropdownfilter to filter according to the new representation
  • Remove filter validation, since there is no need with this new design
  • Allow multiple selection in status filter dropdown
  • Dropdown option only appears if the value for Filter::type is correct

Screenshots:

image

Proposed Commit Message:

Status filter checkboxes

We implement checkboxes for status, so that
multiple types of PRs/issues can be viewed concurrently.

Checklist:

  • I have tested my changes thoroughly.
  • I have created tests for any new code files created in this PR or provided a link to a issue/PR that addresses this.
  • I have added or modified code comments to improve code readability where necessary.
  • I have updated the project's documentation as necessary.

Copy link
Contributor

@Arif-Khalid Arif-Khalid left a comment

Choose a reason for hiding this comment

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

Overall an excellent PR which works well without any errors. Just some minor issues with the modularity and the default filter overlooked.

Well done! 😀

Comment on lines 15 to 26
type StatusInfo = {
type: string;
status: string;
};

/**
* Converts a status string into an info object
*/
export const statusToType = (statusString: string): StatusInfo => {
const [status, type] = statusString.split(' ');
return { status, type };
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to include a statusToType sort of function in the filters service?
The filters service should be exclusively kept for storing and updating filters in line with the SRP.
I think this characterization of information from certain filters should be done where the filters are applied i.e., in dropdownfilter.ts in this case.
I would suggest simply using the status string in dropdownfilter.ts and parsing it appropriately as part of filtering

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

export const DEFAULT_FILTER: Filter = {
title: '',
status: 'all',
status: ['open pullrequest', 'merged pullrequest', 'closed pullrequest', 'open issue', 'closed issue'],
Copy link
Contributor

Choose a reason for hiding this comment

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

As per the description of #296, closed pullrequest should not be selected by default

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

Copy link
Contributor

@Arif-Khalid Arif-Khalid left a comment

Choose a reason for hiding this comment

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

Excellent changes. Just A small overlooked redundancy and naming.
Other than that, very well done PR.

Comment on lines 12 to 15
export const statusToType = (statusString: string): StatusInfo => {
const [status, type] = statusString.split(' ');
return { status, type };
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the export necessary?

Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make more sense to name the function something similar to infoFromStatus since we are returning a type StatusInfo object and not just a Type which the current name seems to imply

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

The label sanitation ensures that keep filters
work with labels. The method is updated
to work with deselected labels as well.
Copy link
Contributor

@Arif-Khalid Arif-Khalid left a comment

Choose a reason for hiding this comment

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

LGTM! Nice implementation of status filter checkboxes

@nknguyenhc nknguyenhc merged commit a65bb59 into CATcher-org:main Mar 25, 2024
3 checks passed
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.

Status filter should be checkboxes
2 participants