@dhis2/analytics 23.13.2 → 23.13.5
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/DynamicDimension/ItemSelector.js +1 -1
- package/build/cjs/components/Interpretations/InterpretationModal/InterpretationModal.js +1 -1
- package/build/cjs/components/Interpretations/common/UserMention/UserMentionWrapper.js +1 -1
- package/build/cjs/components/OpenFileDialog/OpenFileDialog.js +51 -42
- package/build/cjs/locales/en/translations.json +3 -3
- package/build/cjs/visualizations/config/generators/highcharts/index.js +2 -2
- package/build/es/components/DynamicDimension/ItemSelector.js +1 -1
- package/build/es/components/Interpretations/InterpretationModal/InterpretationModal.js +1 -1
- package/build/es/components/Interpretations/common/UserMention/UserMentionWrapper.js +1 -1
- package/build/es/components/OpenFileDialog/OpenFileDialog.js +52 -43
- package/build/es/locales/en/translations.json +3 -3
- package/build/es/visualizations/config/generators/highcharts/index.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [23.13.5](https://github.com/dhis2/analytics/compare/v23.13.4...v23.13.5) (2022-08-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* avoid encoding when interpolating certain variables in i18n.t ([#1304](https://github.com/dhis2/analytics/issues/1304)) ([db83318](https://github.com/dhis2/analytics/commit/db8331800a5132dfe266b2f9a42c5c68bb7e9b6e))
|
|
7
|
+
|
|
8
|
+
## [23.13.4](https://github.com/dhis2/analytics/compare/v23.13.3...v23.13.4) (2022-08-05)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* request first page when sorting/filtering ([#1301](https://github.com/dhis2/analytics/issues/1301)) ([125e2af](https://github.com/dhis2/analytics/commit/125e2af84c19c81a9f8665d3e0cf2a88aaffdbda))
|
|
14
|
+
|
|
15
|
+
## [23.13.3](https://github.com/dhis2/analytics/compare/v23.13.2...v23.13.3) (2022-08-02)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* avoid ES2022 functions ([#1300](https://github.com/dhis2/analytics/issues/1300)) ([93ab848](https://github.com/dhis2/analytics/commit/93ab848e89e4c22a2d9ca20625287af892ef8d89))
|
|
21
|
+
|
|
1
22
|
## [23.13.2](https://github.com/dhis2/analytics/compare/v23.13.1...v23.13.2) (2022-08-01)
|
|
2
23
|
|
|
3
24
|
|
|
@@ -85,7 +85,7 @@ const SourceEmptyPlaceholder = _ref3 => {
|
|
|
85
85
|
if (!loading && !options.length && !filter) {
|
|
86
86
|
message = noItemsMessage || _index.default.t('No data');
|
|
87
87
|
} else if (!loading && !options.length && filter) {
|
|
88
|
-
message = _index.default.t('Nothing found for {{searchTerm}}', {
|
|
88
|
+
message = _index.default.t('Nothing found for {{- searchTerm}}', {
|
|
89
89
|
searchTerm: filter
|
|
90
90
|
});
|
|
91
91
|
}
|
|
@@ -132,7 +132,7 @@ const InterpretationModal = _ref2 => {
|
|
|
132
132
|
className: _style.default.dynamic([["3175860552", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]]) + " " + "title"
|
|
133
133
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
134
134
|
className: _style.default.dynamic([["3175860552", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]]) + " " + "ellipsis"
|
|
135
|
-
}, _d2I18n.default.t('Viewing interpretation: {{visualisationName}}', {
|
|
135
|
+
}, _d2I18n.default.t('Viewing interpretation: {{- visualisationName}}', {
|
|
136
136
|
visualisationName: visualization.displayName,
|
|
137
137
|
nsSeparator: '^^'
|
|
138
138
|
}))), /*#__PURE__*/_react.default.createElement(_ui.ModalContent, {
|
|
@@ -192,7 +192,7 @@ const UserMentionWrapper = _ref => {
|
|
|
192
192
|
className: _UserMentionWrapperStyle.resolvedHeaderStyle.className,
|
|
193
193
|
dense: true,
|
|
194
194
|
hideDivider: true,
|
|
195
|
-
label: capturedText === '' ? _d2I18n.default.t('Search for a user') : _d2I18n.default.t('Searching for "{{searchText}}"', {
|
|
195
|
+
label: capturedText === '' ? _d2I18n.default.t('Search for a user') : _d2I18n.default.t('Searching for "{{- searchText}}"', {
|
|
196
196
|
searchText: capturedText
|
|
197
197
|
})
|
|
198
198
|
}), fetching && /*#__PURE__*/_react.default.createElement(_ui.MenuItem, {
|
|
@@ -79,25 +79,28 @@ const OpenFileDialog = _ref2 => {
|
|
|
79
79
|
onNew,
|
|
80
80
|
currentUser
|
|
81
81
|
} = _ref2;
|
|
82
|
-
const filesQuery = (0, _react.useMemo)(() => getQuery(type), []);
|
|
82
|
+
const filesQuery = (0, _react.useMemo)(() => getQuery(type), [type]);
|
|
83
83
|
const defaultFilters = {
|
|
84
84
|
searchTerm: '',
|
|
85
85
|
createdBy: _CreatedByFilter.CREATED_BY_ALL,
|
|
86
86
|
visType: defaultFilterVisType
|
|
87
87
|
};
|
|
88
88
|
const [{
|
|
89
|
+
page,
|
|
89
90
|
sortField,
|
|
90
|
-
sortDirection
|
|
91
|
-
|
|
91
|
+
sortDirection,
|
|
92
|
+
filters
|
|
93
|
+
}, setState] = (0, _react.useReducer)((state, newState) => ({ ...state,
|
|
94
|
+
...newState
|
|
95
|
+
}), {
|
|
96
|
+
page: 1,
|
|
92
97
|
sortField: 'displayName',
|
|
93
|
-
sortDirection: 'asc'
|
|
98
|
+
sortDirection: 'asc',
|
|
99
|
+
filters: defaultFilters
|
|
94
100
|
});
|
|
95
|
-
const [page, setPage] = (0, _react.useState)(1);
|
|
96
101
|
const [nameFilterValue, setNameFilterValue] = (0, _react.useState)(defaultFilters.searchTerm);
|
|
97
102
|
const [searchTimeout, setSearchTimeout] = (0, _react.useState)(null);
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
const formatFilters = () => {
|
|
103
|
+
const formatFilters = (0, _react.useCallback)(() => {
|
|
101
104
|
const queryFilters = [];
|
|
102
105
|
|
|
103
106
|
switch (filters.createdBy) {
|
|
@@ -134,8 +137,7 @@ const OpenFileDialog = _ref2 => {
|
|
|
134
137
|
}
|
|
135
138
|
|
|
136
139
|
return queryFilters;
|
|
137
|
-
};
|
|
138
|
-
|
|
140
|
+
}, [currentUser, filters]);
|
|
139
141
|
const {
|
|
140
142
|
loading,
|
|
141
143
|
error,
|
|
@@ -146,10 +148,29 @@ const OpenFileDialog = _ref2 => {
|
|
|
146
148
|
});
|
|
147
149
|
|
|
148
150
|
const resetFilters = () => {
|
|
149
|
-
|
|
151
|
+
setState({
|
|
152
|
+
filters: defaultFilters,
|
|
153
|
+
page: 1
|
|
154
|
+
});
|
|
150
155
|
setNameFilterValue(defaultFilters.searchTerm);
|
|
151
156
|
};
|
|
152
157
|
|
|
158
|
+
const setPage = pageNum => setState({
|
|
159
|
+
page: pageNum
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const sortData = _ref3 => {
|
|
163
|
+
let {
|
|
164
|
+
name,
|
|
165
|
+
direction
|
|
166
|
+
} = _ref3;
|
|
167
|
+
return setState({
|
|
168
|
+
sortField: name,
|
|
169
|
+
sortDirection: direction,
|
|
170
|
+
page: 1
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
|
|
153
174
|
(0, _react.useEffect)(() => {
|
|
154
175
|
// only fetch data when the dialog is open
|
|
155
176
|
if (open) {
|
|
@@ -160,19 +181,7 @@ const OpenFileDialog = _ref2 => {
|
|
|
160
181
|
filters: formatFilters()
|
|
161
182
|
});
|
|
162
183
|
}
|
|
163
|
-
}, [open, page, sortField, sortDirection]);
|
|
164
|
-
(0, _react.useEffect)(() => {
|
|
165
|
-
// avoid fetching data when the dialog is first rendered (hidden)
|
|
166
|
-
if (open) {
|
|
167
|
-
// reset pagination when filters are applied/changed
|
|
168
|
-
setPage(1);
|
|
169
|
-
refetch({
|
|
170
|
-
sortField,
|
|
171
|
-
sortDirection,
|
|
172
|
-
filters: formatFilters()
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
}, [filters]);
|
|
184
|
+
}, [open, page, sortField, sortDirection, filters, refetch, formatFilters]);
|
|
176
185
|
const headers = [{
|
|
177
186
|
field: 'displayName',
|
|
178
187
|
label: _d2I18n.default.t('Name'),
|
|
@@ -216,8 +225,11 @@ const OpenFileDialog = _ref2 => {
|
|
|
216
225
|
onChange: value => {
|
|
217
226
|
setNameFilterValue(value);
|
|
218
227
|
clearTimeout(searchTimeout);
|
|
219
|
-
setSearchTimeout(setTimeout(() =>
|
|
220
|
-
|
|
228
|
+
setSearchTimeout(setTimeout(() => setState({
|
|
229
|
+
page: 1,
|
|
230
|
+
filters: { ...filters,
|
|
231
|
+
searchTerm: value
|
|
232
|
+
}
|
|
221
233
|
}), 200));
|
|
222
234
|
}
|
|
223
235
|
})), (filterVisTypes === null || filterVisTypes === void 0 ? void 0 : filterVisTypes.length) && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -225,15 +237,21 @@ const OpenFileDialog = _ref2 => {
|
|
|
225
237
|
}, /*#__PURE__*/_react.default.createElement(_VisTypeFilter.VisTypeFilter, {
|
|
226
238
|
visTypes: filterVisTypes,
|
|
227
239
|
selected: filters.visType,
|
|
228
|
-
onChange: value =>
|
|
229
|
-
|
|
240
|
+
onChange: value => setState({
|
|
241
|
+
page: 1,
|
|
242
|
+
filters: { ...filters,
|
|
243
|
+
visType: value
|
|
244
|
+
}
|
|
230
245
|
})
|
|
231
246
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
232
247
|
className: "jsx-".concat(_OpenFileDialogStyles.styles.__hash) + " " + "created-by-field-container"
|
|
233
248
|
}, /*#__PURE__*/_react.default.createElement(_CreatedByFilter.CreatedByFilter, {
|
|
234
249
|
selected: filters.createdBy,
|
|
235
|
-
onChange: value =>
|
|
236
|
-
|
|
250
|
+
onChange: value => setState({
|
|
251
|
+
page: 1,
|
|
252
|
+
filters: { ...filters,
|
|
253
|
+
createdBy: value
|
|
254
|
+
}
|
|
237
255
|
})
|
|
238
256
|
})), !(0, _isEqual.default)(filters, defaultFilters) && /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
239
257
|
onClick: resetFilters,
|
|
@@ -246,26 +264,17 @@ const OpenFileDialog = _ref2 => {
|
|
|
246
264
|
className: "jsx-".concat(_OpenFileDialogStyles.styles.__hash) + " " + "data-table-wrapper"
|
|
247
265
|
}, /*#__PURE__*/_react.default.createElement(_ui.DataTable, {
|
|
248
266
|
layout: "fixed"
|
|
249
|
-
}, /*#__PURE__*/_react.default.createElement(_ui.DataTableHead, null, /*#__PURE__*/_react.default.createElement(_ui.DataTableRow, null, data !== null && data !== void 0 && data.files[_utils.AOTypeMap[type].apiEndpoint].length ? headers.map(
|
|
267
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.DataTableHead, null, /*#__PURE__*/_react.default.createElement(_ui.DataTableRow, null, data !== null && data !== void 0 && data.files[_utils.AOTypeMap[type].apiEndpoint].length ? headers.map(_ref4 => {
|
|
250
268
|
let {
|
|
251
269
|
field,
|
|
252
270
|
label,
|
|
253
271
|
width
|
|
254
|
-
} =
|
|
272
|
+
} = _ref4;
|
|
255
273
|
return /*#__PURE__*/_react.default.createElement(_ui.DataTableColumnHeader, {
|
|
256
274
|
width: width,
|
|
257
275
|
key: field,
|
|
258
276
|
name: field,
|
|
259
|
-
onSortIconClick:
|
|
260
|
-
let {
|
|
261
|
-
name,
|
|
262
|
-
direction
|
|
263
|
-
} = _ref4;
|
|
264
|
-
return setSorting({
|
|
265
|
-
sortField: name,
|
|
266
|
-
sortDirection: direction
|
|
267
|
-
});
|
|
268
|
-
},
|
|
277
|
+
onSortIconClick: sortData,
|
|
269
278
|
sortDirection: getSortDirection(field)
|
|
270
279
|
}, label);
|
|
271
280
|
}) : /*#__PURE__*/_react.default.createElement(_ui.DataTableColumnHeader, null))), /*#__PURE__*/_react.default.createElement(_ui.DataTableBody, {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"Manually select items...": "Manually select items...",
|
|
58
58
|
"Nothing found in {{- dimensionTitle}}": "Nothing found in {{- dimensionTitle}}",
|
|
59
59
|
"Search": "Search",
|
|
60
|
-
"Nothing found for {{searchTerm}}": "Nothing found for {{searchTerm}}",
|
|
60
|
+
"Nothing found for {{- searchTerm}}": "Nothing found for {{- searchTerm}}",
|
|
61
61
|
"Delete {{fileType}}": "Delete {{fileType}}",
|
|
62
62
|
"This {{fileType}} and related interpretations will be deleted. Continue?": "This {{fileType}} and related interpretations will be deleted. Continue?",
|
|
63
63
|
"Cancel": "Cancel",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"Could not update comment": "Could not update comment",
|
|
90
90
|
"Enter comment text": "Enter comment text",
|
|
91
91
|
"Update": "Update",
|
|
92
|
-
"Viewing interpretation: {{visualisationName}}": "Viewing interpretation: {{visualisationName}}",
|
|
92
|
+
"Viewing interpretation: {{- visualisationName}}": "Viewing interpretation: {{- visualisationName}}",
|
|
93
93
|
"Could not load interpretation": "Could not load interpretation",
|
|
94
94
|
"The interpretation couldn’t be displayed. Try again or contact your system administrator.": "The interpretation couldn’t be displayed. Try again or contact your system administrator.",
|
|
95
95
|
"Hide interpretation": "Hide interpretation",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"Back to write mode": "Back to write mode",
|
|
114
114
|
"Too many results. Try refining the search.": "Too many results. Try refining the search.",
|
|
115
115
|
"Search for a user": "Search for a user",
|
|
116
|
-
"Searching for \"{{searchText}}\"": "Searching for \"{{searchText}}\"",
|
|
116
|
+
"Searching for \"{{- searchText}}\"": "Searching for \"{{- searchText}}\"",
|
|
117
117
|
"No results found": "No results found",
|
|
118
118
|
"Created by": "Created by",
|
|
119
119
|
"Anyone": "Anyone",
|
|
@@ -44,10 +44,10 @@ function drawLegendSymbolWrap() {
|
|
|
44
44
|
|
|
45
45
|
const legends = this.options.legendSet.legends.sort((a, b) => a.startValue - b.startValue);
|
|
46
46
|
this.chart.renderer.path(['M', x, ys, 'A', 1, 1, 0, 0, 0, x, ye, 'V', ys]).attr({
|
|
47
|
-
fill: legends
|
|
47
|
+
fill: legends[legends.length >= 5 ? 1 : 0].color
|
|
48
48
|
}).add(this.legendGroup);
|
|
49
49
|
this.chart.renderer.path(['M', x, ye, 'A', 1, 1, 0, 0, 0, x, ys, 'V', ye]).attr({
|
|
50
|
-
fill: legends
|
|
50
|
+
fill: legends[legends.length >= 5 ? legends.length - 2 : legends.length - 1].color
|
|
51
51
|
}).add(this.legendGroup);
|
|
52
52
|
} else {
|
|
53
53
|
var options = legend.options,
|
|
@@ -64,7 +64,7 @@ const SourceEmptyPlaceholder = _ref3 => {
|
|
|
64
64
|
if (!loading && !options.length && !filter) {
|
|
65
65
|
message = noItemsMessage || i18n.t('No data');
|
|
66
66
|
} else if (!loading && !options.length && filter) {
|
|
67
|
-
message = i18n.t('Nothing found for {{searchTerm}}', {
|
|
67
|
+
message = i18n.t('Nothing found for {{- searchTerm}}', {
|
|
68
68
|
searchTerm: filter
|
|
69
69
|
});
|
|
70
70
|
}
|
|
@@ -110,7 +110,7 @@ const InterpretationModal = _ref2 => {
|
|
|
110
110
|
className: _JSXStyle.dynamic([["3175860552", [colors.grey900, spacers.dp24, spacers.dp4, spacers.dp4]]]) + " " + "title"
|
|
111
111
|
}, /*#__PURE__*/React.createElement("span", {
|
|
112
112
|
className: _JSXStyle.dynamic([["3175860552", [colors.grey900, spacers.dp24, spacers.dp4, spacers.dp4]]]) + " " + "ellipsis"
|
|
113
|
-
}, i18n.t('Viewing interpretation: {{visualisationName}}', {
|
|
113
|
+
}, i18n.t('Viewing interpretation: {{- visualisationName}}', {
|
|
114
114
|
visualisationName: visualization.displayName,
|
|
115
115
|
nsSeparator: '^^'
|
|
116
116
|
}))), /*#__PURE__*/React.createElement(ModalContent, {
|
|
@@ -171,7 +171,7 @@ export const UserMentionWrapper = _ref => {
|
|
|
171
171
|
className: resolvedHeaderStyle.className,
|
|
172
172
|
dense: true,
|
|
173
173
|
hideDivider: true,
|
|
174
|
-
label: capturedText === '' ? i18n.t('Search for a user') : i18n.t('Searching for "{{searchText}}"', {
|
|
174
|
+
label: capturedText === '' ? i18n.t('Search for a user') : i18n.t('Searching for "{{- searchText}}"', {
|
|
175
175
|
searchText: capturedText
|
|
176
176
|
})
|
|
177
177
|
}), fetching && /*#__PURE__*/React.createElement(MenuItem, {
|
|
@@ -4,7 +4,7 @@ import i18n from '@dhis2/d2-i18n';
|
|
|
4
4
|
import { Box, Modal, ModalTitle, ModalContent, DataTable, DataTableHead, DataTableBody, DataTableRow, DataTableCell, DataTableColumnHeader, NoticeBox, CircularLoader, Button } from '@dhis2/ui';
|
|
5
5
|
import isEqual from 'lodash/isEqual';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
7
|
+
import React, { useCallback, useEffect, useMemo, useReducer, useState } from 'react';
|
|
8
8
|
import { VIS_TYPE_GROUP_ALL, VIS_TYPE_GROUP_CHARTS } from '../../modules/visTypes.js';
|
|
9
9
|
import { CreatedByFilter, CREATED_BY_ALL, CREATED_BY_ALL_BUT_CURRENT_USER, CREATED_BY_CURRENT_USER } from './CreatedByFilter.js';
|
|
10
10
|
import { FileList } from './FileList.js';
|
|
@@ -52,25 +52,28 @@ export const OpenFileDialog = _ref2 => {
|
|
|
52
52
|
onNew,
|
|
53
53
|
currentUser
|
|
54
54
|
} = _ref2;
|
|
55
|
-
const filesQuery = useMemo(() => getQuery(type), []);
|
|
55
|
+
const filesQuery = useMemo(() => getQuery(type), [type]);
|
|
56
56
|
const defaultFilters = {
|
|
57
57
|
searchTerm: '',
|
|
58
58
|
createdBy: CREATED_BY_ALL,
|
|
59
59
|
visType: defaultFilterVisType
|
|
60
60
|
};
|
|
61
61
|
const [{
|
|
62
|
+
page,
|
|
62
63
|
sortField,
|
|
63
|
-
sortDirection
|
|
64
|
-
|
|
64
|
+
sortDirection,
|
|
65
|
+
filters
|
|
66
|
+
}, setState] = useReducer((state, newState) => ({ ...state,
|
|
67
|
+
...newState
|
|
68
|
+
}), {
|
|
69
|
+
page: 1,
|
|
65
70
|
sortField: 'displayName',
|
|
66
|
-
sortDirection: 'asc'
|
|
71
|
+
sortDirection: 'asc',
|
|
72
|
+
filters: defaultFilters
|
|
67
73
|
});
|
|
68
|
-
const [page, setPage] = useState(1);
|
|
69
74
|
const [nameFilterValue, setNameFilterValue] = useState(defaultFilters.searchTerm);
|
|
70
75
|
const [searchTimeout, setSearchTimeout] = useState(null);
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
const formatFilters = () => {
|
|
76
|
+
const formatFilters = useCallback(() => {
|
|
74
77
|
const queryFilters = [];
|
|
75
78
|
|
|
76
79
|
switch (filters.createdBy) {
|
|
@@ -107,8 +110,7 @@ export const OpenFileDialog = _ref2 => {
|
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
return queryFilters;
|
|
110
|
-
};
|
|
111
|
-
|
|
113
|
+
}, [currentUser, filters]);
|
|
112
114
|
const {
|
|
113
115
|
loading,
|
|
114
116
|
error,
|
|
@@ -119,10 +121,29 @@ export const OpenFileDialog = _ref2 => {
|
|
|
119
121
|
});
|
|
120
122
|
|
|
121
123
|
const resetFilters = () => {
|
|
122
|
-
|
|
124
|
+
setState({
|
|
125
|
+
filters: defaultFilters,
|
|
126
|
+
page: 1
|
|
127
|
+
});
|
|
123
128
|
setNameFilterValue(defaultFilters.searchTerm);
|
|
124
129
|
};
|
|
125
130
|
|
|
131
|
+
const setPage = pageNum => setState({
|
|
132
|
+
page: pageNum
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const sortData = _ref3 => {
|
|
136
|
+
let {
|
|
137
|
+
name,
|
|
138
|
+
direction
|
|
139
|
+
} = _ref3;
|
|
140
|
+
return setState({
|
|
141
|
+
sortField: name,
|
|
142
|
+
sortDirection: direction,
|
|
143
|
+
page: 1
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
|
|
126
147
|
useEffect(() => {
|
|
127
148
|
// only fetch data when the dialog is open
|
|
128
149
|
if (open) {
|
|
@@ -133,19 +154,7 @@ export const OpenFileDialog = _ref2 => {
|
|
|
133
154
|
filters: formatFilters()
|
|
134
155
|
});
|
|
135
156
|
}
|
|
136
|
-
}, [open, page, sortField, sortDirection]);
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
// avoid fetching data when the dialog is first rendered (hidden)
|
|
139
|
-
if (open) {
|
|
140
|
-
// reset pagination when filters are applied/changed
|
|
141
|
-
setPage(1);
|
|
142
|
-
refetch({
|
|
143
|
-
sortField,
|
|
144
|
-
sortDirection,
|
|
145
|
-
filters: formatFilters()
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}, [filters]);
|
|
157
|
+
}, [open, page, sortField, sortDirection, filters, refetch, formatFilters]);
|
|
149
158
|
const headers = [{
|
|
150
159
|
field: 'displayName',
|
|
151
160
|
label: i18n.t('Name'),
|
|
@@ -189,8 +198,11 @@ export const OpenFileDialog = _ref2 => {
|
|
|
189
198
|
onChange: value => {
|
|
190
199
|
setNameFilterValue(value);
|
|
191
200
|
clearTimeout(searchTimeout);
|
|
192
|
-
setSearchTimeout(setTimeout(() =>
|
|
193
|
-
|
|
201
|
+
setSearchTimeout(setTimeout(() => setState({
|
|
202
|
+
page: 1,
|
|
203
|
+
filters: { ...filters,
|
|
204
|
+
searchTerm: value
|
|
205
|
+
}
|
|
194
206
|
}), 200));
|
|
195
207
|
}
|
|
196
208
|
})), (filterVisTypes === null || filterVisTypes === void 0 ? void 0 : filterVisTypes.length) && /*#__PURE__*/React.createElement("div", {
|
|
@@ -198,15 +210,21 @@ export const OpenFileDialog = _ref2 => {
|
|
|
198
210
|
}, /*#__PURE__*/React.createElement(VisTypeFilter, {
|
|
199
211
|
visTypes: filterVisTypes,
|
|
200
212
|
selected: filters.visType,
|
|
201
|
-
onChange: value =>
|
|
202
|
-
|
|
213
|
+
onChange: value => setState({
|
|
214
|
+
page: 1,
|
|
215
|
+
filters: { ...filters,
|
|
216
|
+
visType: value
|
|
217
|
+
}
|
|
203
218
|
})
|
|
204
219
|
})), /*#__PURE__*/React.createElement("div", {
|
|
205
220
|
className: "jsx-".concat(styles.__hash) + " " + "created-by-field-container"
|
|
206
221
|
}, /*#__PURE__*/React.createElement(CreatedByFilter, {
|
|
207
222
|
selected: filters.createdBy,
|
|
208
|
-
onChange: value =>
|
|
209
|
-
|
|
223
|
+
onChange: value => setState({
|
|
224
|
+
page: 1,
|
|
225
|
+
filters: { ...filters,
|
|
226
|
+
createdBy: value
|
|
227
|
+
}
|
|
210
228
|
})
|
|
211
229
|
})), !isEqual(filters, defaultFilters) && /*#__PURE__*/React.createElement(Button, {
|
|
212
230
|
onClick: resetFilters,
|
|
@@ -219,26 +237,17 @@ export const OpenFileDialog = _ref2 => {
|
|
|
219
237
|
className: "jsx-".concat(styles.__hash) + " " + "data-table-wrapper"
|
|
220
238
|
}, /*#__PURE__*/React.createElement(DataTable, {
|
|
221
239
|
layout: "fixed"
|
|
222
|
-
}, /*#__PURE__*/React.createElement(DataTableHead, null, /*#__PURE__*/React.createElement(DataTableRow, null, data !== null && data !== void 0 && data.files[AOTypeMap[type].apiEndpoint].length ? headers.map(
|
|
240
|
+
}, /*#__PURE__*/React.createElement(DataTableHead, null, /*#__PURE__*/React.createElement(DataTableRow, null, data !== null && data !== void 0 && data.files[AOTypeMap[type].apiEndpoint].length ? headers.map(_ref4 => {
|
|
223
241
|
let {
|
|
224
242
|
field,
|
|
225
243
|
label,
|
|
226
244
|
width
|
|
227
|
-
} =
|
|
245
|
+
} = _ref4;
|
|
228
246
|
return /*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
229
247
|
width: width,
|
|
230
248
|
key: field,
|
|
231
249
|
name: field,
|
|
232
|
-
onSortIconClick:
|
|
233
|
-
let {
|
|
234
|
-
name,
|
|
235
|
-
direction
|
|
236
|
-
} = _ref4;
|
|
237
|
-
return setSorting({
|
|
238
|
-
sortField: name,
|
|
239
|
-
sortDirection: direction
|
|
240
|
-
});
|
|
241
|
-
},
|
|
250
|
+
onSortIconClick: sortData,
|
|
242
251
|
sortDirection: getSortDirection(field)
|
|
243
252
|
}, label);
|
|
244
253
|
}) : /*#__PURE__*/React.createElement(DataTableColumnHeader, null))), /*#__PURE__*/React.createElement(DataTableBody, {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"Manually select items...": "Manually select items...",
|
|
58
58
|
"Nothing found in {{- dimensionTitle}}": "Nothing found in {{- dimensionTitle}}",
|
|
59
59
|
"Search": "Search",
|
|
60
|
-
"Nothing found for {{searchTerm}}": "Nothing found for {{searchTerm}}",
|
|
60
|
+
"Nothing found for {{- searchTerm}}": "Nothing found for {{- searchTerm}}",
|
|
61
61
|
"Delete {{fileType}}": "Delete {{fileType}}",
|
|
62
62
|
"This {{fileType}} and related interpretations will be deleted. Continue?": "This {{fileType}} and related interpretations will be deleted. Continue?",
|
|
63
63
|
"Cancel": "Cancel",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"Could not update comment": "Could not update comment",
|
|
90
90
|
"Enter comment text": "Enter comment text",
|
|
91
91
|
"Update": "Update",
|
|
92
|
-
"Viewing interpretation: {{visualisationName}}": "Viewing interpretation: {{visualisationName}}",
|
|
92
|
+
"Viewing interpretation: {{- visualisationName}}": "Viewing interpretation: {{- visualisationName}}",
|
|
93
93
|
"Could not load interpretation": "Could not load interpretation",
|
|
94
94
|
"The interpretation couldn’t be displayed. Try again or contact your system administrator.": "The interpretation couldn’t be displayed. Try again or contact your system administrator.",
|
|
95
95
|
"Hide interpretation": "Hide interpretation",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"Back to write mode": "Back to write mode",
|
|
114
114
|
"Too many results. Try refining the search.": "Too many results. Try refining the search.",
|
|
115
115
|
"Search for a user": "Search for a user",
|
|
116
|
-
"Searching for \"{{searchText}}\"": "Searching for \"{{searchText}}\"",
|
|
116
|
+
"Searching for \"{{- searchText}}\"": "Searching for \"{{- searchText}}\"",
|
|
117
117
|
"No results found": "No results found",
|
|
118
118
|
"Created by": "Created by",
|
|
119
119
|
"Anyone": "Anyone",
|
|
@@ -27,10 +27,10 @@ function drawLegendSymbolWrap() {
|
|
|
27
27
|
|
|
28
28
|
const legends = this.options.legendSet.legends.sort((a, b) => a.startValue - b.startValue);
|
|
29
29
|
this.chart.renderer.path(['M', x, ys, 'A', 1, 1, 0, 0, 0, x, ye, 'V', ys]).attr({
|
|
30
|
-
fill: legends
|
|
30
|
+
fill: legends[legends.length >= 5 ? 1 : 0].color
|
|
31
31
|
}).add(this.legendGroup);
|
|
32
32
|
this.chart.renderer.path(['M', x, ye, 'A', 1, 1, 0, 0, 0, x, ys, 'V', ye]).attr({
|
|
33
|
-
fill: legends
|
|
33
|
+
fill: legends[legends.length >= 5 ? legends.length - 2 : legends.length - 1].color
|
|
34
34
|
}).add(this.legendGroup);
|
|
35
35
|
} else {
|
|
36
36
|
var options = legend.options,
|