@dhis2-ui/header-bar 8.12.2 → 8.12.4
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/build/cjs/__e2e__/header-bar.stories.e2e.js +0 -8
- package/build/cjs/__e2e__/stories/common.js +18 -5
- package/build/cjs/__e2e__/stories/online-status-message.js +0 -5
- package/build/cjs/features/the_headerbar_can_display_online_status/the_headerbar_displays_online_status.js +7 -32
- package/build/cjs/features/the_headerbar_can_display_online_status.feature +2 -7
- package/build/cjs/header-bar.js +3 -6
- package/build/cjs/header-bar.stories.js +2 -5
- package/build/cjs/online-status.js +2 -2
- package/build/es/__e2e__/header-bar.stories.e2e.js +0 -1
- package/build/es/__e2e__/stories/common.js +15 -4
- package/build/es/__e2e__/stories/online-status-message.js +0 -5
- package/build/es/features/the_headerbar_can_display_online_status/the_headerbar_displays_online_status.js +7 -32
- package/build/es/features/the_headerbar_can_display_online_status.feature +2 -7
- package/build/es/header-bar.js +3 -6
- package/build/es/header-bar.stories.js +3 -6
- package/build/es/online-status.js +3 -3
- package/package.json +16 -16
- package/build/cjs/__e2e__/stories/show-online-status.js +0 -25
- package/build/es/__e2e__/stories/show-online-status.js +0 -11
|
@@ -33,12 +33,6 @@ Object.defineProperty(exports, "PWAEnabled", {
|
|
|
33
33
|
return _pwaEnabled.PWAEnabled;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
-
Object.defineProperty(exports, "ShowOnlineStatus", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _showOnlineStatus.ShowOnlineStatus;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
36
|
Object.defineProperty(exports, "UserHasAllAuthority", {
|
|
43
37
|
enumerable: true,
|
|
44
38
|
get: function () {
|
|
@@ -129,8 +123,6 @@ var _index = require("../index.js");
|
|
|
129
123
|
|
|
130
124
|
var _default2 = require("./stories/default.js");
|
|
131
125
|
|
|
132
|
-
var _showOnlineStatus = require("./stories/show-online-status.js");
|
|
133
|
-
|
|
134
126
|
var _pwaEnabled = require("./stories/pwa-enabled.js");
|
|
135
127
|
|
|
136
128
|
var _onlineStatusMessage = require("./stories/online-status-message.js");
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.providerConfig = exports.modulesWithSpecialCharacters = exports.defaultModules = exports.dataProviderData = exports.createDecoratorProvider = exports.createDecoratorCustomDataProviderHeaderBar = exports.applicationTitle = void 0;
|
|
6
|
+
exports.providerConfig = exports.modulesWithSpecialCharacters = exports.mockOfflineInterface = exports.defaultModules = exports.dataProviderData = exports.createDecoratorProvider = exports.createDecoratorCustomDataProviderHeaderBar = exports.applicationTitle = void 0;
|
|
7
7
|
|
|
8
8
|
var _appRuntime = require("@dhis2/app-runtime");
|
|
9
9
|
|
|
@@ -368,6 +368,7 @@ const providerConfig = {
|
|
|
368
368
|
isMetadataVersionEnabled: true,
|
|
369
369
|
metadataSyncEnabled: false
|
|
370
370
|
},
|
|
371
|
+
// same as in ../../features/common/index.js
|
|
371
372
|
baseUrl: 'https://domain.tld/',
|
|
372
373
|
apiVersion: ''
|
|
373
374
|
};
|
|
@@ -404,7 +405,7 @@ MockAlert.propTypes = {
|
|
|
404
405
|
})
|
|
405
406
|
};
|
|
406
407
|
|
|
407
|
-
const
|
|
408
|
+
const MockAlertStack = () => {
|
|
408
409
|
const alerts = (0, _appRuntime.useAlerts)();
|
|
409
410
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
410
411
|
style: {
|
|
@@ -418,11 +419,23 @@ const MocklAlertStack = () => {
|
|
|
418
419
|
})));
|
|
419
420
|
};
|
|
420
421
|
|
|
421
|
-
const
|
|
422
|
+
const mockOfflineInterface = {
|
|
423
|
+
pwaEnabled: true,
|
|
424
|
+
startRecording: async () => undefined,
|
|
425
|
+
getCachedSections: async () => [],
|
|
426
|
+
removeSection: async () => false,
|
|
427
|
+
subscribeToDhis2ConnectionStatus: () => () => undefined,
|
|
428
|
+
latestIsConnected: true
|
|
429
|
+
};
|
|
430
|
+
exports.mockOfflineInterface = mockOfflineInterface;
|
|
431
|
+
|
|
432
|
+
const createDecoratorProvider = function () {
|
|
433
|
+
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : providerConfig;
|
|
434
|
+
let offlineInterface = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : mockOfflineInterface;
|
|
422
435
|
return fn => /*#__PURE__*/_react.default.createElement(_appRuntime.Provider, {
|
|
423
|
-
config: config
|
|
436
|
+
config: config,
|
|
424
437
|
offlineInterface: offlineInterface
|
|
425
|
-
}, fn(), /*#__PURE__*/_react.default.createElement(
|
|
438
|
+
}, fn(), /*#__PURE__*/_react.default.createElement(MockAlertStack, null));
|
|
426
439
|
};
|
|
427
440
|
|
|
428
441
|
exports.createDecoratorProvider = createDecoratorProvider;
|
|
@@ -41,9 +41,4 @@ const OnlineStatusMessagingWithPwaEnabled = () => /*#__PURE__*/_react.default.cr
|
|
|
41
41
|
exports.OnlineStatusMessagingWithPwaEnabled = OnlineStatusMessagingWithPwaEnabled;
|
|
42
42
|
OnlineStatusMessagingWithPwaEnabled.decorators = [(0, _common.createDecoratorCustomDataProviderHeaderBar)(), (0, _common.createDecoratorProvider)({ ..._common.providerConfig,
|
|
43
43
|
pwaEnabled: true
|
|
44
|
-
}, {
|
|
45
|
-
pwaEnabled: true,
|
|
46
|
-
startRecording: async () => undefined,
|
|
47
|
-
getCachedSections: async () => [],
|
|
48
|
-
removeSection: async () => false
|
|
49
44
|
})];
|
|
@@ -4,43 +4,18 @@ var _steps = require("cypress-cucumber-preprocessor/steps");
|
|
|
4
4
|
|
|
5
5
|
require("../common/index.js");
|
|
6
6
|
|
|
7
|
-
// https://
|
|
7
|
+
// see https://github.com/cypress-io/cypress/issues/17723#issuecomment-1457064322
|
|
8
8
|
const goOffline = () => {
|
|
9
|
-
cy.log('**go offline**')
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}).then(() => {
|
|
14
|
-
return Cypress.automation('remote:debugger:protocol', {
|
|
15
|
-
command: 'Network.emulateNetworkConditions',
|
|
16
|
-
params: {
|
|
17
|
-
offline: true,
|
|
18
|
-
latency: -1,
|
|
19
|
-
downloadThroughput: -1,
|
|
20
|
-
uploadThroughput: -1
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
});
|
|
9
|
+
cy.log('**go offline**') // stub every request with a StaticResponse to simulate network error
|
|
10
|
+
.then(() => cy.intercept('*', {
|
|
11
|
+
forceNetworkError: true
|
|
12
|
+
})).then(() => cy.window().then(win => win.dispatchEvent(new Event('offline'))));
|
|
24
13
|
};
|
|
25
14
|
|
|
26
15
|
const goOnline = () => {
|
|
27
16
|
// disable offline mode, otherwise we will break our tests :)
|
|
28
|
-
cy.log('**go online**')
|
|
29
|
-
|
|
30
|
-
return Cypress.automation('remote:debugger:protocol', {
|
|
31
|
-
command: 'Network.emulateNetworkConditions',
|
|
32
|
-
params: {
|
|
33
|
-
offline: false,
|
|
34
|
-
latency: -1,
|
|
35
|
-
downloadThroughput: -1,
|
|
36
|
-
uploadThroughput: -1
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}).then(() => {
|
|
40
|
-
return Cypress.automation('remote:debugger:protocol', {
|
|
41
|
-
command: 'Network.disable'
|
|
42
|
-
});
|
|
43
|
-
});
|
|
17
|
+
cy.log('**go online**') // go back to normal network behavior
|
|
18
|
+
.then(() => cy.intercept('*')).then(() => cy.window().then(win => win.dispatchEvent(new Event('online'))));
|
|
44
19
|
};
|
|
45
20
|
|
|
46
21
|
(0, _steps.Before)(() => {
|
|
@@ -6,10 +6,6 @@ Feature: The HeaderBar can display online status
|
|
|
6
6
|
Given the HeaderBar loads without an error
|
|
7
7
|
Then the HeaderBar does not render online status
|
|
8
8
|
|
|
9
|
-
Scenario: The HeaderBar displays online status when configured to
|
|
10
|
-
Given the HeaderBar loads without error with showOnlineStatus configured
|
|
11
|
-
Then the HeaderBar renders online status
|
|
12
|
-
|
|
13
9
|
Scenario: The HeaderBar displays online status when PWA is enabled
|
|
14
10
|
Given the HeaderBar loads without error when PWA is enabled
|
|
15
11
|
Then the HeaderBar renders online status
|
|
@@ -26,9 +22,8 @@ Feature: The HeaderBar can display online status
|
|
|
26
22
|
And the viewport is narrower than 480px
|
|
27
23
|
Then the HeaderBar displays only the mobile status bar
|
|
28
24
|
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
# at time of writing the problem doesn't appear to happen on CI
|
|
25
|
+
# This is not a complete test of the connection status functionality --
|
|
26
|
+
# see the app-runtime for detailed tests
|
|
32
27
|
Scenario: The HeaderBar displays an offline status when offline
|
|
33
28
|
Given the HeaderBar loads without error when PWA is enabled
|
|
34
29
|
And the browser goes offline
|
package/build/cjs/header-bar.js
CHANGED
|
@@ -72,10 +72,7 @@ const HeaderBar = _ref => {
|
|
|
72
72
|
const {
|
|
73
73
|
appName: configAppName,
|
|
74
74
|
baseUrl,
|
|
75
|
-
pwaEnabled
|
|
76
|
-
headerbar: {
|
|
77
|
-
showOnlineStatus
|
|
78
|
-
} = {}
|
|
75
|
+
pwaEnabled
|
|
79
76
|
} = (0, _appRuntime.useConfig)();
|
|
80
77
|
const {
|
|
81
78
|
loading,
|
|
@@ -113,7 +110,7 @@ const HeaderBar = _ref => {
|
|
|
113
110
|
instance: data.title.applicationTitle
|
|
114
111
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
115
112
|
className: _style.default.dynamic([["3860078320", [_uiConstants.colors.white]]]) + " " + "right-control-spacer"
|
|
116
|
-
}),
|
|
113
|
+
}), pwaEnabled && /*#__PURE__*/_react.default.createElement(_onlineStatus.OnlineStatus, null), /*#__PURE__*/_react.default.createElement(_notifications.Notifications, {
|
|
117
114
|
interpretations: data.notifications.unreadInterpretations,
|
|
118
115
|
messages: data.notifications.unreadMessageConversations,
|
|
119
116
|
userAuthorities: data.user.authorities
|
|
@@ -124,7 +121,7 @@ const HeaderBar = _ref => {
|
|
|
124
121
|
email: data.user.email,
|
|
125
122
|
avatarId: (_data$user$avatar = data.user.avatar) === null || _data$user$avatar === void 0 ? void 0 : _data$user$avatar.id,
|
|
126
123
|
helpUrl: data.help.helpPageLink
|
|
127
|
-
}))),
|
|
124
|
+
}))), pwaEnabled && !loading && !error && /*#__PURE__*/_react.default.createElement(_onlineStatus.OnlineStatus, {
|
|
128
125
|
dense: true
|
|
129
126
|
}), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
130
127
|
id: "3860078320",
|
|
@@ -248,11 +248,8 @@ const WithOnlineStatusMessage = () => /*#__PURE__*/_react.default.createElement(
|
|
|
248
248
|
exports.WithOnlineStatusMessage = WithOnlineStatusMessage;
|
|
249
249
|
WithOnlineStatusMessage.decorators = [(0, _common.createDecoratorProvider)({ ..._common.providerConfig,
|
|
250
250
|
pwaEnabled: true
|
|
251
|
-
}, {
|
|
252
|
-
|
|
253
|
-
startRecording: async () => undefined,
|
|
254
|
-
getCachedSections: async () => [],
|
|
255
|
-
removeSection: async () => false
|
|
251
|
+
}, { ..._common.mockOfflineInterface,
|
|
252
|
+
latestIsConnected: false
|
|
256
253
|
})];
|
|
257
254
|
WithOnlineStatusMessage.parameters = {
|
|
258
255
|
docs: {
|
|
@@ -27,8 +27,8 @@ function OnlineStatus(_ref) {
|
|
|
27
27
|
dense
|
|
28
28
|
} = _ref;
|
|
29
29
|
const {
|
|
30
|
-
online
|
|
31
|
-
} = (0, _appRuntime.
|
|
30
|
+
isConnected: online
|
|
31
|
+
} = (0, _appRuntime.useDhis2ConnectionStatus)();
|
|
32
32
|
const {
|
|
33
33
|
onlineStatusMessage
|
|
34
34
|
} = (0, _appRuntime.useOnlineStatusMessage)();
|
|
@@ -4,7 +4,6 @@ export default {
|
|
|
4
4
|
component
|
|
5
5
|
};
|
|
6
6
|
export { Default } from './stories/default.js';
|
|
7
|
-
export { ShowOnlineStatus } from './stories/show-online-status.js';
|
|
8
7
|
export { PWAEnabled } from './stories/pwa-enabled.js';
|
|
9
8
|
export { OnlineStatusMessagingWithPwaEnabled } from './stories/online-status-message.js';
|
|
10
9
|
export { MeWithAvatar } from './stories/me-with-avatar.js';
|
|
@@ -345,6 +345,7 @@ export const providerConfig = {
|
|
|
345
345
|
isMetadataVersionEnabled: true,
|
|
346
346
|
metadataSyncEnabled: false
|
|
347
347
|
},
|
|
348
|
+
// same as in ../../features/common/index.js
|
|
348
349
|
baseUrl: 'https://domain.tld/',
|
|
349
350
|
apiVersion: ''
|
|
350
351
|
};
|
|
@@ -380,7 +381,7 @@ MockAlert.propTypes = {
|
|
|
380
381
|
})
|
|
381
382
|
};
|
|
382
383
|
|
|
383
|
-
const
|
|
384
|
+
const MockAlertStack = () => {
|
|
384
385
|
const alerts = useAlerts();
|
|
385
386
|
return /*#__PURE__*/React.createElement("div", {
|
|
386
387
|
style: {
|
|
@@ -394,9 +395,19 @@ const MocklAlertStack = () => {
|
|
|
394
395
|
})));
|
|
395
396
|
};
|
|
396
397
|
|
|
397
|
-
export const
|
|
398
|
+
export const mockOfflineInterface = {
|
|
399
|
+
pwaEnabled: true,
|
|
400
|
+
startRecording: async () => undefined,
|
|
401
|
+
getCachedSections: async () => [],
|
|
402
|
+
removeSection: async () => false,
|
|
403
|
+
subscribeToDhis2ConnectionStatus: () => () => undefined,
|
|
404
|
+
latestIsConnected: true
|
|
405
|
+
};
|
|
406
|
+
export const createDecoratorProvider = function () {
|
|
407
|
+
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : providerConfig;
|
|
408
|
+
let offlineInterface = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : mockOfflineInterface;
|
|
398
409
|
return fn => /*#__PURE__*/React.createElement(Provider, {
|
|
399
|
-
config: config
|
|
410
|
+
config: config,
|
|
400
411
|
offlineInterface: offlineInterface
|
|
401
|
-
}, fn(), /*#__PURE__*/React.createElement(
|
|
412
|
+
}, fn(), /*#__PURE__*/React.createElement(MockAlertStack, null));
|
|
402
413
|
};
|
|
@@ -23,9 +23,4 @@ const OnlineStatusMessaging = () => /*#__PURE__*/React.createElement(React.Fragm
|
|
|
23
23
|
export const OnlineStatusMessagingWithPwaEnabled = () => /*#__PURE__*/React.createElement(OnlineStatusMessaging, null);
|
|
24
24
|
OnlineStatusMessagingWithPwaEnabled.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({ ...providerConfig,
|
|
25
25
|
pwaEnabled: true
|
|
26
|
-
}, {
|
|
27
|
-
pwaEnabled: true,
|
|
28
|
-
startRecording: async () => undefined,
|
|
29
|
-
getCachedSections: async () => [],
|
|
30
|
-
removeSection: async () => false
|
|
31
26
|
})];
|
|
@@ -1,42 +1,17 @@
|
|
|
1
1
|
import { Before, After, Given, Then, When, And } from 'cypress-cucumber-preprocessor/steps';
|
|
2
|
-
import '../common/index.js'; // https://
|
|
2
|
+
import '../common/index.js'; // see https://github.com/cypress-io/cypress/issues/17723#issuecomment-1457064322
|
|
3
3
|
|
|
4
4
|
const goOffline = () => {
|
|
5
|
-
cy.log('**go offline**')
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}).then(() => {
|
|
10
|
-
return Cypress.automation('remote:debugger:protocol', {
|
|
11
|
-
command: 'Network.emulateNetworkConditions',
|
|
12
|
-
params: {
|
|
13
|
-
offline: true,
|
|
14
|
-
latency: -1,
|
|
15
|
-
downloadThroughput: -1,
|
|
16
|
-
uploadThroughput: -1
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
});
|
|
5
|
+
cy.log('**go offline**') // stub every request with a StaticResponse to simulate network error
|
|
6
|
+
.then(() => cy.intercept('*', {
|
|
7
|
+
forceNetworkError: true
|
|
8
|
+
})).then(() => cy.window().then(win => win.dispatchEvent(new Event('offline'))));
|
|
20
9
|
};
|
|
21
10
|
|
|
22
11
|
const goOnline = () => {
|
|
23
12
|
// disable offline mode, otherwise we will break our tests :)
|
|
24
|
-
cy.log('**go online**')
|
|
25
|
-
|
|
26
|
-
return Cypress.automation('remote:debugger:protocol', {
|
|
27
|
-
command: 'Network.emulateNetworkConditions',
|
|
28
|
-
params: {
|
|
29
|
-
offline: false,
|
|
30
|
-
latency: -1,
|
|
31
|
-
downloadThroughput: -1,
|
|
32
|
-
uploadThroughput: -1
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}).then(() => {
|
|
36
|
-
return Cypress.automation('remote:debugger:protocol', {
|
|
37
|
-
command: 'Network.disable'
|
|
38
|
-
});
|
|
39
|
-
});
|
|
13
|
+
cy.log('**go online**') // go back to normal network behavior
|
|
14
|
+
.then(() => cy.intercept('*')).then(() => cy.window().then(win => win.dispatchEvent(new Event('online'))));
|
|
40
15
|
};
|
|
41
16
|
|
|
42
17
|
Before(() => {
|
|
@@ -6,10 +6,6 @@ Feature: The HeaderBar can display online status
|
|
|
6
6
|
Given the HeaderBar loads without an error
|
|
7
7
|
Then the HeaderBar does not render online status
|
|
8
8
|
|
|
9
|
-
Scenario: The HeaderBar displays online status when configured to
|
|
10
|
-
Given the HeaderBar loads without error with showOnlineStatus configured
|
|
11
|
-
Then the HeaderBar renders online status
|
|
12
|
-
|
|
13
9
|
Scenario: The HeaderBar displays online status when PWA is enabled
|
|
14
10
|
Given the HeaderBar loads without error when PWA is enabled
|
|
15
11
|
Then the HeaderBar renders online status
|
|
@@ -26,9 +22,8 @@ Feature: The HeaderBar can display online status
|
|
|
26
22
|
And the viewport is narrower than 480px
|
|
27
23
|
Then the HeaderBar displays only the mobile status bar
|
|
28
24
|
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
# at time of writing the problem doesn't appear to happen on CI
|
|
25
|
+
# This is not a complete test of the connection status functionality --
|
|
26
|
+
# see the app-runtime for detailed tests
|
|
32
27
|
Scenario: The HeaderBar displays an offline status when offline
|
|
33
28
|
Given the HeaderBar loads without error when PWA is enabled
|
|
34
29
|
And the browser goes offline
|
package/build/es/header-bar.js
CHANGED
|
@@ -44,10 +44,7 @@ export const HeaderBar = _ref => {
|
|
|
44
44
|
const {
|
|
45
45
|
appName: configAppName,
|
|
46
46
|
baseUrl,
|
|
47
|
-
pwaEnabled
|
|
48
|
-
headerbar: {
|
|
49
|
-
showOnlineStatus
|
|
50
|
-
} = {}
|
|
47
|
+
pwaEnabled
|
|
51
48
|
} = useConfig();
|
|
52
49
|
const {
|
|
53
50
|
loading,
|
|
@@ -83,7 +80,7 @@ export const HeaderBar = _ref => {
|
|
|
83
80
|
instance: data.title.applicationTitle
|
|
84
81
|
}), /*#__PURE__*/React.createElement("div", {
|
|
85
82
|
className: _JSXStyle.dynamic([["3860078320", [colors.white]]]) + " " + "right-control-spacer"
|
|
86
|
-
}),
|
|
83
|
+
}), pwaEnabled && /*#__PURE__*/React.createElement(OnlineStatus, null), /*#__PURE__*/React.createElement(Notifications, {
|
|
87
84
|
interpretations: data.notifications.unreadInterpretations,
|
|
88
85
|
messages: data.notifications.unreadMessageConversations,
|
|
89
86
|
userAuthorities: data.user.authorities
|
|
@@ -94,7 +91,7 @@ export const HeaderBar = _ref => {
|
|
|
94
91
|
email: data.user.email,
|
|
95
92
|
avatarId: (_data$user$avatar = data.user.avatar) === null || _data$user$avatar === void 0 ? void 0 : _data$user$avatar.id,
|
|
96
93
|
helpUrl: data.help.helpPageLink
|
|
97
|
-
}))),
|
|
94
|
+
}))), pwaEnabled && !loading && !error && /*#__PURE__*/React.createElement(OnlineStatus, {
|
|
98
95
|
dense: true
|
|
99
96
|
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
100
97
|
id: "3860078320",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CustomDataProvider } from '@dhis2/app-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { createDecoratorProvider, providerConfig } from './__e2e__/stories/common.js';
|
|
3
|
+
import { createDecoratorProvider, mockOfflineInterface, providerConfig } from './__e2e__/stories/common.js';
|
|
4
4
|
import { OnlineStatusMessageUpdate } from './__e2e__/stories/online-status-message.js';
|
|
5
5
|
import { HeaderBar } from './header-bar.js';
|
|
6
6
|
const subtitle = 'The common navigation bar used in all DHIS2 apps';
|
|
@@ -206,11 +206,8 @@ export const WithOnlineStatusMessage = () => /*#__PURE__*/React.createElement(Cu
|
|
|
206
206
|
}), /*#__PURE__*/React.createElement(OnlineStatusMessageUpdate, null));
|
|
207
207
|
WithOnlineStatusMessage.decorators = [createDecoratorProvider({ ...providerConfig,
|
|
208
208
|
pwaEnabled: true
|
|
209
|
-
}, {
|
|
210
|
-
|
|
211
|
-
startRecording: async () => undefined,
|
|
212
|
-
getCachedSections: async () => [],
|
|
213
|
-
removeSection: async () => false
|
|
209
|
+
}, { ...mockOfflineInterface,
|
|
210
|
+
latestIsConnected: false
|
|
214
211
|
})];
|
|
215
212
|
WithOnlineStatusMessage.parameters = {
|
|
216
213
|
docs: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import {
|
|
2
|
+
import { useDhis2ConnectionStatus, useOnlineStatusMessage } from '@dhis2/app-runtime';
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
@@ -12,8 +12,8 @@ export function OnlineStatus(_ref) {
|
|
|
12
12
|
dense
|
|
13
13
|
} = _ref;
|
|
14
14
|
const {
|
|
15
|
-
online
|
|
16
|
-
} =
|
|
15
|
+
isConnected: online
|
|
16
|
+
} = useDhis2ConnectionStatus();
|
|
17
17
|
const {
|
|
18
18
|
onlineStatusMessage
|
|
19
19
|
} = useOnlineStatusMessage();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/header-bar",
|
|
3
|
-
"version": "8.12.
|
|
3
|
+
"version": "8.12.4",
|
|
4
4
|
"description": "UI HeaderBar",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,21 +33,21 @@
|
|
|
33
33
|
"styled-jsx": "^4"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@dhis2-ui/box": "8.12.
|
|
37
|
-
"@dhis2-ui/button": "8.12.
|
|
38
|
-
"@dhis2-ui/card": "8.12.
|
|
39
|
-
"@dhis2-ui/center": "8.12.
|
|
40
|
-
"@dhis2-ui/divider": "8.12.
|
|
41
|
-
"@dhis2-ui/input": "8.12.
|
|
42
|
-
"@dhis2-ui/layer": "8.12.
|
|
43
|
-
"@dhis2-ui/loader": "8.12.
|
|
44
|
-
"@dhis2-ui/logo": "8.12.
|
|
45
|
-
"@dhis2-ui/menu": "8.12.
|
|
46
|
-
"@dhis2-ui/modal": "8.12.
|
|
47
|
-
"@dhis2-ui/user-avatar": "8.12.
|
|
36
|
+
"@dhis2-ui/box": "8.12.4",
|
|
37
|
+
"@dhis2-ui/button": "8.12.4",
|
|
38
|
+
"@dhis2-ui/card": "8.12.4",
|
|
39
|
+
"@dhis2-ui/center": "8.12.4",
|
|
40
|
+
"@dhis2-ui/divider": "8.12.4",
|
|
41
|
+
"@dhis2-ui/input": "8.12.4",
|
|
42
|
+
"@dhis2-ui/layer": "8.12.4",
|
|
43
|
+
"@dhis2-ui/loader": "8.12.4",
|
|
44
|
+
"@dhis2-ui/logo": "8.12.4",
|
|
45
|
+
"@dhis2-ui/menu": "8.12.4",
|
|
46
|
+
"@dhis2-ui/modal": "8.12.4",
|
|
47
|
+
"@dhis2-ui/user-avatar": "8.12.4",
|
|
48
48
|
"@dhis2/prop-types": "^3.1.2",
|
|
49
|
-
"@dhis2/ui-constants": "8.12.
|
|
50
|
-
"@dhis2/ui-icons": "8.12.
|
|
49
|
+
"@dhis2/ui-constants": "8.12.4",
|
|
50
|
+
"@dhis2/ui-icons": "8.12.4",
|
|
51
51
|
"classnames": "^2.3.1",
|
|
52
52
|
"moment": "^2.29.1",
|
|
53
53
|
"prop-types": "^15.7.2"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"build"
|
|
57
57
|
],
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@dhis2/app-runtime": "^3.
|
|
59
|
+
"@dhis2/app-runtime": "^3.9.0",
|
|
60
60
|
"@dhis2/d2-i18n": "^1.1.0",
|
|
61
61
|
"react": "16.13",
|
|
62
62
|
"react-dom": "16.13",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ShowOnlineStatus = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _index = require("../../index.js");
|
|
11
|
-
|
|
12
|
-
var _common = require("./common.js");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
const ShowOnlineStatus = () => /*#__PURE__*/_react.default.createElement(_index.HeaderBar, {
|
|
17
|
-
appName: "Example!"
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
exports.ShowOnlineStatus = ShowOnlineStatus;
|
|
21
|
-
ShowOnlineStatus.decorators = [(0, _common.createDecoratorCustomDataProviderHeaderBar)(), (0, _common.createDecoratorProvider)({ ..._common.providerConfig,
|
|
22
|
-
headerbar: {
|
|
23
|
-
showOnlineStatus: true
|
|
24
|
-
}
|
|
25
|
-
})];
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { HeaderBar } from '../../index.js';
|
|
3
|
-
import { providerConfig, createDecoratorCustomDataProviderHeaderBar, createDecoratorProvider } from './common.js';
|
|
4
|
-
export const ShowOnlineStatus = () => /*#__PURE__*/React.createElement(HeaderBar, {
|
|
5
|
-
appName: "Example!"
|
|
6
|
-
});
|
|
7
|
-
ShowOnlineStatus.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({ ...providerConfig,
|
|
8
|
-
headerbar: {
|
|
9
|
-
showOnlineStatus: true
|
|
10
|
-
}
|
|
11
|
-
})];
|