@truedat/dd 4.48.12 → 4.49.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 +6 -0
- package/package.json +5 -5
- package/src/api/fragments.js +2 -2
- package/src/api/mutations.js +33 -11
- package/src/api/queries.js +37 -10
- package/src/api.js +0 -4
- package/src/components/DictionaryRoutes.js +4 -4
- package/src/components/StructureSummary.js +12 -22
- package/src/components/StructureTag.js +83 -54
- package/src/components/StructureTagForm.js +149 -89
- package/src/components/StructureTags.js +57 -27
- package/src/components/Tag.js +62 -0
- package/src/components/TagCards.js +85 -0
- package/src/components/TagCrumbs.js +25 -0
- package/src/components/TagForm.js +102 -0
- package/src/components/TagStructureButton.js +58 -0
- package/src/components/Tags.js +33 -0
- package/src/components/TagsRoutes.js +39 -0
- package/src/components/__tests__/StructureSummary.spec.js +0 -7
- package/src/components/__tests__/StructureTag.spec.js +79 -5
- package/src/components/__tests__/StructureTagForm.spec.js +99 -50
- package/src/components/__tests__/Tag.spec.js +11 -0
- package/src/components/__tests__/{StructureTagsCards.spec.js → TagCards.spec.js} +10 -10
- package/src/components/__tests__/TagCrumbs.spec.js +10 -0
- package/src/components/__tests__/TagForm.spec.js +72 -0
- package/src/components/__tests__/Tags.spec.js +10 -0
- package/src/components/__tests__/__snapshots__/StructureSummary.spec.js.snap +18 -42
- package/src/components/__tests__/__snapshots__/StructureTag.spec.js.snap +10 -30
- package/src/components/__tests__/__snapshots__/StructureTagForm.spec.js.snap +255 -51
- package/src/components/__tests__/__snapshots__/Tag.spec.js.snap +36 -0
- package/src/components/__tests__/__snapshots__/{StructureTagsCards.spec.js.snap → TagCards.spec.js.snap} +1 -1
- package/src/components/__tests__/__snapshots__/TagCrumbs.spec.js.snap +102 -0
- package/src/components/__tests__/__snapshots__/TagForm.spec.js.snap +70 -0
- package/src/components/__tests__/__snapshots__/{StructureTags.spec.js.snap → Tags.spec.js.snap} +1 -1
- package/src/messages/en.js +25 -30
- package/src/messages/es.js +25 -30
- package/src/reducers/__tests__/{editableStructureTags.spec.js → availableTags.spec.js} +7 -11
- package/src/reducers/__tests__/structureTagSaving.spec.js +36 -0
- package/src/reducers/__tests__/tagSaving.spec.js +32 -0
- package/src/reducers/{editableStructureTags.js → availableTags.js} +2 -2
- package/src/reducers/index.js +6 -12
- package/src/reducers/structureRedirect.js +7 -7
- package/src/reducers/structureTagSaving.js +12 -10
- package/src/reducers/tagSaving.js +18 -0
- package/src/routines.js +5 -6
- package/src/sagas/__tests__/createTag.spec.js +81 -0
- package/src/sagas/__tests__/deleteStructureTag.spec.js +11 -12
- package/src/sagas/__tests__/deleteTag.spec.js +76 -0
- package/src/sagas/__tests__/tagStructure.spec.js +86 -0
- package/src/sagas/__tests__/updateTag.spec.js +81 -0
- package/src/sagas/createTag.js +29 -0
- package/src/sagas/deleteStructureTag.js +12 -9
- package/src/sagas/deleteTag.js +34 -0
- package/src/sagas/index.js +15 -18
- package/src/sagas/tagStructure.js +37 -0
- package/src/sagas/updateTag.js +23 -0
- package/src/components/LinkStructureTagForm.js +0 -163
- package/src/components/LinkedStructureTag.js +0 -124
- package/src/components/StructureLinkTagButton.js +0 -47
- package/src/components/StructureTagsCards.js +0 -92
- package/src/components/StructureTagsCrumbs.js +0 -44
- package/src/components/StructureTagsRoutes.js +0 -45
- package/src/components/TagsHeader.js +0 -32
- package/src/components/__tests__/LinkStructureTagForm.spec.js +0 -184
- package/src/components/__tests__/LinkedStructureTag.spec.js +0 -133
- package/src/components/__tests__/StructureTags.spec.js +0 -14
- package/src/components/__tests__/StructureTagsCrumbs.spec.js +0 -13
- package/src/components/__tests__/__snapshots__/LinkStructureTagForm.spec.js.snap +0 -456
- package/src/components/__tests__/__snapshots__/LinkedStructureTag.spec.js.snap +0 -16
- package/src/components/__tests__/__snapshots__/StructureTagsCrumbs.spec.js.snap +0 -36
- package/src/reducers/__tests__/deletingStructureTags.spec.js +0 -30
- package/src/reducers/__tests__/linkedStructureTags.spec.js +0 -69
- package/src/reducers/__tests__/linkedStructureTagsLoading.spec.js +0 -32
- package/src/reducers/__tests__/linkingStructureTags.spec.js +0 -30
- package/src/reducers/__tests__/structureTagsSaving.spec.js +0 -40
- package/src/reducers/deletingStructureTags.js +0 -16
- package/src/reducers/linkedStructureTags.js +0 -28
- package/src/reducers/linkedStructureTagsLoading.js +0 -16
- package/src/reducers/linkingStructureTags.js +0 -16
- package/src/sagas/__tests__/createStructureTag.spec.js +0 -85
- package/src/sagas/__tests__/deleteLinkStructureTag.spec.js +0 -96
- package/src/sagas/__tests__/fetchLinksStructureTags.spec.js +0 -105
- package/src/sagas/__tests__/linkStructureTag.spec.js +0 -102
- package/src/sagas/__tests__/updateStructureTag.spec.js +0 -84
- package/src/sagas/createStructureTag.js +0 -29
- package/src/sagas/deleteLinkStructureTag.js +0 -29
- package/src/sagas/fetchLinksStructureTags.js +0 -31
- package/src/sagas/linkStructureTag.js +0 -30
- package/src/sagas/updateStructureTag.js +0 -23
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { testSaga } from "redux-saga-test-plan";
|
|
2
|
-
import { DELETE_STRUCTURE_TAG } from "../../api/mutations";
|
|
3
|
-
import { deleteStructureTag } from "../../routines";
|
|
4
2
|
import {
|
|
5
|
-
deleteStructureTagRequestSaga,
|
|
6
3
|
deleteStructureTagSaga,
|
|
4
|
+
deleteStructureTagRequestSaga,
|
|
7
5
|
onSuccess,
|
|
8
6
|
} from "../deleteStructureTag";
|
|
7
|
+
import { deleteStructureTag } from "../../routines";
|
|
8
|
+
import { DELETE_STRUCTURE_TAG } from "../../api/mutations";
|
|
9
9
|
|
|
10
10
|
describe("sagas: deleteStructureTagRequestSaga", () => {
|
|
11
|
-
it("should invoke deleteStructureTagSaga on
|
|
11
|
+
it("should invoke deleteStructureTagSaga on deleteStructureTag.TRIGGER", () => {
|
|
12
12
|
expect(() => {
|
|
13
13
|
testSaga(deleteStructureTagRequestSaga)
|
|
14
14
|
.next()
|
|
@@ -28,8 +28,8 @@ describe("sagas: deleteStructureTagRequestSaga", () => {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
describe("sagas: deleteStructureTagSaga", () => {
|
|
31
|
-
const
|
|
32
|
-
const
|
|
31
|
+
const payload = 1;
|
|
32
|
+
const data = { id: 1 };
|
|
33
33
|
const client = { mutate: jest.fn() };
|
|
34
34
|
|
|
35
35
|
it("should put a success action when a response is returned", () => {
|
|
@@ -43,10 +43,10 @@ describe("sagas: deleteStructureTagSaga", () => {
|
|
|
43
43
|
.call(client.mutate, {
|
|
44
44
|
mutation: DELETE_STRUCTURE_TAG,
|
|
45
45
|
update: onSuccess,
|
|
46
|
-
variables: payload,
|
|
46
|
+
variables: { id: payload },
|
|
47
47
|
})
|
|
48
|
-
.next({ data
|
|
49
|
-
.put(deleteStructureTag.success(
|
|
48
|
+
.next({ data })
|
|
49
|
+
.put(deleteStructureTag.success(data))
|
|
50
50
|
.next()
|
|
51
51
|
.put(deleteStructureTag.fulfill())
|
|
52
52
|
.next()
|
|
@@ -54,10 +54,9 @@ describe("sagas: deleteStructureTagSaga", () => {
|
|
|
54
54
|
}).not.toThrow();
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
it("should put a failure action when the call
|
|
57
|
+
it("should put a failure action when the call returns an error with message", () => {
|
|
58
58
|
const message = "Request failed";
|
|
59
59
|
const error = { message };
|
|
60
|
-
const client = { mutate: jest.fn() };
|
|
61
60
|
|
|
62
61
|
expect(() => {
|
|
63
62
|
testSaga(deleteStructureTagSaga, { payload })
|
|
@@ -69,7 +68,7 @@ describe("sagas: deleteStructureTagSaga", () => {
|
|
|
69
68
|
.call(client.mutate, {
|
|
70
69
|
mutation: DELETE_STRUCTURE_TAG,
|
|
71
70
|
update: onSuccess,
|
|
72
|
-
variables: payload,
|
|
71
|
+
variables: { id: payload },
|
|
73
72
|
})
|
|
74
73
|
.throw(error)
|
|
75
74
|
.put(deleteStructureTag.failure(message))
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { testSaga } from "redux-saga-test-plan";
|
|
2
|
+
import { DELETE_TAG } from "../../api/mutations";
|
|
3
|
+
import { deleteTag } from "../../routines";
|
|
4
|
+
import { deleteTagRequestSaga, deleteTagSaga, onSuccess } from "../deleteTag";
|
|
5
|
+
|
|
6
|
+
describe("sagas: deleteTagRequestSaga", () => {
|
|
7
|
+
it("should invoke deleteTagSaga on trigger", () => {
|
|
8
|
+
expect(() => {
|
|
9
|
+
testSaga(deleteTagRequestSaga)
|
|
10
|
+
.next()
|
|
11
|
+
.takeLatest(deleteTag.TRIGGER, deleteTagSaga)
|
|
12
|
+
.finish()
|
|
13
|
+
.isDone();
|
|
14
|
+
}).not.toThrow();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("should throw exception if an unhandled action is received", () => {
|
|
18
|
+
expect(() => {
|
|
19
|
+
testSaga(deleteTagRequestSaga).next().takeLatest("FOO", deleteTagSaga);
|
|
20
|
+
}).toThrow();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
describe("sagas: deleteTagSaga", () => {
|
|
25
|
+
const id = 1;
|
|
26
|
+
const payload = { id };
|
|
27
|
+
const client = { mutate: jest.fn() };
|
|
28
|
+
|
|
29
|
+
it("should put a success action when a response is returned", () => {
|
|
30
|
+
expect(() => {
|
|
31
|
+
testSaga(deleteTagSaga, { payload })
|
|
32
|
+
.next()
|
|
33
|
+
.getContext("client")
|
|
34
|
+
.next(client)
|
|
35
|
+
.put(deleteTag.request(payload))
|
|
36
|
+
.next()
|
|
37
|
+
.call(client.mutate, {
|
|
38
|
+
mutation: DELETE_TAG,
|
|
39
|
+
update: onSuccess,
|
|
40
|
+
variables: payload,
|
|
41
|
+
})
|
|
42
|
+
.next({ data: payload })
|
|
43
|
+
.put(deleteTag.success(payload))
|
|
44
|
+
.next()
|
|
45
|
+
.put(deleteTag.fulfill())
|
|
46
|
+
.next()
|
|
47
|
+
.isDone();
|
|
48
|
+
}).not.toThrow();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("should put a failure action when the call throws an error", () => {
|
|
52
|
+
const message = "Request failed";
|
|
53
|
+
const error = { message };
|
|
54
|
+
const client = { mutate: jest.fn() };
|
|
55
|
+
|
|
56
|
+
expect(() => {
|
|
57
|
+
testSaga(deleteTagSaga, { payload })
|
|
58
|
+
.next()
|
|
59
|
+
.getContext("client")
|
|
60
|
+
.next(client)
|
|
61
|
+
.put(deleteTag.request(payload))
|
|
62
|
+
.next()
|
|
63
|
+
.call(client.mutate, {
|
|
64
|
+
mutation: DELETE_TAG,
|
|
65
|
+
update: onSuccess,
|
|
66
|
+
variables: payload,
|
|
67
|
+
})
|
|
68
|
+
.throw(error)
|
|
69
|
+
.put(deleteTag.failure(message))
|
|
70
|
+
.next()
|
|
71
|
+
.put(deleteTag.fulfill())
|
|
72
|
+
.next()
|
|
73
|
+
.isDone();
|
|
74
|
+
}).not.toThrow();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { testSaga } from "redux-saga-test-plan";
|
|
2
|
+
import {
|
|
3
|
+
tagStructureSaga,
|
|
4
|
+
tagStructureRequestSaga,
|
|
5
|
+
onSuccess,
|
|
6
|
+
} from "../tagStructure";
|
|
7
|
+
import { tagStructure } from "../../routines";
|
|
8
|
+
import { TAG_STRUCTURE } from "../../api/mutations";
|
|
9
|
+
|
|
10
|
+
describe("sagas: tagStructureRequestSaga", () => {
|
|
11
|
+
it("should invoke tagStructureSaga on tagStructure.TRIGGER", () => {
|
|
12
|
+
expect(() => {
|
|
13
|
+
testSaga(tagStructureRequestSaga)
|
|
14
|
+
.next()
|
|
15
|
+
.takeLatest(tagStructure.TRIGGER, tagStructureSaga)
|
|
16
|
+
.finish()
|
|
17
|
+
.isDone();
|
|
18
|
+
}).not.toThrow();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("should throw exception if an unhandled action is received", () => {
|
|
22
|
+
expect(() => {
|
|
23
|
+
testSaga(tagStructureRequestSaga)
|
|
24
|
+
.next()
|
|
25
|
+
.takeLatest("FOO", tagStructureSaga);
|
|
26
|
+
}).toThrow();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe("sagas: tagStructureSaga", () => {
|
|
31
|
+
const payload = {
|
|
32
|
+
tagId: 1,
|
|
33
|
+
dataStructureId: 1,
|
|
34
|
+
comment: "foo",
|
|
35
|
+
inherit: false,
|
|
36
|
+
};
|
|
37
|
+
const data = { id: 1 };
|
|
38
|
+
const client = { mutate: jest.fn() };
|
|
39
|
+
|
|
40
|
+
it("should put a success action when a response is returned", () => {
|
|
41
|
+
expect(() => {
|
|
42
|
+
testSaga(tagStructureSaga, { payload })
|
|
43
|
+
.next()
|
|
44
|
+
.getContext("client")
|
|
45
|
+
.next(client)
|
|
46
|
+
.put(tagStructure.request(payload))
|
|
47
|
+
.next()
|
|
48
|
+
.call(client.mutate, {
|
|
49
|
+
mutation: TAG_STRUCTURE,
|
|
50
|
+
update: onSuccess,
|
|
51
|
+
variables: { structureTag: payload },
|
|
52
|
+
})
|
|
53
|
+
.next({ data })
|
|
54
|
+
.put(tagStructure.success(data))
|
|
55
|
+
.next()
|
|
56
|
+
.put(tagStructure.fulfill())
|
|
57
|
+
.next()
|
|
58
|
+
.isDone();
|
|
59
|
+
}).not.toThrow();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("should put a failure action when the call returns an error with message", () => {
|
|
63
|
+
const message = "Request failed";
|
|
64
|
+
const error = { message };
|
|
65
|
+
|
|
66
|
+
expect(() => {
|
|
67
|
+
testSaga(tagStructureSaga, { payload })
|
|
68
|
+
.next()
|
|
69
|
+
.getContext("client")
|
|
70
|
+
.next(client)
|
|
71
|
+
.put(tagStructure.request(payload))
|
|
72
|
+
.next()
|
|
73
|
+
.call(client.mutate, {
|
|
74
|
+
mutation: TAG_STRUCTURE,
|
|
75
|
+
update: onSuccess,
|
|
76
|
+
variables: { structureTag: payload },
|
|
77
|
+
})
|
|
78
|
+
.throw(error)
|
|
79
|
+
.put(tagStructure.failure(message))
|
|
80
|
+
.next()
|
|
81
|
+
.put(tagStructure.fulfill())
|
|
82
|
+
.next()
|
|
83
|
+
.isDone();
|
|
84
|
+
}).not.toThrow();
|
|
85
|
+
});
|
|
86
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { testSaga } from "redux-saga-test-plan";
|
|
2
|
+
import { updateTagRequestSaga, updateTagSaga } from "../updateTag";
|
|
3
|
+
import { UPDATE_TAG } from "../../api/mutations";
|
|
4
|
+
import { updateTag } from "../../routines";
|
|
5
|
+
|
|
6
|
+
describe("sagas: updateTagRequestSaga", () => {
|
|
7
|
+
it("should invoke updateTagSaga on updateTag.TRIGGER", () => {
|
|
8
|
+
expect(() => {
|
|
9
|
+
testSaga(updateTagRequestSaga)
|
|
10
|
+
.next()
|
|
11
|
+
.takeLatest(updateTag.TRIGGER, updateTagSaga)
|
|
12
|
+
.finish()
|
|
13
|
+
.isDone();
|
|
14
|
+
}).not.toThrow();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("should throw exception if an unhandled action is received", () => {
|
|
18
|
+
expect(() => {
|
|
19
|
+
testSaga(updateTagRequestSaga)
|
|
20
|
+
.next()
|
|
21
|
+
.takeLatest("FOO", updateTagRequestSaga);
|
|
22
|
+
}).toThrow();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe("sagas: updateTagSaga", () => {
|
|
27
|
+
const client = { mutate: jest.fn() };
|
|
28
|
+
const tag = {
|
|
29
|
+
id: "123",
|
|
30
|
+
name: "tag1",
|
|
31
|
+
domainIds: ["1", "2"],
|
|
32
|
+
};
|
|
33
|
+
const payload = tag;
|
|
34
|
+
const variables = { id: tag.id, tag };
|
|
35
|
+
const data = { foo: "bar" };
|
|
36
|
+
|
|
37
|
+
it("should put a success action when a response is returned", () => {
|
|
38
|
+
expect(() => {
|
|
39
|
+
testSaga(updateTagSaga, { payload })
|
|
40
|
+
.next()
|
|
41
|
+
.getContext("client")
|
|
42
|
+
.next(client)
|
|
43
|
+
.put(updateTag.request(payload))
|
|
44
|
+
.next()
|
|
45
|
+
.call(client.mutate, {
|
|
46
|
+
mutation: UPDATE_TAG,
|
|
47
|
+
variables,
|
|
48
|
+
})
|
|
49
|
+
.next({ data })
|
|
50
|
+
.put(updateTag.success(data))
|
|
51
|
+
.next()
|
|
52
|
+
.put(updateTag.fulfill())
|
|
53
|
+
.next()
|
|
54
|
+
.isDone();
|
|
55
|
+
}).not.toThrow();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("should put a failure action when the call returns an error", () => {
|
|
59
|
+
const message = "Request failed";
|
|
60
|
+
const error = { message };
|
|
61
|
+
|
|
62
|
+
expect(() => {
|
|
63
|
+
testSaga(updateTagSaga, { payload })
|
|
64
|
+
.next()
|
|
65
|
+
.getContext("client")
|
|
66
|
+
.next(client)
|
|
67
|
+
.put(updateTag.request(payload))
|
|
68
|
+
.next()
|
|
69
|
+
.call(client.mutate, {
|
|
70
|
+
mutation: UPDATE_TAG,
|
|
71
|
+
variables,
|
|
72
|
+
})
|
|
73
|
+
.throw(error)
|
|
74
|
+
.put(updateTag.failure(message))
|
|
75
|
+
.next()
|
|
76
|
+
.put(updateTag.fulfill())
|
|
77
|
+
.next()
|
|
78
|
+
.isDone();
|
|
79
|
+
}).not.toThrow();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { call, put, takeLatest, getContext } from "redux-saga/effects";
|
|
2
|
+
import { CREATE_TAG } from "../api/mutations";
|
|
3
|
+
import { createTag } from "../routines";
|
|
4
|
+
|
|
5
|
+
export const onSuccess = (cache) => {
|
|
6
|
+
cache.evict({ id: "ROOT_QUERY", fieldName: "tags" });
|
|
7
|
+
cache.gc();
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function* createTagSaga({ payload }) {
|
|
11
|
+
const client = yield getContext("client");
|
|
12
|
+
try {
|
|
13
|
+
yield put(createTag.request(payload));
|
|
14
|
+
const { data } = yield call(client.mutate, {
|
|
15
|
+
mutation: CREATE_TAG,
|
|
16
|
+
update: onSuccess,
|
|
17
|
+
variables: { tag: payload },
|
|
18
|
+
});
|
|
19
|
+
yield put(createTag.success(data));
|
|
20
|
+
} catch (error) {
|
|
21
|
+
yield put(createTag.failure(error.message));
|
|
22
|
+
} finally {
|
|
23
|
+
yield put(createTag.fulfill());
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function* createTagRequestSaga() {
|
|
28
|
+
yield takeLatest(createTag.TRIGGER, createTagSaga);
|
|
29
|
+
}
|
|
@@ -4,26 +4,29 @@ import { DELETE_STRUCTURE_TAG } from "../api/mutations";
|
|
|
4
4
|
|
|
5
5
|
export const onSuccess = (cache, { data: { deleteStructureTag } }) => {
|
|
6
6
|
cache.evict({ id: cache.identify(deleteStructureTag) });
|
|
7
|
+
cache.evict({
|
|
8
|
+
id: cache.identify(deleteStructureTag?.dataStructure),
|
|
9
|
+
fieldName: "structureTags",
|
|
10
|
+
});
|
|
11
|
+
cache.evict({
|
|
12
|
+
id: cache.identify(deleteStructureTag?.dataStructure),
|
|
13
|
+
fieldName: "availableTags",
|
|
14
|
+
});
|
|
7
15
|
cache.gc();
|
|
8
16
|
};
|
|
9
17
|
|
|
10
|
-
export function* deleteStructureTagSaga({ payload }) {
|
|
18
|
+
export function* deleteStructureTagSaga({ payload: id }) {
|
|
11
19
|
const client = yield getContext("client");
|
|
12
20
|
try {
|
|
13
|
-
yield put(deleteStructureTag.request(
|
|
21
|
+
yield put(deleteStructureTag.request(id));
|
|
14
22
|
const { data } = yield call(client.mutate, {
|
|
15
23
|
mutation: DELETE_STRUCTURE_TAG,
|
|
16
24
|
update: onSuccess,
|
|
17
|
-
variables:
|
|
25
|
+
variables: { id },
|
|
18
26
|
});
|
|
19
27
|
yield put(deleteStructureTag.success(data));
|
|
20
28
|
} catch (error) {
|
|
21
|
-
|
|
22
|
-
const { status, data } = error.response;
|
|
23
|
-
yield put(deleteStructureTag.failure({ status, data }));
|
|
24
|
-
} else {
|
|
25
|
-
yield put(deleteStructureTag.failure(error.message));
|
|
26
|
-
}
|
|
29
|
+
yield put(deleteStructureTag.failure(error.message));
|
|
27
30
|
} finally {
|
|
28
31
|
yield put(deleteStructureTag.fulfill());
|
|
29
32
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { call, put, takeLatest, getContext } from "redux-saga/effects";
|
|
2
|
+
import { deleteTag } from "../routines";
|
|
3
|
+
import { DELETE_TAG } from "../api/mutations";
|
|
4
|
+
|
|
5
|
+
export const onSuccess = (cache, { data: { deleteTag } }) => {
|
|
6
|
+
cache.evict({ id: cache.identify(deleteTag) });
|
|
7
|
+
cache.gc();
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function* deleteTagSaga({ payload }) {
|
|
11
|
+
const client = yield getContext("client");
|
|
12
|
+
try {
|
|
13
|
+
yield put(deleteTag.request(payload));
|
|
14
|
+
const { data } = yield call(client.mutate, {
|
|
15
|
+
mutation: DELETE_TAG,
|
|
16
|
+
update: onSuccess,
|
|
17
|
+
variables: payload,
|
|
18
|
+
});
|
|
19
|
+
yield put(deleteTag.success(data));
|
|
20
|
+
} catch (error) {
|
|
21
|
+
if (error.response) {
|
|
22
|
+
const { status, data } = error.response;
|
|
23
|
+
yield put(deleteTag.failure({ status, data }));
|
|
24
|
+
} else {
|
|
25
|
+
yield put(deleteTag.failure(error.message));
|
|
26
|
+
}
|
|
27
|
+
} finally {
|
|
28
|
+
yield put(deleteTag.fulfill());
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function* deleteTagRequestSaga() {
|
|
33
|
+
yield takeLatest(deleteTag.TRIGGER, deleteTagSaga);
|
|
34
|
+
}
|
package/src/sagas/index.js
CHANGED
|
@@ -4,12 +4,12 @@ import { createGraphRequestSaga } from "./createGraph";
|
|
|
4
4
|
import { createProfileGroupRequestSaga } from "./createProfileGroup";
|
|
5
5
|
import { createReferenceDatasetRequestSaga } from "./createReferenceDataset";
|
|
6
6
|
import { createStructureGraphRequestSaga } from "./createStructureGraph";
|
|
7
|
-
import { createStructureTagRequestSaga } from "./createStructureTag";
|
|
8
7
|
import { createSystemRequestSaga } from "./createSystem";
|
|
9
|
-
import {
|
|
8
|
+
import { createTagRequestSaga } from "./createTag";
|
|
9
|
+
import { deleteStructureTagRequestSaga } from "./deleteStructureTag";
|
|
10
10
|
import { deleteReferenceDatasetRequestSaga } from "./deleteReferenceDataset";
|
|
11
11
|
import { deleteStructureRequestSaga } from "./deleteStructure";
|
|
12
|
-
import {
|
|
12
|
+
import { deleteTagRequestSaga } from "./deleteTag";
|
|
13
13
|
import { deleteUserSearchFilterRequestSaga } from "./deleteUserSearchFilter";
|
|
14
14
|
import { doStructureNoteActionRequestSaga } from "./doStructureNoteAction";
|
|
15
15
|
import { downloadCsvGraphRequestSaga } from "./downloadCsvGraph";
|
|
@@ -23,7 +23,6 @@ import { fetchGrantRequestsRequestSaga } from "./fetchGrantRequests";
|
|
|
23
23
|
import { fetchGrantsRequestSaga } from "./fetchGrants";
|
|
24
24
|
import { fetchGraphRequestSaga } from "./fetchGraph";
|
|
25
25
|
import { fetchLineageEventsRequestSaga } from "./fetchLineageEvents";
|
|
26
|
-
import { fetchLinksStructureTagsRequestSaga } from "./fetchLinksStructureTags";
|
|
27
26
|
import { fetchNodesRequestSaga } from "./fetchNodes";
|
|
28
27
|
import { fetchProfileExecutionRequestSaga } from "./fetchProfileExecution";
|
|
29
28
|
import { fetchProfileGroupRequestSaga } from "./fetchProfileGroup";
|
|
@@ -40,17 +39,17 @@ import { fetchSystemStructuresRequestSaga } from "./fetchSystemStructures";
|
|
|
40
39
|
import { fetchSystemsRequestSaga } from "./fetchSystems";
|
|
41
40
|
import { fetchUnitDomainsRequestSaga } from "./fetchUnitDomains";
|
|
42
41
|
import { fetchUserSearchFiltersRequestSaga } from "./fetchUserSearchFilters";
|
|
43
|
-
import {
|
|
42
|
+
import { tagStructureRequestSaga } from "./tagStructure";
|
|
44
43
|
import { operateGrantRequestToCartRequestSaga } from "./operateGrantRequestCart";
|
|
45
44
|
import { requestGrantRemovalRequestSaga } from "./requestGrantRemoval";
|
|
46
45
|
import { saveUserSearchFiltersRequestSaga } from "./saveUserSearchFilters";
|
|
47
46
|
import { updateReferenceDatasetRequestSaga } from "./updateReferenceDataset";
|
|
48
47
|
import { updateStructureRequestSaga } from "./updateStructure";
|
|
49
|
-
import { updateStructureTagRequestSaga } from "./updateStructureTag";
|
|
50
48
|
import { updateStructureTypeRequestSaga } from "./updateStructureType";
|
|
51
49
|
import { updateSystemRequestSaga } from "./updateSystem";
|
|
52
50
|
import { uploadStructuresDomainsRequestSaga } from "./uploadStructuresDomains";
|
|
53
51
|
import { uploadStructuresRequestSaga } from "./uploadStructures";
|
|
52
|
+
import { updateTagRequestSaga } from "./updateTag";
|
|
54
53
|
|
|
55
54
|
export {
|
|
56
55
|
bulkUpdateStructuresRequestsSaga,
|
|
@@ -59,12 +58,12 @@ export {
|
|
|
59
58
|
createProfileGroupRequestSaga,
|
|
60
59
|
createReferenceDatasetRequestSaga,
|
|
61
60
|
createStructureGraphRequestSaga,
|
|
62
|
-
createStructureTagRequestSaga,
|
|
63
61
|
createSystemRequestSaga,
|
|
64
|
-
|
|
62
|
+
createTagRequestSaga,
|
|
63
|
+
deleteStructureTagRequestSaga,
|
|
65
64
|
deleteReferenceDatasetRequestSaga,
|
|
66
65
|
deleteStructureRequestSaga,
|
|
67
|
-
|
|
66
|
+
deleteTagRequestSaga,
|
|
68
67
|
deleteUserSearchFilterRequestSaga,
|
|
69
68
|
doStructureNoteActionRequestSaga,
|
|
70
69
|
downloadCsvGraphRequestSaga,
|
|
@@ -78,7 +77,6 @@ export {
|
|
|
78
77
|
fetchGrantsRequestSaga,
|
|
79
78
|
fetchGraphRequestSaga,
|
|
80
79
|
fetchLineageEventsRequestSaga,
|
|
81
|
-
fetchLinksStructureTagsRequestSaga,
|
|
82
80
|
fetchNodesRequestSaga,
|
|
83
81
|
fetchProfileExecutionRequestSaga,
|
|
84
82
|
fetchProfileGroupRequestSaga,
|
|
@@ -95,17 +93,17 @@ export {
|
|
|
95
93
|
fetchSystemsRequestSaga,
|
|
96
94
|
fetchUnitDomainsRequestSaga,
|
|
97
95
|
fetchUserSearchFiltersRequestSaga,
|
|
98
|
-
|
|
96
|
+
tagStructureRequestSaga,
|
|
99
97
|
operateGrantRequestToCartRequestSaga,
|
|
100
98
|
requestGrantRemovalRequestSaga,
|
|
101
99
|
saveUserSearchFiltersRequestSaga,
|
|
102
100
|
updateReferenceDatasetRequestSaga,
|
|
103
101
|
updateStructureRequestSaga,
|
|
104
|
-
updateStructureTagRequestSaga,
|
|
105
102
|
updateStructureTypeRequestSaga,
|
|
106
103
|
updateSystemRequestSaga,
|
|
107
104
|
uploadStructuresDomainsRequestSaga,
|
|
108
105
|
uploadStructuresRequestSaga,
|
|
106
|
+
updateTagRequestSaga,
|
|
109
107
|
};
|
|
110
108
|
|
|
111
109
|
export default [
|
|
@@ -115,12 +113,12 @@ export default [
|
|
|
115
113
|
createProfileGroupRequestSaga(),
|
|
116
114
|
createReferenceDatasetRequestSaga(),
|
|
117
115
|
createStructureGraphRequestSaga(),
|
|
118
|
-
|
|
116
|
+
createTagRequestSaga(),
|
|
119
117
|
createSystemRequestSaga(),
|
|
120
|
-
|
|
118
|
+
deleteStructureTagRequestSaga(),
|
|
121
119
|
deleteReferenceDatasetRequestSaga(),
|
|
122
120
|
deleteStructureRequestSaga(),
|
|
123
|
-
|
|
121
|
+
deleteTagRequestSaga(),
|
|
124
122
|
deleteUserSearchFilterRequestSaga(),
|
|
125
123
|
doStructureNoteActionRequestSaga(),
|
|
126
124
|
downloadCsvGraphRequestSaga(),
|
|
@@ -134,7 +132,6 @@ export default [
|
|
|
134
132
|
fetchGrantsRequestSaga(),
|
|
135
133
|
fetchGraphRequestSaga(),
|
|
136
134
|
fetchLineageEventsRequestSaga(),
|
|
137
|
-
fetchLinksStructureTagsRequestSaga(),
|
|
138
135
|
fetchNodesRequestSaga(),
|
|
139
136
|
fetchProfileExecutionRequestSaga(),
|
|
140
137
|
fetchProfileGroupRequestSaga(),
|
|
@@ -151,13 +148,13 @@ export default [
|
|
|
151
148
|
fetchSystemsRequestSaga(),
|
|
152
149
|
fetchUnitDomainsRequestSaga(),
|
|
153
150
|
fetchUserSearchFiltersRequestSaga(),
|
|
154
|
-
|
|
151
|
+
tagStructureRequestSaga(),
|
|
155
152
|
operateGrantRequestToCartRequestSaga(),
|
|
156
153
|
requestGrantRemovalRequestSaga(),
|
|
157
154
|
saveUserSearchFiltersRequestSaga(),
|
|
158
155
|
updateReferenceDatasetRequestSaga(),
|
|
159
156
|
updateStructureRequestSaga(),
|
|
160
|
-
|
|
157
|
+
updateTagRequestSaga(),
|
|
161
158
|
updateStructureTypeRequestSaga(),
|
|
162
159
|
updateSystemRequestSaga(),
|
|
163
160
|
uploadStructuresDomainsRequestSaga(),
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { call, put, takeLatest, getContext } from "redux-saga/effects";
|
|
2
|
+
import { tagStructure } from "../routines";
|
|
3
|
+
import { TAG_STRUCTURE } from "../api/mutations";
|
|
4
|
+
|
|
5
|
+
export const onSuccess = (cache, { data: { tagStructure } }) => {
|
|
6
|
+
cache.evict({ id: cache.identify(tagStructure) });
|
|
7
|
+
cache.evict({
|
|
8
|
+
id: cache.identify(tagStructure?.dataStructure),
|
|
9
|
+
fieldName: "structureTags",
|
|
10
|
+
});
|
|
11
|
+
cache.evict({
|
|
12
|
+
id: cache.identify(tagStructure?.dataStructure),
|
|
13
|
+
fieldName: "availableTags",
|
|
14
|
+
});
|
|
15
|
+
cache.gc();
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function* tagStructureSaga({ payload }) {
|
|
19
|
+
const client = yield getContext("client");
|
|
20
|
+
try {
|
|
21
|
+
yield put(tagStructure.request(payload));
|
|
22
|
+
const { data } = yield call(client.mutate, {
|
|
23
|
+
mutation: TAG_STRUCTURE,
|
|
24
|
+
update: onSuccess,
|
|
25
|
+
variables: { structureTag: payload },
|
|
26
|
+
});
|
|
27
|
+
yield put(tagStructure.success(data));
|
|
28
|
+
} catch (error) {
|
|
29
|
+
yield put(tagStructure.failure(error.message));
|
|
30
|
+
} finally {
|
|
31
|
+
yield put(tagStructure.fulfill());
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function* tagStructureRequestSaga() {
|
|
36
|
+
yield takeLatest(tagStructure.TRIGGER, tagStructureSaga);
|
|
37
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { call, put, takeLatest, getContext } from "redux-saga/effects";
|
|
2
|
+
import { updateTag } from "../routines";
|
|
3
|
+
import { UPDATE_TAG } from "../api/mutations";
|
|
4
|
+
|
|
5
|
+
export function* updateTagSaga({ payload }) {
|
|
6
|
+
const client = yield getContext("client");
|
|
7
|
+
try {
|
|
8
|
+
yield put(updateTag.request(payload));
|
|
9
|
+
const { data } = yield call(client.mutate, {
|
|
10
|
+
mutation: UPDATE_TAG,
|
|
11
|
+
variables: { id: payload?.id, tag: payload },
|
|
12
|
+
});
|
|
13
|
+
yield put(updateTag.success(data));
|
|
14
|
+
} catch (error) {
|
|
15
|
+
yield put(updateTag.failure(error.message));
|
|
16
|
+
} finally {
|
|
17
|
+
yield put(updateTag.fulfill());
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function* updateTagRequestSaga() {
|
|
22
|
+
yield takeLatest(updateTag.TRIGGER, updateTagSaga);
|
|
23
|
+
}
|