@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,10 +1,7 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { act } from "react-dom/test-utils";
|
|
3
1
|
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import { render } from "@truedat/test/render";
|
|
5
|
-
import { waitFor } from "@testing-library/react";
|
|
6
|
-
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
2
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
7
3
|
import SearchContext from "@truedat/core/search/SearchContext";
|
|
4
|
+
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
8
5
|
import ResourceSelector from "../ResourceSelector";
|
|
9
6
|
|
|
10
7
|
jest.mock("@truedat/dd/hooks/useStructures", () => {
|
|
@@ -33,26 +30,6 @@ jest.mock("@truedat/dd/hooks/useStructures", () => {
|
|
|
33
30
|
};
|
|
34
31
|
});
|
|
35
32
|
|
|
36
|
-
const renderOpts = {
|
|
37
|
-
messages: {
|
|
38
|
-
en: {
|
|
39
|
-
"queryables.form.resource": "resource",
|
|
40
|
-
"queryables.resource.type": "type",
|
|
41
|
-
"queryables.resource.type.data_structure": "data_structure",
|
|
42
|
-
"queryables.resource.type.reference_dataset": "reference_dataset",
|
|
43
|
-
"queryables.resource.type.data_view": "data_view",
|
|
44
|
-
"queryables.resource.selector.data_view": "data_view",
|
|
45
|
-
"queryables.resource.selector.reference_dataset": "reference_dataset",
|
|
46
|
-
"search.placeholder": "placeholder",
|
|
47
|
-
"structures.not_found.body": "body",
|
|
48
|
-
"structures.not_found.header": "header",
|
|
49
|
-
"structures.search.placeholder": "placeholder",
|
|
50
|
-
"structures.loading.header": "loading",
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
fallback: "loading",
|
|
54
|
-
};
|
|
55
|
-
|
|
56
33
|
const searchProps = {
|
|
57
34
|
useFilters: jest.fn(),
|
|
58
35
|
useSearch: jest.fn(),
|
|
@@ -63,24 +40,20 @@ const searchProps = {
|
|
|
63
40
|
|
|
64
41
|
describe("<ResourceSelector />", () => {
|
|
65
42
|
it("matches the latest snapshot", async () => {
|
|
66
|
-
const
|
|
43
|
+
const rendered = render(
|
|
67
44
|
<TestFormWrapper>
|
|
68
|
-
<SearchContext
|
|
45
|
+
<SearchContext value={searchProps}>
|
|
69
46
|
<ResourceSelector />
|
|
70
|
-
</SearchContext
|
|
71
|
-
</TestFormWrapper
|
|
72
|
-
renderOpts
|
|
73
|
-
);
|
|
74
|
-
await waitFor(() =>
|
|
75
|
-
expect(container.querySelector(".loader")).not.toBeInTheDocument()
|
|
47
|
+
</SearchContext>
|
|
48
|
+
</TestFormWrapper>
|
|
76
49
|
);
|
|
77
|
-
|
|
50
|
+
await waitForLoad(rendered);
|
|
51
|
+
expect(rendered.container).toMatchSnapshot();
|
|
78
52
|
});
|
|
79
53
|
|
|
80
54
|
it("select data_view", async () => {
|
|
81
55
|
const watcher = jest.fn();
|
|
82
|
-
|
|
83
|
-
const { container, getByRole } = render(
|
|
56
|
+
const rendered = render(
|
|
84
57
|
<TestFormWrapper
|
|
85
58
|
context={{
|
|
86
59
|
dataViews: [{ name: "UserDataView", id: 1, source_id: 10 }],
|
|
@@ -88,21 +61,17 @@ describe("<ResourceSelector />", () => {
|
|
|
88
61
|
}}
|
|
89
62
|
watcher={watcher}
|
|
90
63
|
>
|
|
91
|
-
<SearchContext
|
|
64
|
+
<SearchContext value={searchProps}>
|
|
92
65
|
<ResourceSelector />
|
|
93
|
-
</SearchContext
|
|
94
|
-
</TestFormWrapper
|
|
95
|
-
renderOpts
|
|
66
|
+
</SearchContext>
|
|
67
|
+
</TestFormWrapper>
|
|
96
68
|
);
|
|
97
|
-
|
|
98
|
-
await waitFor(() => expect(loader).not.toBeInTheDocument());
|
|
99
|
-
await act(async () => {
|
|
100
|
-
userEvent.click(getByRole("option", { name: /data_view/i }));
|
|
101
|
-
});
|
|
69
|
+
await waitForLoad(rendered);
|
|
102
70
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
});
|
|
71
|
+
const user = userEvent.setup({ delay: null });
|
|
72
|
+
|
|
73
|
+
await user.click(rendered.getByRole("option", { name: /data_view/i }));
|
|
74
|
+
await user.click(rendered.getByRole("option", { name: /userdataview/i }));
|
|
106
75
|
|
|
107
76
|
expect(watcher).toHaveBeenLastCalledWith({
|
|
108
77
|
test: {
|
|
@@ -117,64 +86,50 @@ describe("<ResourceSelector />", () => {
|
|
|
117
86
|
},
|
|
118
87
|
});
|
|
119
88
|
|
|
120
|
-
expect(container).toMatchSnapshot();
|
|
89
|
+
expect(rendered.container).toMatchSnapshot();
|
|
121
90
|
});
|
|
122
91
|
|
|
123
92
|
it("select data_structure", async () => {
|
|
124
93
|
const watcher = jest.fn();
|
|
125
|
-
const
|
|
94
|
+
const rendered = render(
|
|
126
95
|
<TestFormWrapper watcher={watcher}>
|
|
127
|
-
<SearchContext
|
|
96
|
+
<SearchContext value={searchProps}>
|
|
128
97
|
<ResourceSelector />
|
|
129
|
-
</SearchContext
|
|
130
|
-
</TestFormWrapper
|
|
131
|
-
renderOpts
|
|
132
|
-
);
|
|
133
|
-
await waitFor(() =>
|
|
134
|
-
expect(container.querySelector(".loader")).not.toBeInTheDocument()
|
|
98
|
+
</SearchContext>
|
|
99
|
+
</TestFormWrapper>
|
|
135
100
|
);
|
|
136
|
-
await
|
|
137
|
-
|
|
138
|
-
});
|
|
139
|
-
await
|
|
140
|
-
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
expect(container.querySelector(".loading")).not.toBeInTheDocument()
|
|
144
|
-
);
|
|
145
|
-
await findByText(/header/);
|
|
146
|
-
expect(container).toMatchSnapshot();
|
|
101
|
+
await waitForLoad(rendered);
|
|
102
|
+
|
|
103
|
+
const user = userEvent.setup({ delay: null });
|
|
104
|
+
await user.click(rendered.getByRole("option", { name: /data_structure/i }));
|
|
105
|
+
|
|
106
|
+
await rendered.findByText(/header/);
|
|
107
|
+
expect(rendered.container).toMatchSnapshot();
|
|
147
108
|
});
|
|
148
109
|
|
|
149
110
|
it("select reference_dataset", async () => {
|
|
150
111
|
const watcher = jest.fn();
|
|
151
|
-
const
|
|
112
|
+
const rendered = render(
|
|
152
113
|
<TestFormWrapper
|
|
153
114
|
context={{
|
|
154
115
|
referenceDatasets: [{ name: "UserReferenceDataset", id: 1 }],
|
|
155
116
|
}}
|
|
156
117
|
watcher={watcher}
|
|
157
118
|
>
|
|
158
|
-
<SearchContext
|
|
119
|
+
<SearchContext value={searchProps}>
|
|
159
120
|
<ResourceSelector />
|
|
160
|
-
</SearchContext
|
|
161
|
-
</TestFormWrapper
|
|
162
|
-
renderOpts
|
|
121
|
+
</SearchContext>
|
|
122
|
+
</TestFormWrapper>
|
|
163
123
|
);
|
|
164
|
-
|
|
165
|
-
await waitFor(() => expect(loader).not.toBeInTheDocument());
|
|
124
|
+
await waitForLoad(rendered);
|
|
166
125
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
userEvent.click(
|
|
175
|
-
await getByRole("option", { name: /UserReferenceDataset/i })
|
|
176
|
-
);
|
|
177
|
-
});
|
|
126
|
+
const user = userEvent.setup({ delay: null });
|
|
127
|
+
await user.click(
|
|
128
|
+
rendered.getByRole("option", { name: /reference_dataset/i })
|
|
129
|
+
);
|
|
130
|
+
await user.click(
|
|
131
|
+
rendered.getByRole("option", { name: /userreferenceDataset/i })
|
|
132
|
+
);
|
|
178
133
|
|
|
179
134
|
expect(watcher).toHaveBeenLastCalledWith({
|
|
180
135
|
test: {
|
|
@@ -187,6 +142,6 @@ describe("<ResourceSelector />", () => {
|
|
|
187
142
|
type: "reference_dataset",
|
|
188
143
|
},
|
|
189
144
|
});
|
|
190
|
-
expect(container).toMatchSnapshot();
|
|
145
|
+
expect(rendered.container).toMatchSnapshot();
|
|
191
146
|
});
|
|
192
147
|
});
|
|
@@ -6,7 +6,7 @@ exports[`<ResourceSelector /> matches the latest snapshot 1`] = `
|
|
|
6
6
|
class="field"
|
|
7
7
|
>
|
|
8
8
|
<label>
|
|
9
|
-
resource
|
|
9
|
+
queryables.form.resource
|
|
10
10
|
</label>
|
|
11
11
|
<div
|
|
12
12
|
aria-expanded="false"
|
|
@@ -20,7 +20,7 @@ exports[`<ResourceSelector /> matches the latest snapshot 1`] = `
|
|
|
20
20
|
class="divider default text"
|
|
21
21
|
role="alert"
|
|
22
22
|
>
|
|
23
|
-
type
|
|
23
|
+
queryables.resource.type
|
|
24
24
|
</div>
|
|
25
25
|
<i
|
|
26
26
|
aria-hidden="true"
|
|
@@ -39,7 +39,7 @@ exports[`<ResourceSelector /> matches the latest snapshot 1`] = `
|
|
|
39
39
|
<span
|
|
40
40
|
class="text"
|
|
41
41
|
>
|
|
42
|
-
data_structure
|
|
42
|
+
queryables.resource.type.data_structure
|
|
43
43
|
</span>
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
@@ -54,7 +54,7 @@ exports[`<ResourceSelector /> select data_structure 1`] = `
|
|
|
54
54
|
class="field"
|
|
55
55
|
>
|
|
56
56
|
<label>
|
|
57
|
-
resource
|
|
57
|
+
queryables.form.resource
|
|
58
58
|
</label>
|
|
59
59
|
<div
|
|
60
60
|
aria-expanded="false"
|
|
@@ -68,7 +68,7 @@ exports[`<ResourceSelector /> select data_structure 1`] = `
|
|
|
68
68
|
class="divider text"
|
|
69
69
|
role="alert"
|
|
70
70
|
>
|
|
71
|
-
data_structure
|
|
71
|
+
queryables.resource.type.data_structure
|
|
72
72
|
</div>
|
|
73
73
|
<i
|
|
74
74
|
aria-hidden="true"
|
|
@@ -87,7 +87,7 @@ exports[`<ResourceSelector /> select data_structure 1`] = `
|
|
|
87
87
|
<span
|
|
88
88
|
class="text"
|
|
89
89
|
>
|
|
90
|
-
data_structure
|
|
90
|
+
queryables.resource.type.data_structure
|
|
91
91
|
</span>
|
|
92
92
|
</div>
|
|
93
93
|
</div>
|
|
@@ -98,20 +98,19 @@ exports[`<ResourceSelector /> select data_structure 1`] = `
|
|
|
98
98
|
aria-hidden="true"
|
|
99
99
|
class="dropdown icon"
|
|
100
100
|
/>
|
|
101
|
-
|
|
102
101
|
</div>
|
|
103
102
|
<div
|
|
104
103
|
class="ui segment"
|
|
105
104
|
>
|
|
106
105
|
<div
|
|
107
|
-
class="ui action left icon input"
|
|
106
|
+
class="ui loading action left icon input"
|
|
108
107
|
>
|
|
109
108
|
<i
|
|
110
109
|
aria-hidden="true"
|
|
111
110
|
class="search link icon"
|
|
112
111
|
/>
|
|
113
112
|
<input
|
|
114
|
-
placeholder="placeholder"
|
|
113
|
+
placeholder="search.placeholder"
|
|
115
114
|
type="text"
|
|
116
115
|
value=""
|
|
117
116
|
/>
|
|
@@ -124,10 +123,10 @@ exports[`<ResourceSelector /> select data_structure 1`] = `
|
|
|
124
123
|
/>
|
|
125
124
|
</button>
|
|
126
125
|
<div
|
|
127
|
-
aria-busy="
|
|
126
|
+
aria-busy="true"
|
|
128
127
|
aria-disabled="false"
|
|
129
128
|
aria-expanded="false"
|
|
130
|
-
class="ui button floating labeled scrolling dropdown icon"
|
|
129
|
+
class="ui loading button floating labeled scrolling dropdown icon"
|
|
131
130
|
role="listbox"
|
|
132
131
|
tabindex="0"
|
|
133
132
|
>
|
|
@@ -161,8 +160,20 @@ exports[`<ResourceSelector /> select data_structure 1`] = `
|
|
|
161
160
|
class="selectedFilters"
|
|
162
161
|
/>
|
|
163
162
|
<div
|
|
164
|
-
class="dimmable structure-table-overflow"
|
|
163
|
+
class="dimmed dimmable structure-table-overflow"
|
|
165
164
|
>
|
|
165
|
+
<div
|
|
166
|
+
class="ui active transition visible inverted dimmer"
|
|
167
|
+
style="display: flex;"
|
|
168
|
+
>
|
|
169
|
+
<div
|
|
170
|
+
class="content"
|
|
171
|
+
>
|
|
172
|
+
<div
|
|
173
|
+
class="ui large loader"
|
|
174
|
+
/>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
166
177
|
<div
|
|
167
178
|
class="ui icon info message"
|
|
168
179
|
>
|
|
@@ -176,9 +187,8 @@ exports[`<ResourceSelector /> select data_structure 1`] = `
|
|
|
176
187
|
<div
|
|
177
188
|
class="header"
|
|
178
189
|
>
|
|
179
|
-
header
|
|
190
|
+
structures.loading.header
|
|
180
191
|
</div>
|
|
181
|
-
body
|
|
182
192
|
</div>
|
|
183
193
|
</div>
|
|
184
194
|
</div>
|
|
@@ -192,7 +202,7 @@ exports[`<ResourceSelector /> select data_view 1`] = `
|
|
|
192
202
|
class="field"
|
|
193
203
|
>
|
|
194
204
|
<label>
|
|
195
|
-
resource
|
|
205
|
+
queryables.form.resource
|
|
196
206
|
</label>
|
|
197
207
|
<div
|
|
198
208
|
aria-expanded="false"
|
|
@@ -206,7 +216,7 @@ exports[`<ResourceSelector /> select data_view 1`] = `
|
|
|
206
216
|
class="divider text"
|
|
207
217
|
role="alert"
|
|
208
218
|
>
|
|
209
|
-
data_view
|
|
219
|
+
queryables.resource.type.data_view
|
|
210
220
|
</div>
|
|
211
221
|
<i
|
|
212
222
|
aria-hidden="true"
|
|
@@ -225,7 +235,7 @@ exports[`<ResourceSelector /> select data_view 1`] = `
|
|
|
225
235
|
<span
|
|
226
236
|
class="text"
|
|
227
237
|
>
|
|
228
|
-
data_structure
|
|
238
|
+
queryables.resource.type.data_structure
|
|
229
239
|
</span>
|
|
230
240
|
</div>
|
|
231
241
|
<div
|
|
@@ -238,7 +248,7 @@ exports[`<ResourceSelector /> select data_view 1`] = `
|
|
|
238
248
|
<span
|
|
239
249
|
class="text"
|
|
240
250
|
>
|
|
241
|
-
data_view
|
|
251
|
+
queryables.resource.type.data_view
|
|
242
252
|
</span>
|
|
243
253
|
</div>
|
|
244
254
|
</div>
|
|
@@ -297,7 +307,7 @@ exports[`<ResourceSelector /> select reference_dataset 1`] = `
|
|
|
297
307
|
class="field"
|
|
298
308
|
>
|
|
299
309
|
<label>
|
|
300
|
-
resource
|
|
310
|
+
queryables.form.resource
|
|
301
311
|
</label>
|
|
302
312
|
<div
|
|
303
313
|
aria-expanded="false"
|
|
@@ -311,7 +321,7 @@ exports[`<ResourceSelector /> select reference_dataset 1`] = `
|
|
|
311
321
|
class="divider text"
|
|
312
322
|
role="alert"
|
|
313
323
|
>
|
|
314
|
-
reference_dataset
|
|
324
|
+
queryables.resource.type.reference_dataset
|
|
315
325
|
</div>
|
|
316
326
|
<i
|
|
317
327
|
aria-hidden="true"
|
|
@@ -330,7 +340,7 @@ exports[`<ResourceSelector /> select reference_dataset 1`] = `
|
|
|
330
340
|
<span
|
|
331
341
|
class="text"
|
|
332
342
|
>
|
|
333
|
-
data_structure
|
|
343
|
+
queryables.resource.type.data_structure
|
|
334
344
|
</span>
|
|
335
345
|
</div>
|
|
336
346
|
<div
|
|
@@ -343,7 +353,7 @@ exports[`<ResourceSelector /> select reference_dataset 1`] = `
|
|
|
343
353
|
<span
|
|
344
354
|
class="text"
|
|
345
355
|
>
|
|
346
|
-
reference_dataset
|
|
356
|
+
queryables.resource.type.reference_dataset
|
|
347
357
|
</span>
|
|
348
358
|
</div>
|
|
349
359
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import
|
|
2
|
+
import { useState, use } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { useIntl } from "react-intl";
|
|
5
5
|
import { useFieldArray } from "react-hook-form";
|
|
@@ -11,7 +11,7 @@ const newExpression = () => ({ shape: "function", value: null });
|
|
|
11
11
|
|
|
12
12
|
export default function Clauses({ labelId }) {
|
|
13
13
|
const { formatMessage } = useIntl();
|
|
14
|
-
const context =
|
|
14
|
+
const context = use(QxContext);
|
|
15
15
|
const { field } = context;
|
|
16
16
|
const { fields, append, remove } = useFieldArray({ name: field });
|
|
17
17
|
|
|
@@ -28,7 +28,6 @@ export default function Clauses({ labelId }) {
|
|
|
28
28
|
lastGroup={groupIndex === _.size(fields) - 1}
|
|
29
29
|
/>
|
|
30
30
|
))}
|
|
31
|
-
|
|
32
31
|
<Divider horizontal>
|
|
33
32
|
<Button
|
|
34
33
|
size="mini"
|
|
@@ -47,7 +46,7 @@ Clauses.propTypes = {
|
|
|
47
46
|
|
|
48
47
|
const ClauseExpression = ({ groupIndex, removeGroup, lastGroup }) => {
|
|
49
48
|
const { formatMessage } = useIntl();
|
|
50
|
-
const context =
|
|
49
|
+
const context = use(QxContext);
|
|
51
50
|
const { field } = context;
|
|
52
51
|
const [isShownDelete, setIsShownDelete] = useState();
|
|
53
52
|
const { fields, append, remove } = useFieldArray({
|
|
@@ -75,7 +74,7 @@ const ClauseExpression = ({ groupIndex, removeGroup, lastGroup }) => {
|
|
|
75
74
|
|
|
76
75
|
{fields.map((_clauseExpression, expressionIndex) => (
|
|
77
76
|
<div key={`and-${groupIndex}-${expressionIndex}`}>
|
|
78
|
-
<QxContext
|
|
77
|
+
<QxContext
|
|
79
78
|
value={{
|
|
80
79
|
...context,
|
|
81
80
|
field: `${field}[${groupIndex}].expressions[${expressionIndex}]`,
|
|
@@ -87,7 +86,7 @@ const ClauseExpression = ({ groupIndex, removeGroup, lastGroup }) => {
|
|
|
87
86
|
_.size(fields) < 2 ? null : () => remove(expressionIndex)
|
|
88
87
|
}
|
|
89
88
|
/>
|
|
90
|
-
</QxContext
|
|
89
|
+
</QxContext>
|
|
91
90
|
<Divider horizontal>
|
|
92
91
|
{expressionIndex === _.size(fields) - 1 ? null : "AND"}
|
|
93
92
|
</Divider>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import { useIntl } from "react-intl";
|
|
3
|
-
import
|
|
3
|
+
import { useState, use } from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import { Dropdown, Button, Grid } from "semantic-ui-react";
|
|
6
6
|
import { Controller, useFormContext } from "react-hook-form";
|
|
@@ -26,7 +26,7 @@ const isConditionExpression = (expression, functions) => {
|
|
|
26
26
|
export default function Condition({ onDelete }) {
|
|
27
27
|
const { formatMessage } = useIntl();
|
|
28
28
|
const [isShownDelete, setIsShownDelete] = useState();
|
|
29
|
-
const context =
|
|
29
|
+
const context = use(QxContext);
|
|
30
30
|
const { control, watch } = useFormContext();
|
|
31
31
|
const { field, functions } = context;
|
|
32
32
|
|
|
@@ -75,7 +75,7 @@ export default function Condition({ onDelete }) {
|
|
|
75
75
|
onMouseLeave={() => setIsShownDelete(false)}
|
|
76
76
|
>
|
|
77
77
|
{!isCondition ? (
|
|
78
|
-
<QxContext
|
|
78
|
+
<QxContext
|
|
79
79
|
value={{
|
|
80
80
|
...context,
|
|
81
81
|
field,
|
|
@@ -83,11 +83,11 @@ export default function Condition({ onDelete }) {
|
|
|
83
83
|
}}
|
|
84
84
|
>
|
|
85
85
|
<Expression onDelete={isShownDelete ? onDelete : null} deletable />
|
|
86
|
-
</QxContext
|
|
86
|
+
</QxContext>
|
|
87
87
|
) : (
|
|
88
88
|
<Grid className="condition-row">
|
|
89
89
|
<Grid.Column width={6}>
|
|
90
|
-
<QxContext
|
|
90
|
+
<QxContext
|
|
91
91
|
value={{
|
|
92
92
|
...context,
|
|
93
93
|
type: "any",
|
|
@@ -97,9 +97,8 @@ export default function Condition({ onDelete }) {
|
|
|
97
97
|
}}
|
|
98
98
|
>
|
|
99
99
|
<Expression />
|
|
100
|
-
</QxContext
|
|
100
|
+
</QxContext>
|
|
101
101
|
</Grid.Column>
|
|
102
|
-
|
|
103
102
|
<Grid.Column width={3}>
|
|
104
103
|
<div className="flex-justify-center">
|
|
105
104
|
<Controller
|
|
@@ -142,7 +141,7 @@ export default function Condition({ onDelete }) {
|
|
|
142
141
|
</Grid.Column>
|
|
143
142
|
|
|
144
143
|
<Grid.Column width={6}>
|
|
145
|
-
<QxContext
|
|
144
|
+
<QxContext
|
|
146
145
|
value={{
|
|
147
146
|
...context,
|
|
148
147
|
type: "any",
|
|
@@ -152,7 +151,7 @@ export default function Condition({ onDelete }) {
|
|
|
152
151
|
}}
|
|
153
152
|
>
|
|
154
153
|
<Expression />
|
|
155
|
-
</QxContext
|
|
154
|
+
</QxContext>
|
|
156
155
|
</Grid.Column>
|
|
157
156
|
|
|
158
157
|
<Grid.Column width={1} verticalAlign="top">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { use, useEffect } from "react";
|
|
2
2
|
import { useFormContext } from "react-hook-form";
|
|
3
3
|
import QxContext from "@truedat/qx/components/QxContext";
|
|
4
4
|
import {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./constantInputs";
|
|
9
9
|
|
|
10
10
|
export default function ConstantSelector() {
|
|
11
|
-
const { type, field } =
|
|
11
|
+
const { type, field } = use(QxContext);
|
|
12
12
|
const { setValue } = useFormContext();
|
|
13
13
|
|
|
14
14
|
useEffect(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import
|
|
2
|
+
import { use } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { useFormContext } from "react-hook-form";
|
|
5
5
|
import { Button, Grid, Icon } from "semantic-ui-react";
|
|
@@ -11,7 +11,7 @@ import FieldSelector from "./FieldSelector";
|
|
|
11
11
|
import ConstantSelector from "./ConstantSelector";
|
|
12
12
|
|
|
13
13
|
export default function Expression({ onDelete, deletable }) {
|
|
14
|
-
const { field, aggregate } =
|
|
14
|
+
const { field, aggregate } = use(QxContext);
|
|
15
15
|
const { watch } = useFormContext();
|
|
16
16
|
const shape = watch(`${field}.shape`);
|
|
17
17
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import
|
|
2
|
+
import { use, useEffect } from "react";
|
|
3
3
|
import { Controller, useFormContext } from "react-hook-form";
|
|
4
4
|
import { Dropdown, Label } from "semantic-ui-react";
|
|
5
5
|
|
|
@@ -25,7 +25,7 @@ export const fieldsToOptions = _.map((field) => ({
|
|
|
25
25
|
}));
|
|
26
26
|
|
|
27
27
|
export default function FieldSelector() {
|
|
28
|
-
const { field, type, fields } =
|
|
28
|
+
const { field, type, fields } = use(QxContext);
|
|
29
29
|
const { control, watch, setValue } = useFormContext();
|
|
30
30
|
const fieldOptions = _.flow(
|
|
31
31
|
_.filter((field) => type === "any" || field.type == type),
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import
|
|
2
|
+
import { lazy, use } from "react";
|
|
3
3
|
import { useFormContext } from "react-hook-form";
|
|
4
4
|
import { Label, Icon } from "semantic-ui-react";
|
|
5
5
|
import { typeToColor, typeToIcon } from "@truedat/qx/types";
|
|
6
6
|
import QxContext from "@truedat/qx/components/QxContext";
|
|
7
7
|
|
|
8
|
-
const Expression =
|
|
8
|
+
const Expression = lazy(() => import("./Expression"));
|
|
9
9
|
|
|
10
10
|
export default function FunctionArgs() {
|
|
11
|
-
const context =
|
|
11
|
+
const context = use(QxContext);
|
|
12
12
|
const { functions, field } = context;
|
|
13
13
|
const { watch } = useFormContext();
|
|
14
14
|
|
|
@@ -31,8 +31,7 @@ export default function FunctionArgs() {
|
|
|
31
31
|
</Label>
|
|
32
32
|
<div className="param-label-description">{description}</div>
|
|
33
33
|
</div>
|
|
34
|
-
|
|
35
|
-
<QxContext.Provider
|
|
34
|
+
<QxContext
|
|
36
35
|
value={{
|
|
37
36
|
...context,
|
|
38
37
|
type,
|
|
@@ -41,7 +40,7 @@ export default function FunctionArgs() {
|
|
|
41
40
|
}}
|
|
42
41
|
>
|
|
43
42
|
<Expression />
|
|
44
|
-
</QxContext
|
|
43
|
+
</QxContext>
|
|
45
44
|
</div>
|
|
46
45
|
</li>
|
|
47
46
|
))}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import
|
|
2
|
+
import { useState, use } from "react";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import { Controller, useFormContext } from "react-hook-form";
|
|
5
5
|
import { Dropdown, Accordion, Icon, Label, Header } from "semantic-ui-react";
|
|
@@ -10,7 +10,7 @@ import FunctionArgs from "./FunctionArgs";
|
|
|
10
10
|
export default function FunctionSelector() {
|
|
11
11
|
const { formatMessage } = useIntl();
|
|
12
12
|
const { functions, field, type, omitLogicOperators, aggregate } =
|
|
13
|
-
|
|
13
|
+
use(QxContext);
|
|
14
14
|
const { control, watch } = useFormContext();
|
|
15
15
|
|
|
16
16
|
const [collapsed, setCollapsed] = useState(false);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import
|
|
2
|
+
import { use, useEffect } from "react";
|
|
3
3
|
import { Controller, useFormContext } from "react-hook-form";
|
|
4
4
|
import { Dropdown } from "semantic-ui-react";
|
|
5
5
|
import QxContext from "@truedat/qx/components/QxContext";
|
|
6
6
|
import useWatchParams from "./useWatchParams";
|
|
7
7
|
|
|
8
8
|
export default function ParamSelector() {
|
|
9
|
-
const { field, type } =
|
|
9
|
+
const { field, type } = use(QxContext);
|
|
10
10
|
const { control, watch, setValue } = useFormContext();
|
|
11
11
|
|
|
12
12
|
const params = useWatchParams();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import
|
|
2
|
+
import { useEffect, use } from "react";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import { Controller, useFormContext } from "react-hook-form";
|
|
5
5
|
import { Dropdown } from "semantic-ui-react";
|
|
@@ -14,12 +14,7 @@ const shapeToSymbol = {
|
|
|
14
14
|
|
|
15
15
|
export default function ShapeSelector() {
|
|
16
16
|
const { formatMessage } = useIntl();
|
|
17
|
-
const {
|
|
18
|
-
fields,
|
|
19
|
-
field,
|
|
20
|
-
type,
|
|
21
|
-
defaultShape = "function",
|
|
22
|
-
} = useContext(QxContext);
|
|
17
|
+
const { fields, field, type, defaultShape = "function" } = use(QxContext);
|
|
23
18
|
const { control, watch, setValue } = useFormContext();
|
|
24
19
|
|
|
25
20
|
const params = watch("params");
|
|
@@ -35,15 +30,11 @@ export default function ShapeSelector() {
|
|
|
35
30
|
_.isEmpty
|
|
36
31
|
)(fields);
|
|
37
32
|
|
|
38
|
-
const shapes =
|
|
39
|
-
() =>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(shape === "field" && emptyTypeFields)
|
|
44
|
-
)(["constant", "function", "param", "field"]),
|
|
45
|
-
[emptyTypeParams, emptyTypeFields]
|
|
46
|
-
);
|
|
33
|
+
const shapes = _.reject(
|
|
34
|
+
(shape) =>
|
|
35
|
+
(shape === "param" && emptyTypeParams) ||
|
|
36
|
+
(shape === "field" && emptyTypeFields)
|
|
37
|
+
)(["constant", "function", "param", "field"]);
|
|
47
38
|
|
|
48
39
|
const shape = watch(`${field}.shape`);
|
|
49
40
|
|