@dhis2/analytics 20.6.4 → 20.7.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/CHANGELOG.md +21 -0
- package/build/cjs/components/AboutAOUnit/AboutAOUnit.js +226 -0
- package/build/cjs/components/AboutAOUnit/styles/AboutAOUnit.style.js +13 -0
- package/build/cjs/components/OpenFileDialog/OpenFileDialog.js +1 -1
- package/build/cjs/index.js +8 -0
- package/build/cjs/locales/en/translations.json +17 -0
- package/build/cjs/locales/ru/translations.json +1 -1
- package/build/es/components/AboutAOUnit/AboutAOUnit.js +203 -0
- package/build/es/components/AboutAOUnit/styles/AboutAOUnit.style.js +4 -0
- package/build/es/components/OpenFileDialog/OpenFileDialog.js +1 -1
- package/build/es/index.js +2 -1
- package/build/es/locales/en/translations.json +17 -0
- package/build/es/locales/ru/translations.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [20.7.1](https://github.com/dhis2/analytics/compare/v20.7.0...v20.7.1) (2022-04-06)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* filter on displayName to get objects in current language DHIS2-13015 ([#1198](https://github.com/dhis2/analytics/issues/1198)) ([bba6bf7](https://github.com/dhis2/analytics/commit/bba6bf7ac063ad42a30cdd5a8eece145b3ff26fb))
|
|
7
|
+
|
|
8
|
+
# [20.7.0](https://github.com/dhis2/analytics/compare/v20.6.5...v20.7.0) (2021-11-11)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* implement AboutAOUnit component ([#1082](https://github.com/dhis2/analytics/issues/1082)) ([8ab8e27](https://github.com/dhis2/analytics/commit/8ab8e271077ce24b9f032303dad8999ce65b47d3))
|
|
14
|
+
|
|
15
|
+
## [20.6.5](https://github.com/dhis2/analytics/compare/v20.6.4...v20.6.5) (2021-10-27)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **translations:** sync translations from transifex (master) ([b47803b](https://github.com/dhis2/analytics/commit/b47803b5dbca43fa8d72c2d4b3e984a2e3ddbd98))
|
|
21
|
+
|
|
1
22
|
## [20.6.4](https://github.com/dhis2/analytics/compare/v20.6.3...v20.6.4) (2021-10-08)
|
|
2
23
|
|
|
3
24
|
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
+
|
|
10
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
11
|
+
|
|
12
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
13
|
+
|
|
14
|
+
var _ui = require("@dhis2/ui");
|
|
15
|
+
|
|
16
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
+
|
|
18
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
19
|
+
|
|
20
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
21
|
+
|
|
22
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
23
|
+
|
|
24
|
+
var _AboutAOUnit = _interopRequireDefault(require("./styles/AboutAOUnit.style"));
|
|
25
|
+
|
|
26
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
+
|
|
32
|
+
const READ_ONLY = 'r';
|
|
33
|
+
const READ_AND_WRITE = 'rw';
|
|
34
|
+
|
|
35
|
+
const getQueries = type => ({
|
|
36
|
+
ao: {
|
|
37
|
+
resource: type,
|
|
38
|
+
id: ({
|
|
39
|
+
id
|
|
40
|
+
}) => id,
|
|
41
|
+
params: {
|
|
42
|
+
fields: 'id,displayDescription,created,createdBy[displayName],lastUpdated,subscribed,publicAccess,userAccesses[displayName,access],userGroupAccesses[displayName,access]'
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
dataStatistics: {
|
|
46
|
+
resource: 'dataStatistics/favorites',
|
|
47
|
+
id: ({
|
|
48
|
+
id
|
|
49
|
+
}) => id
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const getSubscribeMutation = (type, id) => ({
|
|
54
|
+
resource: "".concat(type, "/").concat(id, "/subscriber"),
|
|
55
|
+
type: 'create'
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const getUnsubscribeMutation = (type, id) => ({
|
|
59
|
+
resource: "".concat(type, "/").concat(id, "/subscriber"),
|
|
60
|
+
type: 'delete'
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const AboutAOUnit = ({
|
|
64
|
+
type,
|
|
65
|
+
id
|
|
66
|
+
}) => {
|
|
67
|
+
const [isExpanded, setIsExpanded] = (0, _react.useState)(true);
|
|
68
|
+
const queries = (0, _react.useMemo)(() => getQueries(type), []);
|
|
69
|
+
const {
|
|
70
|
+
data,
|
|
71
|
+
loading: dataIsLoading,
|
|
72
|
+
refetch
|
|
73
|
+
} = (0, _appRuntime.useDataQuery)(queries, {
|
|
74
|
+
lazy: true
|
|
75
|
+
});
|
|
76
|
+
const subscribeMutation = (0, _react.useMemo)(() => getSubscribeMutation(type, id), []);
|
|
77
|
+
const unsubscribeMutation = (0, _react.useMemo)(() => getUnsubscribeMutation(type, id), []);
|
|
78
|
+
const [subscribe, {
|
|
79
|
+
loading: subscribeIsLoading
|
|
80
|
+
}] = (0, _appRuntime.useDataMutation)(subscribeMutation, {
|
|
81
|
+
onComplete: res => {
|
|
82
|
+
if (res.status === 'OK') {
|
|
83
|
+
refetch({
|
|
84
|
+
id
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
const [unsubscribe, {
|
|
90
|
+
loading: unsubscribeIsLoading
|
|
91
|
+
}] = (0, _appRuntime.useDataMutation)(unsubscribeMutation, {
|
|
92
|
+
onComplete: res => {
|
|
93
|
+
if (res.status === 'OK') {
|
|
94
|
+
refetch({
|
|
95
|
+
id
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
(0, _react.useEffect)(() => {
|
|
101
|
+
if (id) {
|
|
102
|
+
refetch({
|
|
103
|
+
id
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}, [type, id]);
|
|
107
|
+
|
|
108
|
+
const getAccessLevelString = access => {
|
|
109
|
+
const re = new RegExp("(?<accessLevel>".concat(READ_AND_WRITE, "?)"));
|
|
110
|
+
const accessMatch = re.exec(access);
|
|
111
|
+
|
|
112
|
+
switch (accessMatch.groups.accessLevel) {
|
|
113
|
+
case READ_ONLY:
|
|
114
|
+
return _d2I18n.default.t('view only');
|
|
115
|
+
|
|
116
|
+
case READ_AND_WRITE:
|
|
117
|
+
return _d2I18n.default.t('view and edit');
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const getSharingSummary = ao => {
|
|
122
|
+
const sharingText = [];
|
|
123
|
+
const re = new RegExp("^".concat(READ_AND_WRITE, "?"));
|
|
124
|
+
|
|
125
|
+
if (re.test(ao.publicAccess)) {
|
|
126
|
+
sharingText.push(_d2I18n.default.t('all users ({{accessLevel}})', {
|
|
127
|
+
accessLevel: getAccessLevelString(ao.publicAccess)
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const userAccesses = ao.userAccesses;
|
|
132
|
+
const groupAccesses = ao.userGroupAccesses;
|
|
133
|
+
userAccesses.concat(groupAccesses).forEach(accessRule => {
|
|
134
|
+
sharingText.push(_d2I18n.default.t('{{userOrGroup}} ({{accessLevel}})', {
|
|
135
|
+
userOrGroup: accessRule.displayName,
|
|
136
|
+
accessLevel: getAccessLevelString(accessRule.access)
|
|
137
|
+
}));
|
|
138
|
+
});
|
|
139
|
+
return sharingText.length ? _d2I18n.default.t('Shared with {{commaSeparatedListOfUsersAndGroups}}', {
|
|
140
|
+
commaSeparatedListOfUsersAndGroups: sharingText.join(', ')
|
|
141
|
+
}) : _d2I18n.default.t('Not shared with any users or groups');
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
145
|
+
className: "jsx-".concat(_AboutAOUnit.default.__hash) + " " + ((0, _classnames.default)('container', {
|
|
146
|
+
expanded: isExpanded
|
|
147
|
+
}) || "")
|
|
148
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
149
|
+
onClick: () => setIsExpanded(!isExpanded),
|
|
150
|
+
className: "jsx-".concat(_AboutAOUnit.default.__hash) + " " + "header"
|
|
151
|
+
}, _d2I18n.default.t('About this visualization'), isExpanded ? /*#__PURE__*/_react.default.createElement(_ui.IconChevronUp24, {
|
|
152
|
+
color: _ui.colors.grey700
|
|
153
|
+
}) : /*#__PURE__*/_react.default.createElement(_ui.IconChevronDown24, {
|
|
154
|
+
color: _ui.colors.grey700
|
|
155
|
+
})), isExpanded && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, dataIsLoading && /*#__PURE__*/_react.default.createElement("div", {
|
|
156
|
+
className: "jsx-".concat(_AboutAOUnit.default.__hash) + " " + "loader"
|
|
157
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.CircularLoader, {
|
|
158
|
+
small: true
|
|
159
|
+
})), data && /*#__PURE__*/_react.default.createElement("div", {
|
|
160
|
+
className: "jsx-".concat(_AboutAOUnit.default.__hash) + " " + "content"
|
|
161
|
+
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
162
|
+
className: "jsx-".concat(_AboutAOUnit.default.__hash) + " " + ((0, _classnames.default)('detailLine', {
|
|
163
|
+
noDescription: !data.ao.displayDescription
|
|
164
|
+
}) || "")
|
|
165
|
+
}, data.ao.displayDescription ? data.ao.displayDescription : _d2I18n.default.t('No description')), /*#__PURE__*/_react.default.createElement("div", {
|
|
166
|
+
className: "jsx-".concat(_AboutAOUnit.default.__hash)
|
|
167
|
+
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
168
|
+
className: "jsx-".concat(_AboutAOUnit.default.__hash) + " " + "detailLine"
|
|
169
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.IconShare16, {
|
|
170
|
+
color: _ui.colors.grey700
|
|
171
|
+
}), getSharingSummary(data.ao)), /*#__PURE__*/_react.default.createElement("p", {
|
|
172
|
+
className: "jsx-".concat(_AboutAOUnit.default.__hash) + " " + "detailLine"
|
|
173
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.IconClock16, {
|
|
174
|
+
color: _ui.colors.grey700
|
|
175
|
+
}), _d2I18n.default.t('Last updated {{time}}', {
|
|
176
|
+
time: (0, _moment.default)(data.ao.lastUpdated).fromNow()
|
|
177
|
+
})), /*#__PURE__*/_react.default.createElement("p", {
|
|
178
|
+
className: "jsx-".concat(_AboutAOUnit.default.__hash) + " " + "detailLine"
|
|
179
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.IconUser16, {
|
|
180
|
+
color: _ui.colors.grey700
|
|
181
|
+
}), _d2I18n.default.t('Created {{time}} by {{author}}', {
|
|
182
|
+
time: (0, _moment.default)(data.ao.created).fromNow(),
|
|
183
|
+
author: data.ao.createdBy.displayName
|
|
184
|
+
})), /*#__PURE__*/_react.default.createElement("p", {
|
|
185
|
+
className: "jsx-".concat(_AboutAOUnit.default.__hash) + " " + "detailLine"
|
|
186
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.IconView16, {
|
|
187
|
+
color: _ui.colors.grey700
|
|
188
|
+
}), _d2I18n.default.t('Viewed {{count}} times', {
|
|
189
|
+
count: data.dataStatistics.views,
|
|
190
|
+
defaultValue: 'Viewed 1 time',
|
|
191
|
+
defaultValue_plural: 'Viewed {{count}} times'
|
|
192
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
193
|
+
className: "jsx-".concat(_AboutAOUnit.default.__hash) + " " + "subsection"
|
|
194
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
195
|
+
className: "jsx-".concat(_AboutAOUnit.default.__hash) + " " + "subsectionTitle"
|
|
196
|
+
}, _d2I18n.default.t('Notifications')), data.ao.subscribed ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("p", {
|
|
197
|
+
className: "jsx-".concat(_AboutAOUnit.default.__hash) + " " + "subscriptionLabel"
|
|
198
|
+
}, _d2I18n.default.t("You're subscribed and getting updates about new interpretations.")), /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
199
|
+
icon: /*#__PURE__*/_react.default.createElement(_ui.IconSubscribeOff24, {
|
|
200
|
+
color: _ui.colors.grey700
|
|
201
|
+
}),
|
|
202
|
+
secondary: true,
|
|
203
|
+
small: true,
|
|
204
|
+
disabled: unsubscribeIsLoading,
|
|
205
|
+
onClick: unsubscribe
|
|
206
|
+
}, _d2I18n.default.t('Unsubscribe'))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("p", {
|
|
207
|
+
className: "jsx-".concat(_AboutAOUnit.default.__hash) + " " + "subscriptionLabel"
|
|
208
|
+
}, _d2I18n.default.t('Subscribe to get updates about new interpretations.')), /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
209
|
+
icon: /*#__PURE__*/_react.default.createElement(_ui.IconSubscribe24, {
|
|
210
|
+
color: _ui.colors.grey700
|
|
211
|
+
}),
|
|
212
|
+
secondary: true,
|
|
213
|
+
small: true,
|
|
214
|
+
disabled: subscribeIsLoading,
|
|
215
|
+
onClick: subscribe
|
|
216
|
+
}, _d2I18n.default.t('Subscribe')))))), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
217
|
+
id: _AboutAOUnit.default.__hash
|
|
218
|
+
}, _AboutAOUnit.default));
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
AboutAOUnit.propTypes = {
|
|
222
|
+
id: _propTypes.default.string.isRequired,
|
|
223
|
+
type: _propTypes.default.string.isRequired
|
|
224
|
+
};
|
|
225
|
+
var _default = AboutAOUnit;
|
|
226
|
+
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _ui = require("@dhis2/ui");
|
|
9
|
+
|
|
10
|
+
const _defaultExport = [".container.jsx-633421833{padding:".concat(_ui.spacers.dp16, ";border-bottom:1px solid ").concat(_ui.colors.grey400, ";background-color:").concat(_ui.colors.white, ";}"), ".expanded.jsx-633421833{padding-bottom:".concat(_ui.spacers.dp32, ";}"), ".loader.jsx-633421833{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}", ".header.jsx-633421833{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;font-size:".concat(_ui.spacers.dp16, ";font-weight:500;line-height:21px;color:").concat(_ui.colors.grey900, ";}"), ".content.jsx-633421833{font-size:14px;line-height:18px;color:".concat(_ui.colors.grey900, ";}"), ".detailLine.jsx-633421833{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin:0;padding:".concat(_ui.spacers.dp12, " 0 0 0;gap:").concat(_ui.spacers.dp8, ";}"), ".detailLine.jsx-633421833 svg.jsx-633421833{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}", ".noDescription.jsx-633421833{color:".concat(_ui.colors.grey600, ";}"), ".subsection.jsx-633421833{margin-top:".concat(_ui.spacers.dp24, ";}"), ".subsectionTitle.jsx-633421833{color:".concat(_ui.colors.grey700, ";font-weight:500;}"), ".subscriptionLabel.jsx-633421833{margin:".concat(_ui.spacers.dp12, " 0 ").concat(_ui.spacers.dp8, " 0;}"), ".subsection.jsx-633421833 button.jsx-633421833{margin-top:".concat(_ui.spacers.dp8, ";}")];
|
|
11
|
+
_defaultExport.__hash = "633421833";
|
|
12
|
+
var _default = _defaultExport;
|
|
13
|
+
exports.default = _default;
|
|
@@ -122,7 +122,7 @@ const OpenFileDialog = ({
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
if (filters.searchTerm) {
|
|
125
|
-
queryFilters.push("
|
|
125
|
+
queryFilters.push("displayName:ilike:".concat(filters.searchTerm));
|
|
126
126
|
} // for ER 2.38 only show line list ER types
|
|
127
127
|
|
|
128
128
|
|
package/build/cjs/index.js
CHANGED
|
@@ -87,6 +87,12 @@ Object.defineProperty(exports, "LegendKey", {
|
|
|
87
87
|
return _LegendKey.default;
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
|
+
Object.defineProperty(exports, "AboutAOUnit", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _AboutAOUnit.default;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
90
96
|
Object.defineProperty(exports, "Analytics", {
|
|
91
97
|
enumerable: true,
|
|
92
98
|
get: function () {
|
|
@@ -1142,6 +1148,8 @@ var _VisTypeIcon = _interopRequireDefault(require("./components/VisTypeIcon"));
|
|
|
1142
1148
|
|
|
1143
1149
|
var _LegendKey = _interopRequireDefault(require("./components/LegendKey/LegendKey"));
|
|
1144
1150
|
|
|
1151
|
+
var _AboutAOUnit = _interopRequireDefault(require("./components/AboutAOUnit/AboutAOUnit"));
|
|
1152
|
+
|
|
1145
1153
|
var _Analytics = _interopRequireDefault(require("./api/analytics/Analytics"));
|
|
1146
1154
|
|
|
1147
1155
|
var _dimensions = require("./api/dimensions");
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
+
"view only": "view only",
|
|
3
|
+
"view and edit": "view and edit",
|
|
4
|
+
"all users ({{accessLevel}})": "all users ({{accessLevel}})",
|
|
5
|
+
"{{userOrGroup}} ({{accessLevel}})": "{{userOrGroup}} ({{accessLevel}})",
|
|
6
|
+
"Shared with {{commaSeparatedListOfUsersAndGroups}}": "Shared with {{commaSeparatedListOfUsersAndGroups}}",
|
|
7
|
+
"Not shared with any users or groups": "Not shared with any users or groups",
|
|
8
|
+
"About this visualization": "About this visualization",
|
|
9
|
+
"No description": "No description",
|
|
10
|
+
"Last updated {{time}}": "Last updated {{time}}",
|
|
11
|
+
"Created {{time}} by {{author}}": "Created {{time}} by {{author}}",
|
|
12
|
+
"Viewed {{count}} times": "Viewed 1 time",
|
|
13
|
+
"Viewed {{count}} times_plural": "Viewed {{count}} times",
|
|
14
|
+
"Notifications": "Notifications",
|
|
15
|
+
"You're subscribed and getting updates about new interpretations.": "You're subscribed and getting updates about new interpretations.",
|
|
16
|
+
"Unsubscribe": "Unsubscribe",
|
|
17
|
+
"Subscribe to get updates about new interpretations.": "Subscribe to get updates about new interpretations.",
|
|
18
|
+
"Subscribe": "Subscribe",
|
|
2
19
|
"Data Type": "Data Type",
|
|
3
20
|
"All types": "All types",
|
|
4
21
|
"Totals only": "Totals only",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"There was a problem loading items. Try again or contact your system administrator.": "",
|
|
77
77
|
"No items found. Create a new to get started.": "",
|
|
78
78
|
"No items found. Try adjusting your search or filter options to find what you're looking for.": "",
|
|
79
|
-
"Create new": "",
|
|
79
|
+
"Create new": "Создать новый",
|
|
80
80
|
"Open a visualization": "",
|
|
81
81
|
"Loading visualizations": "",
|
|
82
82
|
"Couldn't load visualizations": "",
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import { useDataQuery, useDataMutation } from '@dhis2/app-runtime';
|
|
3
|
+
import i18n from '@dhis2/d2-i18n';
|
|
4
|
+
import { Button, CircularLoader, IconChevronDown24, IconChevronUp24, IconClock16, IconShare16, IconSubscribe24, IconSubscribeOff24, IconUser16, IconView16, colors } from '@dhis2/ui';
|
|
5
|
+
import cx from 'classnames';
|
|
6
|
+
import moment from 'moment';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
9
|
+
import styles from './styles/AboutAOUnit.style';
|
|
10
|
+
const READ_ONLY = 'r';
|
|
11
|
+
const READ_AND_WRITE = 'rw';
|
|
12
|
+
|
|
13
|
+
const getQueries = type => ({
|
|
14
|
+
ao: {
|
|
15
|
+
resource: type,
|
|
16
|
+
id: ({
|
|
17
|
+
id
|
|
18
|
+
}) => id,
|
|
19
|
+
params: {
|
|
20
|
+
fields: 'id,displayDescription,created,createdBy[displayName],lastUpdated,subscribed,publicAccess,userAccesses[displayName,access],userGroupAccesses[displayName,access]'
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
dataStatistics: {
|
|
24
|
+
resource: 'dataStatistics/favorites',
|
|
25
|
+
id: ({
|
|
26
|
+
id
|
|
27
|
+
}) => id
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const getSubscribeMutation = (type, id) => ({
|
|
32
|
+
resource: "".concat(type, "/").concat(id, "/subscriber"),
|
|
33
|
+
type: 'create'
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const getUnsubscribeMutation = (type, id) => ({
|
|
37
|
+
resource: "".concat(type, "/").concat(id, "/subscriber"),
|
|
38
|
+
type: 'delete'
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const AboutAOUnit = ({
|
|
42
|
+
type,
|
|
43
|
+
id
|
|
44
|
+
}) => {
|
|
45
|
+
const [isExpanded, setIsExpanded] = useState(true);
|
|
46
|
+
const queries = useMemo(() => getQueries(type), []);
|
|
47
|
+
const {
|
|
48
|
+
data,
|
|
49
|
+
loading: dataIsLoading,
|
|
50
|
+
refetch
|
|
51
|
+
} = useDataQuery(queries, {
|
|
52
|
+
lazy: true
|
|
53
|
+
});
|
|
54
|
+
const subscribeMutation = useMemo(() => getSubscribeMutation(type, id), []);
|
|
55
|
+
const unsubscribeMutation = useMemo(() => getUnsubscribeMutation(type, id), []);
|
|
56
|
+
const [subscribe, {
|
|
57
|
+
loading: subscribeIsLoading
|
|
58
|
+
}] = useDataMutation(subscribeMutation, {
|
|
59
|
+
onComplete: res => {
|
|
60
|
+
if (res.status === 'OK') {
|
|
61
|
+
refetch({
|
|
62
|
+
id
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const [unsubscribe, {
|
|
68
|
+
loading: unsubscribeIsLoading
|
|
69
|
+
}] = useDataMutation(unsubscribeMutation, {
|
|
70
|
+
onComplete: res => {
|
|
71
|
+
if (res.status === 'OK') {
|
|
72
|
+
refetch({
|
|
73
|
+
id
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (id) {
|
|
80
|
+
refetch({
|
|
81
|
+
id
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}, [type, id]);
|
|
85
|
+
|
|
86
|
+
const getAccessLevelString = access => {
|
|
87
|
+
const re = new RegExp("(?<accessLevel>".concat(READ_AND_WRITE, "?)"));
|
|
88
|
+
const accessMatch = re.exec(access);
|
|
89
|
+
|
|
90
|
+
switch (accessMatch.groups.accessLevel) {
|
|
91
|
+
case READ_ONLY:
|
|
92
|
+
return i18n.t('view only');
|
|
93
|
+
|
|
94
|
+
case READ_AND_WRITE:
|
|
95
|
+
return i18n.t('view and edit');
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const getSharingSummary = ao => {
|
|
100
|
+
const sharingText = [];
|
|
101
|
+
const re = new RegExp("^".concat(READ_AND_WRITE, "?"));
|
|
102
|
+
|
|
103
|
+
if (re.test(ao.publicAccess)) {
|
|
104
|
+
sharingText.push(i18n.t('all users ({{accessLevel}})', {
|
|
105
|
+
accessLevel: getAccessLevelString(ao.publicAccess)
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const userAccesses = ao.userAccesses;
|
|
110
|
+
const groupAccesses = ao.userGroupAccesses;
|
|
111
|
+
userAccesses.concat(groupAccesses).forEach(accessRule => {
|
|
112
|
+
sharingText.push(i18n.t('{{userOrGroup}} ({{accessLevel}})', {
|
|
113
|
+
userOrGroup: accessRule.displayName,
|
|
114
|
+
accessLevel: getAccessLevelString(accessRule.access)
|
|
115
|
+
}));
|
|
116
|
+
});
|
|
117
|
+
return sharingText.length ? i18n.t('Shared with {{commaSeparatedListOfUsersAndGroups}}', {
|
|
118
|
+
commaSeparatedListOfUsersAndGroups: sharingText.join(', ')
|
|
119
|
+
}) : i18n.t('Not shared with any users or groups');
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
123
|
+
className: "jsx-".concat(styles.__hash) + " " + (cx('container', {
|
|
124
|
+
expanded: isExpanded
|
|
125
|
+
}) || "")
|
|
126
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
127
|
+
onClick: () => setIsExpanded(!isExpanded),
|
|
128
|
+
className: "jsx-".concat(styles.__hash) + " " + "header"
|
|
129
|
+
}, i18n.t('About this visualization'), isExpanded ? /*#__PURE__*/React.createElement(IconChevronUp24, {
|
|
130
|
+
color: colors.grey700
|
|
131
|
+
}) : /*#__PURE__*/React.createElement(IconChevronDown24, {
|
|
132
|
+
color: colors.grey700
|
|
133
|
+
})), isExpanded && /*#__PURE__*/React.createElement(React.Fragment, null, dataIsLoading && /*#__PURE__*/React.createElement("div", {
|
|
134
|
+
className: "jsx-".concat(styles.__hash) + " " + "loader"
|
|
135
|
+
}, /*#__PURE__*/React.createElement(CircularLoader, {
|
|
136
|
+
small: true
|
|
137
|
+
})), data && /*#__PURE__*/React.createElement("div", {
|
|
138
|
+
className: "jsx-".concat(styles.__hash) + " " + "content"
|
|
139
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
140
|
+
className: "jsx-".concat(styles.__hash) + " " + (cx('detailLine', {
|
|
141
|
+
noDescription: !data.ao.displayDescription
|
|
142
|
+
}) || "")
|
|
143
|
+
}, data.ao.displayDescription ? data.ao.displayDescription : i18n.t('No description')), /*#__PURE__*/React.createElement("div", {
|
|
144
|
+
className: "jsx-".concat(styles.__hash)
|
|
145
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
146
|
+
className: "jsx-".concat(styles.__hash) + " " + "detailLine"
|
|
147
|
+
}, /*#__PURE__*/React.createElement(IconShare16, {
|
|
148
|
+
color: colors.grey700
|
|
149
|
+
}), getSharingSummary(data.ao)), /*#__PURE__*/React.createElement("p", {
|
|
150
|
+
className: "jsx-".concat(styles.__hash) + " " + "detailLine"
|
|
151
|
+
}, /*#__PURE__*/React.createElement(IconClock16, {
|
|
152
|
+
color: colors.grey700
|
|
153
|
+
}), i18n.t('Last updated {{time}}', {
|
|
154
|
+
time: moment(data.ao.lastUpdated).fromNow()
|
|
155
|
+
})), /*#__PURE__*/React.createElement("p", {
|
|
156
|
+
className: "jsx-".concat(styles.__hash) + " " + "detailLine"
|
|
157
|
+
}, /*#__PURE__*/React.createElement(IconUser16, {
|
|
158
|
+
color: colors.grey700
|
|
159
|
+
}), i18n.t('Created {{time}} by {{author}}', {
|
|
160
|
+
time: moment(data.ao.created).fromNow(),
|
|
161
|
+
author: data.ao.createdBy.displayName
|
|
162
|
+
})), /*#__PURE__*/React.createElement("p", {
|
|
163
|
+
className: "jsx-".concat(styles.__hash) + " " + "detailLine"
|
|
164
|
+
}, /*#__PURE__*/React.createElement(IconView16, {
|
|
165
|
+
color: colors.grey700
|
|
166
|
+
}), i18n.t('Viewed {{count}} times', {
|
|
167
|
+
count: data.dataStatistics.views,
|
|
168
|
+
defaultValue: 'Viewed 1 time',
|
|
169
|
+
defaultValue_plural: 'Viewed {{count}} times'
|
|
170
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
171
|
+
className: "jsx-".concat(styles.__hash) + " " + "subsection"
|
|
172
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
173
|
+
className: "jsx-".concat(styles.__hash) + " " + "subsectionTitle"
|
|
174
|
+
}, i18n.t('Notifications')), data.ao.subscribed ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", {
|
|
175
|
+
className: "jsx-".concat(styles.__hash) + " " + "subscriptionLabel"
|
|
176
|
+
}, i18n.t("You're subscribed and getting updates about new interpretations.")), /*#__PURE__*/React.createElement(Button, {
|
|
177
|
+
icon: /*#__PURE__*/React.createElement(IconSubscribeOff24, {
|
|
178
|
+
color: colors.grey700
|
|
179
|
+
}),
|
|
180
|
+
secondary: true,
|
|
181
|
+
small: true,
|
|
182
|
+
disabled: unsubscribeIsLoading,
|
|
183
|
+
onClick: unsubscribe
|
|
184
|
+
}, i18n.t('Unsubscribe'))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", {
|
|
185
|
+
className: "jsx-".concat(styles.__hash) + " " + "subscriptionLabel"
|
|
186
|
+
}, i18n.t('Subscribe to get updates about new interpretations.')), /*#__PURE__*/React.createElement(Button, {
|
|
187
|
+
icon: /*#__PURE__*/React.createElement(IconSubscribe24, {
|
|
188
|
+
color: colors.grey700
|
|
189
|
+
}),
|
|
190
|
+
secondary: true,
|
|
191
|
+
small: true,
|
|
192
|
+
disabled: subscribeIsLoading,
|
|
193
|
+
onClick: subscribe
|
|
194
|
+
}, i18n.t('Subscribe')))))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
195
|
+
id: styles.__hash
|
|
196
|
+
}, styles));
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
AboutAOUnit.propTypes = {
|
|
200
|
+
id: PropTypes.string.isRequired,
|
|
201
|
+
type: PropTypes.string.isRequired
|
|
202
|
+
};
|
|
203
|
+
export default AboutAOUnit;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { colors, spacers } from '@dhis2/ui';
|
|
2
|
+
const _defaultExport = [".container.jsx-633421833{padding:".concat(spacers.dp16, ";border-bottom:1px solid ").concat(colors.grey400, ";background-color:").concat(colors.white, ";}"), ".expanded.jsx-633421833{padding-bottom:".concat(spacers.dp32, ";}"), ".loader.jsx-633421833{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}", ".header.jsx-633421833{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;font-size:".concat(spacers.dp16, ";font-weight:500;line-height:21px;color:").concat(colors.grey900, ";}"), ".content.jsx-633421833{font-size:14px;line-height:18px;color:".concat(colors.grey900, ";}"), ".detailLine.jsx-633421833{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin:0;padding:".concat(spacers.dp12, " 0 0 0;gap:").concat(spacers.dp8, ";}"), ".detailLine.jsx-633421833 svg.jsx-633421833{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}", ".noDescription.jsx-633421833{color:".concat(colors.grey600, ";}"), ".subsection.jsx-633421833{margin-top:".concat(spacers.dp24, ";}"), ".subsectionTitle.jsx-633421833{color:".concat(colors.grey700, ";font-weight:500;}"), ".subscriptionLabel.jsx-633421833{margin:".concat(spacers.dp12, " 0 ").concat(spacers.dp8, " 0;}"), ".subsection.jsx-633421833 button.jsx-633421833{margin-top:".concat(spacers.dp8, ";}")];
|
|
3
|
+
_defaultExport.__hash = "633421833";
|
|
4
|
+
export default _defaultExport;
|
|
@@ -96,7 +96,7 @@ export const OpenFileDialog = ({
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
if (filters.searchTerm) {
|
|
99
|
-
queryFilters.push("
|
|
99
|
+
queryFilters.push("displayName:ilike:".concat(filters.searchTerm));
|
|
100
100
|
} // for ER 2.38 only show line list ER types
|
|
101
101
|
|
|
102
102
|
|
package/build/es/index.js
CHANGED
|
@@ -12,7 +12,8 @@ export { default as DimensionMenu } from './components/DimensionMenu';
|
|
|
12
12
|
export { default as PivotTable } from './components/PivotTable/PivotTable';
|
|
13
13
|
export { default as FileMenu } from './components/FileMenu/FileMenu';
|
|
14
14
|
export { default as VisTypeIcon } from './components/VisTypeIcon';
|
|
15
|
-
export { default as LegendKey } from './components/LegendKey/LegendKey';
|
|
15
|
+
export { default as LegendKey } from './components/LegendKey/LegendKey';
|
|
16
|
+
export { default as AboutAOUnit } from './components/AboutAOUnit/AboutAOUnit'; // Api
|
|
16
17
|
|
|
17
18
|
export { default as Analytics } from './api/analytics/Analytics';
|
|
18
19
|
export { apiFetchDimensions, apiFetchRecommendedIds } from './api/dimensions';
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
+
"view only": "view only",
|
|
3
|
+
"view and edit": "view and edit",
|
|
4
|
+
"all users ({{accessLevel}})": "all users ({{accessLevel}})",
|
|
5
|
+
"{{userOrGroup}} ({{accessLevel}})": "{{userOrGroup}} ({{accessLevel}})",
|
|
6
|
+
"Shared with {{commaSeparatedListOfUsersAndGroups}}": "Shared with {{commaSeparatedListOfUsersAndGroups}}",
|
|
7
|
+
"Not shared with any users or groups": "Not shared with any users or groups",
|
|
8
|
+
"About this visualization": "About this visualization",
|
|
9
|
+
"No description": "No description",
|
|
10
|
+
"Last updated {{time}}": "Last updated {{time}}",
|
|
11
|
+
"Created {{time}} by {{author}}": "Created {{time}} by {{author}}",
|
|
12
|
+
"Viewed {{count}} times": "Viewed 1 time",
|
|
13
|
+
"Viewed {{count}} times_plural": "Viewed {{count}} times",
|
|
14
|
+
"Notifications": "Notifications",
|
|
15
|
+
"You're subscribed and getting updates about new interpretations.": "You're subscribed and getting updates about new interpretations.",
|
|
16
|
+
"Unsubscribe": "Unsubscribe",
|
|
17
|
+
"Subscribe to get updates about new interpretations.": "Subscribe to get updates about new interpretations.",
|
|
18
|
+
"Subscribe": "Subscribe",
|
|
2
19
|
"Data Type": "Data Type",
|
|
3
20
|
"All types": "All types",
|
|
4
21
|
"Totals only": "Totals only",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"There was a problem loading items. Try again or contact your system administrator.": "",
|
|
77
77
|
"No items found. Create a new to get started.": "",
|
|
78
78
|
"No items found. Try adjusting your search or filter options to find what you're looking for.": "",
|
|
79
|
-
"Create new": "",
|
|
79
|
+
"Create new": "Создать новый",
|
|
80
80
|
"Open a visualization": "",
|
|
81
81
|
"Loading visualizations": "",
|
|
82
82
|
"Couldn't load visualizations": "",
|