@truedat/dq 4.42.5 → 4.43.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 +12 -0
- package/package.json +5 -5
- package/src/api.js +8 -0
- package/src/components/ConditionSummary.js +1 -0
- package/src/components/FieldSummary.js +86 -0
- package/src/components/ImplementationStructureDelete.js +41 -0
- package/src/components/ImplementationStructureLink.js +24 -0
- package/src/components/ImplementationStructures.js +138 -0
- package/src/components/ImplementationStructuresNew.js +125 -0
- package/src/components/ImplementationSummary.js +11 -1
- package/src/components/NewRemediation.js +27 -20
- package/src/components/NewRuleImplementation.js +42 -6
- package/src/components/RemediationPlan.js +47 -78
- package/src/components/RuleImplementationProperties.js +2 -1
- package/src/components/RuleImplementationResultTabs.js +113 -0
- package/src/components/RuleImplementationResults.js +1 -1
- package/src/components/RuleImplementationTabs.js +16 -1
- package/src/components/RuleImplementationsTable.js +10 -3
- package/src/components/RuleResult.js +108 -0
- package/src/components/{ExecutionDetails.js → RuleResultDetails.js} +4 -21
- package/src/components/RuleResultRemediationLoader.js +44 -0
- package/src/components/RuleResultRemediations.js +47 -0
- package/src/components/RuleResultRow.js +0 -3
- package/src/components/RuleResultSegmentRow.js +83 -0
- package/src/components/RuleResultSegments.js +102 -0
- package/src/components/RuleResultSegmentsLoader.js +34 -0
- package/src/components/RuleResultsRoutes.js +73 -0
- package/src/components/RuleRoutes.js +38 -12
- package/src/components/__test_samples__/NewRuleImplementationProps.js +22 -2
- package/src/components/__tests__/ExecutionDetails.spec.js +5 -5
- package/src/components/__tests__/ImplementationStructureDelete.spec.js +27 -0
- package/src/components/__tests__/ImplementationStructureLink.spec.js +23 -0
- package/src/components/__tests__/ImplementationStructures.spec.js +88 -0
- package/src/components/__tests__/ImplementationStructuresNew.spec.js +34 -0
- package/src/components/__tests__/NewRuleImplementation.spec.js +27 -7
- package/src/components/__tests__/RuleImplementation.spec.js +2 -1
- package/src/components/__tests__/RuleImplementationTabs.spec.js +2 -1
- package/src/components/__tests__/RuleResultSegmentsLoader.spec.js +32 -0
- package/src/components/__tests__/__snapshots__/ExecutionDetails.spec.js.snap +2 -30
- package/src/components/__tests__/__snapshots__/ImplementationStructureDelete.spec.js.snap +10 -0
- package/src/components/__tests__/__snapshots__/ImplementationStructureLink.spec.js.snap +11 -0
- package/src/components/__tests__/__snapshots__/ImplementationStructures.spec.js.snap +208 -0
- package/src/components/__tests__/__snapshots__/ImplementationStructuresNew.spec.js.snap +106 -0
- package/src/components/__tests__/__snapshots__/NewRuleImplementation.spec.js.snap +1211 -1217
- package/src/components/__tests__/__snapshots__/RuleImplementation.spec.js.snap +7 -1
- package/src/components/__tests__/__snapshots__/RuleImplementationProperties.spec.js.snap +1 -0
- package/src/components/__tests__/__snapshots__/RuleImplementationTabs.spec.js.snap +8 -2
- package/src/components/index.js +2 -2
- package/src/components/ruleImplementationForm/FieldsGrid.js +57 -0
- package/src/components/ruleImplementationForm/FieldsGroup.js +107 -0
- package/src/components/ruleImplementationForm/RuleImplementationForm.js +45 -0
- package/src/components/ruleImplementationForm/SegmentsForm.js +35 -0
- package/src/components/ruleImplementationForm/__tests__/RuleImplementationForm.spec.js +27 -10
- package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationForm.spec.js.snap +315 -91
- package/src/messages/en.js +20 -1
- package/src/messages/es.js +21 -1
- package/src/reducers/__tests__/segmentResult.spec.js +46 -0
- package/src/reducers/index.js +2 -0
- package/src/reducers/ruleImplementation.js +2 -0
- package/src/reducers/ruleImplementationRedirect.js +4 -0
- package/src/reducers/segmentResults.js +19 -0
- package/src/routines.js +10 -0
- package/src/sagas/__tests__/createImplementationStructure.spec.js +86 -0
- package/src/sagas/__tests__/deleteImplementationStructure.spec.js +84 -0
- package/src/sagas/__tests__/fetchSegmentResults.spec.js +78 -0
- package/src/sagas/createImplementationStructure.js +32 -0
- package/src/sagas/deleteImplementationStructure.js +37 -0
- package/src/sagas/fetchSegmentResults.js +30 -0
- package/src/sagas/index.js +19 -10
- package/src/services/encodeRawContent.js +5 -5
- package/src/styles/remediationPlan.less +5 -0
- package/src/styles/ruleImplementationForm/DatasetForm.less +5 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import { fetchSegmentResults, clearSegmentResults } from "../routines";
|
|
3
|
+
|
|
4
|
+
const initialState = {};
|
|
5
|
+
|
|
6
|
+
const segmentResults = (state = initialState, { type, payload }) => {
|
|
7
|
+
switch (type) {
|
|
8
|
+
case fetchSegmentResults.TRIGGER:
|
|
9
|
+
return initialState;
|
|
10
|
+
case fetchSegmentResults.SUCCESS:
|
|
11
|
+
return _.prop("data")(payload);
|
|
12
|
+
case clearSegmentResults.TRIGGER:
|
|
13
|
+
return initialState;
|
|
14
|
+
default:
|
|
15
|
+
return state;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { segmentResults };
|
package/src/routines.js
CHANGED
|
@@ -59,6 +59,9 @@ export const searchRuleImplementations = createRoutine(
|
|
|
59
59
|
|
|
60
60
|
export const deleteRuleResult = createRoutine("DELETE_RULE_RESULT");
|
|
61
61
|
|
|
62
|
+
export const fetchSegmentResults = createRoutine("FETCH_SEGMENT_RESULTS");
|
|
63
|
+
export const clearSegmentResults = createRoutine("CLEAR_SEGMENT_RESULTS");
|
|
64
|
+
|
|
62
65
|
export const clearImplementationFilters = createRoutine(
|
|
63
66
|
"CLEAR_IMPLEMENTATION_FILTERS"
|
|
64
67
|
);
|
|
@@ -96,3 +99,10 @@ export const createExecutionGroup = createRoutine("CREATE_EXECUTION_GROUP");
|
|
|
96
99
|
export const fetchExecutionGroup = createRoutine("FETCH_EXECUTION_GROUP");
|
|
97
100
|
export const clearExecutionGroup = createRoutine("CLEAR_EXECUTION_GROUP");
|
|
98
101
|
export const fetchRemediation = createRoutine("FETCH_REMEDIATION");
|
|
102
|
+
|
|
103
|
+
export const createImplementationStructure = createRoutine(
|
|
104
|
+
"CREATE_IMPLEMENTATION_STRUCTURE"
|
|
105
|
+
);
|
|
106
|
+
export const deleteImplementationStructure = createRoutine(
|
|
107
|
+
"DELETE_IMPLEMENTATION_STRUCTURE"
|
|
108
|
+
);
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { compile } from "path-to-regexp";
|
|
2
|
+
import { testSaga } from "redux-saga-test-plan";
|
|
3
|
+
import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
|
|
4
|
+
import {
|
|
5
|
+
createImplementationStructureRequestSaga,
|
|
6
|
+
createImplementationStructureSaga,
|
|
7
|
+
} from "../createImplementationStructure";
|
|
8
|
+
import { API_IMPLEMENTATIONS_STRUCTURES } from "../../api";
|
|
9
|
+
import { createImplementationStructure } from "../../routines";
|
|
10
|
+
|
|
11
|
+
describe("sagas: createImplementationStructureRequestSaga", () => {
|
|
12
|
+
it("should invoke createImplementationStructureSaga on trigger", () => {
|
|
13
|
+
expect(() => {
|
|
14
|
+
testSaga(createImplementationStructureRequestSaga)
|
|
15
|
+
.next()
|
|
16
|
+
.takeLatest(
|
|
17
|
+
createImplementationStructure.TRIGGER,
|
|
18
|
+
createImplementationStructureSaga
|
|
19
|
+
)
|
|
20
|
+
.finish()
|
|
21
|
+
.isDone();
|
|
22
|
+
}).not.toThrow();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should throw exception if an unhandled action is received", () => {
|
|
26
|
+
expect(() => {
|
|
27
|
+
testSaga(createImplementationStructureRequestSaga)
|
|
28
|
+
.next()
|
|
29
|
+
.takeLatest("FOO", createImplementationStructure);
|
|
30
|
+
}).toThrow();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe("sagas: createImplementationStructureSaga", () => {
|
|
35
|
+
const implementationId = 1;
|
|
36
|
+
const dataStructureId = 2;
|
|
37
|
+
const type = "dataset";
|
|
38
|
+
const redirectUrl = "uri";
|
|
39
|
+
|
|
40
|
+
const url = compile(API_IMPLEMENTATIONS_STRUCTURES)({ implementationId });
|
|
41
|
+
const payload = {
|
|
42
|
+
implementationId,
|
|
43
|
+
dataStructureId,
|
|
44
|
+
type,
|
|
45
|
+
redirectUrl,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const requestData = { data_structure_id: dataStructureId, type };
|
|
49
|
+
|
|
50
|
+
const data = { response: "foo" };
|
|
51
|
+
|
|
52
|
+
it("should encode request content and put a success action when a response is returned", () => {
|
|
53
|
+
expect(() => {
|
|
54
|
+
testSaga(createImplementationStructureSaga, { payload })
|
|
55
|
+
.next()
|
|
56
|
+
.put(createImplementationStructure.request(payload))
|
|
57
|
+
.next()
|
|
58
|
+
.call(apiJsonPost, url, requestData, JSON_OPTS)
|
|
59
|
+
.next({ data })
|
|
60
|
+
.put(createImplementationStructure.success({ data, redirectUrl }))
|
|
61
|
+
.next()
|
|
62
|
+
.put(createImplementationStructure.fulfill())
|
|
63
|
+
.next()
|
|
64
|
+
.isDone();
|
|
65
|
+
}).not.toThrow();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("should put a failure action when the call returns an error", () => {
|
|
69
|
+
const message = "Request failed";
|
|
70
|
+
const error = { message };
|
|
71
|
+
|
|
72
|
+
expect(() => {
|
|
73
|
+
testSaga(createImplementationStructureSaga, { payload })
|
|
74
|
+
.next()
|
|
75
|
+
.put(createImplementationStructure.request(payload))
|
|
76
|
+
.next()
|
|
77
|
+
.call(apiJsonPost, url, requestData, JSON_OPTS)
|
|
78
|
+
.throw(error)
|
|
79
|
+
.put(createImplementationStructure.failure(message))
|
|
80
|
+
.next()
|
|
81
|
+
.put(createImplementationStructure.fulfill())
|
|
82
|
+
.next()
|
|
83
|
+
.isDone();
|
|
84
|
+
}).not.toThrow();
|
|
85
|
+
});
|
|
86
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { compile } from "path-to-regexp";
|
|
2
|
+
import { testSaga } from "redux-saga-test-plan";
|
|
3
|
+
import { apiJsonDelete, JSON_OPTS } from "@truedat/core/services/api";
|
|
4
|
+
import {
|
|
5
|
+
deleteImplementationStructureRequestSaga,
|
|
6
|
+
deleteImplementationStructureSaga,
|
|
7
|
+
} from "../deleteImplementationStructure";
|
|
8
|
+
import {
|
|
9
|
+
deleteImplementationStructure,
|
|
10
|
+
fetchRuleImplementation,
|
|
11
|
+
} from "../../routines";
|
|
12
|
+
import { API_IMPLEMENTATIONS_STRUCTURE } from "../../api";
|
|
13
|
+
|
|
14
|
+
describe("sagas: deleteImplementationStructureRequestSaga", () => {
|
|
15
|
+
it("should invoke deleteImplementationStructureSaga on trigger", () => {
|
|
16
|
+
expect(() => {
|
|
17
|
+
testSaga(deleteImplementationStructureRequestSaga)
|
|
18
|
+
.next()
|
|
19
|
+
.takeLatest(
|
|
20
|
+
deleteImplementationStructure.TRIGGER,
|
|
21
|
+
deleteImplementationStructureSaga
|
|
22
|
+
)
|
|
23
|
+
.finish()
|
|
24
|
+
.isDone();
|
|
25
|
+
}).not.toThrow();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("should throw exception if an unhandled action is received", () => {
|
|
29
|
+
expect(() => {
|
|
30
|
+
testSaga(deleteImplementationStructureRequestSaga)
|
|
31
|
+
.next()
|
|
32
|
+
.takeLatest("FOO", deleteImplementationStructure);
|
|
33
|
+
}).toThrow();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe("sagas: deleteImplementationStructureSaga", () => {
|
|
38
|
+
const implementationId = 1;
|
|
39
|
+
const id = 2;
|
|
40
|
+
|
|
41
|
+
const url = compile(API_IMPLEMENTATIONS_STRUCTURE)({
|
|
42
|
+
implementationId,
|
|
43
|
+
id,
|
|
44
|
+
});
|
|
45
|
+
const payload = { implementationId, id };
|
|
46
|
+
const data = {};
|
|
47
|
+
|
|
48
|
+
it("should put a success action when a response is returned", () => {
|
|
49
|
+
expect(() => {
|
|
50
|
+
testSaga(deleteImplementationStructureSaga, { payload })
|
|
51
|
+
.next()
|
|
52
|
+
.put(deleteImplementationStructure.request())
|
|
53
|
+
.next()
|
|
54
|
+
.call(apiJsonDelete, url, JSON_OPTS)
|
|
55
|
+
.next({ data })
|
|
56
|
+
.put(deleteImplementationStructure.success(data))
|
|
57
|
+
.next()
|
|
58
|
+
.put(fetchRuleImplementation.trigger({ id: implementationId }))
|
|
59
|
+
.next()
|
|
60
|
+
.put(deleteImplementationStructure.fulfill())
|
|
61
|
+
.next()
|
|
62
|
+
.isDone();
|
|
63
|
+
}).not.toThrow();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("should put a failure action when the call returns an error", () => {
|
|
67
|
+
const message = "Request failed";
|
|
68
|
+
const error = { message };
|
|
69
|
+
|
|
70
|
+
expect(() => {
|
|
71
|
+
testSaga(deleteImplementationStructureSaga, { payload })
|
|
72
|
+
.next()
|
|
73
|
+
.put(deleteImplementationStructure.request())
|
|
74
|
+
.next()
|
|
75
|
+
.call(apiJsonDelete, url, JSON_OPTS)
|
|
76
|
+
.throw(error)
|
|
77
|
+
.put(deleteImplementationStructure.failure(message))
|
|
78
|
+
.next()
|
|
79
|
+
.put(deleteImplementationStructure.fulfill())
|
|
80
|
+
.next()
|
|
81
|
+
.isDone();
|
|
82
|
+
}).not.toThrow();
|
|
83
|
+
});
|
|
84
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { compile } from "path-to-regexp";
|
|
2
|
+
import { testSaga } from "redux-saga-test-plan";
|
|
3
|
+
import { apiJson, JSON_OPTS } from "@truedat/core/services/api";
|
|
4
|
+
import {
|
|
5
|
+
fetchSegmentResultsRequestSaga,
|
|
6
|
+
fetchSegmentResultsSaga,
|
|
7
|
+
} from "../fetchSegmentResults";
|
|
8
|
+
import { fetchSegmentResults } from "../../routines";
|
|
9
|
+
import { API_SEGMENT_RESULTS } from "../../api";
|
|
10
|
+
|
|
11
|
+
describe("sagas: fetchSegmentResultsRequestSaga", () => {
|
|
12
|
+
it("should invoke fetchSegmentResultsSaga on trigger", () => {
|
|
13
|
+
expect(() => {
|
|
14
|
+
testSaga(fetchSegmentResultsRequestSaga)
|
|
15
|
+
.next()
|
|
16
|
+
.takeLatest(fetchSegmentResults.TRIGGER, fetchSegmentResultsSaga)
|
|
17
|
+
.finish()
|
|
18
|
+
.isDone();
|
|
19
|
+
}).not.toThrow();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("should throw exception if an unhandled action is received", () => {
|
|
23
|
+
expect(() => {
|
|
24
|
+
testSaga(fetchSegmentResultsRequestSaga)
|
|
25
|
+
.next()
|
|
26
|
+
.takeLatest("FOO", fetchSegmentResultsSaga);
|
|
27
|
+
}).toThrow();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
describe("sagas: fetchRemediaitonSaga", () => {
|
|
32
|
+
it("should put a success action when a response is returned", () => {
|
|
33
|
+
const ruleResultId = 1;
|
|
34
|
+
const url = compile(API_SEGMENT_RESULTS)({ rule_result_id: ruleResultId });
|
|
35
|
+
const payload = { rule_result_id: ruleResultId };
|
|
36
|
+
const data = {
|
|
37
|
+
id: 1,
|
|
38
|
+
df_name: "remediation_template",
|
|
39
|
+
df_content: { text: "some_text" },
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
expect(() => {
|
|
43
|
+
testSaga(fetchSegmentResultsSaga, { payload })
|
|
44
|
+
.next()
|
|
45
|
+
.put(fetchSegmentResults.request())
|
|
46
|
+
.next()
|
|
47
|
+
.call(apiJson, url, JSON_OPTS)
|
|
48
|
+
.next({ data })
|
|
49
|
+
.put(fetchSegmentResults.success(data))
|
|
50
|
+
.next()
|
|
51
|
+
.put(fetchSegmentResults.fulfill())
|
|
52
|
+
.next()
|
|
53
|
+
.isDone();
|
|
54
|
+
}).not.toThrow();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("should put a failure action when the call returns an error", () => {
|
|
58
|
+
const message = "Request failed";
|
|
59
|
+
const error = { message };
|
|
60
|
+
const ruleResultId = 1;
|
|
61
|
+
const url = compile(API_SEGMENT_RESULTS)({ rule_result_id: ruleResultId });
|
|
62
|
+
const payload = { rule_result_id: ruleResultId };
|
|
63
|
+
|
|
64
|
+
expect(() => {
|
|
65
|
+
testSaga(fetchSegmentResultsSaga, { payload })
|
|
66
|
+
.next()
|
|
67
|
+
.put(fetchSegmentResults.request())
|
|
68
|
+
.next()
|
|
69
|
+
.call(apiJson, url, JSON_OPTS)
|
|
70
|
+
.throw(error)
|
|
71
|
+
.put(fetchSegmentResults.failure(message))
|
|
72
|
+
.next()
|
|
73
|
+
.put(fetchSegmentResults.fulfill())
|
|
74
|
+
.next()
|
|
75
|
+
.isDone();
|
|
76
|
+
}).not.toThrow();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { compile } from "path-to-regexp";
|
|
2
|
+
import { call, put, takeLatest } from "redux-saga/effects";
|
|
3
|
+
import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
|
|
4
|
+
import { createImplementationStructure } from "../routines";
|
|
5
|
+
import { API_IMPLEMENTATIONS_STRUCTURES } from "../api";
|
|
6
|
+
|
|
7
|
+
export function* createImplementationStructureSaga({ payload }) {
|
|
8
|
+
try {
|
|
9
|
+
const { implementationId, dataStructureId, type, redirectUrl } = payload;
|
|
10
|
+
const url = compile(API_IMPLEMENTATIONS_STRUCTURES)({ implementationId });
|
|
11
|
+
const requestData = { data_structure_id: dataStructureId, type };
|
|
12
|
+
yield put(createImplementationStructure.request(payload));
|
|
13
|
+
const { data } = yield call(apiJsonPost, url, requestData, JSON_OPTS);
|
|
14
|
+
yield put(createImplementationStructure.success({ data, redirectUrl }));
|
|
15
|
+
} catch (error) {
|
|
16
|
+
if (error.response) {
|
|
17
|
+
const { status, data } = error.response;
|
|
18
|
+
yield put(createImplementationStructure.failure({ status, data }));
|
|
19
|
+
} else {
|
|
20
|
+
yield put(createImplementationStructure.failure(error.message));
|
|
21
|
+
}
|
|
22
|
+
} finally {
|
|
23
|
+
yield put(createImplementationStructure.fulfill());
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function* createImplementationStructureRequestSaga() {
|
|
28
|
+
yield takeLatest(
|
|
29
|
+
createImplementationStructure.TRIGGER,
|
|
30
|
+
createImplementationStructureSaga
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { compile } from "path-to-regexp";
|
|
2
|
+
import { call, put, takeLatest } from "redux-saga/effects";
|
|
3
|
+
import { apiJsonDelete, JSON_OPTS } from "@truedat/core/services/api";
|
|
4
|
+
import {
|
|
5
|
+
deleteImplementationStructure,
|
|
6
|
+
fetchRuleImplementation,
|
|
7
|
+
} from "../routines";
|
|
8
|
+
import { API_IMPLEMENTATIONS_STRUCTURE } from "../api";
|
|
9
|
+
|
|
10
|
+
export function* deleteImplementationStructureSaga({ payload }) {
|
|
11
|
+
try {
|
|
12
|
+
const { implementationId, id } = payload;
|
|
13
|
+
|
|
14
|
+
const url = compile(API_IMPLEMENTATIONS_STRUCTURE)({ id });
|
|
15
|
+
yield put(deleteImplementationStructure.request());
|
|
16
|
+
const { data } = yield call(apiJsonDelete, url, JSON_OPTS);
|
|
17
|
+
yield put(deleteImplementationStructure.success(data));
|
|
18
|
+
//Re-fetch implementation
|
|
19
|
+
yield put(fetchRuleImplementation.trigger({ id: implementationId }));
|
|
20
|
+
} catch (error) {
|
|
21
|
+
if (error.response) {
|
|
22
|
+
const { status, data } = error.response;
|
|
23
|
+
yield put(deleteImplementationStructure.failure({ status, data }));
|
|
24
|
+
} else {
|
|
25
|
+
yield put(deleteImplementationStructure.failure(error.message));
|
|
26
|
+
}
|
|
27
|
+
} finally {
|
|
28
|
+
yield put(deleteImplementationStructure.fulfill());
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function* deleteImplementationStructureRequestSaga() {
|
|
33
|
+
yield takeLatest(
|
|
34
|
+
deleteImplementationStructure.TRIGGER,
|
|
35
|
+
deleteImplementationStructureSaga
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { compile } from "path-to-regexp";
|
|
2
|
+
import { call, put, takeLatest } from "redux-saga/effects";
|
|
3
|
+
import { apiJson, JSON_OPTS } from "@truedat/core/services/api";
|
|
4
|
+
import { fetchSegmentResults } from "../routines";
|
|
5
|
+
import { API_SEGMENT_RESULTS } from "../api";
|
|
6
|
+
|
|
7
|
+
export function* fetchSegmentResultsSaga({ payload }) {
|
|
8
|
+
try {
|
|
9
|
+
const { rule_result_id } = payload;
|
|
10
|
+
const url = compile(API_SEGMENT_RESULTS)({
|
|
11
|
+
rule_result_id,
|
|
12
|
+
});
|
|
13
|
+
yield put(fetchSegmentResults.request());
|
|
14
|
+
const { data } = yield call(apiJson, url, JSON_OPTS);
|
|
15
|
+
yield put(fetchSegmentResults.success(data));
|
|
16
|
+
} catch (error) {
|
|
17
|
+
if (error.response) {
|
|
18
|
+
const { status, data } = error.response;
|
|
19
|
+
yield put(fetchSegmentResults.failure({ status, data }));
|
|
20
|
+
} else {
|
|
21
|
+
yield put(fetchSegmentResults.failure(error.message));
|
|
22
|
+
}
|
|
23
|
+
} finally {
|
|
24
|
+
yield put(fetchSegmentResults.fulfill());
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function* fetchSegmentResultsRequestSaga() {
|
|
29
|
+
yield takeLatest(fetchSegmentResults.TRIGGER, fetchSegmentResultsSaga);
|
|
30
|
+
}
|
package/src/sagas/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createExecutionGroupRequestSaga } from "./createExecutionGroup";
|
|
2
|
-
import {
|
|
2
|
+
import { createImplementationStructureRequestSaga } from "./createImplementationStructure";
|
|
3
3
|
import { createRemediationRequestSaga } from "./createRemediation";
|
|
4
|
+
import { createRuleImplementationRequestSaga } from "./createRuleImplementation";
|
|
4
5
|
import { createRuleRequestSaga } from "./createRule";
|
|
5
|
-
import {
|
|
6
|
+
import { deleteImplementationStructureRequestSaga } from "./deleteImplementationStructure";
|
|
6
7
|
import { deleteRemediationRequestSaga } from "./deleteRemediation";
|
|
7
8
|
import { deleteRuleRequestSaga } from "./deleteRule";
|
|
8
9
|
import { deleteRuleResultRequestSaga } from "./deleteRuleResult";
|
|
@@ -16,20 +17,23 @@ import { fetchRuleImplementationRequestSaga } from "./fetchRuleImplementation";
|
|
|
16
17
|
import { fetchRuleImplementationsRequestSaga } from "./fetchRuleImplementations";
|
|
17
18
|
import { fetchRuleRequestSaga } from "./fetchRule";
|
|
18
19
|
import { fetchRulesRequestSaga } from "./fetchRules";
|
|
20
|
+
import { fetchSegmentResultsRequestSaga } from "./fetchSegmentResults";
|
|
19
21
|
import { searchRuleImplementationsRequestSaga } from "./searchRuleImplementations";
|
|
22
|
+
import { setRuleImplementationStatusRequestSaga } from "./setRuleImplementationStatus";
|
|
20
23
|
import { updateRemediationRequestSaga } from "./updateRemediation";
|
|
21
|
-
import { uploadImplementationsRequestsSaga } from "./uploadImplementations";
|
|
22
|
-
import { uploadRulesRequestsSaga } from "./uploadRules";
|
|
23
24
|
import { updateRuleImplementationRequestSaga } from "./updateRuleImplementation";
|
|
24
25
|
import { updateRuleRequestSaga } from "./updateRule";
|
|
26
|
+
import { uploadImplementationsRequestsSaga } from "./uploadImplementations";
|
|
25
27
|
import { uploadResultsRequestSaga } from "./uploadResults";
|
|
28
|
+
import { uploadRulesRequestsSaga } from "./uploadRules";
|
|
26
29
|
|
|
27
30
|
export {
|
|
28
31
|
createExecutionGroupRequestSaga,
|
|
32
|
+
createImplementationStructureRequestSaga,
|
|
29
33
|
createRemediationRequestSaga,
|
|
30
34
|
createRuleImplementationRequestSaga,
|
|
31
35
|
createRuleRequestSaga,
|
|
32
|
-
|
|
36
|
+
deleteImplementationStructureRequestSaga,
|
|
33
37
|
deleteRemediationRequestSaga,
|
|
34
38
|
deleteRuleRequestSaga,
|
|
35
39
|
deleteRuleResultRequestSaga,
|
|
@@ -43,21 +47,24 @@ export {
|
|
|
43
47
|
fetchRuleImplementationsRequestSaga,
|
|
44
48
|
fetchRuleRequestSaga,
|
|
45
49
|
fetchRulesRequestSaga,
|
|
50
|
+
fetchSegmentResultsRequestSaga,
|
|
46
51
|
searchRuleImplementationsRequestSaga,
|
|
52
|
+
setRuleImplementationStatusRequestSaga,
|
|
47
53
|
updateRemediationRequestSaga,
|
|
48
|
-
uploadRulesRequestsSaga,
|
|
49
|
-
uploadImplementationsRequestsSaga,
|
|
50
54
|
updateRuleImplementationRequestSaga,
|
|
51
55
|
updateRuleRequestSaga,
|
|
56
|
+
uploadImplementationsRequestsSaga,
|
|
52
57
|
uploadResultsRequestSaga,
|
|
58
|
+
uploadRulesRequestsSaga,
|
|
53
59
|
};
|
|
54
60
|
|
|
55
61
|
export default [
|
|
56
62
|
createExecutionGroupRequestSaga(),
|
|
63
|
+
createImplementationStructureRequestSaga(),
|
|
57
64
|
createRemediationRequestSaga(),
|
|
58
65
|
createRuleImplementationRequestSaga(),
|
|
59
66
|
createRuleRequestSaga(),
|
|
60
|
-
|
|
67
|
+
deleteImplementationStructureRequestSaga(),
|
|
61
68
|
deleteRemediationRequestSaga(),
|
|
62
69
|
deleteRuleRequestSaga(),
|
|
63
70
|
deleteRuleResultRequestSaga(),
|
|
@@ -71,11 +78,13 @@ export default [
|
|
|
71
78
|
fetchRuleImplementationsRequestSaga(),
|
|
72
79
|
fetchRuleRequestSaga(),
|
|
73
80
|
fetchRulesRequestSaga(),
|
|
81
|
+
fetchSegmentResultsRequestSaga(),
|
|
74
82
|
searchRuleImplementationsRequestSaga(),
|
|
83
|
+
setRuleImplementationStatusRequestSaga(),
|
|
75
84
|
updateRemediationRequestSaga(),
|
|
76
|
-
uploadRulesRequestsSaga(),
|
|
77
|
-
uploadImplementationsRequestsSaga(),
|
|
78
85
|
updateRuleImplementationRequestSaga(),
|
|
79
86
|
updateRuleRequestSaga(),
|
|
87
|
+
uploadImplementationsRequestsSaga(),
|
|
80
88
|
uploadResultsRequestSaga(),
|
|
89
|
+
uploadRulesRequestsSaga(),
|
|
81
90
|
];
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
|
|
3
|
-
const encodeValue = value => (_.isNil(value) ? value : btoa(value));
|
|
3
|
+
const encodeValue = (value) => (_.isNil(value) ? value : btoa(value));
|
|
4
4
|
|
|
5
|
-
const encodeProps = o =>
|
|
5
|
+
const encodeProps = (o) =>
|
|
6
6
|
_.flow(
|
|
7
|
-
_.pick(["dataset", "population", "validations"]),
|
|
7
|
+
_.pick(["dataset", "population", "validations", "segments"]),
|
|
8
8
|
_.mapValues(encodeValue),
|
|
9
9
|
_.assign(o)
|
|
10
10
|
)(o);
|
|
11
11
|
|
|
12
|
-
export const encodeRawContent = ruleImplementation =>
|
|
12
|
+
export const encodeRawContent = (ruleImplementation) =>
|
|
13
13
|
_.has("raw_content.dataset")(ruleImplementation)
|
|
14
14
|
? {
|
|
15
15
|
...ruleImplementation,
|
|
16
|
-
raw_content: encodeProps(ruleImplementation.raw_content)
|
|
16
|
+
raw_content: encodeProps(ruleImplementation.raw_content),
|
|
17
17
|
}
|
|
18
18
|
: ruleImplementation;
|