@truedat/qx 7.5.9 → 7.5.11
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/package.json +45 -64
- package/src/components/QxRoutes.js +38 -19
- package/src/components/__tests__/QxRoutes.spec.js +73 -0
- package/src/components/__tests__/__snapshots__/QxRoutes.spec.js.snap +60 -0
- package/src/components/common/ClauseViewer.js +6 -6
- package/src/components/common/DescriptionInput.js +0 -1
- package/src/components/common/ResourceSelector.js +2 -3
- package/src/components/common/TestFormWrapper.js +2 -13
- package/src/components/common/TypeSelector.js +0 -1
- package/src/components/common/__tests__/DescriptionInput.spec.js +12 -21
- package/src/components/common/__tests__/ResourceSelector.spec.js +42 -87
- package/src/components/common/__tests__/TypeSelector.spec.js +0 -1
- package/src/components/common/__tests__/__snapshots__/ResourceSelector.spec.js.snap +32 -22
- package/src/components/common/expressions/Clauses.js +5 -6
- package/src/components/common/expressions/Condition.js +8 -9
- package/src/components/common/expressions/ConstantSelector.js +2 -2
- package/src/components/common/expressions/Expression.js +2 -2
- package/src/components/common/expressions/FieldSelector.js +2 -2
- package/src/components/common/expressions/FunctionArgs.js +5 -6
- package/src/components/common/expressions/FunctionSelector.js +2 -2
- package/src/components/common/expressions/ParamSelector.js +2 -2
- package/src/components/common/expressions/ShapeSelector.js +7 -16
- package/src/components/common/expressions/__tests__/Clauses.spec.js +10 -9
- package/src/components/common/expressions/__tests__/Condition.spec.js +6 -26
- package/src/components/common/expressions/__tests__/ConstantSelector.spec.js +14 -30
- package/src/components/common/expressions/__tests__/Expression.spec.js +44 -51
- package/src/components/common/expressions/__tests__/FieldSelector.spec.js +2 -7
- package/src/components/common/expressions/__tests__/FunctionArgs.spec.js +18 -44
- package/src/components/common/expressions/__tests__/FunctionSelector.spec.js +19 -27
- package/src/components/common/expressions/__tests__/ParamSelector.spec.js +28 -58
- package/src/components/common/expressions/__tests__/ShapeSelector.spec.js +42 -43
- package/src/components/common/expressions/__tests__/__snapshots__/Condition.spec.js.snap +6 -6
- package/src/components/common/expressions/__tests__/__snapshots__/ConstantSelector.spec.js.snap +6 -7
- package/src/components/common/expressions/__tests__/__snapshots__/Expression.spec.js.snap +20 -20
- package/src/components/common/expressions/__tests__/__snapshots__/FunctionArgs.spec.js.snap +8 -9
- package/src/components/common/expressions/__tests__/__snapshots__/FunctionSelector.spec.js.snap +670 -8
- package/src/components/common/expressions/__tests__/__snapshots__/ParamSelector.spec.js.snap +5 -5
- package/src/components/common/expressions/__tests__/__snapshots__/ShapeSelector.spec.js.snap +9 -9
- package/src/components/common/expressions/__tests__/useWatchParams.spec.js +1 -4
- package/src/components/common/expressions/constantInputs/AnySelector.js +5 -6
- package/src/components/common/expressions/constantInputs/BooleanSelector.js +2 -2
- package/src/components/common/expressions/constantInputs/DefaultSelector.js +2 -2
- package/src/components/common/expressions/constantInputs/__tests__/AnySelector.spec.js +16 -37
- package/src/components/common/expressions/constantInputs/__tests__/BooleanSelector.spec.js +14 -17
- package/src/components/common/expressions/constantInputs/__tests__/DefaultSelector.spec.js +12 -27
- package/src/components/common/expressions/constantInputs/__tests__/__snapshots__/AnySelector.spec.js.snap +11 -11
- package/src/components/common/expressions/constantInputs/__tests__/__snapshots__/DefaultSelector.spec.js.snap +0 -1
- package/src/components/common/resourceSelectors/DataStructureSelector.js +2 -2
- package/src/components/common/resourceSelectors/DataViewSelector.js +2 -2
- package/src/components/common/resourceSelectors/ReferenceDatasetSelector.js +2 -2
- package/src/components/common/resourceSelectors/__tests__/DataStructureSelector.spec.js +5 -29
- package/src/components/common/resourceSelectors/__tests__/DataViewSelector.spec.js +23 -25
- package/src/components/common/resourceSelectors/__tests__/ReferenceDatasetSelector.spec.js +21 -32
- package/src/components/common/resourceSelectors/__tests__/__snapshots__/DataStructureSelector.spec.js.snap +3 -4
- package/src/components/common/resourceSelectors/__tests__/__snapshots__/DataViewSelector.spec.js.snap +1 -1
- package/src/components/common/resourceSelectors/__tests__/__snapshots__/ReferenceDatasetSelector.spec.js.snap +1 -1
- package/src/components/dataViews/DataViewEditor.js +5 -6
- package/src/components/dataViews/DataViewSelect.js +4 -5
- package/src/components/dataViews/DataViews.js +1 -2
- package/src/components/dataViews/Queryable.js +4 -4
- package/src/components/dataViews/Queryables.js +0 -1
- package/src/components/dataViews/__tests__/DataViewEditor.spec.js +36 -111
- package/src/components/dataViews/__tests__/DataViewSelect.spec.js +0 -1
- package/src/components/dataViews/__tests__/DataViews.spec.js +15 -16
- package/src/components/dataViews/__tests__/Queryable.spec.js +0 -1
- package/src/components/dataViews/__tests__/Queryables.spec.js +35 -74
- package/src/components/dataViews/__tests__/__snapshots__/DataViewEditor.spec.js.snap +61 -55
- package/src/components/dataViews/__tests__/__snapshots__/DataViews.spec.js.snap +5 -5
- package/src/components/dataViews/__tests__/__snapshots__/Queryables.spec.js.snap +59 -59
- package/src/components/dataViews/queryableProperties/From.js +4 -4
- package/src/components/dataViews/queryableProperties/GroupBy.js +6 -6
- package/src/components/dataViews/queryableProperties/Join.js +6 -6
- package/src/components/dataViews/queryableProperties/JoinTypeIcon.js +8 -9
- package/src/components/dataViews/queryableProperties/Select.js +4 -5
- package/src/components/dataViews/queryableProperties/SelectField.js +4 -4
- package/src/components/dataViews/queryableProperties/Where.js +4 -4
- package/src/components/dataViews/queryableProperties/__tests__/From.spec.js +0 -1
- package/src/components/dataViews/queryableProperties/__tests__/GroupBy.spec.js +16 -42
- package/src/components/dataViews/queryableProperties/__tests__/Join.spec.js +6 -29
- package/src/components/dataViews/queryableProperties/__tests__/JoinTypeIcon.spec.js +0 -1
- package/src/components/dataViews/queryableProperties/__tests__/Select.spec.js +26 -50
- package/src/components/dataViews/queryableProperties/__tests__/SelectField.spec.js +22 -42
- package/src/components/dataViews/queryableProperties/__tests__/Where.spec.js +6 -17
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/GroupBy.spec.js.snap +309 -9
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Join.spec.js.snap +12 -12
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Select.spec.js.snap +192 -18
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/SelectField.spec.js.snap +6 -8
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Where.spec.js.snap +2 -2
- package/src/components/functions/FunctionEditor.js +3 -5
- package/src/components/functions/FunctionParams.js +2 -3
- package/src/components/functions/Functions.js +3 -4
- package/src/components/functions/__tests__/FunctionEditor.spec.js +61 -57
- package/src/components/functions/__tests__/FunctionParams.spec.js +50 -47
- package/src/components/functions/__tests__/Functions.spec.js +5 -12
- package/src/components/functions/__tests__/__snapshots__/FunctionParams.spec.js.snap +11 -11
- package/src/components/functions/__tests__/__snapshots__/Functions.spec.js.snap +4 -5
- package/src/components/qualityControls/ControlProperties.js +4 -4
- package/src/components/qualityControls/ControlPropertiesView.js +0 -1
- package/src/components/qualityControls/EditQualityControl.js +5 -5
- package/src/components/qualityControls/IconPopup.js +0 -1
- package/src/components/qualityControls/NewDraftQualityControl.js +8 -6
- package/src/components/qualityControls/NewQualityControl.js +5 -6
- package/src/components/qualityControls/QualityBadge.js +29 -30
- package/src/components/qualityControls/QualityControl.js +4 -7
- package/src/components/qualityControls/QualityControlActions.js +7 -7
- package/src/components/qualityControls/QualityControlCrumbs.js +1 -3
- package/src/components/qualityControls/QualityControlEditor.js +5 -11
- package/src/components/qualityControls/QualityControlHeader.js +4 -6
- package/src/components/qualityControls/QualityControlHistory.js +3 -3
- package/src/components/qualityControls/QualityControlManageDomain.js +2 -2
- package/src/components/qualityControls/QualityControlQueryModal.js +1 -1
- package/src/components/qualityControls/QualityControlRoutes.js +27 -54
- package/src/components/qualityControls/QualityControlRow.js +0 -2
- package/src/components/qualityControls/QualityControlScores.js +7 -5
- package/src/components/qualityControls/QualityControlTabs.js +2 -2
- package/src/components/qualityControls/QualityControls.js +10 -8
- package/src/components/qualityControls/QualityControlsLabelResults.js +0 -2
- package/src/components/qualityControls/QualityControlsPagination.js +0 -1
- package/src/components/qualityControls/QualityControlsTable.js +1 -2
- package/src/components/qualityControls/ScoreCriteria.js +4 -4
- package/src/components/qualityControls/ScoreCriteriaView.js +0 -1
- package/src/components/qualityControls/__tests__/ControlProperties.spec.js +10 -15
- package/src/components/qualityControls/__tests__/ControlPropertiesView.spec.js +0 -1
- package/src/components/qualityControls/__tests__/EditQualityControl.spec.js +28 -70
- package/src/components/qualityControls/__tests__/IconPopup.spec.js +10 -11
- package/src/components/qualityControls/__tests__/NewDraftQualityControl.spec.js +33 -70
- package/src/components/qualityControls/__tests__/NewQualityControl.spec.js +81 -113
- package/src/components/qualityControls/__tests__/QualityBadge.spec.js +50 -58
- package/src/components/qualityControls/__tests__/QualityControl.spec.js +19 -31
- package/src/components/qualityControls/__tests__/QualityControlActions.spec.js +49 -46
- package/src/components/qualityControls/__tests__/QualityControlCrumbs.spec.js +0 -1
- package/src/components/qualityControls/__tests__/QualityControlEditor.spec.js +68 -107
- package/src/components/qualityControls/__tests__/QualityControlHeader.spec.js +22 -25
- package/src/components/qualityControls/__tests__/QualityControlHistory.spec.js +6 -6
- package/src/components/qualityControls/__tests__/QualityControlManageDomain.spec.js +0 -1
- package/src/components/qualityControls/__tests__/QualityControlQueryModal.spec.js +12 -11
- package/src/components/qualityControls/__tests__/QualityControlRow.spec.js +4 -8
- package/src/components/qualityControls/__tests__/QualityControlScores.spec.js +23 -19
- package/src/components/qualityControls/__tests__/QualityControlTabs.spec.js +2 -3
- package/src/components/qualityControls/__tests__/QualityControls.spec.js +69 -53
- package/src/components/qualityControls/__tests__/QualityControlsLabelResults.spec.js +0 -1
- package/src/components/qualityControls/__tests__/QualityControlsPagination.spec.js +0 -1
- package/src/components/qualityControls/__tests__/QualityControlsTable.spec.js +2 -3
- package/src/components/qualityControls/__tests__/ScoreCriteria.spec.js +0 -1
- package/src/components/qualityControls/__tests__/ScoreCriteriaView.spec.js +0 -1
- package/src/components/qualityControls/__tests__/__fixtures__/qualityControlHelper.js +1 -1
- package/src/components/qualityControls/__tests__/__snapshots__/EditQualityControl.spec.js.snap +32 -34
- package/src/components/qualityControls/__tests__/__snapshots__/NewDraftQualityControl.spec.js.snap +31 -33
- package/src/components/qualityControls/__tests__/__snapshots__/NewQualityControl.spec.js.snap +17 -19
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControl.spec.js.snap +9 -15
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlActions.spec.js.snap +5 -4
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlCrumbs.spec.js.snap +1 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlEditor.spec.js.snap +0 -3
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlHeader.spec.js.snap +16 -11
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlHistory.spec.js.snap +2 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlRow.spec.js.snap +2 -1
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlScores.spec.js.snap +3 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlTabs.spec.js.snap +3 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControls.spec.js.snap +11 -21
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlsTable.spec.js.snap +2 -0
- package/src/components/qualityControls/controlProperties/Count.js +5 -5
- package/src/components/qualityControls/controlProperties/Ratio.js +6 -8
- package/src/components/qualityControls/controlProperties/__tests__/Count.spec.js +6 -11
- package/src/components/qualityControls/controlProperties/__tests__/Ratio.spec.js +9 -27
- package/src/components/qualityControls/controlProperties/__tests__/__snapshots__/Ratio.spec.js.snap +10 -10
- package/src/components/qualityControls/qualityByControlMode.js +14 -14
- package/src/components/qualityControls/qualityControlScoresColumns.js +1 -2
- package/src/components/qualityControls/scoreCriterias/Deviation.js +2 -2
- package/src/components/qualityControls/scoreCriterias/ErrorCount.js +3 -4
- package/src/components/qualityControls/scoreCriterias/Percentage.js +2 -2
- package/src/components/qualityControls/scoreCriterias/__tests__/Deviation.spec.js +0 -1
- package/src/components/qualityControls/scoreCriterias/__tests__/ErrorCount.spec.js +39 -43
- package/src/components/qualityControls/scoreCriterias/__tests__/Percentage.spec.js +23 -19
- package/src/components/qualityControls/scoreCriterias/__tests__/__snapshots__/ErrorCount.spec.js.snap +4 -7
- package/src/components/scores/MyScoreGroups.js +0 -1
- package/src/components/scores/QualityBar.js +24 -22
- package/src/components/scores/Score.js +4 -5
- package/src/components/scores/ScoreCrumbs.js +3 -5
- package/src/components/scores/ScoreDetails.js +2 -2
- package/src/components/scores/ScoreEvents.js +2 -2
- package/src/components/scores/ScoreGroup.js +5 -4
- package/src/components/scores/ScoreGroupBreadcrumbs.js +1 -2
- package/src/components/scores/ScoreGroupForm.js +2 -4
- package/src/components/scores/ScoreGroupLink.js +1 -2
- package/src/components/scores/ScoreGroupMessage.js +0 -1
- package/src/components/scores/ScoreGroupPopup.js +1 -1
- package/src/components/scores/ScoreGroupsRoutes.js +19 -0
- package/src/components/scores/ScoreGroupsTable.js +15 -48
- package/src/components/scores/ScoreRoutes.js +9 -24
- package/src/components/scores/ScoreStatusDecorator.js +1 -2
- package/src/components/scores/ScoreTabs.js +2 -2
- package/src/components/scores/__tests__/MyScoreGroups.spec.js +0 -1
- package/src/components/scores/__tests__/QualityBar.spec.js +19 -26
- package/src/components/scores/__tests__/Score.spec.js +2 -3
- package/src/components/scores/__tests__/ScoreCrumbs.spec.js +4 -5
- package/src/components/scores/__tests__/ScoreDetails.spec.js +4 -5
- package/src/components/scores/__tests__/ScoreEvents.spec.js +2 -3
- package/src/components/scores/__tests__/ScoreGroup.spec.js +15 -14
- package/src/components/scores/__tests__/ScoreGroupBreadcrumbs.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreGroupForm.spec.js +18 -34
- package/src/components/scores/__tests__/ScoreGroupLink.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreGroupMessage.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreGroupPopup.spec.js +0 -2
- package/src/components/scores/__tests__/ScoreGroupsRoutes.spec.js +32 -0
- package/src/components/scores/__tests__/ScoreGroupsTable.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreStatusDecorator.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreTabs.spec.js +3 -4
- package/src/components/scores/__tests__/__snapshots__/MyScoreGroups.spec.js.snap +2 -0
- package/src/components/scores/__tests__/__snapshots__/Score.spec.js.snap +4 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreCrumbs.spec.js.snap +2 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreDetails.spec.js.snap +1 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroup.spec.js.snap +39 -10
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupBreadcrumbs.spec.js.snap +1 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupForm.spec.js.snap +10 -10
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupLink.spec.js.snap +1 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupsRoutes.spec.js.snap +19 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupsTable.spec.js.snap +2 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreStatusDecorator.spec.js.snap +5 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreTabs.spec.js.snap +4 -0
- package/src/hooks/__tests__/useDataViews.spec.js +1 -1
- package/src/hooks/__tests__/useFunctions.spec.js +5 -5
- package/src/hooks/useDataViews.js +2 -2
- package/src/hooks/useExecutionGroups.js +1 -1
- package/src/hooks/useFunctions.js +4 -4
- package/src/hooks/useQualityControls.js +13 -7
- package/src/hooks/useScoreGroups.js +1 -1
- package/src/hooks/useScores.js +2 -2
- package/src/styles/scores.less +21 -21
- package/src/types.js +1 -4
|
@@ -1,78 +1,76 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
3
1
|
import { waitFor } from "@testing-library/react";
|
|
4
2
|
import userEvent from "@testing-library/user-event";
|
|
3
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
5
4
|
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
6
|
-
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
7
5
|
import FunctionParams from "../FunctionParams";
|
|
8
6
|
|
|
9
|
-
const renderOpts = {
|
|
10
|
-
messages,
|
|
11
|
-
fallback: "lazy",
|
|
12
|
-
};
|
|
13
|
-
|
|
14
7
|
describe("<FunctionParams />", () => {
|
|
15
8
|
it("matches the latest snapshot without param", async () => {
|
|
16
|
-
const
|
|
9
|
+
const rendered = render(
|
|
17
10
|
<TestFormWrapper>
|
|
18
11
|
<FunctionParams />
|
|
19
|
-
</TestFormWrapper
|
|
20
|
-
renderOpts
|
|
12
|
+
</TestFormWrapper>
|
|
21
13
|
);
|
|
22
|
-
await
|
|
23
|
-
expect(container).toMatchSnapshot();
|
|
14
|
+
await waitForLoad(rendered);
|
|
15
|
+
expect(rendered.container).toMatchSnapshot();
|
|
24
16
|
});
|
|
25
17
|
|
|
26
18
|
it("matches the latest snapshot with param", async () => {
|
|
27
19
|
const defaultValues = {
|
|
28
20
|
params: [{ name: "param1", type: "boolean", id: 1 }],
|
|
29
21
|
};
|
|
30
|
-
const
|
|
22
|
+
const rendered = render(
|
|
31
23
|
<TestFormWrapper defaultValues={defaultValues}>
|
|
32
24
|
<FunctionParams />
|
|
33
|
-
</TestFormWrapper
|
|
34
|
-
renderOpts
|
|
25
|
+
</TestFormWrapper>
|
|
35
26
|
);
|
|
36
|
-
await
|
|
37
|
-
expect(container).toMatchSnapshot();
|
|
27
|
+
await waitForLoad(rendered);
|
|
28
|
+
expect(rendered.container).toMatchSnapshot();
|
|
38
29
|
});
|
|
39
30
|
|
|
40
31
|
it("user interaction", async () => {
|
|
41
32
|
const watcher = jest.fn();
|
|
33
|
+
const user = userEvent.setup({ delay: null, skipHover: true });
|
|
42
34
|
|
|
43
35
|
const testArgName = "test_arg_name";
|
|
44
36
|
const testArgDescription = "test_arg_description";
|
|
45
37
|
|
|
46
|
-
const
|
|
38
|
+
const rendered = render(
|
|
47
39
|
<TestFormWrapper watcher={watcher}>
|
|
48
40
|
<FunctionParams />
|
|
49
|
-
</TestFormWrapper
|
|
50
|
-
|
|
41
|
+
</TestFormWrapper>
|
|
42
|
+
);
|
|
43
|
+
await waitForLoad(rendered);
|
|
44
|
+
await user.click(
|
|
45
|
+
rendered.getByRole("button", { name: /functions.form.add_param/i })
|
|
51
46
|
);
|
|
52
|
-
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
53
|
-
userEvent.click(getByRole("button", { name: /Add parameter/i }));
|
|
54
47
|
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
48
|
+
const nameInput = () =>
|
|
49
|
+
rendered.queryByPlaceholderText("functions.form.name");
|
|
50
|
+
const descriptionInputLabel = () =>
|
|
51
|
+
rendered.getByText("functions.form.add_description");
|
|
59
52
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
const descriptionInput = () =>
|
|
54
|
+
rendered.getByPlaceholderText("functions.form.description");
|
|
55
|
+
const typeSelector = () => rendered.getByRole("listbox");
|
|
56
|
+
const stringOption = () =>
|
|
57
|
+
rendered.getByRole("option", { name: /string/i });
|
|
63
58
|
|
|
64
|
-
|
|
65
|
-
await waitFor(() => expect(
|
|
59
|
+
await waitFor(() => expect(nameInput()).toBeInTheDocument());
|
|
60
|
+
await waitFor(() => expect(typeSelector()).toBeInTheDocument());
|
|
61
|
+
await waitFor(() => expect(descriptionInputLabel()).toBeInTheDocument());
|
|
66
62
|
|
|
67
|
-
|
|
63
|
+
await user.click(typeSelector());
|
|
64
|
+
await waitFor(() => expect(descriptionInputLabel()).toBeInTheDocument());
|
|
68
65
|
|
|
69
|
-
|
|
66
|
+
await user.click(stringOption());
|
|
70
67
|
|
|
71
|
-
|
|
72
|
-
const descriptionInput = getByPlaceholderText(/description/i);
|
|
73
|
-
await waitFor(() => expect(descriptionInput).toBeInTheDocument());
|
|
68
|
+
await user.type(nameInput(), testArgName);
|
|
74
69
|
|
|
75
|
-
|
|
70
|
+
await user.click(descriptionInputLabel());
|
|
71
|
+
await waitFor(() => expect(descriptionInput()).toBeInTheDocument());
|
|
72
|
+
|
|
73
|
+
await user.type(descriptionInput(), testArgDescription);
|
|
76
74
|
|
|
77
75
|
expect(watcher).toHaveBeenLastCalledWith({
|
|
78
76
|
params: [
|
|
@@ -85,16 +83,21 @@ describe("<FunctionParams />", () => {
|
|
|
85
83
|
],
|
|
86
84
|
});
|
|
87
85
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
await waitFor(() => expect(deleteButton).
|
|
86
|
+
const deleteButton = () =>
|
|
87
|
+
rendered.queryByRole("button", { name: /delete/i });
|
|
88
|
+
|
|
89
|
+
await user.hover(nameInput());
|
|
90
|
+
await waitFor(() => expect(deleteButton()).toBeInTheDocument());
|
|
91
|
+
|
|
92
|
+
await user.unhover(nameInput());
|
|
93
|
+
|
|
94
|
+
await waitFor(() => expect(deleteButton()).not.toBeInTheDocument());
|
|
95
|
+
|
|
96
|
+
await user.hover(nameInput().parentElement);
|
|
97
|
+
|
|
98
|
+
await user.click(rendered.getByRole("button", { name: /delete/i }));
|
|
93
99
|
|
|
94
|
-
|
|
95
|
-
const newDeleteButton = getByRole("button", { name: /delete/i });
|
|
96
|
-
userEvent.click(newDeleteButton);
|
|
97
|
-
await waitFor(() => expect(argInput).not.toBeInTheDocument());
|
|
100
|
+
await waitFor(() => expect(nameInput()).not.toBeInTheDocument());
|
|
98
101
|
|
|
99
102
|
expect(watcher).toHaveBeenLastCalledWith({ params: [] });
|
|
100
103
|
});
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { render } from "@truedat/test/render";
|
|
4
|
-
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
1
|
+
import userEvent from "@testing-library/user-event";
|
|
2
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
5
3
|
import Functions from "../Functions";
|
|
6
4
|
|
|
7
5
|
jest.mock("@truedat/qx/hooks/useFunctions", () => {
|
|
@@ -50,14 +48,9 @@ jest.mock("@truedat/qx/hooks/useFunctions", () => {
|
|
|
50
48
|
});
|
|
51
49
|
|
|
52
50
|
describe("<Functions />", () => {
|
|
53
|
-
const renderOpts = {
|
|
54
|
-
messages,
|
|
55
|
-
fallback: "lazy",
|
|
56
|
-
};
|
|
57
|
-
|
|
58
51
|
it("matches the latest snapshot", async () => {
|
|
59
|
-
const
|
|
60
|
-
await
|
|
61
|
-
expect(container).toMatchSnapshot();
|
|
52
|
+
const rendered = render(<Functions />);
|
|
53
|
+
await waitForLoad(rendered);
|
|
54
|
+
expect(rendered.container).toMatchSnapshot();
|
|
62
55
|
});
|
|
63
56
|
});
|
|
@@ -37,7 +37,7 @@ exports[`<FunctionParams /> matches the latest snapshot with param 1`] = `
|
|
|
37
37
|
>
|
|
38
38
|
<input
|
|
39
39
|
autocomplete="off"
|
|
40
|
-
placeholder="
|
|
40
|
+
placeholder="functions.form.name"
|
|
41
41
|
type="text"
|
|
42
42
|
value="param1"
|
|
43
43
|
/>
|
|
@@ -54,7 +54,7 @@ exports[`<FunctionParams /> matches the latest snapshot with param 1`] = `
|
|
|
54
54
|
class="divider text"
|
|
55
55
|
role="alert"
|
|
56
56
|
>
|
|
57
|
-
boolean
|
|
57
|
+
expressions.data_type.boolean
|
|
58
58
|
</div>
|
|
59
59
|
<i
|
|
60
60
|
aria-hidden="true"
|
|
@@ -77,7 +77,7 @@ exports[`<FunctionParams /> matches the latest snapshot with param 1`] = `
|
|
|
77
77
|
<span
|
|
78
78
|
class="text"
|
|
79
79
|
>
|
|
80
|
-
boolean
|
|
80
|
+
expressions.data_type.boolean
|
|
81
81
|
</span>
|
|
82
82
|
</div>
|
|
83
83
|
<div
|
|
@@ -94,7 +94,7 @@ exports[`<FunctionParams /> matches the latest snapshot with param 1`] = `
|
|
|
94
94
|
<span
|
|
95
95
|
class="text"
|
|
96
96
|
>
|
|
97
|
-
string
|
|
97
|
+
expressions.data_type.string
|
|
98
98
|
</span>
|
|
99
99
|
</div>
|
|
100
100
|
<div
|
|
@@ -111,7 +111,7 @@ exports[`<FunctionParams /> matches the latest snapshot with param 1`] = `
|
|
|
111
111
|
<span
|
|
112
112
|
class="text"
|
|
113
113
|
>
|
|
114
|
-
number
|
|
114
|
+
expressions.data_type.number
|
|
115
115
|
</span>
|
|
116
116
|
</div>
|
|
117
117
|
<div
|
|
@@ -128,7 +128,7 @@ exports[`<FunctionParams /> matches the latest snapshot with param 1`] = `
|
|
|
128
128
|
<span
|
|
129
129
|
class="text"
|
|
130
130
|
>
|
|
131
|
-
date
|
|
131
|
+
expressions.data_type.date
|
|
132
132
|
</span>
|
|
133
133
|
</div>
|
|
134
134
|
<div
|
|
@@ -145,7 +145,7 @@ exports[`<FunctionParams /> matches the latest snapshot with param 1`] = `
|
|
|
145
145
|
<span
|
|
146
146
|
class="text"
|
|
147
147
|
>
|
|
148
|
-
timestamp
|
|
148
|
+
expressions.data_type.timestamp
|
|
149
149
|
</span>
|
|
150
150
|
</div>
|
|
151
151
|
<div
|
|
@@ -162,7 +162,7 @@ exports[`<FunctionParams /> matches the latest snapshot with param 1`] = `
|
|
|
162
162
|
<span
|
|
163
163
|
class="text"
|
|
164
164
|
>
|
|
165
|
-
any
|
|
165
|
+
expressions.data_type.any
|
|
166
166
|
</span>
|
|
167
167
|
</div>
|
|
168
168
|
</div>
|
|
@@ -184,7 +184,7 @@ exports[`<FunctionParams /> matches the latest snapshot with param 1`] = `
|
|
|
184
184
|
style="font-style: italic; font-size: 13px; padding: 9.5px 14px;"
|
|
185
185
|
tabindex="0"
|
|
186
186
|
>
|
|
187
|
-
|
|
187
|
+
functions.form.add_description
|
|
188
188
|
</a>
|
|
189
189
|
</div>
|
|
190
190
|
</div>
|
|
@@ -200,7 +200,7 @@ exports[`<FunctionParams /> matches the latest snapshot with param 1`] = `
|
|
|
200
200
|
<button
|
|
201
201
|
class="ui button"
|
|
202
202
|
>
|
|
203
|
-
|
|
203
|
+
functions.form.add_param
|
|
204
204
|
</button>
|
|
205
205
|
</div>
|
|
206
206
|
</div>
|
|
@@ -220,7 +220,7 @@ exports[`<FunctionParams /> matches the latest snapshot without param 1`] = `
|
|
|
220
220
|
<button
|
|
221
221
|
class="ui button"
|
|
222
222
|
>
|
|
223
|
-
|
|
223
|
+
functions.form.add_param
|
|
224
224
|
</button>
|
|
225
225
|
</div>
|
|
226
226
|
</div>
|
|
@@ -15,11 +15,11 @@ exports[`<Functions /> matches the latest snapshot 1`] = `
|
|
|
15
15
|
<div
|
|
16
16
|
class="content"
|
|
17
17
|
>
|
|
18
|
-
|
|
18
|
+
functions.header
|
|
19
19
|
<div
|
|
20
20
|
class="sub header"
|
|
21
21
|
>
|
|
22
|
-
|
|
22
|
+
functions.subheader
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
25
25
|
</h2>
|
|
@@ -32,7 +32,7 @@ exports[`<Functions /> matches the latest snapshot 1`] = `
|
|
|
32
32
|
<button
|
|
33
33
|
class="ui fluid button"
|
|
34
34
|
>
|
|
35
|
-
|
|
35
|
+
functions.action.new
|
|
36
36
|
</button>
|
|
37
37
|
<div
|
|
38
38
|
class="ui divided selection list"
|
|
@@ -54,7 +54,6 @@ exports[`<Functions /> matches the latest snapshot 1`] = `
|
|
|
54
54
|
>
|
|
55
55
|
b
|
|
56
56
|
</div>
|
|
57
|
-
|
|
58
57
|
user_false
|
|
59
58
|
/
|
|
60
59
|
0
|
|
@@ -76,7 +75,7 @@ exports[`<Functions /> matches the latest snapshot 1`] = `
|
|
|
76
75
|
<div
|
|
77
76
|
class="sub header"
|
|
78
77
|
>
|
|
79
|
-
|
|
78
|
+
functions.no_selection
|
|
80
79
|
</div>
|
|
81
80
|
</h2>
|
|
82
81
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { use } from "react";
|
|
2
2
|
import { useFormContext } from "react-hook-form";
|
|
3
3
|
import { Segment } from "semantic-ui-react";
|
|
4
4
|
import QxContext from "@truedat/qx/components/QxContext";
|
|
@@ -7,7 +7,7 @@ import Ratio from "./controlProperties/Ratio";
|
|
|
7
7
|
|
|
8
8
|
export default function ControlProperties() {
|
|
9
9
|
const { watch } = useFormContext();
|
|
10
|
-
const context =
|
|
10
|
+
const context = use(QxContext);
|
|
11
11
|
|
|
12
12
|
const { control_mode: controlMode, source_id: sourceId } = watch();
|
|
13
13
|
|
|
@@ -20,9 +20,9 @@ export default function ControlProperties() {
|
|
|
20
20
|
|
|
21
21
|
return controlMode && sourceId ? (
|
|
22
22
|
<Segment>
|
|
23
|
-
<QxContext
|
|
23
|
+
<QxContext value={{ ...context, field: "control_properties" }}>
|
|
24
24
|
{componentForMode[controlMode]}
|
|
25
|
-
</QxContext
|
|
25
|
+
</QxContext>
|
|
26
26
|
</Segment>
|
|
27
27
|
) : null;
|
|
28
28
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { FormattedMessage } from "react-intl";
|
|
3
|
-
import { useParams,
|
|
2
|
+
import { useParams, useNavigate } from "react-router";
|
|
4
3
|
import { Container, Header, Icon, Segment } from "semantic-ui-react";
|
|
5
4
|
import { QUALITY_CONTROLS, linkTo } from "@truedat/core/routes";
|
|
6
5
|
import {
|
|
@@ -11,7 +10,8 @@ import QualityControlEditor from "./QualityControlEditor";
|
|
|
11
10
|
|
|
12
11
|
export default function EditQualityControl() {
|
|
13
12
|
const { id, version } = useParams();
|
|
14
|
-
const
|
|
13
|
+
const navigate = useNavigate();
|
|
14
|
+
|
|
15
15
|
const { trigger, isMutating } = useQualityControlUpdateDraft(id);
|
|
16
16
|
const { data, loading: qualityControlLoading } = useQualityControl(
|
|
17
17
|
id,
|
|
@@ -29,7 +29,7 @@ export default function EditQualityControl() {
|
|
|
29
29
|
}).then(({ data }) => {
|
|
30
30
|
const id = data?.data?.id;
|
|
31
31
|
const version = data?.data?.version;
|
|
32
|
-
|
|
32
|
+
navigate(linkTo.QUALITY_CONTROL({ id, version }));
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
35
|
return (
|
|
@@ -49,7 +49,7 @@ export default function EditQualityControl() {
|
|
|
49
49
|
isModification
|
|
50
50
|
value={qualityControl}
|
|
51
51
|
onSave={handleSubmit}
|
|
52
|
-
onCancel={() =>
|
|
52
|
+
onCancel={() => navigate(QUALITY_CONTROLS)}
|
|
53
53
|
isSubmitting={loading}
|
|
54
54
|
/>
|
|
55
55
|
) : null}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
3
2
|
import { FormattedMessage } from "react-intl";
|
|
4
|
-
import { useParams,
|
|
3
|
+
import { useParams, useNavigate } from "react-router";
|
|
5
4
|
import { Container, Header, Icon, Segment } from "semantic-ui-react";
|
|
6
5
|
import { QUALITY_CONTROLS, linkTo } from "@truedat/core/routes";
|
|
7
6
|
import {
|
|
@@ -12,7 +11,8 @@ import QualityControlEditor from "./QualityControlEditor";
|
|
|
12
11
|
|
|
13
12
|
export default function NewDraftQualityControl() {
|
|
14
13
|
const { id, version } = useParams();
|
|
15
|
-
const
|
|
14
|
+
const navigate = useNavigate();
|
|
15
|
+
|
|
16
16
|
const { trigger, isMutating } = useQualityControlCreateDraft(id);
|
|
17
17
|
|
|
18
18
|
const { data, loading: qualityControlLoading } = useQualityControl(
|
|
@@ -31,8 +31,9 @@ export default function NewDraftQualityControl() {
|
|
|
31
31
|
}).then(({ data }) => {
|
|
32
32
|
const id = data?.data?.id;
|
|
33
33
|
const version = data?.data?.version;
|
|
34
|
-
|
|
34
|
+
navigate(linkTo.QUALITY_CONTROL({ id, version }));
|
|
35
35
|
});
|
|
36
|
+
|
|
36
37
|
const handleSave = (qualityControl) => {
|
|
37
38
|
trigger({
|
|
38
39
|
quality_control: {
|
|
@@ -42,9 +43,10 @@ export default function NewDraftQualityControl() {
|
|
|
42
43
|
}).then(({ data }) => {
|
|
43
44
|
const id = data?.data?.id;
|
|
44
45
|
const version = data?.data?.version;
|
|
45
|
-
|
|
46
|
+
navigate(linkTo.QUALITY_CONTROL({ id, version }));
|
|
46
47
|
});
|
|
47
48
|
};
|
|
49
|
+
|
|
48
50
|
return (
|
|
49
51
|
<Segment floated="left" loading={loading}>
|
|
50
52
|
<Container text>
|
|
@@ -63,7 +65,7 @@ export default function NewDraftQualityControl() {
|
|
|
63
65
|
value={qualityControl}
|
|
64
66
|
onPublish={handlePublish}
|
|
65
67
|
onSave={handleSave}
|
|
66
|
-
onCancel={() =>
|
|
68
|
+
onCancel={() => navigate(QUALITY_CONTROLS)}
|
|
67
69
|
isSubmitting={loading}
|
|
68
70
|
/>
|
|
69
71
|
) : null}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
3
2
|
import { FormattedMessage } from "react-intl";
|
|
4
|
-
import {
|
|
3
|
+
import { useNavigate } from "react-router";
|
|
5
4
|
import { Container, Header, Icon, Segment } from "semantic-ui-react";
|
|
6
5
|
import { QUALITY_CONTROLS, linkTo } from "@truedat/core/routes";
|
|
7
6
|
import { useQualityControlCreate } from "../../hooks/useQualityControls";
|
|
@@ -14,7 +13,7 @@ export const defaultQualityControl = {
|
|
|
14
13
|
df_type: null,
|
|
15
14
|
};
|
|
16
15
|
export default function NewQualityControl() {
|
|
17
|
-
const
|
|
16
|
+
const navigate = useNavigate();
|
|
18
17
|
const { trigger, isMutating } = useQualityControlCreate();
|
|
19
18
|
|
|
20
19
|
const handlePublish = (qualityControl) => {
|
|
@@ -26,7 +25,7 @@ export default function NewQualityControl() {
|
|
|
26
25
|
}).then(({ data }) => {
|
|
27
26
|
const id = data?.data?.id;
|
|
28
27
|
const version = data?.data?.version;
|
|
29
|
-
|
|
28
|
+
navigate(linkTo.QUALITY_CONTROL({ id, version }));
|
|
30
29
|
});
|
|
31
30
|
};
|
|
32
31
|
const handleSave = (qualityControl) => {
|
|
@@ -38,7 +37,7 @@ export default function NewQualityControl() {
|
|
|
38
37
|
}).then(({ data }) => {
|
|
39
38
|
const id = data?.data?.id;
|
|
40
39
|
const version = data?.data?.version;
|
|
41
|
-
|
|
40
|
+
navigate(linkTo.QUALITY_CONTROL({ id, version }));
|
|
42
41
|
});
|
|
43
42
|
};
|
|
44
43
|
|
|
@@ -59,7 +58,7 @@ export default function NewQualityControl() {
|
|
|
59
58
|
isModification={false}
|
|
60
59
|
onPublish={handlePublish}
|
|
61
60
|
onSave={handleSave}
|
|
62
|
-
onCancel={() =>
|
|
61
|
+
onCancel={() => navigate(QUALITY_CONTROLS)}
|
|
63
62
|
isSubmitting={isMutating}
|
|
64
63
|
/>
|
|
65
64
|
</Container>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
5
4
|
import { Icon } from "semantic-ui-react";
|
|
@@ -52,10 +51,10 @@ export const QualityBadgeForSearch = ({
|
|
|
52
51
|
latestScore?.result_message === "meets_goal"
|
|
53
52
|
? "green"
|
|
54
53
|
: latestScore?.result_message === "under_goal"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
? "yellow"
|
|
55
|
+
: latestScore?.result_message === "no_results"
|
|
56
|
+
? "grey"
|
|
57
|
+
: "red";
|
|
59
58
|
|
|
60
59
|
const attrs =
|
|
61
60
|
controlMode == "percentage"
|
|
@@ -68,31 +67,31 @@ export const QualityBadgeForSearch = ({
|
|
|
68
67
|
text: `${latestScore.result}%`,
|
|
69
68
|
}
|
|
70
69
|
: controlMode == "deviation"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
70
|
+
? {
|
|
71
|
+
color: color,
|
|
72
|
+
label1: "quality_control.score_criteria.deviation.goal",
|
|
73
|
+
value1: criteria.goal,
|
|
74
|
+
label2: "quality_control.score_criteria.deviation.maximum",
|
|
75
|
+
value2: criteria.maximum,
|
|
76
|
+
text: `${latestScore.result}%`,
|
|
77
|
+
}
|
|
78
|
+
: controlMode == "error_count"
|
|
79
|
+
? {
|
|
80
|
+
color: color,
|
|
81
|
+
label1: "quality_control.score_criteria.error_count.goal",
|
|
82
|
+
value1: criteria.goal,
|
|
83
|
+
label2: "quality_control.score_criteria.error_count.maximum",
|
|
84
|
+
value2: criteria.maximum,
|
|
85
|
+
text: latestScore?.result,
|
|
86
|
+
}
|
|
87
|
+
: {
|
|
88
|
+
color: color,
|
|
89
|
+
label1: "quality_control.score_criteria.count.goal",
|
|
90
|
+
value1: criteria?.goal,
|
|
91
|
+
label2: "quality_control.score_criteria.count.maximum",
|
|
92
|
+
value2: criteria?.maximum,
|
|
93
|
+
text: latestScore?.result,
|
|
94
|
+
};
|
|
96
95
|
return latestScore?.status === "failed" ? (
|
|
97
96
|
<>
|
|
98
97
|
<Icon color="red" name="warning circle" />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import
|
|
2
|
+
import { lazy, use, useState } from "react";
|
|
3
3
|
import { FormattedMessage } from "react-intl";
|
|
4
4
|
import { Button, Header, Icon, List, Label, Popup } from "semantic-ui-react";
|
|
5
5
|
import { Loading } from "@truedat/core/components";
|
|
@@ -7,8 +7,8 @@ import QxContext from "../QxContext";
|
|
|
7
7
|
import QualityControlManageDomain from "./QualityControlManageDomain";
|
|
8
8
|
import ScoreCriteriaView from "./ScoreCriteriaView";
|
|
9
9
|
import ControlPropertiesView from "./ControlPropertiesView";
|
|
10
|
-
const DynamicFormViewer =
|
|
11
|
-
import("@truedat/df/components/DynamicFormViewer")
|
|
10
|
+
const DynamicFormViewer = lazy(
|
|
11
|
+
() => import("@truedat/df/components/DynamicFormViewer")
|
|
12
12
|
);
|
|
13
13
|
|
|
14
14
|
const DomainPopup = () => {
|
|
@@ -37,7 +37,7 @@ const DomainPopup = () => {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export default function QualityControl() {
|
|
40
|
-
const { qualityControl, actions, loading } =
|
|
40
|
+
const { qualityControl, actions, loading } = use(QxContext);
|
|
41
41
|
const canUpdateDomain = _.includes("update_main")(actions);
|
|
42
42
|
return (
|
|
43
43
|
<>
|
|
@@ -58,9 +58,7 @@ export default function QualityControl() {
|
|
|
58
58
|
</List.Description>
|
|
59
59
|
</List.Item>
|
|
60
60
|
</List>
|
|
61
|
-
|
|
62
61
|
<ScoreCriteriaView qualityControl={qualityControl} />
|
|
63
|
-
|
|
64
62
|
{qualityControl.df_type ? (
|
|
65
63
|
<>
|
|
66
64
|
<Header as="h3">
|
|
@@ -77,7 +75,6 @@ export default function QualityControl() {
|
|
|
77
75
|
/>
|
|
78
76
|
</>
|
|
79
77
|
) : null}
|
|
80
|
-
|
|
81
78
|
<ControlPropertiesView qualityControl={qualityControl} />
|
|
82
79
|
</>
|
|
83
80
|
)}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import
|
|
2
|
+
import { use } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { useIntl } from "react-intl";
|
|
5
|
-
import { Link
|
|
5
|
+
import { Link } from "react-router";
|
|
6
|
+
import { useNavigate } from "react-router";
|
|
6
7
|
import { Button, Container, Icon } from "semantic-ui-react";
|
|
7
8
|
import { linkTo, QUALITY_CONTROLS } from "@truedat/core/routes";
|
|
8
9
|
import { useAuthorized } from "@truedat/core/hooks";
|
|
@@ -82,10 +83,10 @@ ConfirmDeletionModal.propTypes = {
|
|
|
82
83
|
};
|
|
83
84
|
|
|
84
85
|
export default function QualityControlActions() {
|
|
85
|
-
const
|
|
86
|
+
const navigate = useNavigate();
|
|
86
87
|
const { formatMessage } = useIntl();
|
|
87
88
|
const authorized = useAuthorized();
|
|
88
|
-
const { qualityControl, actions, mutate } =
|
|
89
|
+
const { qualityControl, actions, mutate } = use(QxContext);
|
|
89
90
|
const { trigger: updateQualityControlStatus, isMutating } =
|
|
90
91
|
useQualityControlUpdateStatus(qualityControl.id);
|
|
91
92
|
|
|
@@ -107,7 +108,7 @@ export default function QualityControlActions() {
|
|
|
107
108
|
}).then(() => mutate());
|
|
108
109
|
|
|
109
110
|
const confirmQualityControlDeletion = () =>
|
|
110
|
-
triggerDeleteQualityControl().then(() =>
|
|
111
|
+
triggerDeleteQualityControl().then(() => navigate(QUALITY_CONTROLS));
|
|
111
112
|
|
|
112
113
|
const canExecute = _.includes("execute")(actions);
|
|
113
114
|
|
|
@@ -181,7 +182,7 @@ export default function QualityControlActions() {
|
|
|
181
182
|
ids: [qualityControl.version_id],
|
|
182
183
|
}).then(({ data }) => {
|
|
183
184
|
const id = _.prop("data.id")(data);
|
|
184
|
-
|
|
185
|
+
navigate(linkTo.SCORE_GROUP({ id }));
|
|
185
186
|
});
|
|
186
187
|
};
|
|
187
188
|
|
|
@@ -190,7 +191,6 @@ export default function QualityControlActions() {
|
|
|
190
191
|
{authorized ? (
|
|
191
192
|
<QualityControlQueryModal qualityControlId={qualityControl.id} />
|
|
192
193
|
) : null}
|
|
193
|
-
|
|
194
194
|
{qualityControl.active &&
|
|
195
195
|
canExecute &&
|
|
196
196
|
!_.includes(qualityControl.status)(["deprecated", "versioned"]) ? (
|