feat: period selector for events layer#3715
Draft
BRaimbault wants to merge 11 commits into
Draft
Conversation
Moves initializePeriodType/getDefaultPeriods/initializePeriods out of initializeThematicLayer.js into components/edit/shared/initializePeriod.js so the Events dialog can reuse them for its own period tab, without duplicating logic. Pure extraction, no behavior change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replace the Events layer dialog's single-period RelativePeriodSelect dropdown with the same Single-mode period tab as the Thematic dialog: a SegmentedControl toggle between multi-select preset periods (PeriodDimension) and start/end dates. Adds initializeEventLayer.js, reusing the shared period-init helpers extracted in the previous commit, so new/existing event layers get sensible period defaults. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Moves the period-tab validation rules (period type, start/end dates, Timeline/Split min-max) out of validateThematicLayer.js into components/edit/shared/validatePeriod.js, and reuses them in EventDialog's own validate(), replacing its ad hoc period/date check and adding the "Period is required" rule that multi-select presets now need. renderingStrategy stays optional so Events (no rendering strategy yet) simply never trigger the Timeline/Split-only rules. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Event layers can now select multiple preset periods in the Period tab, so getAnalyticsRequest() and eventLoader's legend text need to handle an array of periods instead of a single one. Extracts the shared periods-or-dates request logic (already duplicated between the event and thematic loaders) into applyPeriodFilter() in util/analytics.js, used by both. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
setPeriod/LAYER_EDIT_PERIOD_SET, setFiltersFromPeriod, getPeriodFromFilters and RelativePeriodSelect.jsx have no remaining callers now that Events uses the same multi-period setPeriods/filters flow as Thematic. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
|
🚀 Deployed on https://pr-3715.maps.netlify.dhis2.org |
Addresses SonarCloud S7778 (avoid multiple Array#push() calls) left over from extracting the period validation rules into a shared module. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
EventLayer.selectPeriodType() drove the old single-period RelativePeriodSelect dropdown (data-test="relative-period-select-content"), which no longer exists now that the Events dialog uses the same SegmentedControl + PeriodDimension period tab as Thematic. Replaces it with selectStartEndDates(), mirroring ThematicLayer's existing helper of the same name, and updates all call sites. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…r-events # Conflicts: # i18n/en.pot # src/components/edit/event/EventDialog.jsx
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Brings the Events layer dialog's Period tab in line with the Thematic layer dialog (Stage 1 of 2 — Timeline/Split view will be Stage 2):
Quality checklist
Add N/A to items that are not applicable.
Screenshots
Relative and Fixed periods: Before/After

Start and End dates: Before/After
