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

feat: hide periods based on system settings (DHIS2-11161) #1789

Merged
merged 3 commits into from
May 28, 2021

Conversation

martinkrulltott
Copy link
Contributor

@martinkrulltott martinkrulltott commented May 28, 2021

Implements DHIS2-11161

Requires dhis2/analytics#920

Relates to dhis2/data-visualizer-app#1721


Key features

  1. Populates excludedPeriodTypes with values from system settings
  2. Changes all instances of DAYS and WEEKS from Analytics to DAILY and WEEKLY

Description

Fetches props from system settings to be passed to excludedPeriodTypes. Based on the DV change (dhis2/data-visualizer-app#1721).


TODO

  • Move getExcludedPeriodTypes to Analytics?

Screenshots

see the Analytics PR

@@ -90,6 +121,9 @@ const FilterDialog = ({
<PeriodDimension
selectedPeriods={selectedItems}
onSelect={commonProps.onSelect}
excludedPeriodTypes={getExcludedPeriodTypes(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the idea with making excludedPeriodTypes configurable in PeriodDimension that the app may want to be even more restrictive than the system settings? Could the app also enforce a less restrictive list than the system settings?

Copy link
Contributor Author

@martinkrulltott martinkrulltott May 28, 2021

Choose a reason for hiding this comment

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

In my initial version of this, the fetching of system settings and excluding of periods were all done in Analytics itself. But it was decided to move it out to excludedPeriodTypes and let the apps decide which periods to exclude, since we want to keep the lib flexible and unopinionated. Also, since the apps already fetch the system settings, we avoid having a separate backend call in Analytics which would also lead to a having a loading spinner when you open the period dimension.
So by letting the apps fetch the settings (which the already do, these are just additional props to the existing api request), we avoid both the loading spinner, an additional api request and opinionating Analytics.

So to answer the question, yes apps could provide any restrictions they want, regardless of the system settings.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok, if that's approved by the product manager, then ok with me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If what is approved?

@martinkrulltott martinkrulltott merged commit d01c2e6 into master May 28, 2021
@martinkrulltott martinkrulltott deleted the feat/DHIS2-11161-period-settings branch May 28, 2021 12:17
dhis2-bot added a commit that referenced this pull request May 31, 2021
# [31.16.0](v31.15.6...v31.16.0) (2021-05-31)

### Bug Fixes

* applying a filter to a dashboard with a Map item results in the map not rendering [DHIS2-11054] ([#1741](#1741)) ([cd4d2d6](cd4d2d6))

### Features

* hide periods based on system settings (DHIS2-11161) ([#1789](#1789)) ([d01c2e6](d01c2e6))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 31.16.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants