@dhis2-ui/header-bar 10.16.2 → 10.16.3-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -16
- package/src/__e2e__/header-bar.e2e.stories.js +26 -0
- package/src/__e2e__/stories/common.js +226 -0
- package/src/__e2e__/stories/custom-application-title.js +19 -0
- package/src/__e2e__/stories/default.js +13 -0
- package/src/__e2e__/stories/me-with-avatar.js +27 -0
- package/src/__e2e__/stories/modulesWithSpecialCharacters.js +229 -0
- package/src/__e2e__/stories/online-status-message.js +49 -0
- package/src/__e2e__/stories/pwa-enabled.js +17 -0
- package/src/__e2e__/stories/user-has-all-authority.js +20 -0
- package/src/__e2e__/stories/user-has-no-authorities.js +20 -0
- package/src/__e2e__/stories/user-has-web-interpretation-and-messaging-authority.js +22 -0
- package/src/__e2e__/stories/user-has-web-interpretation-authority.js +22 -0
- package/src/__e2e__/stories/user-has-web-messaging-authority.js +22 -0
- package/src/__e2e__/stories/with-debug-info-edge-cases.js +51 -0
- package/src/__e2e__/stories/with-special-app-name-character.js +23 -0
- package/src/__e2e__/stories/with-update-available-notification.js +39 -0
- package/src/__e2e__/stories/zero-unread-interpretations.js +19 -0
- package/src/__e2e__/stories/zero-unread-messages.js +19 -0
- package/src/apps.js +276 -0
- package/src/debug-info/debug-info-menu-item.js +72 -0
- package/src/debug-info/debug-info-modal.js +47 -0
- package/src/debug-info/debug-info-table.js +51 -0
- package/src/debug-info/use-debug-info.js +15 -0
- package/src/features/common/index.js +14 -0
- package/src/features/the_headerbar_can_display_online_status/the_headerbar_displays_online_status.js +158 -0
- package/src/features/the_headerbar_can_display_online_status.feature +57 -0
- package/src/features/the_headerbar_conditionally_renders_notification_icons/the_headerbar_conditionally_renders_notification_icons.js +43 -0
- package/src/features/the_headerbar_conditionally_renders_notification_icons.feature +26 -0
- package/src/features/the_headerbar_contains_a_menu_to_all_apps/common.js +5 -0
- package/src/features/the_headerbar_contains_a_menu_to_all_apps/the_app_menu_closes_when_the_user_clicks_outside.js +9 -0
- package/src/features/the_headerbar_contains_a_menu_to_all_apps/the_headerbar_contains_a_menu_icon.js +5 -0
- package/src/features/the_headerbar_contains_a_menu_to_all_apps/the_user_will_be_offered_a_menu_with_5_apps.js +16 -0
- package/src/features/the_headerbar_contains_a_menu_to_all_apps.feature +21 -0
- package/src/features/the_headerbar_contains_a_profile_menu/common.js +14 -0
- package/src/features/the_headerbar_contains_a_profile_menu/the_headerbar_shows_a_text_icon_if_the_user_does_not_have_an_avatar.js +30 -0
- package/src/features/the_headerbar_contains_a_profile_menu/the_headerbar_shows_an_image_icon_if_the_user_has_an_avatar.js +23 -0
- package/src/features/the_headerbar_contains_a_profile_menu/the_menu_is_closed_by_default.js +1 -0
- package/src/features/the_headerbar_contains_a_profile_menu/the_menu_opens.js +14 -0
- package/src/features/the_headerbar_contains_a_profile_menu/the_profile_menu_closes_when_the_user_clicks_outside.js +5 -0
- package/src/features/the_headerbar_contains_a_profile_menu/the_user_can_edit_his_profile.js +7 -0
- package/src/features/the_headerbar_contains_a_profile_menu/the_user_can_go_to_his_account.js +7 -0
- package/src/features/the_headerbar_contains_a_profile_menu/the_user_can_go_to_the_about_dhis2_page.js +7 -0
- package/src/features/the_headerbar_contains_a_profile_menu/the_user_can_go_to_the_help_page.js +7 -0
- package/src/features/the_headerbar_contains_a_profile_menu/the_user_can_go_to_the_settings.js +7 -0
- package/src/features/the_headerbar_contains_a_profile_menu/the_user_can_log_out.js +53 -0
- package/src/features/the_headerbar_contains_a_profile_menu/the_user_name_and_email_are_displayed.js +22 -0
- package/src/features/the_headerbar_contains_a_profile_menu.feature +73 -0
- package/src/features/the_headerbar_displays_a_link_to_interpretations_and_an_unread_count/the_headerbar_displays_a_link_to_the_interpretations.js +5 -0
- package/src/features/the_headerbar_displays_a_link_to_interpretations_and_an_unread_count/there_are_no_unread_interpretations.js +9 -0
- package/src/features/the_headerbar_displays_a_link_to_interpretations_and_an_unread_count/there_are_some_unread_interpretations.js +12 -0
- package/src/features/the_headerbar_displays_a_link_to_interpretations_and_an_unread_count.feature +13 -0
- package/src/features/the_headerbar_displays_a_link_to_messages_and_an_unread_count/the_headerbar_displays_a_link_to_the_messages.js +5 -0
- package/src/features/the_headerbar_displays_a_link_to_messages_and_an_unread_count/there_are_no_unread_messages.js +9 -0
- package/src/features/the_headerbar_displays_a_link_to_messages_and_an_unread_count/there_are_some_unread_messages.js +7 -0
- package/src/features/the_headerbar_displays_a_link_to_messages_and_an_unread_count.feature +13 -0
- package/src/features/the_headerbar_should_contain_a_logo_that_links_to_the_homepage/headerbar_contains_logo.js +12 -0
- package/src/features/the_headerbar_should_contain_a_logo_that_links_to_the_homepage.feature +6 -0
- package/src/features/the_headerbar_should_display_app_update_notification/index.js +52 -0
- package/src/features/the_headerbar_should_display_app_update_notification.feature +22 -0
- package/src/features/the_headerbar_should_display_debug_version_infos/index.js +130 -0
- package/src/features/the_headerbar_should_display_debug_version_infos.feature +52 -0
- package/src/features/the_headerbar_should_display_the_title_provided_by_the_backend_and_the_app/the_headerbar_displays_the_custom_title.js +11 -0
- package/src/features/the_headerbar_should_display_the_title_provided_by_the_backend_and_the_app.feature +5 -0
- package/src/features/the_search_should_escape_regexp_character/common.js +6 -0
- package/src/features/the_search_should_escape_regexp_character/the_modules_do_not_contain_items_with_special_chars.js +23 -0
- package/src/features/the_search_should_escape_regexp_character/the_user_searches_for_an_app_with_a_regex_character.js +29 -0
- package/src/features/the_search_should_escape_regexp_character.feature +48 -0
- package/src/header-bar-context.js +28 -0
- package/src/header-bar.js +145 -0
- package/src/header-bar.prod.stories.js +303 -0
- package/src/index.js +1 -0
- package/src/join-path.js +4 -0
- package/src/locales/ar/translations.json +24 -0
- package/src/locales/ar_IQ/translations.json +24 -0
- package/src/locales/bn/translations.json +12 -0
- package/src/locales/ckb/translations.json +23 -0
- package/src/locales/cs/translations.json +24 -0
- package/src/locales/da/translations.json +24 -0
- package/src/locales/en/translations.json +25 -0
- package/src/locales/en_US/translations.json +25 -0
- package/src/locales/es/translations.json +25 -0
- package/src/locales/es_419/translations.json +24 -0
- package/src/locales/fr/translations.json +25 -0
- package/src/locales/hi_IN/translations.json +25 -0
- package/src/locales/id/translations.json +24 -0
- package/src/locales/index.js +88 -0
- package/src/locales/km/translations.json +24 -0
- package/src/locales/lo/translations.json +24 -0
- package/src/locales/my/translations.json +24 -0
- package/src/locales/nb/translations.json +24 -0
- package/src/locales/nl/translations.json +24 -0
- package/src/locales/or/translations.json +12 -0
- package/src/locales/prs/translations.json +24 -0
- package/src/locales/ps/translations.json +24 -0
- package/src/locales/pt/translations.json +25 -0
- package/src/locales/pt_BR/translations.json +24 -0
- package/src/locales/ro/translations.json +23 -0
- package/src/locales/ru/translations.json +24 -0
- package/src/locales/si/translations.json +24 -0
- package/src/locales/sv/translations.json +24 -0
- package/src/locales/tet/translations.json +24 -0
- package/src/locales/tg/translations.json +24 -0
- package/src/locales/uk/translations.json +24 -0
- package/src/locales/ur/translations.json +24 -0
- package/src/locales/uz_Latn/translations.json +23 -0
- package/src/locales/uz_UZ_Cyrl/translations.json +24 -0
- package/src/locales/uz_UZ_Latn/translations.json +24 -0
- package/src/locales/vi/translations.json +24 -0
- package/src/locales/zh/translations.json +25 -0
- package/src/locales/zh_CN/translations.json +24 -0
- package/src/logo-image.js +71 -0
- package/src/logo.js +45 -0
- package/src/notification-icon.js +91 -0
- package/src/notifications.js +63 -0
- package/src/online-status.js +40 -0
- package/src/online-status.styles.js +91 -0
- package/src/profile/use-on-doc-click.js +23 -0
- package/src/profile/use-on-doc-click.test.js +40 -0
- package/src/profile-menu/index.js +1 -0
- package/src/profile-menu/profile-header.js +118 -0
- package/src/profile-menu/profile-menu.js +176 -0
- package/src/profile-menu/update-notification.js +67 -0
- package/src/profile.js +101 -0
- package/src/title.js +23 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/header-bar",
|
|
3
|
-
"version": "10.16.
|
|
3
|
+
"version": "10.16.3-alpha.1",
|
|
4
4
|
"description": "UI HeaderBar",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,28 +34,29 @@
|
|
|
34
34
|
"styled-jsx": "^4"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@dhis2-ui/box": "10.16.
|
|
38
|
-
"@dhis2-ui/button": "10.16.
|
|
39
|
-
"@dhis2-ui/card": "10.16.
|
|
40
|
-
"@dhis2-ui/center": "10.16.
|
|
41
|
-
"@dhis2-ui/divider": "10.16.
|
|
42
|
-
"@dhis2-ui/input": "10.16.
|
|
43
|
-
"@dhis2-ui/layer": "10.16.
|
|
44
|
-
"@dhis2-ui/loader": "10.16.
|
|
45
|
-
"@dhis2-ui/logo": "10.16.
|
|
46
|
-
"@dhis2-ui/menu": "10.16.
|
|
47
|
-
"@dhis2-ui/modal": "10.16.
|
|
48
|
-
"@dhis2-ui/user-avatar": "10.16.
|
|
37
|
+
"@dhis2-ui/box": "10.16.3-alpha.1",
|
|
38
|
+
"@dhis2-ui/button": "10.16.3-alpha.1",
|
|
39
|
+
"@dhis2-ui/card": "10.16.3-alpha.1",
|
|
40
|
+
"@dhis2-ui/center": "10.16.3-alpha.1",
|
|
41
|
+
"@dhis2-ui/divider": "10.16.3-alpha.1",
|
|
42
|
+
"@dhis2-ui/input": "10.16.3-alpha.1",
|
|
43
|
+
"@dhis2-ui/layer": "10.16.3-alpha.1",
|
|
44
|
+
"@dhis2-ui/loader": "10.16.3-alpha.1",
|
|
45
|
+
"@dhis2-ui/logo": "10.16.3-alpha.1",
|
|
46
|
+
"@dhis2-ui/menu": "10.16.3-alpha.1",
|
|
47
|
+
"@dhis2-ui/modal": "10.16.3-alpha.1",
|
|
48
|
+
"@dhis2-ui/user-avatar": "10.16.3-alpha.1",
|
|
49
49
|
"@dhis2/prop-types": "^3.1.2",
|
|
50
|
-
"@dhis2/ui-constants": "10.16.
|
|
51
|
-
"@dhis2/ui-icons": "10.16.
|
|
50
|
+
"@dhis2/ui-constants": "10.16.3-alpha.1",
|
|
51
|
+
"@dhis2/ui-icons": "10.16.3-alpha.1",
|
|
52
52
|
"classnames": "^2.3.1",
|
|
53
53
|
"moment": "^2.29.1",
|
|
54
54
|
"prop-types": "^15.7.2"
|
|
55
55
|
},
|
|
56
56
|
"files": [
|
|
57
57
|
"build",
|
|
58
|
-
"types"
|
|
58
|
+
"types",
|
|
59
|
+
"src"
|
|
59
60
|
],
|
|
60
61
|
"devDependencies": {
|
|
61
62
|
"@dhis2/app-runtime": "^3.9.0",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { HeaderBar as component } from '../index.js'
|
|
2
|
+
|
|
3
|
+
export default { title: 'HeaderBarTesting', component }
|
|
4
|
+
export { Default } from './stories/default.js'
|
|
5
|
+
export { PWAEnabled } from './stories/pwa-enabled.js'
|
|
6
|
+
export { OnlineStatusMessagingWithPwaEnabled } from './stories/online-status-message.js'
|
|
7
|
+
export { MeWithAvatar } from './stories/me-with-avatar.js'
|
|
8
|
+
export { WithSpecialAppNameCharacters } from './stories/with-special-app-name-character.js'
|
|
9
|
+
export { CustomApplicationTitle } from './stories/custom-application-title.js'
|
|
10
|
+
export { UserHasAllAuthority } from './stories/user-has-all-authority.js'
|
|
11
|
+
export { UserHasWebInterpretationAndMessagingAuthority } from './stories/user-has-web-interpretation-and-messaging-authority.js'
|
|
12
|
+
export { UserHasWebInterpretationAuthority } from './stories/user-has-web-interpretation-authority.js'
|
|
13
|
+
export { UserHasWebMessagingAuthority } from './stories/user-has-web-messaging-authority.js'
|
|
14
|
+
export { UserHasNoAuthorities } from './stories/user-has-no-authorities.js'
|
|
15
|
+
export { ZeroUnreadInterpretations } from './stories/zero-unread-interpretations.js'
|
|
16
|
+
export { ZeroUnreadMessages } from './stories/zero-unread-messages.js'
|
|
17
|
+
export {
|
|
18
|
+
WithUpdateAvailableNotification,
|
|
19
|
+
WithUpdateAvailableNotificationNoAppName,
|
|
20
|
+
} from './stories/with-update-available-notification.js'
|
|
21
|
+
export {
|
|
22
|
+
WithUnknownInstanceVersion,
|
|
23
|
+
WithUnknownAppNameAndVersion,
|
|
24
|
+
WithUnknownAppName,
|
|
25
|
+
WithUnknownAppVersion,
|
|
26
|
+
} from './stories/with-debug-info-edge-cases.js'
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/* eslint-disable react/display-name */
|
|
2
|
+
import { CustomDataProvider, Provider, useAlerts } from '@dhis2/app-runtime'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
4
|
+
import React, { useEffect } from 'react'
|
|
5
|
+
|
|
6
|
+
export { modulesWithSpecialCharacters } from './modulesWithSpecialCharacters.js'
|
|
7
|
+
|
|
8
|
+
export const defaultModules = [
|
|
9
|
+
{
|
|
10
|
+
name: 'dhis-web-dashboard',
|
|
11
|
+
namespace: '/dhis-web-dashboard',
|
|
12
|
+
defaultAction: '../dhis-web-dashboard/index.action',
|
|
13
|
+
displayName: 'Dashboard',
|
|
14
|
+
icon: '../icons/dhis-web-dashboard.png',
|
|
15
|
+
description: '',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'dhis-web-data-visualizer',
|
|
19
|
+
namespace: '/dhis-web-data-visualizer',
|
|
20
|
+
defaultAction: '../dhis-web-data-visualizer/index.action',
|
|
21
|
+
displayName: 'Data Visualizer',
|
|
22
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
23
|
+
description: '',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'dhis-web-capture',
|
|
27
|
+
namespace: '/dhis-web-capture',
|
|
28
|
+
defaultAction: '../dhis-web-capture/index.action',
|
|
29
|
+
displayName: 'Capture',
|
|
30
|
+
icon: '../icons/dhis-web-capture.png',
|
|
31
|
+
description: '',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'dhis-web-maintenance',
|
|
35
|
+
namespace: '/dhis-web-maintenance',
|
|
36
|
+
defaultAction: '../dhis-web-maintenance/index.action',
|
|
37
|
+
displayName: 'Maintenance',
|
|
38
|
+
icon: '../icons/dhis-web-maintenance.png',
|
|
39
|
+
description: '',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'dhis-web-maps',
|
|
43
|
+
namespace: '/dhis-web-maps',
|
|
44
|
+
defaultAction: '../dhis-web-maps/index.action',
|
|
45
|
+
displayName: 'Maps',
|
|
46
|
+
icon: '../icons/dhis-web-maps.png',
|
|
47
|
+
description: '',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'dhis-web-event-reports',
|
|
51
|
+
namespace: '/dhis-web-event-reports',
|
|
52
|
+
defaultAction: '../dhis-web-event-reports/index.action',
|
|
53
|
+
displayName: 'Event Reports',
|
|
54
|
+
icon: '../icons/dhis-web-event-reports.png',
|
|
55
|
+
description: '',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'dhis-web-interpretation',
|
|
59
|
+
namespace: '/dhis-web-interpretation',
|
|
60
|
+
defaultAction: '../dhis-web-interpretation/index.action',
|
|
61
|
+
displayName: 'Interpretations',
|
|
62
|
+
icon: '../icons/dhis-web-interpretation.png',
|
|
63
|
+
description: '',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'WHO Metadata browser',
|
|
67
|
+
namespace: 'WHO Metadata browser',
|
|
68
|
+
defaultAction:
|
|
69
|
+
'https://debug.dhis2.org/dev/api/apps/WHO-Metadata-browser/index.html',
|
|
70
|
+
displayName: '',
|
|
71
|
+
icon: 'https://debug.dhis2.org/dev/api/apps/WHO-Metadata-browser/icons/medicine-48.png',
|
|
72
|
+
description: '',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'Dashboard Classic',
|
|
76
|
+
namespace: 'Dashboard Classic',
|
|
77
|
+
defaultAction:
|
|
78
|
+
'https://debug.dhis2.org/dev/api/apps/Dashboard-Classic/index.html',
|
|
79
|
+
displayName: 'Dashboard Classic',
|
|
80
|
+
icon: 'https://debug.dhis2.org/dev/api/apps/Dashboard-Classic/icon.png',
|
|
81
|
+
description: 'DHIS2 Legacy Dashboard App',
|
|
82
|
+
},
|
|
83
|
+
]
|
|
84
|
+
|
|
85
|
+
export const applicationTitle = 'Foobar'
|
|
86
|
+
|
|
87
|
+
export const dataProviderData = {
|
|
88
|
+
'systemSettings/applicationTitle': {
|
|
89
|
+
applicationTitle,
|
|
90
|
+
},
|
|
91
|
+
'systemSettings/helpPageLink': {
|
|
92
|
+
helpPageLink: '//custom-help-page-link',
|
|
93
|
+
},
|
|
94
|
+
me: {
|
|
95
|
+
name: 'John Doe',
|
|
96
|
+
email: 'john_doe@dhis2.org',
|
|
97
|
+
settings: {
|
|
98
|
+
keyUiLocale: 'en',
|
|
99
|
+
},
|
|
100
|
+
authorities: ['ALL'],
|
|
101
|
+
},
|
|
102
|
+
'action::menu/getModules': {
|
|
103
|
+
modules: defaultModules,
|
|
104
|
+
},
|
|
105
|
+
'me/dashboard': {
|
|
106
|
+
unreadInterpretations: 10,
|
|
107
|
+
unreadMessageConversations: 5,
|
|
108
|
+
},
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Trailing "HeaderBar" because storybook is confusing this with the
|
|
112
|
+
// helper from the org unit tree's common.js helper with the same name
|
|
113
|
+
export const createDecoratorCustomDataProviderHeaderBar = (
|
|
114
|
+
data = dataProviderData
|
|
115
|
+
) => {
|
|
116
|
+
return (fn) => {
|
|
117
|
+
window.dataProviderData = data
|
|
118
|
+
|
|
119
|
+
return <CustomDataProvider data={data}>{fn()}</CustomDataProvider>
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export const providerConfig = {
|
|
124
|
+
appName: 'TestApp',
|
|
125
|
+
appVersion: {
|
|
126
|
+
full: '101.2.3-beta.4',
|
|
127
|
+
major: 101,
|
|
128
|
+
minor: 2,
|
|
129
|
+
patch: 3,
|
|
130
|
+
tag: 'beta.4',
|
|
131
|
+
},
|
|
132
|
+
serverVersion: {
|
|
133
|
+
full: '2.39.2.1-SNAPSHOT',
|
|
134
|
+
major: 2,
|
|
135
|
+
minor: 39,
|
|
136
|
+
patch: 2,
|
|
137
|
+
hotfix: 1,
|
|
138
|
+
tag: 'SNAPSHOT',
|
|
139
|
+
},
|
|
140
|
+
systemInfo: {
|
|
141
|
+
contextPath: 'https://debug.dhis2.org/dev',
|
|
142
|
+
userAgent:
|
|
143
|
+
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36',
|
|
144
|
+
calendar: 'iso8601',
|
|
145
|
+
dateFormat: 'yyyy-mm-dd',
|
|
146
|
+
serverDate: '2021-10-06T08:06:15.256',
|
|
147
|
+
serverTimeZoneId: 'Etc/UTC',
|
|
148
|
+
serverTimeZoneDisplayName: 'Coordinated Universal Time',
|
|
149
|
+
lastAnalyticsTableSuccess: '2021-09-18T10:24:03.536',
|
|
150
|
+
intervalSinceLastAnalyticsTableSuccess: '429 h, 42 m, 11 s',
|
|
151
|
+
lastAnalyticsTableRuntime: '520835',
|
|
152
|
+
lastSystemMonitoringSuccess: '2019-03-26T17:07:15.418',
|
|
153
|
+
version: '2.39.2.1-SNAPSHOT',
|
|
154
|
+
revision: '6607c3c',
|
|
155
|
+
buildTime: '2021-10-05T17:13:00.000',
|
|
156
|
+
jasperReportsVersion: '6.3.1',
|
|
157
|
+
environmentVariable: 'DHIS2_HOME',
|
|
158
|
+
databaseInfo: {
|
|
159
|
+
spatialSupport: true,
|
|
160
|
+
},
|
|
161
|
+
encryption: false,
|
|
162
|
+
emailConfigured: false,
|
|
163
|
+
redisEnabled: false,
|
|
164
|
+
systemId: 'eed3d451-4ff5-4193-b951-ffcc68954299',
|
|
165
|
+
systemName: 'DHIS 2 Demo - Sierra Leone',
|
|
166
|
+
instanceBaseUrl: 'https://debug.dhis2.org/dev',
|
|
167
|
+
clusterHostname: '',
|
|
168
|
+
isMetadataVersionEnabled: true,
|
|
169
|
+
metadataSyncEnabled: false,
|
|
170
|
+
},
|
|
171
|
+
// same as in ../../features/common/index.js
|
|
172
|
+
baseUrl: 'https://domain.tld/',
|
|
173
|
+
apiVersion: '',
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const MockAlert = ({ alert }) => {
|
|
177
|
+
useEffect(() => {
|
|
178
|
+
if (alert.options?.duration) {
|
|
179
|
+
setTimeout(() => alert.remove(), alert.options?.duration)
|
|
180
|
+
}
|
|
181
|
+
}, [alert])
|
|
182
|
+
return (
|
|
183
|
+
<div style={{ backgroundColor: '#CCC', padding: 8 }}>
|
|
184
|
+
{alert.message}
|
|
185
|
+
</div>
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
MockAlert.propTypes = {
|
|
189
|
+
alert: PropTypes.shape({
|
|
190
|
+
message: PropTypes.string,
|
|
191
|
+
options: PropTypes.shape({ duration: PropTypes.number }),
|
|
192
|
+
remove: PropTypes.func,
|
|
193
|
+
}),
|
|
194
|
+
}
|
|
195
|
+
const MockAlertStack = () => {
|
|
196
|
+
const alerts = useAlerts()
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<div style={{ position: 'absolute', bottom: 16, right: 16 }}>
|
|
200
|
+
{alerts.map((alert) => (
|
|
201
|
+
<MockAlert key={alert.id} alert={alert} />
|
|
202
|
+
))}
|
|
203
|
+
</div>
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export const mockOfflineInterface = {
|
|
208
|
+
pwaEnabled: true,
|
|
209
|
+
startRecording: async () => undefined,
|
|
210
|
+
getCachedSections: async () => [],
|
|
211
|
+
removeSection: async () => false,
|
|
212
|
+
subscribeToDhis2ConnectionStatus: () => () => undefined,
|
|
213
|
+
latestIsConnected: true,
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export const createDecoratorProvider = (
|
|
217
|
+
config = providerConfig,
|
|
218
|
+
offlineInterface = mockOfflineInterface
|
|
219
|
+
) => {
|
|
220
|
+
return (fn) => (
|
|
221
|
+
<Provider config={config} offlineInterface={offlineInterface}>
|
|
222
|
+
{fn()}
|
|
223
|
+
<MockAlertStack />
|
|
224
|
+
</Provider>
|
|
225
|
+
)
|
|
226
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { HeaderBar } from '../../index.js'
|
|
3
|
+
import {
|
|
4
|
+
dataProviderData,
|
|
5
|
+
createDecoratorCustomDataProviderHeaderBar,
|
|
6
|
+
createDecoratorProvider,
|
|
7
|
+
} from './common.js'
|
|
8
|
+
|
|
9
|
+
export const CustomApplicationTitle = () => <HeaderBar appName="Example!" />
|
|
10
|
+
|
|
11
|
+
CustomApplicationTitle.decorators = [
|
|
12
|
+
createDecoratorCustomDataProviderHeaderBar({
|
|
13
|
+
...dataProviderData,
|
|
14
|
+
['systemSettings/applicationTitle']: {
|
|
15
|
+
applicationTitle: 'Barbaz',
|
|
16
|
+
},
|
|
17
|
+
}),
|
|
18
|
+
createDecoratorProvider(),
|
|
19
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { HeaderBar } from '../../index.js'
|
|
3
|
+
import {
|
|
4
|
+
createDecoratorCustomDataProviderHeaderBar,
|
|
5
|
+
createDecoratorProvider,
|
|
6
|
+
} from './common.js'
|
|
7
|
+
|
|
8
|
+
export const Default = () => <HeaderBar appName="Example!" />
|
|
9
|
+
|
|
10
|
+
Default.decorators = [
|
|
11
|
+
createDecoratorCustomDataProviderHeaderBar(),
|
|
12
|
+
createDecoratorProvider(),
|
|
13
|
+
]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { HeaderBar } from '../../index.js'
|
|
3
|
+
import {
|
|
4
|
+
dataProviderData,
|
|
5
|
+
createDecoratorCustomDataProviderHeaderBar,
|
|
6
|
+
createDecoratorProvider,
|
|
7
|
+
} from './common.js'
|
|
8
|
+
|
|
9
|
+
export const MeWithAvatar = () => <HeaderBar appName="Example!" />
|
|
10
|
+
|
|
11
|
+
MeWithAvatar.decorators = [
|
|
12
|
+
createDecoratorCustomDataProviderHeaderBar({
|
|
13
|
+
...dataProviderData,
|
|
14
|
+
me: {
|
|
15
|
+
name: 'John Doe',
|
|
16
|
+
email: 'john_doe@dhis2.org',
|
|
17
|
+
settings: {
|
|
18
|
+
keyUiLocale: 'en',
|
|
19
|
+
},
|
|
20
|
+
authorities: ['ALL'],
|
|
21
|
+
avatar: {
|
|
22
|
+
id: 'avatarId',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
}),
|
|
26
|
+
createDecoratorProvider(),
|
|
27
|
+
]
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
export const modulesWithSpecialCharacters = [
|
|
2
|
+
{
|
|
3
|
+
name: '/',
|
|
4
|
+
namespace: '//',
|
|
5
|
+
defaultAction: '..//.action',
|
|
6
|
+
displayName: 'A / character',
|
|
7
|
+
icon: '../icons/dhis-web-dashboard.png',
|
|
8
|
+
description: '',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: '-',
|
|
12
|
+
namespace: '/-',
|
|
13
|
+
defaultAction: '../-.action',
|
|
14
|
+
displayName: 'A - character',
|
|
15
|
+
icon: '../icons/dhis-web-dashboard.png',
|
|
16
|
+
description: '',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: '(',
|
|
20
|
+
namespace: '/(',
|
|
21
|
+
defaultAction: '../(.action',
|
|
22
|
+
displayName: 'A ( character',
|
|
23
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
24
|
+
description: '',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: ')',
|
|
28
|
+
namespace: '/)',
|
|
29
|
+
defaultAction: '../).action',
|
|
30
|
+
displayName: 'A ) character',
|
|
31
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
32
|
+
description: '',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: '[',
|
|
36
|
+
namespace: '/[',
|
|
37
|
+
defaultAction: '../[.action',
|
|
38
|
+
displayName: 'A [ character',
|
|
39
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
40
|
+
description: '',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: ']',
|
|
44
|
+
namespace: '/]',
|
|
45
|
+
defaultAction: '../].action',
|
|
46
|
+
displayName: 'A ] character',
|
|
47
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
48
|
+
description: '',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: '{',
|
|
52
|
+
namespace: '/{',
|
|
53
|
+
defaultAction: '../{.action',
|
|
54
|
+
displayName: 'A { character',
|
|
55
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
56
|
+
description: '',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: '}',
|
|
60
|
+
namespace: '/}',
|
|
61
|
+
defaultAction: '../}.action',
|
|
62
|
+
displayName: 'A } character',
|
|
63
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
64
|
+
description: '',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: '*',
|
|
68
|
+
namespace: '/*',
|
|
69
|
+
defaultAction: '../*.action',
|
|
70
|
+
displayName: 'A * character',
|
|
71
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
72
|
+
description: '',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: '+',
|
|
76
|
+
namespace: '/+',
|
|
77
|
+
defaultAction: '../+.action',
|
|
78
|
+
displayName: 'A + character',
|
|
79
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
80
|
+
description: '',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: '?',
|
|
84
|
+
namespace: '/?',
|
|
85
|
+
defaultAction: '../?.action',
|
|
86
|
+
displayName: 'A ? character',
|
|
87
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
88
|
+
description: '',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: '.',
|
|
92
|
+
namespace: '/.',
|
|
93
|
+
defaultAction: '../..action',
|
|
94
|
+
displayName: 'A . character',
|
|
95
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
96
|
+
description: '',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: ',',
|
|
100
|
+
namespace: '/,',
|
|
101
|
+
defaultAction: '../,.action',
|
|
102
|
+
displayName: 'A , character',
|
|
103
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
104
|
+
description: '',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: '^',
|
|
108
|
+
namespace: '/^',
|
|
109
|
+
defaultAction: '../^.action',
|
|
110
|
+
displayName: 'A ^ character',
|
|
111
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
112
|
+
description: '',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: '$',
|
|
116
|
+
namespace: '/$',
|
|
117
|
+
defaultAction: '../$.action',
|
|
118
|
+
displayName: 'A $ character',
|
|
119
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
120
|
+
description: '',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: '|',
|
|
124
|
+
namespace: '/|',
|
|
125
|
+
defaultAction: '../|.action',
|
|
126
|
+
displayName: 'A | character',
|
|
127
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
128
|
+
description: '',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: '#',
|
|
132
|
+
namespace: '/#',
|
|
133
|
+
defaultAction: '../#.action',
|
|
134
|
+
displayName: 'A # character',
|
|
135
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
136
|
+
description: '',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: '\\s',
|
|
140
|
+
namespace: '/\\s',
|
|
141
|
+
defaultAction: '../\\s.action',
|
|
142
|
+
displayName: 'A \\s character',
|
|
143
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
144
|
+
description: '',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: '\\',
|
|
148
|
+
namespace: '/\\',
|
|
149
|
+
defaultAction: '../\\.action',
|
|
150
|
+
displayName: 'A \\ character',
|
|
151
|
+
icon: '../icons/dhis-web-data-visualizer.png',
|
|
152
|
+
description: '',
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
{
|
|
156
|
+
name: 'dhis-web-dashboard',
|
|
157
|
+
namespace: '/dhis-web-dashboard',
|
|
158
|
+
defaultAction: '../dhis-web-dashboard/index.action',
|
|
159
|
+
displayName: 'Dashboard',
|
|
160
|
+
icon: '../icons/dhis-web-dashboard.png',
|
|
161
|
+
description: '',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: 'dhis-web-capture',
|
|
165
|
+
namespace: '/dhis-web-capture',
|
|
166
|
+
defaultAction: '../dhis-web-capture/index.action',
|
|
167
|
+
displayName: 'Capture',
|
|
168
|
+
icon: '../icons/dhis-web-capture.png',
|
|
169
|
+
description: '',
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: 'dhis-web-maintenance',
|
|
173
|
+
namespace: '/dhis-web-maintenance',
|
|
174
|
+
defaultAction: '../dhis-web-maintenance/index.action',
|
|
175
|
+
displayName: 'Maintenance',
|
|
176
|
+
icon: '../icons/dhis-web-maintenance.png',
|
|
177
|
+
description: '',
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: 'dhis-web-maps',
|
|
181
|
+
namespace: '/dhis-web-maps',
|
|
182
|
+
defaultAction: '../dhis-web-maps/index.action',
|
|
183
|
+
displayName: 'Maps',
|
|
184
|
+
icon: '../icons/dhis-web-maps.png',
|
|
185
|
+
description: '',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: 'dhis-web-event-reports',
|
|
189
|
+
namespace: '/dhis-web-event-reports',
|
|
190
|
+
defaultAction: '../dhis-web-event-reports/index.action',
|
|
191
|
+
displayName: 'Event Reports',
|
|
192
|
+
icon: '../icons/dhis-web-event-reports.png',
|
|
193
|
+
description: '',
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'dhis-web-interpretation',
|
|
197
|
+
namespace: '/dhis-web-interpretation',
|
|
198
|
+
defaultAction: '../dhis-web-interpretation/index.action',
|
|
199
|
+
displayName: 'Interpretations',
|
|
200
|
+
icon: '../icons/dhis-web-interpretation.png',
|
|
201
|
+
description: '',
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: 'dhis-web-import-export',
|
|
205
|
+
namespace: '/dhis-web-import-export',
|
|
206
|
+
defaultAction: '../dhis-web-import-export/index.action',
|
|
207
|
+
displayName: 'Import/Export',
|
|
208
|
+
icon: '../icons/dhis-web-importexport.png',
|
|
209
|
+
description: '',
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: 'WHO Metadata browser',
|
|
213
|
+
namespace: 'WHO Metadata browser',
|
|
214
|
+
defaultAction:
|
|
215
|
+
'https://debug.dhis2.org/dev/api/apps/WHO-Metadata-browser/index.html',
|
|
216
|
+
displayName: '',
|
|
217
|
+
icon: 'https://debug.dhis2.org/dev/api/apps/WHO-Metadata-browser/icons/medicine-48.png',
|
|
218
|
+
description: '',
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: 'Dashboard Classic',
|
|
222
|
+
namespace: 'Dashboard Classic',
|
|
223
|
+
defaultAction:
|
|
224
|
+
'https://debug.dhis2.org/dev/api/apps/Dashboard-Classic/index.html',
|
|
225
|
+
displayName: '',
|
|
226
|
+
icon: 'https://debug.dhis2.org/dev/api/apps/Dashboard-Classic/icon.png',
|
|
227
|
+
description: 'DHIS2 Legacy Dashboard App',
|
|
228
|
+
},
|
|
229
|
+
]
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useOnlineStatusMessage } from '@dhis2/app-runtime'
|
|
2
|
+
import { Button } from '@dhis2-ui/button'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { HeaderBar } from '../../index.js'
|
|
5
|
+
import {
|
|
6
|
+
providerConfig,
|
|
7
|
+
createDecoratorCustomDataProviderHeaderBar,
|
|
8
|
+
createDecoratorProvider,
|
|
9
|
+
} from './common.js'
|
|
10
|
+
|
|
11
|
+
export const OnlineStatusMessageUpdate = () => {
|
|
12
|
+
const { onlineStatusMessage, setOnlineStatusMessage } =
|
|
13
|
+
useOnlineStatusMessage()
|
|
14
|
+
|
|
15
|
+
const buttonLabel = !onlineStatusMessage
|
|
16
|
+
? 'display online status message'
|
|
17
|
+
: 'remove online status message'
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Button
|
|
21
|
+
onClick={() => {
|
|
22
|
+
setOnlineStatusMessage(
|
|
23
|
+
!onlineStatusMessage ? '8 offline events' : ''
|
|
24
|
+
)
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
{buttonLabel}
|
|
28
|
+
</Button>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const OnlineStatusMessaging = () => (
|
|
33
|
+
<>
|
|
34
|
+
<HeaderBar appName="Example!" />
|
|
35
|
+
<OnlineStatusMessageUpdate />
|
|
36
|
+
</>
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
export const OnlineStatusMessagingWithPwaEnabled = () => (
|
|
40
|
+
<OnlineStatusMessaging />
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
OnlineStatusMessagingWithPwaEnabled.decorators = [
|
|
44
|
+
createDecoratorCustomDataProviderHeaderBar(),
|
|
45
|
+
createDecoratorProvider({
|
|
46
|
+
...providerConfig,
|
|
47
|
+
pwaEnabled: true,
|
|
48
|
+
}),
|
|
49
|
+
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { HeaderBar } from '../../index.js'
|
|
3
|
+
import {
|
|
4
|
+
providerConfig,
|
|
5
|
+
createDecoratorCustomDataProviderHeaderBar,
|
|
6
|
+
createDecoratorProvider,
|
|
7
|
+
} from './common.js'
|
|
8
|
+
|
|
9
|
+
export const PWAEnabled = () => <HeaderBar appName="Example!" />
|
|
10
|
+
|
|
11
|
+
PWAEnabled.decorators = [
|
|
12
|
+
createDecoratorCustomDataProviderHeaderBar(),
|
|
13
|
+
createDecoratorProvider({
|
|
14
|
+
...providerConfig,
|
|
15
|
+
pwaEnabled: true,
|
|
16
|
+
}),
|
|
17
|
+
]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { HeaderBar } from '../../index.js'
|
|
3
|
+
import {
|
|
4
|
+
dataProviderData,
|
|
5
|
+
createDecoratorCustomDataProviderHeaderBar,
|
|
6
|
+
createDecoratorProvider,
|
|
7
|
+
} from './common.js'
|
|
8
|
+
|
|
9
|
+
export const UserHasAllAuthority = () => <HeaderBar appName="Example!" />
|
|
10
|
+
|
|
11
|
+
UserHasAllAuthority.decorators = [
|
|
12
|
+
createDecoratorCustomDataProviderHeaderBar({
|
|
13
|
+
...dataProviderData,
|
|
14
|
+
me: {
|
|
15
|
+
...dataProviderData.me,
|
|
16
|
+
authorities: ['ALL'],
|
|
17
|
+
},
|
|
18
|
+
}),
|
|
19
|
+
createDecoratorProvider(),
|
|
20
|
+
]
|