@dhis2/analytics 22.0.1 → 23.1.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,29 @@
1
+ ## [23.1.1](https://github.com/dhis2/analytics/compare/v23.1.0...v23.1.1) (2022-02-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **translations:** sync translations from transifex (master) ([92f1a2d](https://github.com/dhis2/analytics/commit/92f1a2d91f5552d3c9ffb9b3ee627cda5fc56570))
7
+
8
+ # [23.1.0](https://github.com/dhis2/analytics/compare/v23.0.0...v23.1.0) (2022-02-03)
9
+
10
+
11
+ ### Features
12
+
13
+ * export apiFetchItemsByDimension ([#1145](https://github.com/dhis2/analytics/issues/1145)) ([3e5957d](https://github.com/dhis2/analytics/commit/3e5957d20ceb5f997fcda8fca1663a6723fcfe0c))
14
+
15
+ # [23.0.0](https://github.com/dhis2/analytics/compare/v22.0.1...v23.0.0) (2022-02-03)
16
+
17
+
18
+ ### Features
19
+
20
+ * reworked the vis type filter in OpenFileDialog ([#1126](https://github.com/dhis2/analytics/issues/1126)) ([f63aed3](https://github.com/dhis2/analytics/commit/f63aed35bca69b94c8c73356e140a88f34a947e7))
21
+
22
+
23
+ ### BREAKING CHANGES
24
+
25
+ * Apps that want the vis type filter enabled in the OpenFileDialog need to pass new props: filterVisTypes and defaultFilterVisType.
26
+
1
27
  ## [22.0.1](https://github.com/dhis2/analytics/compare/v22.0.0...v22.0.1) (2022-02-02)
2
28
 
3
29
 
@@ -8,6 +8,8 @@ var _react2 = _interopRequireDefault(require("react"));
8
8
 
9
9
  var _OpenFileDialog = require("../components/OpenFileDialog/OpenFileDialog.js");
10
10
 
11
+ var _visTypes = require("../modules/visTypes.js");
12
+
11
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
14
 
13
15
  const configMock = {
@@ -22,17 +24,30 @@ const user = {
22
24
 
23
25
  const onFileSelect = id => alert("Opening ".concat(id));
24
26
 
25
- (0, _react.storiesOf)('OpenFileDialog', module).add('List of visualizations', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.Provider, {
27
+ const filterVisTypesWithGroupsAndDivider = [{
28
+ type: _visTypes.VIS_TYPE_GROUP_ALL
29
+ }, {
30
+ type: _visTypes.VIS_TYPE_GROUP_CHARTS,
31
+ insertDivider: true
32
+ }, {
33
+ type: _visTypes.VIS_TYPE_PIVOT_TABLE
34
+ }, {
35
+ type: _visTypes.VIS_TYPE_COLUMN
36
+ }, {
37
+ type: _visTypes.VIS_TYPE_BAR
38
+ }];
39
+ (0, _react.storiesOf)('OpenFileDialog', module).add('List of visualizations with vis type filter and divider (no default vis type)', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.Provider, {
26
40
  config: configMock
27
41
  }, /*#__PURE__*/_react2.default.createElement(_OpenFileDialog.OpenFileDialog, {
28
42
  type: "visualization",
43
+ filterVisTypes: filterVisTypesWithGroupsAndDivider,
29
44
  onClose: Function.prototype,
30
45
  onFileSelect: onFileSelect,
31
46
  onNew: Function.prototype,
32
47
  open: true,
33
48
  currentUser: user
34
49
  })));
35
- (0, _react.storiesOf)('OpenFileDialog', module).add('List of maps', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.Provider, {
50
+ (0, _react.storiesOf)('OpenFileDialog', module).add('List of maps (no vis type filter)', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.Provider, {
36
51
  config: configMock
37
52
  }, /*#__PURE__*/_react2.default.createElement(_OpenFileDialog.OpenFileDialog, {
38
53
  type: "map",
@@ -42,20 +57,38 @@ const onFileSelect = id => alert("Opening ".concat(id));
42
57
  open: true,
43
58
  currentUser: user
44
59
  })));
45
- (0, _react.storiesOf)('OpenFileDialog', module).add('List of event reports (Line list only)', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.Provider, {
60
+ const filterVisTypesWithDisabled = [{
61
+ type: _visTypes.VIS_TYPE_PIVOT_TABLE,
62
+ disabled: true
63
+ }, {
64
+ type: _visTypes.VIS_TYPE_LINE_LIST
65
+ }];
66
+ (0, _react.storiesOf)('OpenFileDialog', module).add('List of event visualizations with vis type filter, disabled type and default vis type', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.Provider, {
46
67
  config: configMock
47
68
  }, /*#__PURE__*/_react2.default.createElement(_OpenFileDialog.OpenFileDialog, {
48
- type: "eventReport",
69
+ type: "eventVisualization",
70
+ filterVisTypes: filterVisTypesWithDisabled,
71
+ defaultFilterVisType: _visTypes.VIS_TYPE_LINE_LIST,
49
72
  onClose: Function.prototype,
50
73
  onFileSelect: onFileSelect,
51
74
  onNew: Function.prototype,
52
75
  open: true,
53
76
  currentUser: user
54
77
  })));
55
- (0, _react.storiesOf)('OpenFileDialog', module).add('List of a supported type without custom titles/texts', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.Provider, {
78
+ const filterVisTypesWithGroupDividerAndDisabled = [{
79
+ type: _visTypes.VIS_TYPE_GROUP_ALL
80
+ }, {
81
+ type: _visTypes.VIS_TYPE_BAR,
82
+ insertDivider: true
83
+ }, {
84
+ type: _visTypes.VIS_TYPE_COLUMN,
85
+ disabled: true
86
+ }];
87
+ (0, _react.storiesOf)('OpenFileDialog', module).add('List of visualizations with vis type filter with group type, divider and disabled option (no default vis type)', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.Provider, {
56
88
  config: configMock
57
89
  }, /*#__PURE__*/_react2.default.createElement(_OpenFileDialog.OpenFileDialog, {
58
- type: "eventChart",
90
+ type: "visualization",
91
+ filterVisTypes: filterVisTypesWithGroupDividerAndDisabled,
59
92
  onClose: Function.prototype,
60
93
  onFileSelect: onFileSelect,
61
94
  onNew: Function.prototype,
@@ -39,8 +39,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
39
39
 
40
40
  const FileMenu = ({
41
41
  currentUser,
42
+ defaultFilterVisType,
42
43
  fileType,
43
44
  fileObject,
45
+ filterVisTypes,
44
46
  onNew,
45
47
  onOpen,
46
48
  onSave,
@@ -155,6 +157,8 @@ const FileMenu = ({
155
157
  }, _index.default.t('File'))), /*#__PURE__*/_react.default.createElement(_OpenFileDialog.OpenFileDialog, {
156
158
  open: currentDialog === 'open',
157
159
  type: fileType,
160
+ filterVisTypes: filterVisTypes,
161
+ defaultFilterVisType: defaultFilterVisType,
158
162
  onClose: onDialogClose,
159
163
  onFileSelect: id => {
160
164
  onOpen(id);
@@ -265,8 +269,10 @@ FileMenu.defaultProps = {
265
269
  };
266
270
  FileMenu.propTypes = {
267
271
  currentUser: _propTypes.default.object,
272
+ defaultFilterVisType: _propTypes.default.string,
268
273
  fileObject: _propTypes.default.object,
269
274
  fileType: _propTypes.default.oneOf(_utils.supportedFileTypes),
275
+ filterVisTypes: _propTypes.default.array,
270
276
  onDelete: _propTypes.default.func,
271
277
  onError: _propTypes.default.func,
272
278
  onNew: _propTypes.default.func,
@@ -7,6 +7,10 @@ exports.default = exports.CustomSelectOption = void 0;
7
7
 
8
8
  var _style = _interopRequireDefault(require("styled-jsx/style"));
9
9
 
10
+ var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
11
+
12
+ var _ui = require("@dhis2/ui");
13
+
10
14
  var _classnames = _interopRequireDefault(require("classnames"));
11
15
 
12
16
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -17,14 +21,15 @@ var _CustomSelectOptionStyle = _interopRequireDefault(require("./styles/CustomSe
17
21
 
18
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
23
 
20
- const CustomSelectOption = ({
24
+ const CustomSelectOptionItem = ({
21
25
  value,
22
26
  label,
23
27
  icon,
28
+ insertDivider,
24
29
  onClick,
25
30
  active,
26
31
  disabled
27
- }) => /*#__PURE__*/_react.default.createElement("div", {
32
+ }) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
28
33
  onClick: e => onClick({}, e),
29
34
  "data-value": value,
30
35
  "data-label": label,
@@ -33,10 +38,18 @@ const CustomSelectOption = ({
33
38
  disabled
34
39
  }) || "")
35
40
  }, icon, /*#__PURE__*/_react.default.createElement("span", {
36
- className: "jsx-".concat(_CustomSelectOptionStyle.default.__hash) + " " + "label"
41
+ className: "jsx-".concat(_CustomSelectOptionStyle.default.__hash) + " " + ((0, _classnames.default)({
42
+ label: icon
43
+ }) || "")
37
44
  }, label), /*#__PURE__*/_react.default.createElement(_style.default, {
38
45
  id: _CustomSelectOptionStyle.default.__hash
39
- }, _CustomSelectOptionStyle.default));
46
+ }, _CustomSelectOptionStyle.default)), insertDivider && /*#__PURE__*/_react.default.createElement(_ui.MenuDivider, {
47
+ dense: true
48
+ }));
49
+
50
+ const CustomSelectOption = props => props.disabled ? /*#__PURE__*/_react.default.createElement(_ui.Tooltip, {
51
+ content: _d2I18n.default.t('Not supported by this app yet')
52
+ }, /*#__PURE__*/_react.default.createElement(CustomSelectOptionItem, props)) : /*#__PURE__*/_react.default.createElement(CustomSelectOptionItem, props);
40
53
 
41
54
  exports.CustomSelectOption = CustomSelectOption;
42
55
  CustomSelectOption.propTypes = {
@@ -47,5 +60,6 @@ CustomSelectOption.propTypes = {
47
60
  disabled: _propTypes.default.bool,
48
61
  onClick: _propTypes.default.func
49
62
  };
63
+ CustomSelectOptionItem.propTypes = CustomSelectOption.propTypes;
50
64
  var _default = CustomSelectOption;
51
65
  exports.default = _default;
@@ -18,14 +18,14 @@ var _DateField = require("./DateField.js");
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
20
20
  const FileList = ({
21
- type,
22
21
  data,
23
- onSelect
22
+ onSelect,
23
+ showVisTypeColumn
24
24
  }) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, data.map(visualization => /*#__PURE__*/_react.default.createElement(_ui.DataTableRow, {
25
25
  key: visualization.id
26
26
  }, /*#__PURE__*/_react.default.createElement(_ui.DataTableCell, {
27
27
  onClick: () => onSelect(visualization.id)
28
- }, visualization.displayName), type === 'visualization' && /*#__PURE__*/_react.default.createElement(_ui.DataTableCell, {
28
+ }, visualization.displayName), showVisTypeColumn && /*#__PURE__*/_react.default.createElement(_ui.DataTableCell, {
29
29
  align: "center"
30
30
  }, /*#__PURE__*/_react.default.createElement(_VisTypeIcon.VisTypeIcon, {
31
31
  type: visualization.type,
@@ -46,8 +46,8 @@ FileList.propTypes = {
46
46
  lastUpdated: _propTypes.default.string.isRequired,
47
47
  type: _propTypes.default.string
48
48
  })).isRequired,
49
- type: _propTypes.default.string.isRequired,
50
- onSelect: _propTypes.default.func.isRequired
49
+ onSelect: _propTypes.default.func.isRequired,
50
+ showVisTypeColumn: _propTypes.default.bool
51
51
  };
52
52
  var _default = FileList;
53
53
  exports.default = _default;
@@ -19,6 +19,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
19
19
 
20
20
  var _react = _interopRequireWildcard(require("react"));
21
21
 
22
+ var _visTypes = require("../../modules/visTypes.js");
23
+
22
24
  var _CreatedByFilter = require("./CreatedByFilter.js");
23
25
 
24
26
  var _FileList = require("./FileList.js");
@@ -68,6 +70,8 @@ const getQuery = type => ({
68
70
  const OpenFileDialog = ({
69
71
  type,
70
72
  open,
73
+ filterVisTypes,
74
+ defaultFilterVisType,
71
75
  onClose,
72
76
  onFileSelect,
73
77
  onNew,
@@ -77,7 +81,7 @@ const OpenFileDialog = ({
77
81
  const defaultFilters = {
78
82
  searchTerm: '',
79
83
  createdBy: _CreatedByFilter.CREATED_BY_ALL,
80
- visType: _VisTypeFilter.VIS_TYPE_ALL
84
+ visType: defaultFilterVisType
81
85
  };
82
86
  const [{
83
87
  sortField,
@@ -108,26 +112,23 @@ const OpenFileDialog = ({
108
112
  break;
109
113
  }
110
114
 
111
- switch (filters.visType) {
112
- case _VisTypeFilter.VIS_TYPE_ALL:
113
- break;
115
+ if (filters.visType) {
116
+ switch (filters.visType) {
117
+ case _visTypes.VIS_TYPE_GROUP_ALL:
118
+ break;
114
119
 
115
- case _VisTypeFilter.VIS_TYPE_CHARTS:
116
- queryFilters.push('type:!eq:PIVOT_TABLE');
117
- break;
120
+ case _visTypes.VIS_TYPE_GROUP_CHARTS:
121
+ queryFilters.push('type:!eq:PIVOT_TABLE');
122
+ break;
118
123
 
119
- default:
120
- queryFilters.push("type:eq:".concat(filters.visType));
121
- break;
124
+ default:
125
+ queryFilters.push("type:eq:".concat(filters.visType));
126
+ break;
127
+ }
122
128
  }
123
129
 
124
130
  if (filters.searchTerm) {
125
131
  queryFilters.push("name:ilike:".concat(filters.searchTerm));
126
- } // for ER 2.38 only show line list ER types
127
-
128
-
129
- if (type === _utils.AO_TYPE_EVENT_REPORT || type === _utils.AO_TYPE_EVENT_VISUALIZATION) {
130
- queryFilters.push('dataType:eq:EVENTS');
131
132
  }
132
133
 
133
134
  return queryFilters;
@@ -153,7 +154,8 @@ const OpenFileDialog = ({
153
154
  refetch({
154
155
  page,
155
156
  sortField,
156
- sortDirection
157
+ sortDirection,
158
+ filters: formatFilters()
157
159
  });
158
160
  }
159
161
  }, [open, page, sortField, sortDirection]);
@@ -183,7 +185,7 @@ const OpenFileDialog = ({
183
185
  width: '110px'
184
186
  }];
185
187
 
186
- if (type === _utils.AO_TYPE_VISUALIZATION) {
188
+ if (filterVisTypes !== null && filterVisTypes !== void 0 && filterVisTypes.length) {
187
189
  headers.splice(1, 0, {
188
190
  field: 'type',
189
191
  label: _d2I18n.default.t('Type'),
@@ -216,9 +218,10 @@ const OpenFileDialog = ({
216
218
  searchTerm: value
217
219
  }), 200));
218
220
  }
219
- })), type === _utils.AO_TYPE_VISUALIZATION && /*#__PURE__*/_react.default.createElement("div", {
221
+ })), (filterVisTypes === null || filterVisTypes === void 0 ? void 0 : filterVisTypes.length) && /*#__PURE__*/_react.default.createElement("div", {
220
222
  className: "jsx-".concat(_OpenFileDialogStyles.styles.__hash) + " " + "type-field-container"
221
223
  }, /*#__PURE__*/_react.default.createElement(_VisTypeFilter.VisTypeFilter, {
224
+ visTypes: filterVisTypes,
222
225
  selected: filters.visType,
223
226
  onChange: value => setFilters({ ...filters,
224
227
  visType: value
@@ -287,9 +290,9 @@ const OpenFileDialog = ({
287
290
  onClose();
288
291
  }
289
292
  }, (0, _utils.getTranslatedString)(type, 'newButtonLabel'))))))))), (data === null || data === void 0 ? void 0 : data.files[_utils.AOTypeMap[type].apiEndpoint].length) > 0 && /*#__PURE__*/_react.default.createElement(_FileList.FileList, {
290
- type: type,
291
293
  data: data.files[_utils.AOTypeMap[type].apiEndpoint],
292
- onSelect: onFileSelect
294
+ onSelect: onFileSelect,
295
+ showVisTypeColumn: Boolean(filterVisTypes === null || filterVisTypes === void 0 ? void 0 : filterVisTypes.length)
293
296
  }))), (data === null || data === void 0 ? void 0 : data.files[_utils.AOTypeMap[type].apiEndpoint].length) > 0 && /*#__PURE__*/_react.default.createElement(_ui.DataTableToolbar, {
294
297
  position: "bottom"
295
298
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -310,7 +313,9 @@ OpenFileDialog.propTypes = {
310
313
  type: _propTypes.default.oneOf(Object.keys(_utils.AOTypeMap)).isRequired,
311
314
  onClose: _propTypes.default.func.isRequired,
312
315
  onFileSelect: _propTypes.default.func.isRequired,
313
- onNew: _propTypes.default.func.isRequired
316
+ onNew: _propTypes.default.func.isRequired,
317
+ defaultFilterVisType: _propTypes.default.string,
318
+ filterVisTypes: _propTypes.default.array
314
319
  };
315
320
  var _default = OpenFileDialog;
316
321
  exports.default = _default;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.VisTypeFilter = exports.VIS_TYPE_CHARTS = exports.VIS_TYPE_ALL = void 0;
6
+ exports.default = exports.VisTypeFilter = void 0;
7
7
 
8
8
  var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
9
9
 
@@ -21,12 +21,8 @@ var _CustomSelectOption = require("./CustomSelectOption.js");
21
21
 
22
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
23
 
24
- const VIS_TYPE_ALL = 'all';
25
- exports.VIS_TYPE_ALL = VIS_TYPE_ALL;
26
- const VIS_TYPE_CHARTS = 'charts';
27
- exports.VIS_TYPE_CHARTS = VIS_TYPE_CHARTS;
28
-
29
24
  const VisTypeFilter = ({
25
+ visTypes,
30
26
  selected,
31
27
  onChange
32
28
  }) => /*#__PURE__*/_react.default.createElement(_ui.SingleSelect, {
@@ -37,26 +33,31 @@ const VisTypeFilter = ({
37
33
  prefix: _d2I18n.default.t('Type'),
38
34
  dense: true,
39
35
  maxHeight: "400px"
40
- }, /*#__PURE__*/_react.default.createElement(_ui.SingleSelectOption, {
41
- label: _d2I18n.default.t('All types'),
42
- value: VIS_TYPE_ALL
43
- }), /*#__PURE__*/_react.default.createElement(_ui.SingleSelectOption, {
44
- label: _d2I18n.default.t('All charts'),
45
- value: VIS_TYPE_CHARTS
46
- }), /*#__PURE__*/_react.default.createElement(_ui.Divider, null), Object.entries(_visTypes.visTypeDisplayNames).map(([type, label]) => /*#__PURE__*/_react.default.createElement(_CustomSelectOption.CustomSelectOption, {
36
+ }, visTypes === null || visTypes === void 0 ? void 0 : visTypes.map(({
37
+ type,
38
+ disabled,
39
+ insertDivider
40
+ }) => /*#__PURE__*/_react.default.createElement(_CustomSelectOption.CustomSelectOption, {
47
41
  key: type,
48
- label: label,
42
+ disabled: disabled,
43
+ label: (0, _visTypes.getDisplayNameByVisType)(type),
44
+ insertDivider: insertDivider,
49
45
  value: type,
50
- icon: /*#__PURE__*/_react.default.createElement(_VisTypeIcon.VisTypeIcon, {
46
+ icon: _visTypes.visTypeIcons[type] ? /*#__PURE__*/_react.default.createElement(_VisTypeIcon.VisTypeIcon, {
51
47
  type: type,
52
48
  useSmall: true,
53
49
  color: _ui.colors.grey600
54
- })
50
+ }) : undefined
55
51
  })));
56
52
 
57
53
  exports.VisTypeFilter = VisTypeFilter;
58
54
  VisTypeFilter.propTypes = {
59
55
  selected: _propTypes.default.string,
56
+ visTypes: _propTypes.default.arrayOf(_propTypes.default.shape({
57
+ disabled: _propTypes.default.bool,
58
+ insertDivider: _propTypes.default.bool,
59
+ type: _propTypes.default.string
60
+ })),
60
61
  onChange: _propTypes.default.func
61
62
  };
62
63
  var _default = VisTypeFilter;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getTranslatedString = exports.AOTypeMap = exports.AO_TYPE_EVENT_VISUALIZATION = exports.AO_TYPE_EVENT_REPORT = exports.AO_TYPE_EVENT_CHART = exports.AO_TYPE_MAP = exports.AO_TYPE_VISUALIZATION = void 0;
6
+ exports.getTranslatedString = exports.AOTypeMap = exports.AO_TYPE_EVENT_VISUALIZATION = exports.AO_TYPE_MAP = exports.AO_TYPE_VISUALIZATION = void 0;
7
7
 
8
8
  var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
9
9
 
@@ -13,10 +13,6 @@ const AO_TYPE_VISUALIZATION = 'visualization';
13
13
  exports.AO_TYPE_VISUALIZATION = AO_TYPE_VISUALIZATION;
14
14
  const AO_TYPE_MAP = 'map';
15
15
  exports.AO_TYPE_MAP = AO_TYPE_MAP;
16
- const AO_TYPE_EVENT_CHART = 'eventChart';
17
- exports.AO_TYPE_EVENT_CHART = AO_TYPE_EVENT_CHART;
18
- const AO_TYPE_EVENT_REPORT = 'eventReport';
19
- exports.AO_TYPE_EVENT_REPORT = AO_TYPE_EVENT_REPORT;
20
16
  const AO_TYPE_EVENT_VISUALIZATION = 'eventVisualization';
21
17
  exports.AO_TYPE_EVENT_VISUALIZATION = AO_TYPE_EVENT_VISUALIZATION;
22
18
  const AOTypeMap = {
@@ -26,20 +22,14 @@ const AOTypeMap = {
26
22
  [AO_TYPE_MAP]: {
27
23
  apiEndpoint: 'maps'
28
24
  },
29
- [AO_TYPE_EVENT_CHART]: {
30
- apiEndpoint: 'eventCharts'
31
- },
32
- [AO_TYPE_EVENT_REPORT]: {
33
- apiEndpoint: 'eventReports'
34
- },
35
25
  [AO_TYPE_EVENT_VISUALIZATION]: {
36
26
  apiEndpoint: 'eventVisualizations'
37
27
  }
38
28
  };
39
29
  exports.AOTypeMap = AOTypeMap;
40
-
41
- const getTranslatedString = (type, key) => {
42
- let texts = {
30
+ const NO_TYPE = 'NO_TYPE';
31
+ const texts = {
32
+ [NO_TYPE]: {
43
33
  modalTitle: _d2I18n.default.t('Open'),
44
34
  loadingText: _d2I18n.default.t('Loading'),
45
35
  errorTitle: _d2I18n.default.t("Couldn't load items"),
@@ -47,67 +37,36 @@ const getTranslatedString = (type, key) => {
47
37
  noDataText: _d2I18n.default.t('No items found. Create a new to get started.'),
48
38
  noFilteredDataText: _d2I18n.default.t("No items found. Try adjusting your search or filter options to find what you're looking for."),
49
39
  newButtonLabel: _d2I18n.default.t('Create new')
50
- };
51
-
52
- switch (type) {
53
- case 'visualization':
54
- {
55
- texts = {
56
- modalTitle: _d2I18n.default.t('Open a visualization'),
57
- loadingText: _d2I18n.default.t('Loading visualizations'),
58
- errorTitle: _d2I18n.default.t("Couldn't load visualizations"),
59
- errorText: _d2I18n.default.t('There was a problem loading visualizations. Try again or contact your system administrator.'),
60
- noDataText: _d2I18n.default.t('No visualizations found. Click New visualization to get started.'),
61
- noFilteredDataText: _d2I18n.default.t("No visualizations found. Try adjusting your search or filter options to find what you're looking for."),
62
- newButtonLabel: _d2I18n.default.t('New visualization')
63
- };
64
- break;
65
- }
66
-
67
- case 'map':
68
- {
69
- texts = {
70
- modalTitle: _d2I18n.default.t('Open a map'),
71
- loadingText: _d2I18n.default.t('Loading maps'),
72
- errorTitle: _d2I18n.default.t("Couldn't load maps"),
73
- errorText: _d2I18n.default.t('There was a problem loading maps. Try again or contact your system administrator.'),
74
- noDataText: _d2I18n.default.t('No maps found. Click New map to get started.'),
75
- noFilteredDataText: _d2I18n.default.t("No maps found. Try adjusting your search or filter options to find what you're looking for."),
76
- newButtonLabel: _d2I18n.default.t('New map')
77
- };
78
- break;
79
- }
80
-
81
- case 'eventReport':
82
- {
83
- texts = {
84
- modalTitle: _d2I18n.default.t('Open an event report'),
85
- loadingText: _d2I18n.default.t('Loading event reports'),
86
- errorTitle: _d2I18n.default.t("Couldn't load event reports"),
87
- errorText: _d2I18n.default.t('There was a problem loading event reports. Try again or contact your system administrator.'),
88
- noDataText: _d2I18n.default.t('No event reports found. Click New event report to get started.'),
89
- noFilteredDataText: _d2I18n.default.t("No event reports found. Try adjusting your search or filter options to find what you're looking for."),
90
- newButtonLabel: _d2I18n.default.t('New event report')
91
- };
92
- break;
93
- }
94
-
95
- case 'eventVisualization':
96
- {
97
- texts = {
98
- modalTitle: _d2I18n.default.t('Open an event visualization'),
99
- loadingText: _d2I18n.default.t('Loading event visualizations'),
100
- errorTitle: _d2I18n.default.t("Couldn't load event visualizations"),
101
- errorText: _d2I18n.default.t('There was a problem loading event visualizations. Try again or contact your system administrator.'),
102
- noDataText: _d2I18n.default.t('No event visualizations found. Click New event visualization to get started.'),
103
- noFilteredDataText: _d2I18n.default.t("No event visualizations found. Try adjusting your search or filter options to find what you're looking for."),
104
- newButtonLabel: _d2I18n.default.t('New event visualization')
105
- };
106
- break;
107
- }
40
+ },
41
+ [AO_TYPE_VISUALIZATION]: {
42
+ modalTitle: _d2I18n.default.t('Open a visualization'),
43
+ loadingText: _d2I18n.default.t('Loading visualizations'),
44
+ errorTitle: _d2I18n.default.t("Couldn't load visualizations"),
45
+ errorText: _d2I18n.default.t('There was a problem loading visualizations. Try again or contact your system administrator.'),
46
+ noDataText: _d2I18n.default.t('No visualizations found. Click New visualization to get started.'),
47
+ noFilteredDataText: _d2I18n.default.t("No visualizations found. Try adjusting your search or filter options to find what you're looking for."),
48
+ newButtonLabel: _d2I18n.default.t('New visualization')
49
+ },
50
+ [AO_TYPE_MAP]: {
51
+ modalTitle: _d2I18n.default.t('Open a map'),
52
+ loadingText: _d2I18n.default.t('Loading maps'),
53
+ errorTitle: _d2I18n.default.t("Couldn't load maps"),
54
+ errorText: _d2I18n.default.t('There was a problem loading maps. Try again or contact your system administrator.'),
55
+ noDataText: _d2I18n.default.t('No maps found. Click New map to get started.'),
56
+ noFilteredDataText: _d2I18n.default.t("No maps found. Try adjusting your search or filter options to find what you're looking for."),
57
+ newButtonLabel: _d2I18n.default.t('New map')
58
+ },
59
+ [AO_TYPE_EVENT_VISUALIZATION]: {
60
+ modalTitle: _d2I18n.default.t('Open an event visualization'),
61
+ loadingText: _d2I18n.default.t('Loading event visualizations'),
62
+ errorTitle: _d2I18n.default.t("Couldn't load event visualizations"),
63
+ errorText: _d2I18n.default.t('There was a problem loading event visualizations. Try again or contact your system administrator.'),
64
+ noDataText: _d2I18n.default.t('No event visualizations found. Click New event visualization to get started.'),
65
+ noFilteredDataText: _d2I18n.default.t("No event visualizations found. Try adjusting your search or filter options to find what you're looking for."),
66
+ newButtonLabel: _d2I18n.default.t('New event visualization')
108
67
  }
109
-
110
- return texts[key];
111
68
  };
112
69
 
70
+ const getTranslatedString = (type, key) => (texts[type] || texts[NO_TYPE])[key];
71
+
113
72
  exports.getTranslatedString = getTranslatedString;
@@ -123,6 +123,12 @@ Object.defineProperty(exports, "apiFetchRecommendedIds", {
123
123
  return _dimensions.apiFetchRecommendedIds;
124
124
  }
125
125
  });
126
+ Object.defineProperty(exports, "apiFetchItemsByDimension", {
127
+ enumerable: true,
128
+ get: function () {
129
+ return _dimensions.apiFetchItemsByDimension;
130
+ }
131
+ });
126
132
  Object.defineProperty(exports, "apiFetchOrganisationUnitLevels", {
127
133
  enumerable: true,
128
134
  get: function () {
@@ -537,6 +543,18 @@ Object.defineProperty(exports, "getLayoutTypeByVisType", {
537
543
  return _visTypeToLayoutType.getLayoutTypeByVisType;
538
544
  }
539
545
  });
546
+ Object.defineProperty(exports, "VIS_TYPE_GROUP_ALL", {
547
+ enumerable: true,
548
+ get: function () {
549
+ return _visTypes.VIS_TYPE_GROUP_ALL;
550
+ }
551
+ });
552
+ Object.defineProperty(exports, "VIS_TYPE_GROUP_CHARTS", {
553
+ enumerable: true,
554
+ get: function () {
555
+ return _visTypes.VIS_TYPE_GROUP_CHARTS;
556
+ }
557
+ });
540
558
  Object.defineProperty(exports, "VIS_TYPE_COLUMN", {
541
559
  enumerable: true,
542
560
  get: function () {
@@ -633,16 +651,16 @@ Object.defineProperty(exports, "VIS_TYPE_SCATTER", {
633
651
  return _visTypes.VIS_TYPE_SCATTER;
634
652
  }
635
653
  });
636
- Object.defineProperty(exports, "visTypeDisplayNames", {
654
+ Object.defineProperty(exports, "VIS_TYPE_LINE_LIST", {
637
655
  enumerable: true,
638
656
  get: function () {
639
- return _visTypes.visTypeDisplayNames;
657
+ return _visTypes.VIS_TYPE_LINE_LIST;
640
658
  }
641
659
  });
642
- Object.defineProperty(exports, "visTypeDescriptions", {
660
+ Object.defineProperty(exports, "visTypeDisplayNames", {
643
661
  enumerable: true,
644
662
  get: function () {
645
- return _visTypes.visTypeDescriptions;
663
+ return _visTypes.visTypeDisplayNames;
646
664
  }
647
665
  });
648
666
  Object.defineProperty(exports, "visTypeIcons", {
@@ -18,8 +18,8 @@
18
18
  "Unsubscribe": "Odhlásit odběr",
19
19
  "Subscribe to get updates about new interpretations.": "Přihlaste se k odběru novinek o nových interpretacích.",
20
20
  "Subscribe": "Odebírat",
21
- "This app could not retrieve required data.": "",
22
- "Network error": "",
21
+ "This app could not retrieve required data.": "Tato aplikace nemohla načíst požadovaná data.",
22
+ "Network error": "Chyba sítě",
23
23
  "Data Type": "Typ dat",
24
24
  "All types": "Všechny typy",
25
25
  "Totals only": "Pouze součty",
@@ -119,13 +119,13 @@
119
119
  "No event reports found. Click New event report to get started.": "Nebyly nalezeny žádné zprávy o událostech. Začněte kliknutím na Nový přehled událostí.",
120
120
  "No event reports found. Try adjusting your search or filter options to find what you're looking for.": "Nebyly nalezeny žádné zprávy o událostech. Zkuste upravit možnosti vyhledávání nebo filtrování, abyste našli to, co hledáte.",
121
121
  "New event report": "Nová zpráva o události",
122
- "Open an event visualization": "",
123
- "Loading event visualizations": "",
124
- "Couldn't load event visualizations": "",
125
- "There was a problem loading event visualizations. Try again or contact your system administrator.": "",
126
- "No event visualizations found. Click New event visualization to get started.": "",
127
- "No event visualizations found. Try adjusting your search or filter options to find what you're looking for.": "",
128
- "New event visualization": "",
122
+ "Open an event visualization": "Otevřete vizualizaci události",
123
+ "Loading event visualizations": "Načítání vizualizací událostí",
124
+ "Couldn't load event visualizations": "Vizualizace událostí se nepodařilo načíst",
125
+ "There was a problem loading event visualizations. Try again or contact your system administrator.": "Při načítání vizualizací událostí došlo k problému. Zkuste to znovu nebo se obraťte na správce systému.",
126
+ "No event visualizations found. Click New event visualization to get started.": "Nebyly nalezeny žádné vizualizace událostí. Začněte kliknutím na Nová vizualizace události.",
127
+ "No event visualizations found. Try adjusting your search or filter options to find what you're looking for.": "Nebyly nalezeny žádné vizualizace událostí. Zkuste upravit možnosti vyhledávání nebo filtru, abyste našli to, co hledáte.",
128
+ "New event visualization": "Nová vizualizace události",
129
129
  "Options": "Možnosti",
130
130
  "Hide": "Skrýt",
131
131
  "Update": "Aktualizovat",