-
Notifications
You must be signed in to change notification settings - Fork 13
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: dhis2 connection status [LIBS-315] #1203
Merged
Merged
Changes from 40 commits
Commits
Show all changes
93 commits
Select commit
Hold shift + click to select a range
614621b
feat: track dhis2 connection status with hook
KaiVandivier 5ace882
feat(offline): ping server for status periodically
KaiVandivier c3714ef
fix: use better endpoint
KaiVandivier 2b6135a
chore: add a comment
KaiVandivier d901403
fix: file extension
KaiVandivier 144d12d
test(offline): add custom data provider to tests
KaiVandivier 17aafd6
Merge branch 'master' into feat-dhis2-connection-status
KaiVandivier e1d59e5
fix: fix tests
KaiVandivier a5b3a27
chore: satisfy types
KaiVandivier 0329746
feat: useProgressiveInterval hook
KaiVandivier 23a258a
feat: use smart intervals in connection status (wip)
KaiVandivier 3d60b30
fix: pinging, back-off, pausing, fn references
KaiVandivier 70b6869
fix: pausing correctly
KaiVandivier 9566408
fix: don't start pinging if window isn't focused
KaiVandivier b9af561
chore: remove unused eslint ignore
KaiVandivier a61802b
feat: add 'invokeCallbackImmediately' fn
KaiVandivier b4d97bd
feat: ping on network status changes
KaiVandivier 88d64c4
fix: enter standby when network changes while blurred
KaiVandivier 435f12c
chore: format
KaiVandivier ccf6105
fix: only ping when going offline to save resources
KaiVandivier ecb8961
fix: don't increment delay on immediate cb unless regular timer has e…
KaiVandivier a1055a9
refactor: smart interval as class
KaiVandivier 7d03d21
fix: use data engine for pings to avoid rerenders; handle fetch errors
KaiVandivier 575db1e
refactor: make class properties private again
KaiVandivier fb3fe64
feat: handle sw-free conditions; simplify logic
KaiVandivier 40af57d
chore: remove interval hook
KaiVandivier 05b5801
fix: don't check auth
KaiVandivier ba838db
refactor: use shorter isConnected name
KaiVandivier 2b9019e
feat: add lastConnected value
KaiVandivier 2d73194
fix: await callbacks to reset correct intervals
KaiVandivier 41f17f8
chore: cleanup
KaiVandivier 6cf649b
fix: update subscription callback name
KaiVandivier 2a86c2d
refactor: rename to NetworkStatus
KaiVandivier 81ee476
refactor: rename type to match NetworkStatus
KaiVandivier d331171
chore: fix import
KaiVandivier d2e5ffc
chore: other renaming clean-up
KaiVandivier c63b1a7
chore: bump cli-style version
KaiVandivier e590d5c
Merge branch 'master' into feat-dhis2-connection-status
KaiVandivier 39c3e4d
refactor: rename method for clarity
KaiVandivier 3a28264
chore: clarify logs
KaiVandivier beffd46
fix: bump cli-app-scripts version for jest v27
KaiVandivier b1ca209
refactor: use ping query for easier testing
KaiVandivier 2be05a4
ci: use node 14
KaiVandivier 8bb78cd
fix: accept header on ping requests
KaiVandivier b9fdbd6
fix: check for err.type instead of err.message
KaiVandivier 62a0e10
chore: add comment to remove clg
KaiVandivier 274f11a
test: fix tests for RestAPILink
KaiVandivier 76e2c21
chore: prep for tests
KaiVandivier 307579f
test: initial test commit (dirty wip)
KaiVandivier f10365c
refactor: use a `start` method on SmartInterval
KaiVandivier a90fa13
fix(smart-interval): delay reset after 'partial standby'
KaiVandivier e96e9c1
refactor: use a function for smartInterval instead of class
KaiVandivier a2997df
Merge branch 'master' into feat-dhis2-connection-status
KaiVandivier c9a1ecf
chore: remove comment
KaiVandivier b1e060b
test: some more testing attempts (dirty)
KaiVandivier 5d76a7e
refactor: don't await callback
KaiVandivier aeda89b
test(dhis2-connection-status): tweak test for smart interval
HendrikThePendric 80e37ae
test: delays in ping interval
KaiVandivier ccf7803
refactor: only create smartInterval once
KaiVandivier 94fe75f
test: resetting ping interval
KaiVandivier b31cc2c
test: standby behavior
KaiVandivier 390a29c
test: offline & refocusing behavior
KaiVandivier 627bf5c
fix: maintain lastConnected when disconnected during startup
KaiVandivier 6225963
test: lastConnected handling
KaiVandivier ff5dfcd
fix: initialize to correct status based on offline interface
KaiVandivier 9f05cbc
chore: comment updates
KaiVandivier d0663f3
fix: set lastConnected if not set yet and starting while offline
KaiVandivier db0edc1
test: initialization conditions
KaiVandivier 0112b4c
chore: remove console log
KaiVandivier 78c5b6f
chore: reorganize tests
KaiVandivier 7771142
test: refactor to generalize to any default values
KaiVandivier a9bd40b
chore: clean up smartInterval tests
KaiVandivier 0fae4b7
chore: ignore eslint warning
KaiVandivier 03160cc
test: fix test for offlineInterface effects
KaiVandivier cf81622
test: refactor to improve assertions on `setTimeout` delays
KaiVandivier 559e86f
chore: remove console log
KaiVandivier d32ef70
fix: clear lastConnected when online
KaiVandivier 04add33
refactor: setting lastConnected on startup
KaiVandivier 573238a
fix: make lastConnected specific to each app
KaiVandivier 852292e
docs: reorganize and update docs
KaiVandivier 47c3644
docs: useDhis2ConnectionStatus
KaiVandivier ab2abca
refactor: remove unused function
KaiVandivier b0e38cb
chore: explanatory comments
KaiVandivier 1585c50
docs: clarify importance of useDhis2ConnectionStatus
KaiVandivier 0389e3f
refactor: only use logs when specified in dev env
KaiVandivier 86b61f8
fix: allow logging in production env for netlify previews
KaiVandivier 86f885a
chore: undo changes from old ping endpoint
KaiVandivier c1675e2
fix: migrate to new ping endpoint
KaiVandivier 532f3ae
chore: remove unused data service from offline service
KaiVandivier 4e36fa9
chore: reorganize connection status dir
KaiVandivier 9f62d6c
fix: don't ping on unsupported server versions
KaiVandivier de423f5
Merge branch 'master' into feat-dhis2-connection-status
KaiVandivier e7d6065
fix: choose default timer values
KaiVandivier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
export { OfflineProvider } from './lib/offline-provider' | ||
export { CacheableSection, useCacheableSection } from './lib/cacheable-section' | ||
export { useCachedSections } from './lib/cacheable-section-state' | ||
export { useOnlineStatus } from './lib/online-status' | ||
// Use "useOnlineStatus" name for backwards compatibility | ||
export { useNetworkStatus as useOnlineStatus } from './lib/network-status' | ||
export { useOnlineStatusMessage } from './lib/online-status-message' | ||
export { clearSensitiveCaches } from './lib/clear-sensitive-caches' | ||
export { useDhis2ConnectionStatus } from './lib/dhis2-connection-status' |
2 changes: 1 addition & 1 deletion
2
.../src/lib/__tests__/online-status.test.tsx → ...src/lib/__tests__/network-status.test.tsx
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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 OfflineProvider now uses a data provider to use the engine to make a data query to
/api/system/ping
The same changes will be repeated in the next few test files