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 DateRangeFilter #1913

Merged
merged 2 commits into from
Jun 9, 2024
Merged

✨ Add DateRangeFilter #1913

merged 2 commits into from
Jun 9, 2024

Conversation

rszwajko
Copy link
Collaborator

@rszwajko rszwajko commented May 14, 2024

Create a filter widget based on DateRangeFilter developed
for Forklift plugin.
Use the new widget to filter migration waves on both start and end date.

Key points:

  1. filter values are stored as strings in ISO 8601 time interval
    format (date part only) i.e. "2024-04-01/2024-05-01".
  2. date range is a closed range (both ends are included)
  3. browser local time zone is used
  4. date format is hard-coded to "MM/DD/YYYY" to match the format
    used in the UI

Additional changes:

  1. force TZ=UTC for jest unit tests to ensure the same test results
  2. initialize dayjs plugins for tests

Reference-Url: kubev2v/forklift-console-plugin#754
Reference-Url: https://en.wikipedia.org/wiki/ISO_8601#Time_intervals

Copy link

codecov bot commented May 14, 2024

Codecov Report

Attention: Patch coverage is 40.00000% with 42 lines in your changes missing coverage. Please review.

Project coverage is 42.17%. Comparing base (b654645) to head (f551353).
Report is 152 commits behind head on main.

Files Patch % Lines
...c/app/components/FilterToolbar/DateRangeFilter.tsx 10.25% 35 Missing ⚠️
...ient/src/app/components/FilterToolbar/dateUtils.ts 81.48% 5 Missing ⚠️
...src/app/components/FilterToolbar/FilterControl.tsx 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1913      +/-   ##
==========================================
+ Coverage   39.20%   42.17%   +2.97%     
==========================================
  Files         146      166      +20     
  Lines        4857     5318     +461     
  Branches     1164     1293     +129     
==========================================
+ Hits         1904     2243     +339     
- Misses       2939     3059     +120     
- Partials       14       16       +2     
Flag Coverage Δ
client 42.17% <40.00%> (+2.97%) ⬆️
server ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rszwajko
Copy link
Collaborator Author

rszwajko commented May 21, 2024

Date range filter in action

image

rszwajko added a commit that referenced this pull request May 29, 2024
Before this PR, all values were matched in the same way:
1. value needs to be string or have string representation via
   getItemValue
2. positive match is returned if (lowercased) value contains
   (lowercased) filter value.

After this PR, a custom algorithm can be provided using "matcher"
property. Direct motivation is DateRange filter which stores filter
values as ISO 8601 time intervals i.e. "2024-04-01/2024-05-01".
Positive match (value is in the range) requires parsing to date objects.

Reference-Url: https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
Reference-Url: #1913

Signed-off-by: Radoslaw Szwajkowski <rszwajko@redhat.com>
@rszwajko rszwajko marked this pull request as ready for review May 29, 2024 20:12
Create a filter widget based on DateRangeFilter developed
for Forklift plugin.
Use the new widget to filter migration waves on both start and end date.

Key points:
1. filter values are stored as strings in ISO 8601 time interval
   format (date part only) i.e. "2024-04-01/2024-05-01".
2. date range is a closed range (both ends are included)
3. browser local time zone is used
4. date format is hard-coded to "MM/DD/YYYY" to match the format
   used in the UI

Additional changes:
1. force TZ=UTC for jest unit tests to ensure the same test results
2. initialize dayjs plugins for tests

Reference-Url: kubev2v/forklift-console-plugin#754
Reference-Url: https://en.wikipedia.org/wiki/ISO_8601#Time_intervals

Signed-off-by: Radoslaw Szwajkowski <rszwajko@redhat.com>
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