@truedat/dd 4.49.8 → 4.50.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/package.json +5 -5
  3. package/src/api/queries.js +16 -0
  4. package/src/api.js +2 -0
  5. package/src/components/GrantChangeRequest.js +32 -0
  6. package/src/components/GrantRequestCancel.js +47 -0
  7. package/src/components/GrantRequestHeader.js +9 -1
  8. package/src/components/MyGrantRequests.js +1 -0
  9. package/src/components/StructureGrantButton.js +24 -44
  10. package/src/components/StructureGrantCart.js +2 -2
  11. package/src/components/StructureGrantCartCheckout.js +20 -15
  12. package/src/components/StructureGrantCartTemplate.js +15 -61
  13. package/src/components/StructureGrantDropdown.js +201 -0
  14. package/src/components/StructureGrantRequestButton.js +15 -14
  15. package/src/components/StructureGrants.js +1 -1
  16. package/src/components/StructureSummary.js +13 -6
  17. package/src/components/StructureView.js +7 -8
  18. package/src/components/__tests__/MyGrantRequests.spec.js +5 -0
  19. package/src/components/__tests__/StructureGrantButton.spec.js +107 -34
  20. package/src/components/__tests__/StructureGrantCartTemplate.spec.js +11 -100
  21. package/src/components/__tests__/StructureGrantDropdown.spec.js +148 -0
  22. package/src/components/__tests__/StructureGrantRequestButton.spec.js +9 -10
  23. package/src/components/__tests__/__snapshots__/MyGrantRequests.spec.js.snap +14 -0
  24. package/src/components/__tests__/__snapshots__/StructureGrantButton.spec.js.snap +162 -16
  25. package/src/components/__tests__/__snapshots__/StructureGrantCartTemplate.spec.js.snap +0 -3
  26. package/src/components/__tests__/__snapshots__/StructureGrantDropdown.spec.js.snap +271 -0
  27. package/src/components/__tests__/__snapshots__/StructureGrantRequestButton.spec.js.snap +11 -10
  28. package/src/components/__tests__/__snapshots__/StructureSummary.spec.js.snap +6 -0
  29. package/src/messages/en.js +17 -1
  30. package/src/messages/es.js +17 -3
  31. package/src/reducers/__tests__/grantRequestsCart.spec.js +223 -9
  32. package/src/reducers/grantRequestsCart.js +20 -26
  33. package/src/routines.js +2 -1
  34. package/src/sagas/__tests__/createGrantRequestStatus.spec.js +82 -0
  35. package/src/sagas/createGrantRequestStatus.js +32 -0
  36. package/src/sagas/index.js +3 -0
  37. package/src/sagas/operateGrantRequestCart.js +2 -27
  38. package/src/selectors/getGrantRequestsColumns.js +18 -3
@@ -1,5 +1,6 @@
1
1
  import { bulkUpdateStructuresRequestsSaga } from "./bulkUpdateStructures";
2
2
  import { createGrantRequestApprovalRequestSaga } from "./createGrantRequestApproval";
3
+ import { createGrantRequestStatusRequestSaga } from "./createGrantRequestStatus";
3
4
  import { createGraphRequestSaga } from "./createGraph";
4
5
  import { createProfileGroupRequestSaga } from "./createProfileGroup";
5
6
  import { createReferenceDatasetRequestSaga } from "./createReferenceDataset";
@@ -54,6 +55,7 @@ import { updateTagRequestSaga } from "./updateTag";
54
55
  export {
55
56
  bulkUpdateStructuresRequestsSaga,
56
57
  createGrantRequestApprovalRequestSaga,
58
+ createGrantRequestStatusRequestSaga,
57
59
  createGraphRequestSaga,
58
60
  createProfileGroupRequestSaga,
59
61
  createReferenceDatasetRequestSaga,
@@ -109,6 +111,7 @@ export {
109
111
  export default [
110
112
  bulkUpdateStructuresRequestsSaga(),
111
113
  createGrantRequestApprovalRequestSaga(),
114
+ createGrantRequestStatusRequestSaga(),
112
115
  createGraphRequestSaga(),
113
116
  createProfileGroupRequestSaga(),
114
117
  createReferenceDatasetRequestSaga(),
@@ -1,29 +1,8 @@
1
1
  import { call, put, takeLatest } from "redux-saga/effects";
2
- import { apiJson, apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
3
- import { API_TEMPLATES } from "@truedat/df/templates/api";
4
- import { fetchGrantRequestTemplates, checkoutGrantRequest } from "../routines";
2
+ import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
3
+ import { checkoutGrantRequest } from "../routines";
5
4
  import { API_GRANT_REQUEST_GROUP } from "../api";
6
5
 
7
- export function* fetchGrantRequestTemplatesSaga() {
8
- try {
9
- const scope = "gr";
10
- const url = API_TEMPLATES;
11
- yield put(fetchGrantRequestTemplates.request());
12
- const json_opts = { ...JSON_OPTS, params: { preprocess: true, scope } };
13
- const { data } = yield call(apiJson, url, json_opts);
14
- yield put(fetchGrantRequestTemplates.success({ scope, ...data }));
15
- } catch (error) {
16
- if (error.response) {
17
- const { status, data } = error.response;
18
- yield put(fetchGrantRequestTemplates.failure({ status, data }));
19
- } else {
20
- yield put(fetchGrantRequestTemplates.failure(error.message));
21
- }
22
- } finally {
23
- yield put(fetchGrantRequestTemplates.fulfill());
24
- }
25
- }
26
-
27
6
  export function* checkoutGrantRequestSaga({ payload }) {
28
7
  try {
29
8
  const url = API_GRANT_REQUEST_GROUP;
@@ -43,9 +22,5 @@ export function* checkoutGrantRequestSaga({ payload }) {
43
22
  }
44
23
 
45
24
  export function* operateGrantRequestToCartRequestSaga() {
46
- yield takeLatest(
47
- fetchGrantRequestTemplates.TRIGGER,
48
- fetchGrantRequestTemplatesSaga
49
- );
50
25
  yield takeLatest(checkoutGrantRequest.TRIGGER, checkoutGrantRequestSaga);
51
26
  }
@@ -1,6 +1,6 @@
1
1
  import _ from "lodash/fp";
2
2
  import React from "react";
3
- import { Header } from "semantic-ui-react";
3
+ import { Header, Icon, Popup } from "semantic-ui-react";
4
4
  import { createSelector } from "reselect";
5
5
  import { useIntl } from "react-intl";
6
6
  import PropTypes from "prop-types";
@@ -32,12 +32,24 @@ PathDecorator.propTypes = {
32
32
  data_structure: PropTypes.object,
33
33
  };
34
34
 
35
- export const StructureDecorator = ({ data_structure }) => {
36
- return <>{data_structure.name}</>;
35
+ export const StructureDecorator = ({ data_structure, modificationGrant }) => {
36
+ const { formatMessage } = useIntl();
37
+ return (
38
+ <>
39
+ {modificationGrant ? (
40
+ <Popup
41
+ content={formatMessage({ id: "grantRequest.isModification" })}
42
+ trigger={<Icon name="edit" />}
43
+ />
44
+ ) : null}
45
+ {data_structure.name}
46
+ </>
47
+ );
37
48
  };
38
49
 
39
50
  StructureDecorator.propTypes = {
40
51
  data_structure: PropTypes.object,
52
+ modificationGrant: PropTypes.object,
41
53
  };
42
54
 
43
55
  const DateDecorator = ({ date }) => {
@@ -74,6 +86,9 @@ export const defaultGrantRequestsTableColumns = [
74
86
  name: "data_structure",
75
87
  fieldSelector: (grantRequest) => ({
76
88
  data_structure: grantRequest?._embedded?.data_structure,
89
+ modificationGrant: _.prop("_embedded.group._embedded.modification_grant")(
90
+ grantRequest
91
+ ),
77
92
  }),
78
93
  fieldDecorator: StructureDecorator,
79
94
  },