-
Notifications
You must be signed in to change notification settings - Fork 35
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: offline dashboard #1700
feat: offline dashboard #1700
Conversation
…pp into feat/offline-dashboard
8e3e002
to
efe6f69
Compare
type="button" | ||
<Tooltip | ||
content={i18n.t( | ||
'Cannot confirm changes while offline' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this tooltip conditionally rendered based on !filtersSelectable
or the online status to not show when online?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tooltip is for when the button is disabled due to being offline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. I am only adding functionality for offline. Nothing else has changed unless I'm missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, I thought, since this is wrapping the "confirm" button, which I thought would be visible both online and offline, that the tooltip would then also be (incorrectly) visible when online. The button has a if (!filtersSelectable)
condition, but the tooltip has none. But maybe Im missing something, hard to judge when you just look at this in isolation.
src/components/Item/VisualizationItem/ItemContextMenu/__tests__/ItemContextMenu.offline.spec.js
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed, see separate comments with suggestions and questions.
# [31.18.0](v31.17.9...v31.18.0) (2021-09-01) ### Bug Fixes * disable or delete cypress tests that are currently broken [v37] ([#1925](#1925)) ([#1926](#1926)) ([264a999](264a999)) * migrate from chart/pt to visualizations ([#1916](#1916)) ([b313a39](b313a39)) ### Features * dashboard layout (DHIS2-3600) ([#1803](#1803)) ([75da018](75da018)) * offline dashboard ([#1700](#1700)) ([4103643](4103643))
🎉 This PR is included in version 31.18.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Implements DHIS2-10874
Add offline functionality to dashboard to support Dashboard PWA. With this implementation, it is possible to cache dashboards so they can be viewed while offline. The app also detects the offline/online state, and updates availability of actions - like editing, starring, changing filters, and viewing certain info like sharing and interpretations - accordingly.
Much of this PR is about disabling/enabling buttons and menu items, and showing a tooltip. ViewDashboard is the main code for navigating to different dashboards while offline, while view/TitleBar/ActionsBar triggers the recording of a dashboard.
Additional info for some of the changed files:
Cypress tests:
offline.feature
andoffline.js
files. The rest of the changes are adaptations based on changed html structure, or sharing functionalitygoOffline
andgoOnline
functions were copied from this post: https://www.cypress.io/blog/2020/11/12/testing-application-in-offline-network-mode/d2.config.js
patternsToOmit
property is a list of endpoints that should NOT be cached as part of the GENERAL app cache. Therefore, the endpoints listed in this property are related to content for a specific dashboard. Endpoints that go into the general app cache include e.g./dashboards
, static assets (dashboard bundle, plugins, jquery...),/schemas
, etc.actions/selected.js
tSetSelectedDashboardById
to use async/awaittSetSelectedDashboardByIdOffline
- this is used when user navigates to an uncached dashboard while offline. We still want to navigate to the url and set the state of the app, then when connection is restored, the rest of the data gets loaded.Tooltip.js
MenuItemWithTooltip.js
ConfirmActionDialog.js (refactor/code sharing)
DropdownButton.js
disabledWhenOffline
- moved that and other properties intorest
VisualizationItem/Item.js
ViewAsMenuItems.js
DefaultPlugin.js
ProgressiveLoadingContainer.js
forceLoadCount
is an incrementing property that triggers force loading when a dashboard is being recorded.PrintDashboard, PrintLayoutDashboard
CacheableViewDashboard
CacheableSection
which enables the dashboard to be recorded as a section.DashboardsBar - useCallback to prevent unneeded rerendering of the content
FilterBadge.js, FilterBar.js
view/TitleBar.js
ViewDashboard.js
yarn.lock.