@dhis2/analytics 21.0.0 → 21.0.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
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [21.0.1](https://github.com/dhis2/analytics/compare/v21.0.0...v21.0.1) (2021-11-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* use Intl.ListFormat for formatting the sharing list ([#1086](https://github.com/dhis2/analytics/issues/1086)) ([68e2889](https://github.com/dhis2/analytics/commit/68e288955185be0429206af88ca50bf70873ac81))
|
|
7
|
+
|
|
1
8
|
# [21.0.0](https://github.com/dhis2/analytics/compare/v20.7.0...v21.0.0) (2021-11-16)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -21,6 +21,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
21
21
|
|
|
22
22
|
var _react = _interopRequireWildcard(require("react"));
|
|
23
23
|
|
|
24
|
+
var _list = require("../../modules/list");
|
|
25
|
+
|
|
24
26
|
var _AboutAOUnit = _interopRequireDefault(require("./styles/AboutAOUnit.style"));
|
|
25
27
|
|
|
26
28
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -119,11 +121,11 @@ const AboutAOUnit = ({
|
|
|
119
121
|
};
|
|
120
122
|
|
|
121
123
|
const getSharingSummary = ao => {
|
|
122
|
-
const
|
|
124
|
+
const sharingTextParts = [];
|
|
123
125
|
const re = new RegExp("^".concat(READ_AND_WRITE, "?"));
|
|
124
126
|
|
|
125
127
|
if (re.test(ao.publicAccess)) {
|
|
126
|
-
|
|
128
|
+
sharingTextParts.push(_d2I18n.default.t('all users ({{accessLevel}})', {
|
|
127
129
|
accessLevel: getAccessLevelString(ao.publicAccess)
|
|
128
130
|
}));
|
|
129
131
|
}
|
|
@@ -131,13 +133,13 @@ const AboutAOUnit = ({
|
|
|
131
133
|
const userAccesses = ao.userAccesses;
|
|
132
134
|
const groupAccesses = ao.userGroupAccesses;
|
|
133
135
|
userAccesses.concat(groupAccesses).forEach(accessRule => {
|
|
134
|
-
|
|
136
|
+
sharingTextParts.push(_d2I18n.default.t('{{userOrGroup}} ({{accessLevel}})', {
|
|
135
137
|
userOrGroup: accessRule.displayName,
|
|
136
138
|
accessLevel: getAccessLevelString(accessRule.access)
|
|
137
139
|
}));
|
|
138
140
|
});
|
|
139
|
-
return
|
|
140
|
-
commaSeparatedListOfUsersAndGroups:
|
|
141
|
+
return sharingTextParts.length ? _d2I18n.default.t('Shared with {{commaSeparatedListOfUsersAndGroups}}', {
|
|
142
|
+
commaSeparatedListOfUsersAndGroups: (0, _list.formatList)(sharingTextParts)
|
|
141
143
|
}) : _d2I18n.default.t('Not shared with any users or groups');
|
|
142
144
|
};
|
|
143
145
|
|
|
@@ -6,6 +6,7 @@ import cx from 'classnames';
|
|
|
6
6
|
import moment from 'moment';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
9
|
+
import { formatList } from '../../modules/list';
|
|
9
10
|
import styles from './styles/AboutAOUnit.style';
|
|
10
11
|
const READ_ONLY = 'r';
|
|
11
12
|
const READ_AND_WRITE = 'rw';
|
|
@@ -97,11 +98,11 @@ const AboutAOUnit = ({
|
|
|
97
98
|
};
|
|
98
99
|
|
|
99
100
|
const getSharingSummary = ao => {
|
|
100
|
-
const
|
|
101
|
+
const sharingTextParts = [];
|
|
101
102
|
const re = new RegExp("^".concat(READ_AND_WRITE, "?"));
|
|
102
103
|
|
|
103
104
|
if (re.test(ao.publicAccess)) {
|
|
104
|
-
|
|
105
|
+
sharingTextParts.push(i18n.t('all users ({{accessLevel}})', {
|
|
105
106
|
accessLevel: getAccessLevelString(ao.publicAccess)
|
|
106
107
|
}));
|
|
107
108
|
}
|
|
@@ -109,13 +110,13 @@ const AboutAOUnit = ({
|
|
|
109
110
|
const userAccesses = ao.userAccesses;
|
|
110
111
|
const groupAccesses = ao.userGroupAccesses;
|
|
111
112
|
userAccesses.concat(groupAccesses).forEach(accessRule => {
|
|
112
|
-
|
|
113
|
+
sharingTextParts.push(i18n.t('{{userOrGroup}} ({{accessLevel}})', {
|
|
113
114
|
userOrGroup: accessRule.displayName,
|
|
114
115
|
accessLevel: getAccessLevelString(accessRule.access)
|
|
115
116
|
}));
|
|
116
117
|
});
|
|
117
|
-
return
|
|
118
|
-
commaSeparatedListOfUsersAndGroups:
|
|
118
|
+
return sharingTextParts.length ? i18n.t('Shared with {{commaSeparatedListOfUsersAndGroups}}', {
|
|
119
|
+
commaSeparatedListOfUsersAndGroups: formatList(sharingTextParts)
|
|
119
120
|
}) : i18n.t('Not shared with any users or groups');
|
|
120
121
|
};
|
|
121
122
|
|