@dhis2/analytics 24.0.5 → 24.0.6
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 +7 -0
- package/build/cjs/__demo__/FileMenu.stories.js +2 -2
- package/build/cjs/components/FileMenu/SaveAsDialog.js +4 -1
- package/build/cjs/components/FileMenu/__tests__/SaveAsDialog.spec.js +2 -2
- package/build/cjs/locales/en/translations.json +1 -0
- package/build/es/__demo__/FileMenu.stories.js +2 -2
- package/build/es/components/FileMenu/SaveAsDialog.js +4 -1
- package/build/es/components/FileMenu/__tests__/SaveAsDialog.spec.js +2 -2
- package/build/es/locales/en/translations.json +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [24.0.6](https://github.com/dhis2/analytics/compare/v24.0.5...v24.0.6) (2022-08-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* change default value for Save as (DHIS2-13328) ([#1325](https://github.com/dhis2/analytics/issues/1325)) ([1957c51](https://github.com/dhis2/analytics/commit/1957c519a47998f3ae637836861a88dac0ec5110))
|
|
7
|
+
|
|
1
8
|
## [24.0.5](https://github.com/dhis2/analytics/compare/v24.0.4...v24.0.5) (2022-08-26)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -24,10 +24,10 @@ const visObject = {
|
|
|
24
24
|
href: 'http://localhost:8080/api/32/visualizations/a8LrqsBQlHP',
|
|
25
25
|
id: 'a8LrqsBQlHP',
|
|
26
26
|
created: '2012-11-05T09:17:23.388',
|
|
27
|
-
name: 'ANC: 1-3 dropout rate Yearly
|
|
27
|
+
name: 'ANC: 1-3 dropout rate Yearly',
|
|
28
28
|
publicAccess: '--------',
|
|
29
29
|
displayDescription: 'some _italic (10%)_ and some *bold (10%)*',
|
|
30
|
-
displayName: 'ANC: 1-3 dropout rate Yearly
|
|
30
|
+
displayName: 'ANC: 1-3 dropout rate Yearly',
|
|
31
31
|
description: 'some _italic (10%)_ and some *bold (10%)*',
|
|
32
32
|
externalAccess: false,
|
|
33
33
|
access: {
|
|
@@ -30,7 +30,9 @@ const SaveAsDialog = _ref => {
|
|
|
30
30
|
onClose,
|
|
31
31
|
onSaveAs
|
|
32
32
|
} = _ref;
|
|
33
|
-
const [name, setName] = (0, _react.useState)(object
|
|
33
|
+
const [name, setName] = (0, _react.useState)(object !== null && object !== void 0 && object.displayName || object !== null && object !== void 0 && object.name ? _index.default.t('{{objectName}} (copy)', {
|
|
34
|
+
objectName: object.name
|
|
35
|
+
}) : '');
|
|
34
36
|
const [description, setDescription] = (0, _react.useState)(object === null || object === void 0 ? void 0 : object.description); // the actual API request is done in the app
|
|
35
37
|
|
|
36
38
|
const saveObjectAs = () => {
|
|
@@ -83,6 +85,7 @@ exports.SaveAsDialog = SaveAsDialog;
|
|
|
83
85
|
SaveAsDialog.propTypes = {
|
|
84
86
|
object: _propTypes.default.shape({
|
|
85
87
|
description: _propTypes.default.string,
|
|
88
|
+
displayName: _propTypes.default.string,
|
|
86
89
|
name: _propTypes.default.string
|
|
87
90
|
}),
|
|
88
91
|
type: _propTypes.default.oneOf(_utils.supportedFileTypes),
|
|
@@ -44,7 +44,7 @@ describe('The FileMenu - SaveAsDialog component', () => {
|
|
|
44
44
|
});
|
|
45
45
|
it('renders a InputField for name with prefilled value from the object prop', () => {
|
|
46
46
|
const nameInputField = getSaveAsDialogComponent(props).findWhere(n => n.prop('label') === 'Name');
|
|
47
|
-
expect(nameInputField.prop('value')).toEqual(
|
|
47
|
+
expect(nameInputField.prop('value')).toEqual('Save as name test (copy)');
|
|
48
48
|
});
|
|
49
49
|
it('renders a TextAreaField for description with prefilled value from the object prop', () => {
|
|
50
50
|
const descriptionInputField = getSaveAsDialogComponent(props).findWhere(n => n.prop('label') === 'Description');
|
|
@@ -53,7 +53,7 @@ describe('The FileMenu - SaveAsDialog component', () => {
|
|
|
53
53
|
it('calls the onSaveAs callback when the Save button is clicked', () => {
|
|
54
54
|
getSaveAsDialogComponent(props).find(_ui.Button).at(1).simulate('click');
|
|
55
55
|
expect(onSaveAs).toHaveBeenCalledWith({
|
|
56
|
-
name:
|
|
56
|
+
name: 'Save as name test (copy)',
|
|
57
57
|
description: props.object.description
|
|
58
58
|
});
|
|
59
59
|
});
|
|
@@ -16,10 +16,10 @@ const visObject = {
|
|
|
16
16
|
href: 'http://localhost:8080/api/32/visualizations/a8LrqsBQlHP',
|
|
17
17
|
id: 'a8LrqsBQlHP',
|
|
18
18
|
created: '2012-11-05T09:17:23.388',
|
|
19
|
-
name: 'ANC: 1-3 dropout rate Yearly
|
|
19
|
+
name: 'ANC: 1-3 dropout rate Yearly',
|
|
20
20
|
publicAccess: '--------',
|
|
21
21
|
displayDescription: 'some _italic (10%)_ and some *bold (10%)*',
|
|
22
|
-
displayName: 'ANC: 1-3 dropout rate Yearly
|
|
22
|
+
displayName: 'ANC: 1-3 dropout rate Yearly',
|
|
23
23
|
description: 'some _italic (10%)_ and some *bold (10%)*',
|
|
24
24
|
externalAccess: false,
|
|
25
25
|
access: {
|
|
@@ -11,7 +11,9 @@ export const SaveAsDialog = _ref => {
|
|
|
11
11
|
onClose,
|
|
12
12
|
onSaveAs
|
|
13
13
|
} = _ref;
|
|
14
|
-
const [name, setName] = useState(object
|
|
14
|
+
const [name, setName] = useState(object !== null && object !== void 0 && object.displayName || object !== null && object !== void 0 && object.name ? i18n.t('{{objectName}} (copy)', {
|
|
15
|
+
objectName: object.name
|
|
16
|
+
}) : '');
|
|
15
17
|
const [description, setDescription] = useState(object === null || object === void 0 ? void 0 : object.description); // the actual API request is done in the app
|
|
16
18
|
|
|
17
19
|
const saveObjectAs = () => {
|
|
@@ -62,6 +64,7 @@ export const SaveAsDialog = _ref => {
|
|
|
62
64
|
SaveAsDialog.propTypes = {
|
|
63
65
|
object: PropTypes.shape({
|
|
64
66
|
description: PropTypes.string,
|
|
67
|
+
displayName: PropTypes.string,
|
|
65
68
|
name: PropTypes.string
|
|
66
69
|
}),
|
|
67
70
|
type: PropTypes.oneOf(supportedFileTypes),
|
|
@@ -36,7 +36,7 @@ describe('The FileMenu - SaveAsDialog component', () => {
|
|
|
36
36
|
});
|
|
37
37
|
it('renders a InputField for name with prefilled value from the object prop', () => {
|
|
38
38
|
const nameInputField = getSaveAsDialogComponent(props).findWhere(n => n.prop('label') === 'Name');
|
|
39
|
-
expect(nameInputField.prop('value')).toEqual(
|
|
39
|
+
expect(nameInputField.prop('value')).toEqual('Save as name test (copy)');
|
|
40
40
|
});
|
|
41
41
|
it('renders a TextAreaField for description with prefilled value from the object prop', () => {
|
|
42
42
|
const descriptionInputField = getSaveAsDialogComponent(props).findWhere(n => n.prop('label') === 'Description');
|
|
@@ -45,7 +45,7 @@ describe('The FileMenu - SaveAsDialog component', () => {
|
|
|
45
45
|
it('calls the onSaveAs callback when the Save button is clicked', () => {
|
|
46
46
|
getSaveAsDialogComponent(props).find(Button).at(1).simulate('click');
|
|
47
47
|
expect(onSaveAs).toHaveBeenCalledWith({
|
|
48
|
-
name:
|
|
48
|
+
name: 'Save as name test (copy)',
|
|
49
49
|
description: props.object.description
|
|
50
50
|
});
|
|
51
51
|
});
|