@dhis2/analytics 24.9.0 → 24.9.2
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 +16 -0
- package/build/cjs/components/FileMenu/FileMenu.styles.js +5 -2
- package/build/cjs/components/FileMenu/GetLinkDialog.js +25 -5
- package/build/cjs/components/FileMenu/GetLinkDialog.styles.js +12 -0
- package/build/cjs/components/FileMenu/RenameDialog.js +12 -4
- package/build/cjs/components/FileMenu/SaveAsDialog.js +11 -3
- package/build/cjs/components/FileMenu/__tests__/GetLinkDialog.spec.js +8 -2
- package/build/cjs/components/OfflineTooltip.js +2 -2
- package/build/cjs/components/TranslationDialog/TranslationModal/TranslationModalActions.js +2 -2
- package/build/es/components/FileMenu/FileMenu.styles.js +3 -1
- package/build/es/components/FileMenu/GetLinkDialog.js +23 -6
- package/build/es/components/FileMenu/GetLinkDialog.styles.js +3 -0
- package/build/es/components/FileMenu/RenameDialog.js +10 -4
- package/build/es/components/FileMenu/SaveAsDialog.js +9 -3
- package/build/es/components/FileMenu/__tests__/GetLinkDialog.spec.js +8 -2
- package/build/es/components/OfflineTooltip.js +3 -3
- package/build/es/components/TranslationDialog/TranslationModal/TranslationModalActions.js +3 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [24.9.2](https://github.com/dhis2/analytics/compare/v24.9.1...v24.9.2) (2023-03-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* deduplicate yarn.lock ([#1450](https://github.com/dhis2/analytics/issues/1450)) ([85781ef](https://github.com/dhis2/analytics/commit/85781efeb3f347eabb70ff0db327f888dfcb3da3))
|
|
7
|
+
* prevent wrong URL with duplicated path parts DHIS2-14789 ([#1449](https://github.com/dhis2/analytics/issues/1449)) ([7c5c2a6](https://github.com/dhis2/analytics/commit/7c5c2a6870f14f9a18c155ee7f7817a3055b6205))
|
|
8
|
+
* use connection status to handle local offline conditions ([#1443](https://github.com/dhis2/analytics/issues/1443)) ([df4bb97](https://github.com/dhis2/analytics/commit/df4bb97f52d9bc03555621beadfe929721500e31))
|
|
9
|
+
|
|
10
|
+
## [24.9.1](https://github.com/dhis2/analytics/compare/v24.9.0...v24.9.1) (2023-03-10)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* spacing in Rename and SaveAs dialogs ([#1447](https://github.com/dhis2/analytics/issues/1447)) ([35e1872](https://github.com/dhis2/analytics/commit/35e18724ff88a09d13deedb54e897ad2506c4f08))
|
|
16
|
+
|
|
1
17
|
# [24.9.0](https://github.com/dhis2/analytics/compare/v24.8.0...v24.9.0) (2023-02-24)
|
|
2
18
|
|
|
3
19
|
|
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.fileMenuStyles = void 0;
|
|
6
|
+
exports.modalStyles = exports.fileMenuStyles = void 0;
|
|
7
7
|
|
|
8
8
|
var _ui = require("@dhis2/ui");
|
|
9
9
|
|
|
10
10
|
const fileMenuStyles = [".menu-toggle.jsx-2670121391{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;-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;font-size:14px;font-weight:400;text-transform:none;padding:6px ".concat(_ui.spacers.dp12, ";border-radius:3px;color:").concat(_ui.colors.grey900, ";box-sizing:border-box;line-height:1.75;background:none;border:none;-webkit-transition:background-color 250ms cubic-bezier(0.4,0,0.2,1) 0ms;transition:background-color 250ms cubic-bezier(0.4,0,0.2,1) 0ms;cursor:pointer;}"), ".menu-toggle.jsx-2670121391:hover.jsx-2670121391:enabled{background-color:".concat(_ui.colors.grey200, ";}"), ".menu-toggle.jsx-2670121391:disabled{color:".concat(_ui.colors.grey400, ";cursor:not-allowed;}"), ".menu-toggle.jsx-2670121391:active{background-color:".concat(_ui.colors.grey300, ";}"), ".menuButton.jsx-2670121391:focus{outline:2px solid ".concat(_ui.colors.blue600, ";}"), ".menuButton.jsx-2670121391:focus.jsx-2670121391:not(:focus-visible){outline:none;}"];
|
|
11
11
|
exports.fileMenuStyles = fileMenuStyles;
|
|
12
|
-
fileMenuStyles.__hash = "2670121391";
|
|
12
|
+
fileMenuStyles.__hash = "2670121391";
|
|
13
|
+
const modalStyles = [".modal-content.jsx-3091623050{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:".concat(_ui.spacers.dp12, ";}")];
|
|
14
|
+
exports.modalStyles = modalStyles;
|
|
15
|
+
modalStyles.__hash = "3091623050";
|
|
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.GetLinkDialog = void 0;
|
|
7
7
|
|
|
8
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
+
|
|
10
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
11
|
+
|
|
8
12
|
var _ui = require("@dhis2/ui");
|
|
9
13
|
|
|
10
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -13,6 +17,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
13
17
|
|
|
14
18
|
var _index = _interopRequireDefault(require("../../locales/index.js"));
|
|
15
19
|
|
|
20
|
+
var _GetLinkDialogStyles = require("./GetLinkDialog.styles.js");
|
|
21
|
+
|
|
16
22
|
var _utils = require("./utils.js");
|
|
17
23
|
|
|
18
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -23,13 +29,27 @@ const GetLinkDialog = _ref => {
|
|
|
23
29
|
id,
|
|
24
30
|
onClose
|
|
25
31
|
} = _ref;
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
const {
|
|
33
|
+
baseUrl
|
|
34
|
+
} = (0, _appRuntime.useConfig)(); // TODO simply use href from the visualization object?
|
|
35
|
+
|
|
36
|
+
const appUrl = new URL((0, _utils.appPathFor)(type, id), baseUrl);
|
|
28
37
|
return /*#__PURE__*/_react.default.createElement(_ui.Modal, {
|
|
29
38
|
onClose: onClose
|
|
30
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
31
|
-
|
|
32
|
-
},
|
|
39
|
+
}, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
40
|
+
id: _GetLinkDialogStyles.styles.__hash
|
|
41
|
+
}, _GetLinkDialogStyles.styles), /*#__PURE__*/_react.default.createElement(_ui.ModalContent, null, /*#__PURE__*/_react.default.createElement("p", {
|
|
42
|
+
className: "jsx-".concat(_GetLinkDialogStyles.styles.__hash)
|
|
43
|
+
}, _index.default.t('Open in this app')), /*#__PURE__*/_react.default.createElement("div", {
|
|
44
|
+
className: "jsx-".concat(_GetLinkDialogStyles.styles.__hash) + " " + "link-container"
|
|
45
|
+
}, /*#__PURE__*/_react.default.createElement("a", {
|
|
46
|
+
href: appUrl.href,
|
|
47
|
+
className: "jsx-".concat(_GetLinkDialogStyles.styles.__hash)
|
|
48
|
+
}, appUrl.href), /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
49
|
+
icon: /*#__PURE__*/_react.default.createElement(_ui.IconCopy24, null),
|
|
50
|
+
small: true,
|
|
51
|
+
onClick: () => navigator.clipboard.writeText(appUrl.href)
|
|
52
|
+
}))), /*#__PURE__*/_react.default.createElement(_ui.ModalActions, null, /*#__PURE__*/_react.default.createElement(_ui.ButtonStrip, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
33
53
|
onClick: onClose,
|
|
34
54
|
secondary: true
|
|
35
55
|
}, _index.default.t('Close')))));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.styles = void 0;
|
|
7
|
+
|
|
8
|
+
var _ui = require("@dhis2/ui");
|
|
9
|
+
|
|
10
|
+
const styles = [".link-container.jsx-844167137{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;gap:".concat(_ui.spacers.dp12, ";}")];
|
|
11
|
+
exports.styles = styles;
|
|
12
|
+
styles.__hash = "844167137";
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.RenameDialog = void 0;
|
|
7
7
|
|
|
8
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
+
|
|
8
10
|
var _appRuntime = require("@dhis2/app-runtime");
|
|
9
11
|
|
|
10
12
|
var _ui = require("@dhis2/ui");
|
|
@@ -15,6 +17,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
15
17
|
|
|
16
18
|
var _index = _interopRequireDefault(require("../../locales/index.js"));
|
|
17
19
|
|
|
20
|
+
var _FileMenuStyles = require("./FileMenu.styles.js");
|
|
21
|
+
|
|
18
22
|
var _utils = require("./utils.js");
|
|
19
23
|
|
|
20
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -55,7 +59,7 @@ const RenameDialog = _ref3 => {
|
|
|
55
59
|
} = _ref3;
|
|
56
60
|
const [name, setName] = (0, _react.useState)(object.name);
|
|
57
61
|
const [description, setDescription] = (0, _react.useState)(object.description);
|
|
58
|
-
const mutation = (0, _react.useMemo)(() => getMutation(type), []);
|
|
62
|
+
const mutation = (0, _react.useMemo)(() => getMutation(type), [type]);
|
|
59
63
|
const [mutate, {
|
|
60
64
|
loading
|
|
61
65
|
}] = (0, _appRuntime.useDataMutation)(mutation, {
|
|
@@ -82,9 +86,13 @@ const RenameDialog = _ref3 => {
|
|
|
82
86
|
|
|
83
87
|
return /*#__PURE__*/_react.default.createElement(_ui.Modal, {
|
|
84
88
|
onClose: onClose
|
|
85
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
89
|
+
}, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
90
|
+
id: _FileMenuStyles.modalStyles.__hash
|
|
91
|
+
}, _FileMenuStyles.modalStyles), /*#__PURE__*/_react.default.createElement(_ui.ModalTitle, null, _index.default.t('Rename {{fileType}}', {
|
|
86
92
|
fileType: (0, _utils.labelForFileType)(type)
|
|
87
|
-
})), /*#__PURE__*/_react.default.createElement(_ui.ModalContent, null, /*#__PURE__*/_react.default.createElement(
|
|
93
|
+
})), /*#__PURE__*/_react.default.createElement(_ui.ModalContent, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
94
|
+
className: "jsx-".concat(_FileMenuStyles.modalStyles.__hash) + " " + "modal-content"
|
|
95
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.InputField, {
|
|
88
96
|
label: _index.default.t('Name'),
|
|
89
97
|
disabled: loading,
|
|
90
98
|
required: true,
|
|
@@ -106,7 +114,7 @@ const RenameDialog = _ref3 => {
|
|
|
106
114
|
} = _ref5;
|
|
107
115
|
return setDescription(value);
|
|
108
116
|
}
|
|
109
|
-
})), /*#__PURE__*/_react.default.createElement(_ui.ModalActions, null, /*#__PURE__*/_react.default.createElement(_ui.ButtonStrip, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
117
|
+
}))), /*#__PURE__*/_react.default.createElement(_ui.ModalActions, null, /*#__PURE__*/_react.default.createElement(_ui.ButtonStrip, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
110
118
|
onClick: onClose,
|
|
111
119
|
disabled: loading,
|
|
112
120
|
secondary: true
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.SaveAsDialog = void 0;
|
|
7
7
|
|
|
8
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
+
|
|
8
10
|
var _ui = require("@dhis2/ui");
|
|
9
11
|
|
|
10
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -13,6 +15,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
15
|
|
|
14
16
|
var _index = _interopRequireDefault(require("../../locales/index.js"));
|
|
15
17
|
|
|
18
|
+
var _FileMenuStyles = require("./FileMenu.styles.js");
|
|
19
|
+
|
|
16
20
|
var _utils = require("./utils.js");
|
|
17
21
|
|
|
18
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -46,9 +50,13 @@ const SaveAsDialog = _ref => {
|
|
|
46
50
|
return /*#__PURE__*/_react.default.createElement(_ui.Modal, {
|
|
47
51
|
onClose: onClose,
|
|
48
52
|
dataTest: "file-menu-saveas-modal"
|
|
49
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
53
|
+
}, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
54
|
+
id: _FileMenuStyles.modalStyles.__hash
|
|
55
|
+
}, _FileMenuStyles.modalStyles), /*#__PURE__*/_react.default.createElement(_ui.ModalTitle, null, _index.default.t('Save {{fileType}} as', {
|
|
50
56
|
fileType: (0, _utils.labelForFileType)(type)
|
|
51
|
-
})), /*#__PURE__*/_react.default.createElement(_ui.ModalContent, null, /*#__PURE__*/_react.default.createElement(
|
|
57
|
+
})), /*#__PURE__*/_react.default.createElement(_ui.ModalContent, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
58
|
+
className: "jsx-".concat(_FileMenuStyles.modalStyles.__hash) + " " + "modal-content"
|
|
59
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.InputField, {
|
|
52
60
|
label: _index.default.t('Name'),
|
|
53
61
|
value: name,
|
|
54
62
|
onChange: _ref2 => {
|
|
@@ -69,7 +77,7 @@ const SaveAsDialog = _ref => {
|
|
|
69
77
|
return setDescription(value);
|
|
70
78
|
},
|
|
71
79
|
dataTest: "file-menu-saveas-modal-description"
|
|
72
|
-
})), /*#__PURE__*/_react.default.createElement(_ui.ModalActions, null, /*#__PURE__*/_react.default.createElement(_ui.ButtonStrip, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
80
|
+
}))), /*#__PURE__*/_react.default.createElement(_ui.ModalActions, null, /*#__PURE__*/_react.default.createElement(_ui.ButtonStrip, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
73
81
|
onClick: onClose,
|
|
74
82
|
secondary: true,
|
|
75
83
|
dataTest: "file-menu-saveas-modal-cancel"
|
|
@@ -12,6 +12,12 @@ var _utils = require("../utils.js");
|
|
|
12
12
|
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
|
|
15
|
+
const testBaseUrl = 'http://test.tld/test';
|
|
16
|
+
jest.mock('@dhis2/app-runtime', () => ({
|
|
17
|
+
useConfig: () => ({
|
|
18
|
+
baseUrl: testBaseUrl
|
|
19
|
+
})
|
|
20
|
+
}));
|
|
15
21
|
describe('The FileMenu - GetLinkDialog component', () => {
|
|
16
22
|
let shallowGetLinkDialog;
|
|
17
23
|
let props;
|
|
@@ -38,10 +44,10 @@ describe('The FileMenu - GetLinkDialog component', () => {
|
|
|
38
44
|
});
|
|
39
45
|
it('renders a <a> tag containing the type and id props', () => {
|
|
40
46
|
const href = getGetLinkDialogComponent(props).find('a').prop('href');
|
|
41
|
-
expect(href).toMatch((0, _utils.appPathFor)(props.type, props.id));
|
|
47
|
+
expect(href).toMatch(new URL((0, _utils.appPathFor)(props.type, props.id), testBaseUrl).href);
|
|
42
48
|
});
|
|
43
49
|
it('calls the onClose callback when the Close button is clicked', () => {
|
|
44
|
-
getGetLinkDialogComponent(props).find(_ui.Button).
|
|
50
|
+
getGetLinkDialogComponent(props).find(_ui.Button).at(1).simulate('click');
|
|
45
51
|
expect(onClose).toHaveBeenCalled();
|
|
46
52
|
});
|
|
47
53
|
});
|
|
@@ -31,8 +31,8 @@ const OfflineTooltip = _ref => {
|
|
|
31
31
|
children
|
|
32
32
|
} = _ref;
|
|
33
33
|
const {
|
|
34
|
-
offline
|
|
35
|
-
} = (0, _appRuntime.
|
|
34
|
+
isDisconnected: offline
|
|
35
|
+
} = (0, _appRuntime.useDhis2ConnectionStatus)();
|
|
36
36
|
const notAllowed = disabled || disabledWhenOffline && offline;
|
|
37
37
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ui.Tooltip, {
|
|
38
38
|
content: content || _d2I18n.default.t('Not available offline'),
|
|
@@ -52,8 +52,8 @@ const TranslationModalActions = _ref2 => {
|
|
|
52
52
|
saveButtonDisabled
|
|
53
53
|
} = _ref2;
|
|
54
54
|
const {
|
|
55
|
-
offline
|
|
56
|
-
} = (0, _appRuntime.
|
|
55
|
+
isDisconnected: offline
|
|
56
|
+
} = (0, _appRuntime.useDhis2ConnectionStatus)();
|
|
57
57
|
return /*#__PURE__*/_react.default.createElement(_ui.ModalActions, null, /*#__PURE__*/_react.default.createElement(_ui.ButtonStrip, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
58
58
|
secondary: true,
|
|
59
59
|
onClick: onClose
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { colors, spacers } from '@dhis2/ui';
|
|
2
2
|
export const fileMenuStyles = [".menu-toggle.jsx-2670121391{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;-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;font-size:14px;font-weight:400;text-transform:none;padding:6px ".concat(spacers.dp12, ";border-radius:3px;color:").concat(colors.grey900, ";box-sizing:border-box;line-height:1.75;background:none;border:none;-webkit-transition:background-color 250ms cubic-bezier(0.4,0,0.2,1) 0ms;transition:background-color 250ms cubic-bezier(0.4,0,0.2,1) 0ms;cursor:pointer;}"), ".menu-toggle.jsx-2670121391:hover.jsx-2670121391:enabled{background-color:".concat(colors.grey200, ";}"), ".menu-toggle.jsx-2670121391:disabled{color:".concat(colors.grey400, ";cursor:not-allowed;}"), ".menu-toggle.jsx-2670121391:active{background-color:".concat(colors.grey300, ";}"), ".menuButton.jsx-2670121391:focus{outline:2px solid ".concat(colors.blue600, ";}"), ".menuButton.jsx-2670121391:focus.jsx-2670121391:not(:focus-visible){outline:none;}"];
|
|
3
|
-
fileMenuStyles.__hash = "2670121391";
|
|
3
|
+
fileMenuStyles.__hash = "2670121391";
|
|
4
|
+
export const modalStyles = [".modal-content.jsx-3091623050{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:".concat(spacers.dp12, ";}")];
|
|
5
|
+
modalStyles.__hash = "3091623050";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import { useConfig } from '@dhis2/app-runtime';
|
|
3
|
+
import { Modal, ModalContent, ModalActions, ButtonStrip, Button, IconCopy24 } from '@dhis2/ui';
|
|
2
4
|
import PropTypes from 'prop-types';
|
|
3
5
|
import React from 'react';
|
|
4
6
|
import i18n from '../../locales/index.js';
|
|
7
|
+
import { styles } from './GetLinkDialog.styles.js';
|
|
5
8
|
import { supportedFileTypes, appPathFor } from './utils.js';
|
|
6
9
|
export const GetLinkDialog = _ref => {
|
|
7
10
|
let {
|
|
@@ -9,13 +12,27 @@ export const GetLinkDialog = _ref => {
|
|
|
9
12
|
id,
|
|
10
13
|
onClose
|
|
11
14
|
} = _ref;
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
const {
|
|
16
|
+
baseUrl
|
|
17
|
+
} = useConfig(); // TODO simply use href from the visualization object?
|
|
18
|
+
|
|
19
|
+
const appUrl = new URL(appPathFor(type, id), baseUrl);
|
|
14
20
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
15
21
|
onClose: onClose
|
|
16
|
-
}, /*#__PURE__*/React.createElement(
|
|
17
|
-
|
|
18
|
-
},
|
|
22
|
+
}, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
23
|
+
id: styles.__hash
|
|
24
|
+
}, styles), /*#__PURE__*/React.createElement(ModalContent, null, /*#__PURE__*/React.createElement("p", {
|
|
25
|
+
className: "jsx-".concat(styles.__hash)
|
|
26
|
+
}, i18n.t('Open in this app')), /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: "jsx-".concat(styles.__hash) + " " + "link-container"
|
|
28
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
29
|
+
href: appUrl.href,
|
|
30
|
+
className: "jsx-".concat(styles.__hash)
|
|
31
|
+
}, appUrl.href), /*#__PURE__*/React.createElement(Button, {
|
|
32
|
+
icon: /*#__PURE__*/React.createElement(IconCopy24, null),
|
|
33
|
+
small: true,
|
|
34
|
+
onClick: () => navigator.clipboard.writeText(appUrl.href)
|
|
35
|
+
}))), /*#__PURE__*/React.createElement(ModalActions, null, /*#__PURE__*/React.createElement(ButtonStrip, null, /*#__PURE__*/React.createElement(Button, {
|
|
19
36
|
onClick: onClose,
|
|
20
37
|
secondary: true
|
|
21
38
|
}, i18n.t('Close')))));
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { spacers } from '@dhis2/ui';
|
|
2
|
+
export const styles = [".link-container.jsx-844167137{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;gap:".concat(spacers.dp12, ";}")];
|
|
3
|
+
styles.__hash = "844167137";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
1
2
|
import { useDataMutation } from '@dhis2/app-runtime';
|
|
2
3
|
import { Modal, ModalTitle, ModalContent, ModalActions, ButtonStrip, Button, InputField, TextAreaField } from '@dhis2/ui';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
4
5
|
import React, { useMemo, useState } from 'react';
|
|
5
6
|
import i18n from '../../locales/index.js';
|
|
7
|
+
import { modalStyles } from './FileMenu.styles.js';
|
|
6
8
|
import { supportedFileTypes, endpointFromFileType, labelForFileType } from './utils.js';
|
|
7
9
|
|
|
8
10
|
const getMutation = type => ({
|
|
@@ -37,7 +39,7 @@ export const RenameDialog = _ref3 => {
|
|
|
37
39
|
} = _ref3;
|
|
38
40
|
const [name, setName] = useState(object.name);
|
|
39
41
|
const [description, setDescription] = useState(object.description);
|
|
40
|
-
const mutation = useMemo(() => getMutation(type), []);
|
|
42
|
+
const mutation = useMemo(() => getMutation(type), [type]);
|
|
41
43
|
const [mutate, {
|
|
42
44
|
loading
|
|
43
45
|
}] = useDataMutation(mutation, {
|
|
@@ -64,9 +66,13 @@ export const RenameDialog = _ref3 => {
|
|
|
64
66
|
|
|
65
67
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
66
68
|
onClose: onClose
|
|
67
|
-
}, /*#__PURE__*/React.createElement(
|
|
69
|
+
}, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
70
|
+
id: modalStyles.__hash
|
|
71
|
+
}, modalStyles), /*#__PURE__*/React.createElement(ModalTitle, null, i18n.t('Rename {{fileType}}', {
|
|
68
72
|
fileType: labelForFileType(type)
|
|
69
|
-
})), /*#__PURE__*/React.createElement(ModalContent, null, /*#__PURE__*/React.createElement(
|
|
73
|
+
})), /*#__PURE__*/React.createElement(ModalContent, null, /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: "jsx-".concat(modalStyles.__hash) + " " + "modal-content"
|
|
75
|
+
}, /*#__PURE__*/React.createElement(InputField, {
|
|
70
76
|
label: i18n.t('Name'),
|
|
71
77
|
disabled: loading,
|
|
72
78
|
required: true,
|
|
@@ -88,7 +94,7 @@ export const RenameDialog = _ref3 => {
|
|
|
88
94
|
} = _ref5;
|
|
89
95
|
return setDescription(value);
|
|
90
96
|
}
|
|
91
|
-
})), /*#__PURE__*/React.createElement(ModalActions, null, /*#__PURE__*/React.createElement(ButtonStrip, null, /*#__PURE__*/React.createElement(Button, {
|
|
97
|
+
}))), /*#__PURE__*/React.createElement(ModalActions, null, /*#__PURE__*/React.createElement(ButtonStrip, null, /*#__PURE__*/React.createElement(Button, {
|
|
92
98
|
onClick: onClose,
|
|
93
99
|
disabled: loading,
|
|
94
100
|
secondary: true
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
1
2
|
import { Modal, ModalTitle, ModalContent, ModalActions, ButtonStrip, Button, InputField, TextAreaField } from '@dhis2/ui';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import React, { useState } from 'react';
|
|
4
5
|
import i18n from '../../locales/index.js';
|
|
6
|
+
import { modalStyles } from './FileMenu.styles.js';
|
|
5
7
|
import { supportedFileTypes, labelForFileType } from './utils.js';
|
|
6
8
|
const NAME_MAXLENGTH = 230;
|
|
7
9
|
export const SaveAsDialog = _ref => {
|
|
@@ -27,9 +29,13 @@ export const SaveAsDialog = _ref => {
|
|
|
27
29
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
28
30
|
onClose: onClose,
|
|
29
31
|
dataTest: "file-menu-saveas-modal"
|
|
30
|
-
}, /*#__PURE__*/React.createElement(
|
|
32
|
+
}, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
33
|
+
id: modalStyles.__hash
|
|
34
|
+
}, modalStyles), /*#__PURE__*/React.createElement(ModalTitle, null, i18n.t('Save {{fileType}} as', {
|
|
31
35
|
fileType: labelForFileType(type)
|
|
32
|
-
})), /*#__PURE__*/React.createElement(ModalContent, null, /*#__PURE__*/React.createElement(
|
|
36
|
+
})), /*#__PURE__*/React.createElement(ModalContent, null, /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: "jsx-".concat(modalStyles.__hash) + " " + "modal-content"
|
|
38
|
+
}, /*#__PURE__*/React.createElement(InputField, {
|
|
33
39
|
label: i18n.t('Name'),
|
|
34
40
|
value: name,
|
|
35
41
|
onChange: _ref2 => {
|
|
@@ -50,7 +56,7 @@ export const SaveAsDialog = _ref => {
|
|
|
50
56
|
return setDescription(value);
|
|
51
57
|
},
|
|
52
58
|
dataTest: "file-menu-saveas-modal-description"
|
|
53
|
-
})), /*#__PURE__*/React.createElement(ModalActions, null, /*#__PURE__*/React.createElement(ButtonStrip, null, /*#__PURE__*/React.createElement(Button, {
|
|
59
|
+
}))), /*#__PURE__*/React.createElement(ModalActions, null, /*#__PURE__*/React.createElement(ButtonStrip, null, /*#__PURE__*/React.createElement(Button, {
|
|
54
60
|
onClick: onClose,
|
|
55
61
|
secondary: true,
|
|
56
62
|
dataTest: "file-menu-saveas-modal-cancel"
|
|
@@ -3,6 +3,12 @@ import { shallow } from 'enzyme';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { GetLinkDialog } from '../GetLinkDialog.js';
|
|
5
5
|
import { appPathFor } from '../utils.js';
|
|
6
|
+
const testBaseUrl = 'http://test.tld/test';
|
|
7
|
+
jest.mock('@dhis2/app-runtime', () => ({
|
|
8
|
+
useConfig: () => ({
|
|
9
|
+
baseUrl: testBaseUrl
|
|
10
|
+
})
|
|
11
|
+
}));
|
|
6
12
|
describe('The FileMenu - GetLinkDialog component', () => {
|
|
7
13
|
let shallowGetLinkDialog;
|
|
8
14
|
let props;
|
|
@@ -29,10 +35,10 @@ describe('The FileMenu - GetLinkDialog component', () => {
|
|
|
29
35
|
});
|
|
30
36
|
it('renders a <a> tag containing the type and id props', () => {
|
|
31
37
|
const href = getGetLinkDialogComponent(props).find('a').prop('href');
|
|
32
|
-
expect(href).toMatch(appPathFor(props.type, props.id));
|
|
38
|
+
expect(href).toMatch(new URL(appPathFor(props.type, props.id), testBaseUrl).href);
|
|
33
39
|
});
|
|
34
40
|
it('calls the onClose callback when the Close button is clicked', () => {
|
|
35
|
-
getGetLinkDialogComponent(props).find(Button).
|
|
41
|
+
getGetLinkDialogComponent(props).find(Button).at(1).simulate('click');
|
|
36
42
|
expect(onClose).toHaveBeenCalled();
|
|
37
43
|
});
|
|
38
44
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import {
|
|
2
|
+
import { useDhis2ConnectionStatus } from '@dhis2/app-runtime';
|
|
3
3
|
import i18n from '@dhis2/d2-i18n';
|
|
4
4
|
import { Tooltip } from '@dhis2/ui';
|
|
5
5
|
import cx from 'classnames';
|
|
@@ -15,8 +15,8 @@ const OfflineTooltip = _ref => {
|
|
|
15
15
|
children
|
|
16
16
|
} = _ref;
|
|
17
17
|
const {
|
|
18
|
-
offline
|
|
19
|
-
} =
|
|
18
|
+
isDisconnected: offline
|
|
19
|
+
} = useDhis2ConnectionStatus();
|
|
20
20
|
const notAllowed = disabled || disabledWhenOffline && offline;
|
|
21
21
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
22
22
|
content: content || i18n.t('Not available offline'),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useDhis2ConnectionStatus } from '@dhis2/app-runtime';
|
|
2
2
|
import i18n from '@dhis2/d2-i18n';
|
|
3
3
|
import { Button, ButtonStrip, ModalActions } from '@dhis2/ui';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
@@ -37,8 +37,8 @@ export const TranslationModalActions = _ref2 => {
|
|
|
37
37
|
saveButtonDisabled
|
|
38
38
|
} = _ref2;
|
|
39
39
|
const {
|
|
40
|
-
offline
|
|
41
|
-
} =
|
|
40
|
+
isDisconnected: offline
|
|
41
|
+
} = useDhis2ConnectionStatus();
|
|
42
42
|
return /*#__PURE__*/React.createElement(ModalActions, null, /*#__PURE__*/React.createElement(ButtonStrip, null, /*#__PURE__*/React.createElement(Button, {
|
|
43
43
|
secondary: true,
|
|
44
44
|
onClick: onClose
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2/analytics",
|
|
3
|
-
"version": "24.9.
|
|
3
|
+
"version": "24.9.2",
|
|
4
4
|
"main": "./build/cjs/index.js",
|
|
5
5
|
"module": "./build/es/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"validate-push": "yarn test"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@dhis2/app-runtime": "^3.
|
|
34
|
+
"@dhis2/app-runtime": "^3.9.0",
|
|
35
35
|
"@dhis2/cli-app-scripts": "^9.0.1",
|
|
36
36
|
"@dhis2/cli-style": "^10.4.1",
|
|
37
37
|
"@dhis2/d2-i18n": "^1.1.0",
|