@truedat/dq 7.10.4 → 7.11.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/package.json +3 -3
- package/src/api.js +12 -0
- package/src/components/ImplementationSearchResults.js +24 -42
- package/src/components/ImplementationUploadJobBreadcrumbs.js +25 -0
- package/src/components/Implementations.js +31 -17
- package/src/components/ImplementationsRoutes.js +9 -0
- package/src/components/ImplementationsUploadButton.js +38 -50
- package/src/components/ImplementationsUploadJob.js +217 -0
- package/src/components/ImplementationsUploadJobs.js +128 -0
- package/src/components/RuleFormImplementations.js +29 -10
- package/src/components/RuleImplementationActions.js +10 -20
- package/src/components/RuleImplementationsActions.js +15 -37
- package/src/components/RuleImplementationsDownload.js +26 -31
- package/src/components/RuleImplementationsDownloadXlsx.js +47 -0
- package/src/components/RuleImplementationsLabelResults.js +30 -39
- package/src/components/RuleImplementationsOptions.js +5 -3
- package/src/components/RuleImplementationsTable.js +7 -3
- package/src/components/RuleRoutes.js +1 -4
- package/src/components/SimpleRuleImplementationsTable.js +68 -0
- package/src/components/__tests__/ImplementationSearchResults.spec.js +32 -4
- package/src/components/__tests__/ImplementationUploadJobBreadcrumbs.spec.js +28 -0
- package/src/components/__tests__/Implementations.spec.js +43 -0
- package/src/components/__tests__/ImplementationsUploadButton.spec.js +67 -40
- package/src/components/__tests__/ImplementationsUploadJob.spec.js +112 -0
- package/src/components/__tests__/ImplementationsUploadJobs.spec.js +60 -0
- package/src/components/__tests__/RuleImplementationsActions.spec.js +71 -56
- package/src/components/__tests__/RuleImplementationsOptions.spec.js +28 -3
- package/src/components/__tests__/RuleImplementationsTable.spec.js +24 -0
- package/src/components/__tests__/__snapshots__/ImplementationSearchResults.spec.js.snap +113 -46
- package/src/components/__tests__/__snapshots__/ImplementationUploadJobBreadcrumbs.spec.js.snap +42 -0
- package/src/components/__tests__/__snapshots__/Implementations.spec.js.snap +125 -24
- package/src/components/__tests__/__snapshots__/RuleImplementationsActions.spec.js.snap +4 -8
- package/src/components/__tests__/__snapshots__/RuleImplementationsOptions.spec.js.snap +5 -8
- package/src/components/__tests__/implementationsUploadJobParser.spec.js +105 -0
- package/src/components/implementationsUploadJobParser.js +276 -0
- package/src/components/index.js +0 -2
- package/src/hooks/useImplementations.js +80 -0
- package/src/reducers/index.js +2 -0
- package/src/reducers/ruleImplementationSelectedFilter.js +1 -1
- package/src/reducers/ruleImplementationsDownloadingXlsx.js +14 -0
- package/src/routines.js +3 -0
- package/src/sagas/downloadRuleImplementationsXlsx.js +52 -0
- package/src/sagas/index.js +3 -0
- package/src/components/RuleImplementationFilters.js +0 -25
- package/src/components/RuleImplementationSelectedFilters.js +0 -99
- package/src/components/RuleImplementationsFromRuleLoader.js +0 -60
- package/src/components/RuleImplementationsPagination.js +0 -18
- package/src/components/RuleImplementationsSearch.js +0 -39
- package/src/components/__tests__/RuleImplementationsFromRuleLoader.spec.js +0 -63
- package/src/components/__tests__/RuleImplementationsSearch.spec.js +0 -29
- package/src/components/__tests__/__snapshots__/RuleImplementationsFromRuleLoader.spec.js.snap +0 -3
- package/src/components/__tests__/__snapshots__/RuleImplementationsSearch.spec.js.snap +0 -50
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import moment from "moment";
|
|
3
|
+
import {
|
|
4
|
+
Header,
|
|
5
|
+
Icon,
|
|
6
|
+
Segment,
|
|
7
|
+
Dimmer,
|
|
8
|
+
Loader,
|
|
9
|
+
Table,
|
|
10
|
+
} from "semantic-ui-react";
|
|
11
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
12
|
+
import { useNavigate } from "react-router";
|
|
13
|
+
import { useImplementationsUploadJobs } from "../hooks/useImplementations";
|
|
14
|
+
import { linkTo } from "@truedat/core/routes";
|
|
15
|
+
import { StatusPill, ResponseCell } from "./implementationsUploadJobParser";
|
|
16
|
+
|
|
17
|
+
import ImplementationUploadJobBreadcrumbs from "./ImplementationUploadJobBreadcrumbs";
|
|
18
|
+
|
|
19
|
+
export default function ImplementationsUploadJobs() {
|
|
20
|
+
const { formatMessage } = useIntl();
|
|
21
|
+
const { data, loading } = useImplementationsUploadJobs();
|
|
22
|
+
const jobs = data?.data;
|
|
23
|
+
const navigate = useNavigate();
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
<ImplementationUploadJobBreadcrumbs />
|
|
28
|
+
<Segment>
|
|
29
|
+
<Header as="h2">
|
|
30
|
+
<Icon
|
|
31
|
+
circular
|
|
32
|
+
name={formatMessage({
|
|
33
|
+
id: "implementations.bulkUpload.jobs.header.icon",
|
|
34
|
+
defaultMessage: "cogs",
|
|
35
|
+
})}
|
|
36
|
+
/>
|
|
37
|
+
<Header.Content>
|
|
38
|
+
<FormattedMessage id="implementations.bulkUpload.jobs.header" />
|
|
39
|
+
<Header.Subheader>
|
|
40
|
+
<FormattedMessage id="implementations.bulkUpload.jobs.subheader" />
|
|
41
|
+
</Header.Subheader>
|
|
42
|
+
</Header.Content>
|
|
43
|
+
</Header>
|
|
44
|
+
<Dimmer.Dimmable dimmed={loading}>
|
|
45
|
+
<Segment attached="bottom">
|
|
46
|
+
{jobs ? (
|
|
47
|
+
<Table selectable>
|
|
48
|
+
<Table.Header>
|
|
49
|
+
<Table.Row>
|
|
50
|
+
<Table.HeaderCell>
|
|
51
|
+
<FormattedMessage
|
|
52
|
+
id="implementations.bulkUpload.job.table.filename"
|
|
53
|
+
defaultMessage="Filename"
|
|
54
|
+
/>
|
|
55
|
+
</Table.HeaderCell>
|
|
56
|
+
<Table.HeaderCell>
|
|
57
|
+
<FormattedMessage
|
|
58
|
+
id="implementations.bulkUpload.job.table.status"
|
|
59
|
+
defaultMessage="Status"
|
|
60
|
+
/>
|
|
61
|
+
</Table.HeaderCell>
|
|
62
|
+
<Table.HeaderCell>
|
|
63
|
+
<FormattedMessage
|
|
64
|
+
id="implementations.bulkUpload.job.table.response"
|
|
65
|
+
defaultMessage="Response"
|
|
66
|
+
/>
|
|
67
|
+
</Table.HeaderCell>
|
|
68
|
+
<Table.HeaderCell>
|
|
69
|
+
<FormattedMessage
|
|
70
|
+
id="implementations.bulkUpload.job.table.latest_event_at"
|
|
71
|
+
defaultMessage="Latest Event"
|
|
72
|
+
/>
|
|
73
|
+
</Table.HeaderCell>
|
|
74
|
+
</Table.Row>
|
|
75
|
+
</Table.Header>
|
|
76
|
+
<Table.Body>
|
|
77
|
+
{_.isArray(jobs) && !_.isEmpty(jobs) ? (
|
|
78
|
+
jobs.map((job, idx) => (
|
|
79
|
+
<Table.Row
|
|
80
|
+
key={idx}
|
|
81
|
+
style={{ cursor: "pointer" }}
|
|
82
|
+
onClick={() =>
|
|
83
|
+
navigate(
|
|
84
|
+
linkTo.IMPLEMENTATIONS_UPLOAD_JOB({ id: job.id })
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
>
|
|
88
|
+
<Table.Cell>{job.filename}</Table.Cell>
|
|
89
|
+
<Table.Cell>
|
|
90
|
+
<StatusPill status={job.latest_status} />
|
|
91
|
+
</Table.Cell>
|
|
92
|
+
<Table.Cell>
|
|
93
|
+
<ResponseCell
|
|
94
|
+
response={job.latest_event_response}
|
|
95
|
+
status={job.latest_status}
|
|
96
|
+
/>
|
|
97
|
+
</Table.Cell>
|
|
98
|
+
<Table.Cell>
|
|
99
|
+
{job.latest_event_at
|
|
100
|
+
? moment(job.latest_event_at).fromNow()
|
|
101
|
+
: ""}
|
|
102
|
+
</Table.Cell>
|
|
103
|
+
</Table.Row>
|
|
104
|
+
))
|
|
105
|
+
) : (
|
|
106
|
+
<Table.Row>
|
|
107
|
+
<Table.Cell colSpan={5}>
|
|
108
|
+
<FormattedMessage
|
|
109
|
+
id="implementations.bulkUpload.job.table.no_jobs"
|
|
110
|
+
defaultMessage="No jobs found."
|
|
111
|
+
/>
|
|
112
|
+
</Table.Cell>
|
|
113
|
+
</Table.Row>
|
|
114
|
+
)}
|
|
115
|
+
</Table.Body>
|
|
116
|
+
</Table>
|
|
117
|
+
) : null}
|
|
118
|
+
{loading ? (
|
|
119
|
+
<Dimmer active inverted>
|
|
120
|
+
<Loader />
|
|
121
|
+
</Dimmer>
|
|
122
|
+
) : null}
|
|
123
|
+
</Segment>
|
|
124
|
+
</Dimmer.Dimmable>
|
|
125
|
+
</Segment>
|
|
126
|
+
</>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
@@ -3,21 +3,40 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import { connect } from "react-redux";
|
|
4
4
|
import { Container } from "semantic-ui-react";
|
|
5
5
|
import { getLinkedImplementationsToRulesColumns } from "../selectors";
|
|
6
|
+
import {
|
|
7
|
+
useRuleImplementationSearch,
|
|
8
|
+
useRuleImplementationFilters,
|
|
9
|
+
} from "../hooks/useImplementations";
|
|
6
10
|
import RuleImplementationsTable from "./RuleImplementationsTable";
|
|
7
11
|
import RuleImplementationActions from "./RuleImplementationActions";
|
|
12
|
+
import { SearchContextProvider } from "@truedat/core/search/SearchContext";
|
|
8
13
|
|
|
9
|
-
export const RuleFormImplementations = ({ rule, columns }) =>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
export const RuleFormImplementations = ({ rule, columns }) => {
|
|
15
|
+
const searchProps = {
|
|
16
|
+
initialSortColumn: "implementation_key.raw",
|
|
17
|
+
initialSortDirection: "ascending",
|
|
18
|
+
useSearch: useRuleImplementationSearch,
|
|
19
|
+
useFilters: useRuleImplementationFilters,
|
|
20
|
+
pageSize: 20,
|
|
21
|
+
defaultFilters: {
|
|
22
|
+
rule_id: rule?.id,
|
|
23
|
+
"mustnot.status": ["versioned"],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return _.isEmpty(rule) ? null : (
|
|
28
|
+
<SearchContextProvider {...searchProps}>
|
|
29
|
+
<Container fluid>
|
|
30
|
+
<div className="inline">
|
|
31
|
+
<div className="implementation-actions">
|
|
32
|
+
<RuleImplementationActions />
|
|
33
|
+
</div>
|
|
15
34
|
</div>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
</
|
|
35
|
+
<RuleImplementationsTable columns={columns} />
|
|
36
|
+
</Container>
|
|
37
|
+
</SearchContextProvider>
|
|
19
38
|
);
|
|
20
|
-
|
|
39
|
+
};
|
|
21
40
|
const mapStateToProps = ({ rule, ...state }) => ({
|
|
22
41
|
rule,
|
|
23
42
|
columns: getLinkedImplementationsToRulesColumns(state),
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import { useIntl } from "react-intl";
|
|
3
|
-
import { connect } from "react-redux";
|
|
4
2
|
import { Link } from "react-router";
|
|
5
3
|
import { useParams } from "react-router";
|
|
6
4
|
import { Button } from "semantic-ui-react";
|
|
7
5
|
import { linkTo } from "@truedat/core/routes";
|
|
6
|
+
import { useSearchContext } from "@truedat/core/search/SearchContext";
|
|
8
7
|
|
|
9
|
-
const RuleImplementationActions = ({
|
|
10
|
-
canCreate,
|
|
11
|
-
canCreateRaw,
|
|
12
|
-
canCreateBasic,
|
|
13
|
-
}) => {
|
|
8
|
+
const RuleImplementationActions = () => {
|
|
14
9
|
const { formatMessage } = useIntl();
|
|
15
10
|
const params = useParams();
|
|
11
|
+
const { searchData } = useSearchContext();
|
|
12
|
+
|
|
13
|
+
const implementationActions = searchData?._actions;
|
|
14
|
+
const canCreate = !!implementationActions?.create;
|
|
15
|
+
const canCreateRaw = !!implementationActions?.createRaw;
|
|
16
|
+
const canCreateBasic = !!implementationActions?.createBasic;
|
|
17
|
+
|
|
16
18
|
return (
|
|
17
19
|
<>
|
|
18
20
|
{canCreateBasic && (
|
|
@@ -46,16 +48,4 @@ const RuleImplementationActions = ({
|
|
|
46
48
|
);
|
|
47
49
|
};
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
canCreate: PropTypes.bool,
|
|
51
|
-
canCreateRaw: PropTypes.bool,
|
|
52
|
-
canCreateBasic: PropTypes.bool,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const mapStateToProps = ({ implementationActions }) => ({
|
|
56
|
-
canCreate: !!implementationActions?.create,
|
|
57
|
-
canCreateRaw: !!implementationActions?.createRaw,
|
|
58
|
-
canCreateBasic: !!implementationActions?.createBasic,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
export default connect(mapStateToProps)(RuleImplementationActions);
|
|
51
|
+
export default RuleImplementationActions;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { connect } from "react-redux";
|
|
4
3
|
import { Button, Checkbox } from "semantic-ui-react";
|
|
5
4
|
import { Link } from "react-router";
|
|
6
5
|
import { useIntl } from "react-intl";
|
|
@@ -8,31 +7,32 @@ import {
|
|
|
8
7
|
IMPLEMENTATION_NEW,
|
|
9
8
|
IMPLEMENTATION_NEW_RAW,
|
|
10
9
|
} from "@truedat/core/routes";
|
|
11
|
-
import {
|
|
10
|
+
import { useSearchContext } from "@truedat/core/search/SearchContext";
|
|
12
11
|
import {
|
|
13
12
|
addImplementationFilter,
|
|
14
13
|
toggleImplementationFilterValue,
|
|
15
14
|
removeImplementationFilter,
|
|
16
|
-
createExecutionGroup,
|
|
17
15
|
} from "../routines";
|
|
18
16
|
import ExecutionPopup from "./ExecutionPopup";
|
|
19
17
|
import RuleImplementationsOptions from "./RuleImplementationsOptions";
|
|
20
18
|
|
|
21
19
|
export const RuleImplementationsActions = ({
|
|
22
|
-
actions,
|
|
23
|
-
addImplementationFilter,
|
|
24
|
-
createExecutionGroup,
|
|
25
20
|
executeImplementationsOn,
|
|
26
|
-
implementationQuery,
|
|
27
|
-
implementationsExecution,
|
|
28
|
-
removeImplementationFilter,
|
|
29
|
-
ruleImplementationCount,
|
|
30
|
-
ruleImplementationsLoading,
|
|
31
21
|
selectedImplementations,
|
|
32
22
|
setMode,
|
|
33
|
-
toggleImplementationFilterValue,
|
|
34
23
|
}) => {
|
|
35
24
|
const { formatMessage } = useIntl();
|
|
25
|
+
const {
|
|
26
|
+
searchData,
|
|
27
|
+
count: ruleImplementationCount,
|
|
28
|
+
loading: ruleImplementationsLoading,
|
|
29
|
+
filterParams: implementationQuery,
|
|
30
|
+
} = useSearchContext();
|
|
31
|
+
|
|
32
|
+
const actions = searchData?._actions;
|
|
33
|
+
const canUploadResults = !!actions?.uploadResults;
|
|
34
|
+
const canExecute = !!actions?.execute;
|
|
35
|
+
|
|
36
36
|
const showExecutableInfo = () => {
|
|
37
37
|
addImplementationFilter({ filter: "executable" });
|
|
38
38
|
toggleImplementationFilterValue({
|
|
@@ -52,15 +52,14 @@ export const RuleImplementationsActions = ({
|
|
|
52
52
|
|
|
53
53
|
const handleSubmit = (df_content) => {
|
|
54
54
|
const query = _.isEmpty(selectedImplementations)
|
|
55
|
-
? implementationQuery
|
|
55
|
+
? _.omit(["sort", "page", "size"])(implementationQuery)
|
|
56
56
|
: { filters: { id: selectedImplementations } };
|
|
57
57
|
createExecutionGroup({ ...query, df_content });
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
const canUploadResults = !!actions?.uploadResults;
|
|
61
60
|
return (
|
|
62
61
|
<div style={{ float: "right" }}>
|
|
63
|
-
{
|
|
62
|
+
{canExecute ? (
|
|
64
63
|
<>
|
|
65
64
|
<Checkbox
|
|
66
65
|
id="execute_checkbox"
|
|
@@ -108,30 +107,9 @@ export const RuleImplementationsActions = ({
|
|
|
108
107
|
};
|
|
109
108
|
|
|
110
109
|
RuleImplementationsActions.propTypes = {
|
|
111
|
-
actions: PropTypes.object,
|
|
112
|
-
addImplementationFilter: PropTypes.func,
|
|
113
|
-
createExecutionGroup: PropTypes.func,
|
|
114
110
|
executeImplementationsOn: PropTypes.bool,
|
|
115
|
-
implementationQuery: PropTypes.object,
|
|
116
|
-
implementationsExecution: PropTypes.bool,
|
|
117
|
-
removeImplementationFilter: PropTypes.func,
|
|
118
|
-
ruleImplementationCount: PropTypes.number,
|
|
119
|
-
ruleImplementationsLoading: PropTypes.bool,
|
|
120
111
|
selectedImplementations: PropTypes.array,
|
|
121
112
|
setMode: PropTypes.func,
|
|
122
|
-
toggleImplementationFilterValue: PropTypes.func,
|
|
123
113
|
};
|
|
124
114
|
|
|
125
|
-
|
|
126
|
-
ruleImplementationCount: state.ruleImplementationCount,
|
|
127
|
-
implementationsExecution: getImplementationsExecution(state),
|
|
128
|
-
ruleImplementationsLoading: state.ruleImplementationsLoading,
|
|
129
|
-
actions: state.implementationsActions,
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
export default connect(mapStateToProps, {
|
|
133
|
-
addImplementationFilter,
|
|
134
|
-
toggleImplementationFilterValue,
|
|
135
|
-
removeImplementationFilter,
|
|
136
|
-
createExecutionGroup,
|
|
137
|
-
})(RuleImplementationsActions);
|
|
115
|
+
export default RuleImplementationsActions;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import
|
|
3
|
-
import { connect } from "react-redux";
|
|
2
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
4
3
|
import { Dropdown } from "semantic-ui-react";
|
|
5
4
|
import { useIntl } from "react-intl";
|
|
5
|
+
import { useSearchContext } from "@truedat/core/search/SearchContext";
|
|
6
6
|
import { downloadImplementations } from "../routines";
|
|
7
7
|
|
|
8
8
|
const staticHeaderLabels = [
|
|
@@ -35,12 +35,18 @@ const staticContentLabels = [
|
|
|
35
35
|
"executable.false",
|
|
36
36
|
];
|
|
37
37
|
|
|
38
|
-
export const RuleImplementationsDownload = ({
|
|
39
|
-
|
|
40
|
-
ruleImplementationsDownloading,
|
|
41
|
-
ruleImplementations,
|
|
42
|
-
}) => {
|
|
38
|
+
export const RuleImplementationsDownload = () => {
|
|
39
|
+
const dispatch = useDispatch();
|
|
43
40
|
const { formatMessage, locale } = useIntl();
|
|
41
|
+
const ruleImplementationsDownloading = useSelector(
|
|
42
|
+
(state) => state.ruleImplementationsDownloading
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const {
|
|
46
|
+
loading: ruleImplementationsLoading,
|
|
47
|
+
filterParams: searchParams,
|
|
48
|
+
searchData,
|
|
49
|
+
} = useSearchContext();
|
|
44
50
|
|
|
45
51
|
const headerLabels = _.flow(
|
|
46
52
|
_.map((l) => [l, formatMessage({ id: `ruleImplementations.props.${l}` })]),
|
|
@@ -52,9 +58,9 @@ export const RuleImplementationsDownload = ({
|
|
|
52
58
|
_.fromPairs
|
|
53
59
|
)(staticContentLabels);
|
|
54
60
|
|
|
55
|
-
const
|
|
61
|
+
const isEmpty = _.isEmpty(searchData?.data);
|
|
56
62
|
|
|
57
|
-
return (
|
|
63
|
+
return !ruleImplementationsLoading && !isEmpty ? (
|
|
58
64
|
<Dropdown.Item
|
|
59
65
|
icon="download"
|
|
60
66
|
content={
|
|
@@ -62,32 +68,21 @@ export const RuleImplementationsDownload = ({
|
|
|
62
68
|
<span>
|
|
63
69
|
{formatMessage({ id: "implementations.actions.download.tooltip" })}
|
|
64
70
|
</span>
|
|
65
|
-
{isDisabled && (
|
|
66
|
-
<p className="menu-item-description">
|
|
67
|
-
{formatMessage({ id: "implementations.actions.download.empty" })}
|
|
68
|
-
</p>
|
|
69
|
-
)}
|
|
70
71
|
</>
|
|
71
72
|
}
|
|
72
73
|
onClick={() =>
|
|
73
|
-
|
|
74
|
+
dispatch(
|
|
75
|
+
downloadImplementations({
|
|
76
|
+
contentLabels,
|
|
77
|
+
headerLabels,
|
|
78
|
+
searchParams,
|
|
79
|
+
lang: locale,
|
|
80
|
+
})
|
|
81
|
+
)
|
|
74
82
|
}
|
|
75
|
-
disabled={
|
|
83
|
+
disabled={ruleImplementationsDownloading}
|
|
76
84
|
/>
|
|
77
|
-
);
|
|
85
|
+
) : null;
|
|
78
86
|
};
|
|
79
87
|
|
|
80
|
-
|
|
81
|
-
downloadImplementations: PropTypes.func,
|
|
82
|
-
ruleImplementationsDownloading: PropTypes.bool,
|
|
83
|
-
ruleImplementations: PropTypes.array,
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const mapStateToProps = _.pick([
|
|
87
|
-
"ruleImplementationsDownloading",
|
|
88
|
-
"ruleImplementations",
|
|
89
|
-
]);
|
|
90
|
-
|
|
91
|
-
export default connect(mapStateToProps, {
|
|
92
|
-
downloadImplementations,
|
|
93
|
-
})(RuleImplementationsDownload);
|
|
88
|
+
export default RuleImplementationsDownload;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Dropdown } from "semantic-ui-react";
|
|
4
|
+
import { useIntl } from "react-intl";
|
|
5
|
+
import { useSearchContext } from "@truedat/core/search/SearchContext";
|
|
6
|
+
import { useImplementationsDownload } from "../hooks/useImplementations";
|
|
7
|
+
|
|
8
|
+
export const RuleImplementationsDownloadXlsx = () => {
|
|
9
|
+
const { formatMessage, locale } = useIntl();
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
loading: ruleImplementationsLoading,
|
|
13
|
+
filterParams: searchParams,
|
|
14
|
+
searchData,
|
|
15
|
+
} = useSearchContext();
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
trigger: triggerDownload,
|
|
19
|
+
isMutating: ruleImplementationsDownloading,
|
|
20
|
+
} = useImplementationsDownload();
|
|
21
|
+
|
|
22
|
+
const isEmpty = _.isEmpty(searchData?.data);
|
|
23
|
+
|
|
24
|
+
return !ruleImplementationsLoading && !isEmpty ? (
|
|
25
|
+
<Dropdown.Item
|
|
26
|
+
icon="download"
|
|
27
|
+
content={
|
|
28
|
+
<>
|
|
29
|
+
<span>
|
|
30
|
+
{formatMessage({
|
|
31
|
+
id: "implementations.actions.downloadXlsx.tooltip",
|
|
32
|
+
})}
|
|
33
|
+
</span>
|
|
34
|
+
</>
|
|
35
|
+
}
|
|
36
|
+
onClick={() =>
|
|
37
|
+
triggerDownload({
|
|
38
|
+
...searchParams,
|
|
39
|
+
lang: locale,
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
disabled={ruleImplementationsDownloading}
|
|
43
|
+
/>
|
|
44
|
+
) : null;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default RuleImplementationsDownloadXlsx;
|
|
@@ -1,54 +1,45 @@
|
|
|
1
1
|
import PropTypes from "prop-types";
|
|
2
|
-
import { connect } from "react-redux";
|
|
3
2
|
import { FormattedMessage } from "react-intl";
|
|
4
3
|
import { Label } from "semantic-ui-react";
|
|
4
|
+
import { useSearchContext } from "@truedat/core/search/SearchContext";
|
|
5
5
|
|
|
6
6
|
export const RuleImplementationsLabelResults = ({
|
|
7
7
|
executeImplementationsOn,
|
|
8
8
|
implementationsToExecute,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<Label className="rules-label-results">
|
|
14
|
-
{ruleImplementationsLoading ? (
|
|
15
|
-
<FormattedMessage id="ruleImplementations.searching" />
|
|
16
|
-
) : (
|
|
17
|
-
<FormattedMessage
|
|
18
|
-
id="ruleImplementations.retrieved.results"
|
|
19
|
-
values={{ count: ruleImplementationCount }}
|
|
20
|
-
/>
|
|
21
|
-
)}
|
|
22
|
-
</Label>
|
|
23
|
-
{!ruleImplementationsLoading && executeImplementationsOn && (
|
|
9
|
+
}) => {
|
|
10
|
+
const { loading, count } = useSearchContext();
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
24
13
|
<Label className="rules-label-results">
|
|
25
|
-
|
|
26
|
-
id="
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/>
|
|
14
|
+
{loading ? (
|
|
15
|
+
<FormattedMessage id="ruleImplementations.searching" />
|
|
16
|
+
) : (
|
|
17
|
+
<FormattedMessage
|
|
18
|
+
id="ruleImplementations.retrieved.results"
|
|
19
|
+
values={{ count }}
|
|
20
|
+
/>
|
|
21
|
+
)}
|
|
34
22
|
</Label>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
{!loading && executeImplementationsOn && (
|
|
24
|
+
<Label className="rules-label-results">
|
|
25
|
+
<FormattedMessage
|
|
26
|
+
id="implementations.execute.filtered"
|
|
27
|
+
values={{
|
|
28
|
+
count:
|
|
29
|
+
implementationsToExecute == 0
|
|
30
|
+
? count
|
|
31
|
+
: implementationsToExecute,
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
</Label>
|
|
35
|
+
)}
|
|
36
|
+
</>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
38
39
|
|
|
39
40
|
RuleImplementationsLabelResults.propTypes = {
|
|
40
41
|
executeImplementationsOn: PropTypes.bool,
|
|
41
42
|
implementationsToExecute: PropTypes.number,
|
|
42
|
-
ruleImplementationCount: PropTypes.number,
|
|
43
|
-
ruleImplementationsLoading: PropTypes.bool,
|
|
44
43
|
};
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
ruleImplementationCount,
|
|
48
|
-
ruleImplementationsLoading,
|
|
49
|
-
}) => ({
|
|
50
|
-
ruleImplementationCount,
|
|
51
|
-
ruleImplementationsLoading,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
export default connect(mapStateToProps)(RuleImplementationsLabelResults);
|
|
45
|
+
export default RuleImplementationsLabelResults;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
1
2
|
import PropTypes from "prop-types";
|
|
2
3
|
import { Dropdown } from "semantic-ui-react";
|
|
3
4
|
import { useIntl } from "react-intl";
|
|
4
5
|
import { Link } from "react-router";
|
|
5
6
|
import { IMPLEMENTATION_NEW_BASIC } from "@truedat/core/routes";
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
import RuleImplementationsDownloadXlsx from "./RuleImplementationsDownloadXlsx";
|
|
7
9
|
import RuleResultsUpload from "./RuleResultsUpload";
|
|
8
10
|
import ImplementationsUploadButton from "./ImplementationsUploadButton";
|
|
9
11
|
|
|
10
12
|
export const RuleImplementationsOptions = ({
|
|
11
|
-
loading,
|
|
12
13
|
canUploadResults,
|
|
13
14
|
canCreateBasicImplementations,
|
|
14
15
|
}) => {
|
|
16
|
+
const [loading, setDownloading] = useState(false);
|
|
15
17
|
const { formatMessage } = useIntl();
|
|
16
18
|
return (
|
|
17
19
|
<Dropdown
|
|
@@ -34,7 +36,7 @@ export const RuleImplementationsOptions = ({
|
|
|
34
36
|
onClick={(e) => e.stopPropagation()}
|
|
35
37
|
/>
|
|
36
38
|
) : null}
|
|
37
|
-
<
|
|
39
|
+
<RuleImplementationsDownloadXlsx setDownloading={setDownloading} />
|
|
38
40
|
<ImplementationsUploadButton />
|
|
39
41
|
{canUploadResults ? <RuleResultsUpload /> : null}
|
|
40
42
|
</Dropdown.Menu>
|
|
@@ -5,9 +5,9 @@ import { connect } from "react-redux";
|
|
|
5
5
|
import { getSortInfo, sortColumn } from "@truedat/core/services/sort";
|
|
6
6
|
import { Checkbox, Table, Header, Icon } from "semantic-ui-react";
|
|
7
7
|
import { useIntl } from "react-intl";
|
|
8
|
+
import { useSearchContext } from "@truedat/core/search/SearchContext";
|
|
8
9
|
import { sortImplementations } from "../routines";
|
|
9
10
|
import RuleImplementationRow from "./RuleImplementationRow";
|
|
10
|
-
|
|
11
11
|
export const RuleImplementationsTable = ({
|
|
12
12
|
addAll,
|
|
13
13
|
checkedAll,
|
|
@@ -16,18 +16,23 @@ export const RuleImplementationsTable = ({
|
|
|
16
16
|
implementationsSort,
|
|
17
17
|
sortImplementations,
|
|
18
18
|
columns,
|
|
19
|
-
ruleImplementations,
|
|
20
19
|
ruleImplementationsLoading,
|
|
21
20
|
isRowChecked,
|
|
22
21
|
}) => {
|
|
22
|
+
const { searchData } = useSearchContext();
|
|
23
|
+
|
|
23
24
|
const { formatMessage } = useIntl();
|
|
25
|
+
|
|
24
26
|
const [sortedColumn, setColumn] = useState(
|
|
25
27
|
_.prop("column")(getSortInfo(implementationsSort))
|
|
26
28
|
);
|
|
29
|
+
|
|
27
30
|
const [direction, setDirection] = useState(
|
|
28
31
|
_.prop("direction")(getSortInfo(implementationsSort))
|
|
29
32
|
);
|
|
30
33
|
|
|
34
|
+
const ruleImplementations = searchData?.data;
|
|
35
|
+
|
|
31
36
|
const validColumns = _.reject(
|
|
32
37
|
({ hideOn }) => _.isFunction(hideOn) && hideOn(ruleImplementations)
|
|
33
38
|
)(columns);
|
|
@@ -126,7 +131,6 @@ RuleImplementationsTable.propTypes = {
|
|
|
126
131
|
sortImplementations: PropTypes.func,
|
|
127
132
|
ruleImplementations: PropTypes.array,
|
|
128
133
|
columns: PropTypes.array,
|
|
129
|
-
implementationContext: PropTypes.string,
|
|
130
134
|
};
|
|
131
135
|
|
|
132
136
|
const mapStateToProps = (state, props) => ({
|
|
@@ -5,7 +5,7 @@ import { Routes, Route } from "react-router";
|
|
|
5
5
|
import { useParams } from "react-router";
|
|
6
6
|
import { connect } from "react-redux";
|
|
7
7
|
import { Segment } from "semantic-ui-react";
|
|
8
|
-
import {
|
|
8
|
+
import { Loader } from "@truedat/core/router";
|
|
9
9
|
import {
|
|
10
10
|
RULE,
|
|
11
11
|
RULE_EDIT,
|
|
@@ -24,7 +24,6 @@ import Rule from "./Rule";
|
|
|
24
24
|
import RuleCrumbs from "./RuleCrumbs";
|
|
25
25
|
import RuleEvents from "./RuleEvents";
|
|
26
26
|
import RuleFormImplementations from "./RuleFormImplementations";
|
|
27
|
-
import RuleImplementationsFromRuleLoader from "./RuleImplementationsFromRuleLoader";
|
|
28
27
|
import RuleLoader from "./RuleLoader";
|
|
29
28
|
import RuleProperties from "./RuleProperties";
|
|
30
29
|
import RuleSubscriptionLoader from "./RuleSubscriptionLoader";
|
|
@@ -67,7 +66,6 @@ export const RuleRoutes = ({
|
|
|
67
66
|
<>
|
|
68
67
|
<RuleSubscriptionLoader />
|
|
69
68
|
<QualityTemplatesLoader />
|
|
70
|
-
<RuleImplementationsFromRuleLoader />
|
|
71
69
|
</>
|
|
72
70
|
}
|
|
73
71
|
/>
|
|
@@ -108,7 +106,6 @@ export const RuleRoutes = ({
|
|
|
108
106
|
loaders={
|
|
109
107
|
<>
|
|
110
108
|
<RuleSubscriptionLoader />
|
|
111
|
-
<RuleImplementationsFromRuleLoader />
|
|
112
109
|
</>
|
|
113
110
|
}
|
|
114
111
|
/>
|