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 filter by Due Date #1755

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dregad
Copy link
Member

@dregad dregad commented Jun 5, 2021

This is @tgulacsi's original patch, as submitted in #28669.

PR submitted as-is, without testing (yet).

@dregad
Copy link
Member Author

dregad commented Jun 5, 2021

This makes the Due Date filter appear on a new row by itself. Maybe it would be better if all 3 date fields were together on the same line ?

image

One option could be to shorten the labels (Filter by xxxx date => xxxx date) and remove the colspan = 2, then everything would fit on a single row (but a single-col span could be too narrow to display the date range when filter is active.

@atrol
Copy link
Member

atrol commented Jun 5, 2021

The filter should just be displayed if access_has_bug_level( config_get( 'due_date_view_threshold' )

@dregad
Copy link
Member Author

dregad commented Jun 17, 2021

The filter should just be displayed if access_has_bug_level( config_get( 'due_date_view_threshold' )

@atrol We are not in a bug context here, I guess you meant access_has_project_level() ?

@atrol
Copy link
Member

atrol commented Jun 17, 2021

@dregad right, access_has_bug_level is not the right function (copy/pasted from IssueViewPageCommand)

But access_has_project_level() seems also not to be the right function for it, at least if "All Projects" is selected in project selection.
I didn't try, just looked at the code: https://github.com/mantisbt/mantisbt/blob/release-2.25.2/core/access_api.php#L283
access_get_project_level would return the global access level if "All Projects" is selected, which is not the right one in some cases, e.g if

  • the projects where due_date is enabled are private and the user is not assigned to any of the projects
  • the user is assigned to the project (public or privat) with another access level than the global one.
  • ...

access_has_any_project_level might be the right function for it.

I've copied the LAST_UPDATED filter as DUE.

Fixes #28669

Signed-off-by: Damien Regad <dregad@mantisbt.org>
@dregad
Copy link
Member Author

dregad commented Jun 20, 2021

You're right.

As a side note, there's quite a few occurrences of using array_has_project_level() in filter_form_api.php, possibly some of these are wrong but I don't have time to analyze in detail ATM.

The Date Submitted / Last Updated and Due Date filters display 'No' when
no filter exists. This is not consistent with other filter fields.

This changes the display value to 'any', to be consistent.

Fixes #28831
Until now, the labels for "Date Submitted" and "Last Updated" filters
were displayed with a "Filter by" prefix, making them longer than
necessary.

This commit removes the prefix, leaving just the date field's name as
filter label; the full description (i.e. "Filter by xxxx") is now
displayed only as label for the checkbox to enable/disable the filter
when it is expanded).

Fixes #28831
@dregad
Copy link
Member Author

dregad commented Jun 20, 2021

shorten the labels (Filter by xxxx date => xxxx date)

Tracked in #28831

@dregad
Copy link
Member Author

dregad commented Jun 20, 2021

remove the colspan = 2, then everything would fit on a single row (but a single-col span could be too narrow to display the date range when filter is active.

This is fine on wide screens:
image

However on narrower displays it does not look good at all, with

  • filters area wider than screen, causing horizontal scrollbar to appear
  • day selector for end date displayed on next line
  • other columns become too narrow

image

An alternative would be to display the date filters on a line of their own, but no everyone uses Due Date, and it would waste vertical space and have a filters line with only 2 elements on it.

So I guess it's better to leave it like that.

Copy link
Member

@vboctor vboctor left a comment

Choose a reason for hiding this comment

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

It would be great to have "pseudo dates" support here. For example:

  • overdue - due date is <= current date
  • next week - next week + overdue
  • next month - next month + overdue

This way a filter can be saved and re-used by all users and work overtime without having to keep updating the due date range.

filter_form_get_input( $t_filter, 'do_filter_by_date', $t_show_inputs ),
2 /* colspan */,
null /* class */,
'do_filter_by_date_filter_target' /* content id */
));
$t_row2->add_item( new TableFieldsItem(
$get_field_header( 'do_filter_by_last_updated_date_filter', lang_get( 'use_last_updated_date_filters' ) ),
$get_field_header( 'do_filter_by_last_updated_date_filter', lang_get( 'tag_updated' ) ),
Copy link
Member

Choose a reason for hiding this comment

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

Not sure why we use tag_updated string here.

@@ -911,6 +911,7 @@ $s_start_date_label = 'Kezdődátum:';
$s_end_date_label = 'Záródátum:';
$s_use_date_filters = 'Szűrés a beküldés dátuma szerint';
$s_use_last_updated_date_filters = 'Szűrés a frissítés dátuma szerint';
$s_use_due_date_filters = 'Szűrés az esedékesség dátuma szerint';
Copy link
Member

Choose a reason for hiding this comment

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

Don't update strings_hungarian.

@vboctor vboctor added the waiting-on-author PRs that are waiting on author to make changes label Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-author PRs that are waiting on author to make changes
Projects
None yet
4 participants