Conversation
eba7567 to
f0fb158
Compare
|
Claude finished @oidacra's task —— View job Code Review CompleteI've analyzed the PR changes and found the implementation to be clean and well-designed. Here are the key aspects I reviewed: What I Analyzed:
The Implementation is Solid:
No Issues Found - The code handles edge cases well, has proper error boundaries, and maintains clean separation of concerns. |
Legal RiskThe following dependencies were released under a license that RecommendationWhile merging is not directly blocked, it's best to pause and consider what it means to use this license before continuing. If you are unsure, reach out to your security team or Semgrep admin to address this issue. MPL-2.0
|
There was a problem hiding this comment.
Pull request overview
This PR implements the requirements from issue #34397 to simplify and constrain the date filter options in the Analytics Dashboard portlet. It removes the today and yesterday filter options, enforces a 7-day minimum custom date range via UI constraints, and ensures stale URL parameters for removed options fall back to last7days.
Changes:
- Removes
todayandyesterdayfrom theTIME_PERIOD_OPTIONSdropdown, with URL fallback handling in both the portlet utils and data-access layers - Enforces a 7-day minimum custom date range via
$disabledDatescomputed signal andisValidCustomDateRangevalidation; replaces the(onSelect)binding with a newonDateSelecthandler that tracks first-click state and emits only valid complete ranges - Replaces the inline
router.navigatecall with a new sharedsilentNavigateutility; fixesupdateTimeRangeto avoid triggering store state changes for bare'custom'until full date range is selected
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
dot-analytics.utils.ts |
Adds MIN_CUSTOM_DATE_RANGE_DAYS, updates isValidCustomDateRange to enforce 7-day minimum, adds getValidTimeRangeUrl with today/yesterday exclusion |
dot-analytics.utils.spec.ts |
Adds tests for new 7-day minimum validation and getValidTimeRangeUrl exclusion logic |
dot-analytics.constants.ts |
Removes today and yesterday entries from TIME_PERIOD_OPTIONS |
dot-analytics-filters.component.ts |
Adds $today, $rangeStart, $disabledDates signals; rewires date selection to onDateSelect; adds clearDateRange and onCalendarClosed; adds ButtonModule import |
dot-analytics-filters.component.spec.ts |
Comprehensive tests for all new signals and methods |
dot-analytics-filters.component.html |
Adds [maxDate], [disabledDates], (onClose), new #buttonbar ng-template with only a Clear button |
dot-analytics-dashboard.component.spec.ts |
Updates and adds tests for today/yesterday/invalid URL param fallback behavior |
router.utils.ts |
New shared silentNavigate utility to update URL without triggering router events |
filters.utils.ts |
Adds today/yesterday exclusion in paramsToTimeRange; adds validation against VALID_TIME_RANGE_VALUES |
filters.utils.spec.ts |
Adds tests for today/yesterday fallback in paramsToTimeRange |
You can also share your feedback on Copilot code review. Take the survey.
...ts/dot-analytics/portlet/src/lib/dot-analytics-dashboard/shared/utils/dot-analytics.utils.ts
Outdated
Show resolved
Hide resolved
...alytics-dashboard/shared/components/dot-analytics-filters/dot-analytics-filters.component.ts
Outdated
Show resolved
Hide resolved
...cs-dashboard/shared/components/dot-analytics-filters/dot-analytics-filters.component.spec.ts
Outdated
Show resolved
Hide resolved
...ytics-dashboard/shared/components/dot-analytics-filters/dot-analytics-filters.component.html
Show resolved
Hide resolved
|
Claude finished @oidacra's task —— View job Code Review CompleteIssues Found:
Minor Concerns:
What's Good:
The implementation is mostly solid but has some cleanup opportunities around dead code and redundant logic. |
|
Claude finished @oidacra's task —— View job Review CompleteIssues Found: 1. Logic Inconsistency in Date Validation (
2. Fragile PrimeNG Integration (
3. Unbounded Disabled Dates (
4. State Synchronization Workaround (
The implementation works correctly but has some areas where the logic could be cleaner and more resilient to external library changes. |
…imum range - Remove `today` and `yesterday` from TIME_PERIOD_OPTIONS dropdown - URL params with `today`/`yesterday` silently fall back to `last7days` - Enforce minimum 7-day custom date range via `disabledDates` computed signal - Track range start via `(onSelect)` event to block invalid end-date selections - Prevent future date selection with `[maxDate]="$today()"` - Replace default button bar with custom template (Clear button only, no Today button) - Update `paramsToTimeRange` to exclude unsupported and unrecognized values Closes #34397
…ng safety, remove redundant test config - Add readonly to $today, $rangeStart, $disabledDates signals - Guard [from, to] destructuring with instanceof Date checks - Remove redundant mocks: [DotMessageService] from filters spec - Remove duplicate empty-params test from filters.utils.spec
…and enhance date filter logic - Introduced utility to update the URL without triggering Angular router events. - Refactored and methods to utilize . - Enhanced date filtering logic to disable dates both forward and backward, ensuring a minimum range requirement. - Updated unit tests to reflect changes in date selection behavior and filter emissions. Closes #34397
- Removed the method to streamline date range logic. - Updated unit tests to reflect the removal of incomplete date range checks. - Adjusted date validation logic to ensure strict ordering of date ranges. - Added a clear action for custom date range selection in the UI. Closes #34397
54112d4 to
268a736
Compare
|
Claude finished @oidacra's task —— View job PR Review CompleteIssues Found: 1. Dead Code in Component (
2. Test Organization Issue (
3. Potential Edge Case in Reset Logic (
What's Clean:
The implementation is functionally correct but has cleanup opportunities around dead code and test organization. |
Proposed Changes
todayandyesterdayfrom the time period dropdown (TIME_PERIOD_OPTIONS)time_range=todayandtime_range=yesterdaynow silently fall back tolast7days; unrecognized values also fall backdisabledDatescomputed signal)[maxDate]="$today()"#buttonbarng-template override)Acceptance Criteria
todayandyesterdayremoved from the time period dropdownlast7daystoday/yesterdayastime_rangesilently fall back tolast7days[maxDate]= today)Test Coverage
23+ test cases covering all 7 ACs across portlet and data-access libraries.
portlets-dot-analytics: 249 tests passing (18 suites)
portlets-dot-analytics-data-access: 175 tests passing (5 suites)
Checklist
Technical Notes
The
[minDate]approach was discarded because PrimeNG's DatePicker in range mode does not update the ngModel after the first date click — only after both dates are selected. The fix uses(onSelect)to track the first click via$rangeStartsignal, then computes the array of disabled dates from it.Closes #34397
This PR fixes: #34397