@truedat/dd 4.43.1 → 4.43.4

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +14 -2
  2. package/package.json +7 -7
  3. package/src/api.js +3 -0
  4. package/src/components/DictionaryRoutes.js +10 -0
  5. package/src/components/GrantRequestApprovalForm.js +10 -4
  6. package/src/components/LinkStructureTagForm.js +21 -15
  7. package/src/components/MetadataFiltersInput.js +1 -1
  8. package/src/components/MetadataViewForm.js +2 -2
  9. package/src/components/MyGrantRequests.js +1 -1
  10. package/src/components/PendingStructureNotes.js +3 -3
  11. package/src/components/StructureTagForm.js +5 -2
  12. package/src/components/StructureTypeForm.js +2 -2
  13. package/src/components/StructuresUploadEvents.js +38 -0
  14. package/src/components/StructuresUploadEventsTable.js +183 -0
  15. package/src/components/__tests__/StructuresUploadEventsTable.spec.js +84 -0
  16. package/src/components/__tests__/__snapshots__/DictionaryRoutes.spec.js.snap +4 -0
  17. package/src/components/__tests__/__snapshots__/StructuresUploadEventsTable.spec.js.snap +130 -0
  18. package/src/messages/en.js +17 -0
  19. package/src/messages/es.js +18 -0
  20. package/src/reducers/__tests__/structuresUploadEvents.spec.js +46 -0
  21. package/src/reducers/__tests__/structuresUploadEventsLoading.spec.js +26 -0
  22. package/src/reducers/ddMessage.js +54 -30
  23. package/src/reducers/index.js +4 -0
  24. package/src/reducers/structuresUploadEvents.js +16 -0
  25. package/src/reducers/structuresUploadEventsLoading.js +16 -0
  26. package/src/routines.js +1 -0
  27. package/src/sagas/__tests__/fetchStructuresUploadEvents.spec.js +79 -0
  28. package/src/sagas/__tests__/uploadStructures.spec.js +3 -2
  29. package/src/sagas/fetchStructuresUploadEvents.js +29 -0
  30. package/src/sagas/index.js +3 -0
  31. package/src/sagas/uploadStructures.js +2 -2
  32. package/src/selectors/__tests__/getStructuresUploadEventColumns.spec.js +20 -0
  33. package/src/selectors/getStructuresUploadEventColumns.js +74 -0
  34. package/src/selectors/index.js +4 -0
  35. package/src/styles/structuresUploadEventColumns.less +24 -0
@@ -0,0 +1,74 @@
1
+ import _ from "lodash/fp";
2
+ import React from "react";
3
+ import { createSelector } from "reselect";
4
+ import { FormattedMessage } from "react-intl";
5
+ import Moment from "react-moment";
6
+ import { AlertExporter } from "@truedat/core/components/AlertExporter";
7
+
8
+ const bulkUpdateErrors = (response) => {
9
+ return _.isEmpty(response) ? (
10
+ ""
11
+ ) : (
12
+ <>
13
+ <p>{response.translatedHeader}</p>
14
+ <ul className="csv-bulk-upload-error">
15
+ {_.map.convert({ cap: false })((translatedError, key) => {
16
+ return <li key={`error_${key}`}>{translatedError}</li>;
17
+ })(response.translatedErrors)}
18
+ </ul>
19
+ {_.isEmpty(response.errors) ? null : (
20
+ <AlertExporter
21
+ className="alert-exporter-in-table"
22
+ onClick={(e) => e.stopPropagation()}
23
+ {...{
24
+ list: response.translatedErrors,
25
+ messages: response.errors,
26
+ }}
27
+ />
28
+ )}
29
+ </>
30
+ );
31
+ };
32
+
33
+ const dateDecorator = (date) =>
34
+ date && <Moment locale="es" date={date} format="YYYY-MM-DD HH:mm" />;
35
+
36
+ const statusDecorator = (status) => (
37
+ <FormattedMessage
38
+ id={`structures.bulkUploadEvents.status.${_.toLower(status)}`}
39
+ />
40
+ );
41
+
42
+ export const defaultStructuresUploadEventColumns = [
43
+ {
44
+ name: "csv_hash",
45
+ width: 2,
46
+ },
47
+ {
48
+ name: "status",
49
+ fieldDecorator: statusDecorator,
50
+ width: 2,
51
+ },
52
+ {
53
+ name: "response",
54
+ fieldDecorator: bulkUpdateErrors,
55
+ width: 2,
56
+ },
57
+ {
58
+ name: "message",
59
+ width: 2,
60
+ },
61
+ {
62
+ name: "inserted_at",
63
+ fieldDecorator: dateDecorator,
64
+ textAlign: "center",
65
+ width: 2,
66
+ },
67
+ ];
68
+
69
+ const getColumns = (state) => state.structuresUploadEventColumns;
70
+
71
+ export const getStructuresUploadEventColumns = createSelector(
72
+ [getColumns],
73
+ (columns) => _.defaultTo(defaultStructuresUploadEventColumns)(columns)
74
+ );
@@ -39,6 +39,10 @@ export { getStructureSelectedFilterValues } from "./getStructureSelectedFilterVa
39
39
  export { getStructuresFields } from "./getStructuresFields";
40
40
  export { getStructureSortingCriteria } from "./getStructureSortingCriteria";
41
41
  export { getStructureUpdatedAt } from "./getStructureUpdatedAt";
42
+ export {
43
+ getStructuresUploadEventColumns,
44
+ defaultStructuresUploadEventColumns,
45
+ } from "./getStructuresUploadEventColumns";
42
46
  export { getSystem } from "./getSystem";
43
47
  export { getSystemTemplate } from "./getSystemTemplate";
44
48
  export { getTabVisibility } from "./getTabVisibility";
@@ -0,0 +1,24 @@
1
+ .contracted ul.csv-bulk-upload-error {
2
+ max-height: 100px;
3
+ overflow: hidden;
4
+ }
5
+
6
+ .contracted ul.csv-bulk-upload-error {
7
+ .fade-up();
8
+ }
9
+
10
+ .fade-up {
11
+ background: -webkit-linear-gradient(rgba(0,0,0,1), rgba(0,0,0,0));
12
+ background-clip: text;
13
+ -webkit-background-clip: text;
14
+ -webkit-text-fill-color: transparent;
15
+ }
16
+
17
+ .alert-exporter-in-table {
18
+ padding: 3px;
19
+ margin: 5px;
20
+ &:hover {
21
+ padding: 2px;
22
+ border: 1px solid blue;
23
+ }
24
+ }