@dhis2/analytics 21.5.1 → 22.0.0
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/CHANGELOG.md +12 -0
- package/build/cjs/__demo__/FileMenu.stories.js +9 -17
- package/build/cjs/components/CachedDataQueryProvider.js +70 -0
- package/build/cjs/components/FileMenu/FileMenu.js +3 -4
- package/build/cjs/components/FileMenu/__tests__/FileMenu.spec.js +3 -5
- package/build/cjs/components/OpenFileDialog/OpenFileDialog.js +10 -7
- package/build/cjs/components/OpenFileDialog/OpenFileDialog.styles.js +2 -2
- package/build/cjs/index.js +14 -0
- package/build/cjs/locales/en/translations.json +2 -0
- package/build/es/__demo__/FileMenu.stories.js +9 -17
- package/build/es/components/CachedDataQueryProvider.js +50 -0
- package/build/es/components/FileMenu/FileMenu.js +3 -4
- package/build/es/components/FileMenu/__tests__/FileMenu.spec.js +3 -5
- package/build/es/components/OpenFileDialog/OpenFileDialog.js +10 -7
- package/build/es/components/OpenFileDialog/OpenFileDialog.styles.js +2 -2
- package/build/es/index.js +2 -1
- package/build/es/locales/en/translations.json +2 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# [22.0.0](https://github.com/dhis2/analytics/compare/v21.5.1...v22.0.0) (2022-02-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* remove d2 and implement a generic provider component and hook ([#1114](https://github.com/dhis2/analytics/issues/1114)) ([f76233b](https://github.com/dhis2/analytics/commit/f76233bf961d1bea5586e2cffeba8e4c5a8ee254))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* currentUser is a new prop required in FileMenu in place of d2.
|
|
12
|
+
|
|
1
13
|
## [21.5.1](https://github.com/dhis2/analytics/compare/v21.5.0...v21.5.1) (2022-01-27)
|
|
2
14
|
|
|
3
15
|
|
|
@@ -14,10 +14,10 @@ const configMock = {
|
|
|
14
14
|
baseUrl: 'http://localhost:8080',
|
|
15
15
|
apiVersion: 33
|
|
16
16
|
};
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const user = {
|
|
18
|
+
displayName: 'John Traore',
|
|
19
|
+
id: 'xE7jOejl9FI',
|
|
20
|
+
username: 'admin'
|
|
21
21
|
};
|
|
22
22
|
const visObject = {
|
|
23
23
|
lastUpdated: '2020-10-12T09:44:46.194',
|
|
@@ -38,16 +38,8 @@ const visObject = {
|
|
|
38
38
|
write: true,
|
|
39
39
|
manage: true
|
|
40
40
|
},
|
|
41
|
-
lastUpdatedBy:
|
|
42
|
-
|
|
43
|
-
id: 'xE7jOejl9FI',
|
|
44
|
-
username: 'admin'
|
|
45
|
-
},
|
|
46
|
-
user: {
|
|
47
|
-
displayName: 'John Traore',
|
|
48
|
-
id: 'xE7jOejl9FI',
|
|
49
|
-
username: 'admin'
|
|
50
|
-
},
|
|
41
|
+
lastUpdatedBy: user,
|
|
42
|
+
user,
|
|
51
43
|
translations: [],
|
|
52
44
|
userAccesses: [{
|
|
53
45
|
access: 'rw------',
|
|
@@ -67,18 +59,18 @@ const visReadonlyObject = { ...visObject,
|
|
|
67
59
|
}
|
|
68
60
|
};
|
|
69
61
|
(0, _react.storiesOf)('FileMenu', module).add('Simple', () => /*#__PURE__*/_react2.default.createElement(_FileMenu.FileMenu, {
|
|
70
|
-
|
|
62
|
+
currentUser: user,
|
|
71
63
|
fileType: "visualization"
|
|
72
64
|
})).add('With AO', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.Provider, {
|
|
73
65
|
config: configMock
|
|
74
66
|
}, /*#__PURE__*/_react2.default.createElement(_FileMenu.FileMenu, {
|
|
75
|
-
|
|
67
|
+
currentUser: user,
|
|
76
68
|
fileType: "visualization",
|
|
77
69
|
fileObject: visObject
|
|
78
70
|
}))).add('With readonly AO', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.Provider, {
|
|
79
71
|
config: configMock
|
|
80
72
|
}, /*#__PURE__*/_react2.default.createElement(_FileMenu.FileMenu, {
|
|
81
|
-
|
|
73
|
+
currentUser: user,
|
|
82
74
|
fileType: "visualization",
|
|
83
75
|
fileObject: visReadonlyObject
|
|
84
76
|
})));
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useCachedDataQuery = exports.CachedDataQueryProvider = void 0;
|
|
7
|
+
|
|
8
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
9
|
+
|
|
10
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
11
|
+
|
|
12
|
+
var _ui = require("@dhis2/ui");
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
19
|
+
|
|
20
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
const CachedDataQueryCtx = /*#__PURE__*/(0, _react.createContext)({});
|
|
25
|
+
|
|
26
|
+
const CachedDataQueryProvider = ({
|
|
27
|
+
query,
|
|
28
|
+
dataTransformation,
|
|
29
|
+
children
|
|
30
|
+
}) => {
|
|
31
|
+
const {
|
|
32
|
+
data: rawData,
|
|
33
|
+
...rest
|
|
34
|
+
} = (0, _appRuntime.useDataQuery)(query);
|
|
35
|
+
const {
|
|
36
|
+
error,
|
|
37
|
+
loading
|
|
38
|
+
} = rest;
|
|
39
|
+
const data = rawData && dataTransformation ? dataTransformation(rawData) : rawData;
|
|
40
|
+
|
|
41
|
+
if (loading) {
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_ui.Layer, {
|
|
43
|
+
translucent: true
|
|
44
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.CenteredContent, null, /*#__PURE__*/_react.default.createElement(_ui.CircularLoader, null)));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (error) {
|
|
48
|
+
const fallbackMsg = _d2I18n.default.t('This app could not retrieve required data.');
|
|
49
|
+
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement(_ui.NoticeBox, {
|
|
51
|
+
error: true,
|
|
52
|
+
title: _d2I18n.default.t('Network error')
|
|
53
|
+
}, error.message || fallbackMsg);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement(CachedDataQueryCtx.Provider, {
|
|
57
|
+
value: data
|
|
58
|
+
}, children);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.CachedDataQueryProvider = CachedDataQueryProvider;
|
|
62
|
+
CachedDataQueryProvider.propTypes = {
|
|
63
|
+
children: _propTypes.default.node.isRequired,
|
|
64
|
+
query: _propTypes.default.object.isRequired,
|
|
65
|
+
dataTransformation: _propTypes.default.func
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const useCachedDataQuery = () => (0, _react.useContext)(CachedDataQueryCtx);
|
|
69
|
+
|
|
70
|
+
exports.useCachedDataQuery = useCachedDataQuery;
|
|
@@ -38,8 +38,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
38
38
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
39
|
|
|
40
40
|
const FileMenu = ({
|
|
41
|
-
|
|
42
|
-
// to be removed as soon as TranslateDialog and FavoritesDialog are rewritten
|
|
41
|
+
currentUser,
|
|
43
42
|
fileType,
|
|
44
43
|
fileObject,
|
|
45
44
|
onNew,
|
|
@@ -162,7 +161,7 @@ const FileMenu = ({
|
|
|
162
161
|
onDialogClose();
|
|
163
162
|
},
|
|
164
163
|
onNew: onNew,
|
|
165
|
-
currentUser:
|
|
164
|
+
currentUser: currentUser
|
|
166
165
|
}), menuIsOpen && /*#__PURE__*/_react.default.createElement(_ui.Layer, {
|
|
167
166
|
onClick: toggleMenu,
|
|
168
167
|
position: "fixed",
|
|
@@ -265,7 +264,7 @@ FileMenu.defaultProps = {
|
|
|
265
264
|
onTranslate: Function.prototype
|
|
266
265
|
};
|
|
267
266
|
FileMenu.propTypes = {
|
|
268
|
-
|
|
267
|
+
currentUser: _propTypes.default.object,
|
|
269
268
|
fileObject: _propTypes.default.object,
|
|
270
269
|
fileType: _propTypes.default.oneOf(_utils.supportedFileTypes),
|
|
271
270
|
onDelete: _propTypes.default.func,
|
|
@@ -46,11 +46,9 @@ describe('The FileMenu component ', () => {
|
|
|
46
46
|
beforeEach(() => {
|
|
47
47
|
shallowFileMenu = undefined;
|
|
48
48
|
props = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
displayName: 'Test user'
|
|
53
|
-
}
|
|
49
|
+
currentUser: {
|
|
50
|
+
id: 'u1',
|
|
51
|
+
displayName: 'Test user'
|
|
54
52
|
},
|
|
55
53
|
fileType: 'visualization',
|
|
56
54
|
fileObject: undefined,
|
|
@@ -158,13 +158,16 @@ const OpenFileDialog = ({
|
|
|
158
158
|
}
|
|
159
159
|
}, [open, page, sortField, sortDirection]);
|
|
160
160
|
(0, _react.useEffect)(() => {
|
|
161
|
-
//
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
161
|
+
// avoid fetching data when the dialog is first rendered (hidden)
|
|
162
|
+
if (open) {
|
|
163
|
+
// reset pagination when filters are applied/changed
|
|
164
|
+
setPage(1);
|
|
165
|
+
refetch({
|
|
166
|
+
sortField,
|
|
167
|
+
sortDirection,
|
|
168
|
+
filters: formatFilters()
|
|
169
|
+
});
|
|
170
|
+
}
|
|
168
171
|
}, [filters]);
|
|
169
172
|
const headers = [{
|
|
170
173
|
field: 'displayName',
|
|
@@ -7,6 +7,6 @@ exports.styles = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _ui = require("@dhis2/ui");
|
|
9
9
|
|
|
10
|
-
const styles = [".data-table-body.jsx-
|
|
10
|
+
const styles = [".data-table-body.jsx-1047699013{min-height:465px;}", ".pagination-controls.jsx-1047699013{width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;}", ".search-and-filter-bar.jsx-1047699013{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:".concat(_ui.spacers.dp4, ";-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-bottom:").concat(_ui.spacers.dp8, ";}"), ".search-field-container.jsx-1047699013{min-width:220px;}", ".type-field-container.jsx-1047699013,.created-by-field-container.jsx-1047699013{min-width:180px;}", ".info-cell.jsx-1047699013{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;margin:".concat(_ui.spacers.dp32, " 0;}"), ".info-container.jsx-1047699013{max-width:400px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}", ".info-text.jsx-1047699013{text-align:center;font-size:14px;line-height:19px;color:".concat(_ui.colors.grey700, ";}"), ".info-button.jsx-1047699013{margin-top:".concat(_ui.spacers.dp12, ";}")];
|
|
11
11
|
exports.styles = styles;
|
|
12
|
-
styles.__hash = "
|
|
12
|
+
styles.__hash = "1047699013";
|
package/build/cjs/index.js
CHANGED
|
@@ -93,6 +93,18 @@ Object.defineProperty(exports, "AboutAOUnit", {
|
|
|
93
93
|
return _AboutAOUnit.default;
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
|
+
Object.defineProperty(exports, "CachedDataQueryProvider", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () {
|
|
99
|
+
return _CachedDataQueryProvider.CachedDataQueryProvider;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
Object.defineProperty(exports, "useCachedDataQuery", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function () {
|
|
105
|
+
return _CachedDataQueryProvider.useCachedDataQuery;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
96
108
|
Object.defineProperty(exports, "Analytics", {
|
|
97
109
|
enumerable: true,
|
|
98
110
|
get: function () {
|
|
@@ -1174,6 +1186,8 @@ var _LegendKey = _interopRequireDefault(require("./components/LegendKey/LegendKe
|
|
|
1174
1186
|
|
|
1175
1187
|
var _AboutAOUnit = _interopRequireDefault(require("./components/AboutAOUnit/AboutAOUnit.js"));
|
|
1176
1188
|
|
|
1189
|
+
var _CachedDataQueryProvider = require("./components/CachedDataQueryProvider.js");
|
|
1190
|
+
|
|
1177
1191
|
var _Analytics = _interopRequireDefault(require("./api/analytics/Analytics.js"));
|
|
1178
1192
|
|
|
1179
1193
|
var _dimensions = require("./api/dimensions.js");
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"Unsubscribe": "Unsubscribe",
|
|
17
17
|
"Subscribe to get updates about new interpretations.": "Subscribe to get updates about new interpretations.",
|
|
18
18
|
"Subscribe": "Subscribe",
|
|
19
|
+
"This app could not retrieve required data.": "This app could not retrieve required data.",
|
|
20
|
+
"Network error": "Network error",
|
|
19
21
|
"Data Type": "Data Type",
|
|
20
22
|
"All types": "All types",
|
|
21
23
|
"Totals only": "Totals only",
|
|
@@ -6,10 +6,10 @@ const configMock = {
|
|
|
6
6
|
baseUrl: 'http://localhost:8080',
|
|
7
7
|
apiVersion: 33
|
|
8
8
|
};
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const user = {
|
|
10
|
+
displayName: 'John Traore',
|
|
11
|
+
id: 'xE7jOejl9FI',
|
|
12
|
+
username: 'admin'
|
|
13
13
|
};
|
|
14
14
|
const visObject = {
|
|
15
15
|
lastUpdated: '2020-10-12T09:44:46.194',
|
|
@@ -30,16 +30,8 @@ const visObject = {
|
|
|
30
30
|
write: true,
|
|
31
31
|
manage: true
|
|
32
32
|
},
|
|
33
|
-
lastUpdatedBy:
|
|
34
|
-
|
|
35
|
-
id: 'xE7jOejl9FI',
|
|
36
|
-
username: 'admin'
|
|
37
|
-
},
|
|
38
|
-
user: {
|
|
39
|
-
displayName: 'John Traore',
|
|
40
|
-
id: 'xE7jOejl9FI',
|
|
41
|
-
username: 'admin'
|
|
42
|
-
},
|
|
33
|
+
lastUpdatedBy: user,
|
|
34
|
+
user,
|
|
43
35
|
translations: [],
|
|
44
36
|
userAccesses: [{
|
|
45
37
|
access: 'rw------',
|
|
@@ -59,18 +51,18 @@ const visReadonlyObject = { ...visObject,
|
|
|
59
51
|
}
|
|
60
52
|
};
|
|
61
53
|
storiesOf('FileMenu', module).add('Simple', () => /*#__PURE__*/React.createElement(FileMenu, {
|
|
62
|
-
|
|
54
|
+
currentUser: user,
|
|
63
55
|
fileType: "visualization"
|
|
64
56
|
})).add('With AO', () => /*#__PURE__*/React.createElement(Provider, {
|
|
65
57
|
config: configMock
|
|
66
58
|
}, /*#__PURE__*/React.createElement(FileMenu, {
|
|
67
|
-
|
|
59
|
+
currentUser: user,
|
|
68
60
|
fileType: "visualization",
|
|
69
61
|
fileObject: visObject
|
|
70
62
|
}))).add('With readonly AO', () => /*#__PURE__*/React.createElement(Provider, {
|
|
71
63
|
config: configMock
|
|
72
64
|
}, /*#__PURE__*/React.createElement(FileMenu, {
|
|
73
|
-
|
|
65
|
+
currentUser: user,
|
|
74
66
|
fileType: "visualization",
|
|
75
67
|
fileObject: visReadonlyObject
|
|
76
68
|
})));
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useDataQuery } from '@dhis2/app-runtime';
|
|
2
|
+
import i18n from '@dhis2/d2-i18n';
|
|
3
|
+
import { Layer, CenteredContent, CircularLoader, NoticeBox } from '@dhis2/ui';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import React, { createContext, useContext } from 'react';
|
|
6
|
+
const CachedDataQueryCtx = /*#__PURE__*/createContext({});
|
|
7
|
+
|
|
8
|
+
const CachedDataQueryProvider = ({
|
|
9
|
+
query,
|
|
10
|
+
dataTransformation,
|
|
11
|
+
children
|
|
12
|
+
}) => {
|
|
13
|
+
const {
|
|
14
|
+
data: rawData,
|
|
15
|
+
...rest
|
|
16
|
+
} = useDataQuery(query);
|
|
17
|
+
const {
|
|
18
|
+
error,
|
|
19
|
+
loading
|
|
20
|
+
} = rest;
|
|
21
|
+
const data = rawData && dataTransformation ? dataTransformation(rawData) : rawData;
|
|
22
|
+
|
|
23
|
+
if (loading) {
|
|
24
|
+
return /*#__PURE__*/React.createElement(Layer, {
|
|
25
|
+
translucent: true
|
|
26
|
+
}, /*#__PURE__*/React.createElement(CenteredContent, null, /*#__PURE__*/React.createElement(CircularLoader, null)));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (error) {
|
|
30
|
+
const fallbackMsg = i18n.t('This app could not retrieve required data.');
|
|
31
|
+
return /*#__PURE__*/React.createElement(NoticeBox, {
|
|
32
|
+
error: true,
|
|
33
|
+
title: i18n.t('Network error')
|
|
34
|
+
}, error.message || fallbackMsg);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return /*#__PURE__*/React.createElement(CachedDataQueryCtx.Provider, {
|
|
38
|
+
value: data
|
|
39
|
+
}, children);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
CachedDataQueryProvider.propTypes = {
|
|
43
|
+
children: PropTypes.node.isRequired,
|
|
44
|
+
query: PropTypes.object.isRequired,
|
|
45
|
+
dataTransformation: PropTypes.func
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const useCachedDataQuery = () => useContext(CachedDataQueryCtx);
|
|
49
|
+
|
|
50
|
+
export { CachedDataQueryProvider, useCachedDataQuery };
|
|
@@ -12,8 +12,7 @@ import { RenameDialog } from './RenameDialog.js';
|
|
|
12
12
|
import { SaveAsDialog } from './SaveAsDialog.js';
|
|
13
13
|
import { supportedFileTypes } from './utils.js';
|
|
14
14
|
export const FileMenu = ({
|
|
15
|
-
|
|
16
|
-
// to be removed as soon as TranslateDialog and FavoritesDialog are rewritten
|
|
15
|
+
currentUser,
|
|
17
16
|
fileType,
|
|
18
17
|
fileObject,
|
|
19
18
|
onNew,
|
|
@@ -136,7 +135,7 @@ export const FileMenu = ({
|
|
|
136
135
|
onDialogClose();
|
|
137
136
|
},
|
|
138
137
|
onNew: onNew,
|
|
139
|
-
currentUser:
|
|
138
|
+
currentUser: currentUser
|
|
140
139
|
}), menuIsOpen && /*#__PURE__*/React.createElement(Layer, {
|
|
141
140
|
onClick: toggleMenu,
|
|
142
141
|
position: "fixed",
|
|
@@ -237,7 +236,7 @@ FileMenu.defaultProps = {
|
|
|
237
236
|
onTranslate: Function.prototype
|
|
238
237
|
};
|
|
239
238
|
FileMenu.propTypes = {
|
|
240
|
-
|
|
239
|
+
currentUser: PropTypes.object,
|
|
241
240
|
fileObject: PropTypes.object,
|
|
242
241
|
fileType: PropTypes.oneOf(supportedFileTypes),
|
|
243
242
|
onDelete: PropTypes.func,
|
|
@@ -32,11 +32,9 @@ describe('The FileMenu component ', () => {
|
|
|
32
32
|
beforeEach(() => {
|
|
33
33
|
shallowFileMenu = undefined;
|
|
34
34
|
props = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
displayName: 'Test user'
|
|
39
|
-
}
|
|
35
|
+
currentUser: {
|
|
36
|
+
id: 'u1',
|
|
37
|
+
displayName: 'Test user'
|
|
40
38
|
},
|
|
41
39
|
fileType: 'visualization',
|
|
42
40
|
fileObject: undefined,
|
|
@@ -132,13 +132,16 @@ export const OpenFileDialog = ({
|
|
|
132
132
|
}
|
|
133
133
|
}, [open, page, sortField, sortDirection]);
|
|
134
134
|
useEffect(() => {
|
|
135
|
-
//
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
135
|
+
// avoid fetching data when the dialog is first rendered (hidden)
|
|
136
|
+
if (open) {
|
|
137
|
+
// reset pagination when filters are applied/changed
|
|
138
|
+
setPage(1);
|
|
139
|
+
refetch({
|
|
140
|
+
sortField,
|
|
141
|
+
sortDirection,
|
|
142
|
+
filters: formatFilters()
|
|
143
|
+
});
|
|
144
|
+
}
|
|
142
145
|
}, [filters]);
|
|
143
146
|
const headers = [{
|
|
144
147
|
field: 'displayName',
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { colors, spacers } from '@dhis2/ui';
|
|
2
|
-
export const styles = [".data-table-body.jsx-
|
|
3
|
-
styles.__hash = "
|
|
2
|
+
export const styles = [".data-table-body.jsx-1047699013{min-height:465px;}", ".pagination-controls.jsx-1047699013{width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;}", ".search-and-filter-bar.jsx-1047699013{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:".concat(spacers.dp4, ";-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-bottom:").concat(spacers.dp8, ";}"), ".search-field-container.jsx-1047699013{min-width:220px;}", ".type-field-container.jsx-1047699013,.created-by-field-container.jsx-1047699013{min-width:180px;}", ".info-cell.jsx-1047699013{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;margin:".concat(spacers.dp32, " 0;}"), ".info-container.jsx-1047699013{max-width:400px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}", ".info-text.jsx-1047699013{text-align:center;font-size:14px;line-height:19px;color:".concat(colors.grey700, ";}"), ".info-button.jsx-1047699013{margin-top:".concat(spacers.dp12, ";}")];
|
|
3
|
+
styles.__hash = "1047699013";
|
package/build/es/index.js
CHANGED
|
@@ -13,7 +13,8 @@ export { default as PivotTable } from './components/PivotTable/PivotTable.js';
|
|
|
13
13
|
export { default as FileMenu } from './components/FileMenu/FileMenu.js';
|
|
14
14
|
export { default as VisTypeIcon } from './components/VisTypeIcon.js';
|
|
15
15
|
export { default as LegendKey } from './components/LegendKey/LegendKey.js';
|
|
16
|
-
export { default as AboutAOUnit } from './components/AboutAOUnit/AboutAOUnit.js';
|
|
16
|
+
export { default as AboutAOUnit } from './components/AboutAOUnit/AboutAOUnit.js';
|
|
17
|
+
export { CachedDataQueryProvider, useCachedDataQuery } from './components/CachedDataQueryProvider.js'; // Api
|
|
17
18
|
|
|
18
19
|
export { default as Analytics } from './api/analytics/Analytics.js';
|
|
19
20
|
export { apiFetchDimensions, apiFetchRecommendedIds } from './api/dimensions.js';
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"Unsubscribe": "Unsubscribe",
|
|
17
17
|
"Subscribe to get updates about new interpretations.": "Subscribe to get updates about new interpretations.",
|
|
18
18
|
"Subscribe": "Subscribe",
|
|
19
|
+
"This app could not retrieve required data.": "This app could not retrieve required data.",
|
|
20
|
+
"Network error": "Network error",
|
|
19
21
|
"Data Type": "Data Type",
|
|
20
22
|
"All types": "All types",
|
|
21
23
|
"Totals only": "Totals only",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2/analytics",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "22.0.0",
|
|
4
4
|
"main": "./build/cjs/index.js",
|
|
5
5
|
"module": "./build/es/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@dhis2/cli-app-scripts": "^6.2.0",
|
|
36
36
|
"@dhis2/cli-style": "^10.1.1",
|
|
37
37
|
"@dhis2/d2-i18n": "^1.1.0",
|
|
38
|
-
"@dhis2/ui": "^7.
|
|
38
|
+
"@dhis2/ui": "^7.14.3",
|
|
39
39
|
"@sambego/storybook-state": "^2.0.1",
|
|
40
40
|
"@storybook/addons": "^6.1.14",
|
|
41
41
|
"@storybook/preset-create-react-app": "^3.1.7",
|