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

[#62386] Project attribute list entries not displayed when applied as filter in project list #18530

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

dombesz
Copy link
Contributor

@dombesz dombesz commented Apr 3, 2025

Ticket

https://community.openproject.org/work_packages/62386

What are you trying to accomplish?

Load the autocompleter values of project filters from saved queries. Additionally, fix 4 flaky specs by using synchronous matchers instead of asynchronous ones.

What approach did you choose and why?

The solution consists of 2 parts:

  • Fix the change detection mechanism of the autocompleter to pick up the selected value.
  • Fix the additional attribute computation to use the active filters whenever is possible in order to retrieve the values from the saved project queries.

The flaky specs fixed:

'./spec/features/work_packages/custom_actions/custom_actions_spec.rb:316'
'./spec/features/work_packages/details/milestones_spec.rb:48'
'./modules/boards/spec/features/action_boards/status_type_moving_board_spec.rb:112'
'./spec/features/notifications/notification_center/split_screen_spec.rb:55'
'./spec/features/types/form_configuration_query_spec.rb:174'

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@dombesz dombesz force-pushed the bug/62386-project-attribute-list-entries-not-displayed-when-applied-as-filter-in-project-list branch 3 times, most recently from 957321e to f80b39a Compare April 4, 2025 12:36
dombesz and others added 3 commits April 4, 2025 16:10
…r the autocompleters.

Previously the inactive filter was passed to the additional_attributes,
this leading to values not being initialized correctly from the active
filters.
@dombesz dombesz force-pushed the bug/62386-project-attribute-list-entries-not-displayed-when-applied-as-filter-in-project-list branch from f80b39a to 20f902b Compare April 4, 2025 13:22
@dombesz dombesz force-pushed the bug/62386-project-attribute-list-entries-not-displayed-when-applied-as-filter-in-project-list branch from 7deb989 to 133647e Compare April 4, 2025 15:37
@dombesz dombesz force-pushed the bug/62386-project-attribute-list-entries-not-displayed-when-applied-as-filter-in-project-list branch from 86dea27 to a4c5531 Compare April 4, 2025 17:28
@dombesz dombesz marked this pull request as ready for review April 4, 2025 18:16
Copy link

github-actions bot commented Apr 4, 2025

Caution

The provided work package version does not match the core version

Details:

Please make sure that:

  • The work package version OR your pull request target branch is correct

@@ -151,9 +151,6 @@ describe('autocompleter', () => {
const inputElement = inputDebugElement.nativeElement as HTMLInputElement;

fixture.detectChanges();
tick();
expect(getOptionsFnSpy).not.toHaveBeenCalled();
tick(50);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@myabc Can I ask you kindly to check whether this testcase is still valid. The component has changed a bit, which causes the spec to fail. Thank you!

Copy link
Contributor

@ulferts ulferts left a comment

Choose a reason for hiding this comment

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

The values now show up and I really appreciate you removing duplicated methods, @dombesz.

So I feel bad telling you that there still appears to be a bug in here. I didn't look into the why but this is how to reproduce it:

  • Have two list custom fields
  • Save a query with one of those custom fields as a filter
  • After saving, add the second custom field as a filter.
  • Try to save.

The former filter seems to not have its value set thoroughly so the saving fails.

def date_filter?(filter)
filter[:"data-filter-type"] == "date"
end

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 for cleaning up the duplicated methods. I wasn't aware of those. How about we open a code maintenance ticket to move even more over to the module, e.g. date_time_filter? but also the set_advanced_filter method?

@dombesz
Copy link
Contributor Author

dombesz commented Apr 7, 2025

The values now show up and I really appreciate you removing duplicated methods, @dombesz.

So I feel bad telling you that there still appears to be a bug in here. I didn't look into the why but this is how to reproduce it:

  • Have two list custom fields
  • Save a query with one of those custom fields as a filter
  • After saving, add the second custom field as a filter.
  • Try to save.

The former filter seems to not have its value set thoroughly so the saving fails.

Thanks @ulferts, I bumped into this bug earlier and according to my investigations, it is not a related bug. However since I'm already doing this bugfix, I would solve the issue in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants