@truedat/bg 7.0.4 → 7.0.6
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 +6 -6
- package/src/concepts/components/DomainConcepts.js +1 -4
- package/src/concepts/components/__tests__/__snapshots__/ConceptForm.spec.js.snap +2 -2
- package/src/concepts/components/__tests__/__snapshots__/ConceptsBulkUpdate.spec.js.snap +2 -2
- package/src/concepts/components/__tests__/__snapshots__/SharedToForm.spec.js.snap +2 -2
- package/src/hooks/useDomains.js +77 -0
- package/src/messages/en.js +6 -0
- package/src/messages/es.js +5 -0
- package/src/reducers/index.js +0 -1
- package/src/taxonomy/components/AddDomainMember.js +1 -7
- package/src/taxonomy/components/Domain.js +80 -84
- package/src/taxonomy/components/DomainActions.js +57 -84
- package/src/taxonomy/components/DomainCrumbs.js +51 -43
- package/src/taxonomy/components/DomainDetail.js +88 -46
- package/src/taxonomy/components/DomainForm.js +34 -36
- package/src/taxonomy/components/DomainImplementations.js +1 -4
- package/src/taxonomy/components/DomainMembers.js +8 -1
- package/src/taxonomy/components/DomainRoutes.js +8 -55
- package/src/taxonomy/components/DomainStructures.js +1 -4
- package/src/taxonomy/components/DomainTabs.js +22 -29
- package/src/taxonomy/components/Domains.js +66 -27
- package/src/taxonomy/components/DomainsActions.js +5 -14
- package/src/taxonomy/components/EditDomain.js +35 -21
- package/src/taxonomy/components/NewDomain.js +47 -22
- package/src/taxonomy/components/__tests__/Domain.spec.js +17 -8
- package/src/taxonomy/components/__tests__/DomainActions.spec.js +62 -7
- package/src/taxonomy/components/__tests__/DomainCrumbs.spec.js +18 -5
- package/src/taxonomy/components/__tests__/DomainDetail.spec.js +87 -4
- package/src/taxonomy/components/__tests__/DomainForm.spec.js +189 -4
- package/src/taxonomy/components/__tests__/DomainMembers.spec.js +1 -3
- package/src/taxonomy/components/__tests__/DomainStructures.spec.js +3 -2
- package/src/taxonomy/components/__tests__/Domains.spec.js +103 -6
- package/src/taxonomy/components/__tests__/EditDomain.spec.js +56 -5
- package/src/taxonomy/components/__tests__/NewDomain.spec.js +65 -6
- package/src/taxonomy/components/__tests__/__snapshots__/AddDomainMember.spec.js.snap +0 -10
- package/src/taxonomy/components/__tests__/__snapshots__/Domain.spec.js.snap +35 -48
- package/src/taxonomy/components/__tests__/__snapshots__/DomainActions.spec.js.snap +56 -1
- package/src/taxonomy/components/__tests__/__snapshots__/DomainCrumbs.spec.js.snap +14 -2
- package/src/taxonomy/components/__tests__/__snapshots__/DomainDetail.spec.js.snap +93 -40
- package/src/taxonomy/components/__tests__/__snapshots__/DomainForm.spec.js.snap +7 -7
- package/src/taxonomy/components/__tests__/__snapshots__/Domains.spec.js.snap +75 -10
- package/src/taxonomy/components/__tests__/__snapshots__/DomainsActions.spec.js.snap +20 -1
- package/src/taxonomy/components/__tests__/__snapshots__/EditDomain.spec.js.snap +192 -30
- package/src/taxonomy/components/__tests__/__snapshots__/NewDomain.spec.js.snap +405 -28
- package/src/taxonomy/components/index.js +1 -2
- package/src/taxonomy/index.js +0 -1
- package/src/taxonomy/routines.js +0 -10
- package/src/taxonomy/sagas/index.js +2 -21
- package/src/taxonomy/selectors/getDomainsConcept.js +0 -13
- package/src/taxonomy/selectors/index.js +0 -16
- package/src/taxonomy/components/DomainCards.js +0 -97
- package/src/taxonomy/components/DomainLoader.js +0 -60
- package/src/taxonomy/components/DomainMembersLoader.js +0 -44
- package/src/taxonomy/components/DomainsLoader.js +0 -40
- package/src/taxonomy/components/__tests__/DomainCards.spec.js +0 -30
- package/src/taxonomy/components/__tests__/DomainsLoader.spec.js +0 -38
- package/src/taxonomy/components/__tests__/__snapshots__/DomainCards.spec.js.snap +0 -160
- package/src/taxonomy/reducers/__tests__/domain.spec.js +0 -58
- package/src/taxonomy/reducers/__tests__/domainConceptLoading.spec.js +0 -26
- package/src/taxonomy/reducers/__tests__/domainCreating.spec.js +0 -24
- package/src/taxonomy/reducers/__tests__/domainLoading.spec.js +0 -22
- package/src/taxonomy/reducers/__tests__/domainMembersActions.spec.js +0 -38
- package/src/taxonomy/reducers/__tests__/domainMembersLoading.spec.js +0 -26
- package/src/taxonomy/reducers/__tests__/domainRedirect.spec.js +0 -36
- package/src/taxonomy/reducers/__tests__/domainUpdating.spec.js +0 -24
- package/src/taxonomy/reducers/__tests__/domains.spec.js +0 -30
- package/src/taxonomy/reducers/__tests__/domainsActions.spec.js +0 -36
- package/src/taxonomy/reducers/__tests__/domainsConcept.spec.js +0 -30
- package/src/taxonomy/reducers/__tests__/domainsFilter.spec.js +0 -41
- package/src/taxonomy/reducers/__tests__/domainsLoading.spec.js +0 -22
- package/src/taxonomy/reducers/domain.js +0 -32
- package/src/taxonomy/reducers/domainActions.js +0 -19
- package/src/taxonomy/reducers/domainCreating.js +0 -14
- package/src/taxonomy/reducers/domainLoading.js +0 -14
- package/src/taxonomy/reducers/domainMembersActions.js +0 -22
- package/src/taxonomy/reducers/domainMembersLoading.js +0 -12
- package/src/taxonomy/reducers/domainRedirect.js +0 -25
- package/src/taxonomy/reducers/domainUpdating.js +0 -14
- package/src/taxonomy/reducers/domains.js +0 -19
- package/src/taxonomy/reducers/domainsActions.js +0 -20
- package/src/taxonomy/reducers/domainsConcept.js +0 -19
- package/src/taxonomy/reducers/domainsConceptLoading.js +0 -12
- package/src/taxonomy/reducers/domainsFilter.js +0 -24
- package/src/taxonomy/reducers/domainsLoading.js +0 -12
- package/src/taxonomy/reducers/index.js +0 -31
- package/src/taxonomy/sagas/__tests__/fetchDomain.spec.js +0 -69
- package/src/taxonomy/sagas/__tests__/fetchDomains.spec.js +0 -90
- package/src/taxonomy/sagas/createDomain.js +0 -27
- package/src/taxonomy/sagas/deleteDomain.js +0 -34
- package/src/taxonomy/sagas/fetchDomain.js +0 -30
- package/src/taxonomy/sagas/fetchDomains.js +0 -37
- package/src/taxonomy/sagas/updateDomain.js +0 -30
- package/src/taxonomy/selectors/__tests__/domainParentOptionsSelector.spec.js +0 -24
- package/src/taxonomy/selectors/__tests__/getDomainActions.spec.js +0 -46
- package/src/taxonomy/selectors/__tests__/getDomainGroups.spec.js +0 -17
- package/src/taxonomy/selectors/__tests__/getDomainTypes.spec.js +0 -14
- package/src/taxonomy/selectors/domainParentOptionsSelector.js +0 -12
- package/src/taxonomy/selectors/getDomainActions.js +0 -32
- package/src/taxonomy/selectors/getDomainGroups.js +0 -11
|
@@ -1,57 +1,65 @@
|
|
|
1
1
|
import React, { Fragment } from "react";
|
|
2
2
|
import { Link } from "react-router-dom";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { connect } from "react-redux";
|
|
5
4
|
import { Breadcrumb } from "semantic-ui-react";
|
|
6
5
|
import { FormattedMessage } from "react-intl";
|
|
7
6
|
import { DOMAINS, linkTo } from "@truedat/core/routes";
|
|
8
|
-
import {
|
|
7
|
+
import { ascendants } from "@truedat/core/services/tree";
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
import { useDomains } from "../../hooks/useDomains";
|
|
10
|
+
|
|
11
|
+
export const DomainCrumbs = ({ domain, actionCrumb }) => {
|
|
12
|
+
const { data: domains } = useDomains();
|
|
13
|
+
|
|
14
|
+
const ancestorsAndDomainIds = domain
|
|
15
|
+
? ascendants(domain?.id, domains)
|
|
16
|
+
: undefined;
|
|
17
|
+
return (
|
|
18
|
+
<Breadcrumb>
|
|
19
|
+
<Breadcrumb.Section as={Link} to={DOMAINS} active={!domain}>
|
|
20
|
+
<FormattedMessage id="navigation.glossary.taxonomy" />
|
|
21
|
+
</Breadcrumb.Section>
|
|
22
|
+
{ancestorsAndDomainIds
|
|
23
|
+
? ancestorsAndDomainIds.slice(0, -1).map((p, i) => (
|
|
24
|
+
<Fragment key={i}>
|
|
25
|
+
<Breadcrumb.Divider icon="right angle" />
|
|
26
|
+
<Breadcrumb.Section
|
|
27
|
+
key={i}
|
|
28
|
+
as={Link}
|
|
29
|
+
to={linkTo.DOMAIN({ id: parseInt(p) })}
|
|
30
|
+
>
|
|
31
|
+
{domains.find((d) => d.id === parseInt(p)).name}
|
|
32
|
+
</Breadcrumb.Section>
|
|
33
|
+
</Fragment>
|
|
34
|
+
))
|
|
35
|
+
: null}
|
|
36
|
+
{domain ? (
|
|
37
|
+
<>
|
|
38
|
+
<Breadcrumb.Divider icon="right angle" />
|
|
39
|
+
{actionCrumb ? (
|
|
40
|
+
<Breadcrumb.Section as={Link} to={linkTo.DOMAIN({ id: domain.id })}>
|
|
41
|
+
{domain.name}
|
|
42
|
+
</Breadcrumb.Section>
|
|
43
|
+
) : (
|
|
44
|
+
<Breadcrumb.Section active>{domain.name}</Breadcrumb.Section>
|
|
45
|
+
)}
|
|
46
|
+
</>
|
|
47
|
+
) : null}
|
|
48
|
+
{actionCrumb ? (
|
|
49
|
+
<>
|
|
50
|
+
<Breadcrumb.Divider icon="right angle" />
|
|
51
|
+
<Breadcrumb.Section active>
|
|
52
|
+
<FormattedMessage id={actionCrumb} />
|
|
29
53
|
</Breadcrumb.Section>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{actionCrumb && (
|
|
36
|
-
<>
|
|
37
|
-
<Breadcrumb.Divider icon="right angle" />
|
|
38
|
-
<Breadcrumb.Section active>
|
|
39
|
-
<FormattedMessage id={actionCrumb} />
|
|
40
|
-
</Breadcrumb.Section>
|
|
41
|
-
</>
|
|
42
|
-
)}
|
|
43
|
-
</Breadcrumb>
|
|
44
|
-
);
|
|
54
|
+
</>
|
|
55
|
+
) : null}
|
|
56
|
+
</Breadcrumb>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
45
59
|
|
|
46
60
|
DomainCrumbs.propTypes = {
|
|
47
61
|
actionCrumb: PropTypes.string,
|
|
48
62
|
domain: PropTypes.object,
|
|
49
|
-
parents: PropTypes.array,
|
|
50
63
|
};
|
|
51
64
|
|
|
52
|
-
|
|
53
|
-
domain: state.domain,
|
|
54
|
-
parents: getAncestorDomains(state),
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
export default connect(mapStateToProps)(DomainCrumbs);
|
|
65
|
+
export default DomainCrumbs;
|
|
@@ -1,63 +1,105 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { Icon,
|
|
5
|
-
import {
|
|
6
|
-
import { FormattedMessage } from "react-intl";
|
|
4
|
+
import { Icon, Header, Grid, GridRow } from "semantic-ui-react";
|
|
5
|
+
import { useHistory } from "react-router-dom";
|
|
6
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
7
7
|
import { linkTo } from "@truedat/core/routes";
|
|
8
|
+
import { DOMAINS_QUERY } from "@truedat/core/api/queries";
|
|
9
|
+
import { useQuery } from "@apollo/client";
|
|
10
|
+
import { useDomain, useDomainDelete } from "../../hooks/useDomains";
|
|
8
11
|
|
|
9
12
|
import DomainActions from "./DomainActions";
|
|
10
13
|
|
|
11
|
-
export const DomainDetail = ({
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
export const DomainDetail = ({ id }) => {
|
|
15
|
+
const { data: domain, actions: domainAllActions, loading } = useDomain(id);
|
|
16
|
+
const { trigger: deleteDomain } = useDomainDelete(id);
|
|
17
|
+
const { client } = useQuery(DOMAINS_QUERY, {
|
|
18
|
+
variables: { action: "viewDomain", fetchPolicy: "no-cache" },
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const history = useHistory();
|
|
22
|
+
const { formatMessage } = useIntl();
|
|
23
|
+
|
|
24
|
+
const available_actions = domain
|
|
25
|
+
? {
|
|
26
|
+
create: {
|
|
27
|
+
id: id,
|
|
28
|
+
order: 1,
|
|
29
|
+
icon: "cube",
|
|
30
|
+
messageId: "domain.actions.create",
|
|
31
|
+
action: () => linkTo.DOMAIN_NEW({ id }),
|
|
32
|
+
},
|
|
33
|
+
update: {
|
|
34
|
+
id: id,
|
|
35
|
+
order: 2,
|
|
36
|
+
icon: "edit",
|
|
37
|
+
messageId: "actions.edit",
|
|
38
|
+
action: () => linkTo.DOMAIN_EDIT({ id }),
|
|
39
|
+
},
|
|
40
|
+
deleteOption: true,
|
|
41
|
+
}
|
|
42
|
+
: null;
|
|
43
|
+
|
|
44
|
+
const handleDeleteDomain = async () => {
|
|
45
|
+
const { id, parent_id } = domain;
|
|
46
|
+
await deleteDomain(id);
|
|
47
|
+
if (parent_id) {
|
|
48
|
+
history.push(linkTo.DOMAIN_CONCEPTS({ id: parent_id }));
|
|
49
|
+
} else {
|
|
50
|
+
history.push(linkTo.DOMAINS());
|
|
51
|
+
}
|
|
52
|
+
client.resetStore();
|
|
20
53
|
};
|
|
21
|
-
|
|
54
|
+
|
|
55
|
+
return !loading ? (
|
|
22
56
|
<>
|
|
23
57
|
<Grid>
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
|
|
58
|
+
<GridRow>
|
|
59
|
+
<Grid.Column width={8}>
|
|
60
|
+
<Header as="h2">
|
|
61
|
+
<Icon name="cube" />
|
|
62
|
+
<Header.Content>
|
|
63
|
+
{domain.name}
|
|
64
|
+
<Header.Subheader>
|
|
65
|
+
{domain.type || <FormattedMessage id="domain" />}
|
|
66
|
+
</Header.Subheader>
|
|
67
|
+
</Header.Content>
|
|
68
|
+
</Header>
|
|
69
|
+
</Grid.Column>
|
|
70
|
+
<Grid.Column width={8} textAlign="right">
|
|
71
|
+
<DomainActions
|
|
72
|
+
availableActions={available_actions}
|
|
73
|
+
domain={domain}
|
|
74
|
+
domainAllActions={domainAllActions}
|
|
75
|
+
onDeleteDomain={handleDeleteDomain}
|
|
76
|
+
/>
|
|
77
|
+
</Grid.Column>
|
|
78
|
+
</GridRow>
|
|
79
|
+
{domain.description ? (
|
|
80
|
+
<GridRow>
|
|
81
|
+
<Grid.Column>{domain.description}</Grid.Column>
|
|
82
|
+
</GridRow>
|
|
83
|
+
) : null}
|
|
84
|
+
{domain.domain_group ? (
|
|
85
|
+
<GridRow>
|
|
86
|
+
<Grid.Column>
|
|
87
|
+
<Header sub>
|
|
88
|
+
{formatMessage({
|
|
89
|
+
id: "domain.props.domain_group",
|
|
90
|
+
})}
|
|
91
|
+
</Header>
|
|
92
|
+
<span>{_.get("name")(domain.domain_group)}</span>
|
|
93
|
+
</Grid.Column>
|
|
94
|
+
</GridRow>
|
|
95
|
+
) : null}
|
|
38
96
|
</Grid>
|
|
39
|
-
<p>{description}</p>
|
|
40
|
-
{domain_group && (
|
|
41
|
-
<Item>
|
|
42
|
-
<Item.Content>
|
|
43
|
-
<Item.Header as="h5">
|
|
44
|
-
<FormattedMessage id="domain.props.domain_group" />
|
|
45
|
-
</Item.Header>
|
|
46
|
-
<Item.Description>{_.get("name")(domain_group)}</Item.Description>
|
|
47
|
-
</Item.Content>
|
|
48
|
-
</Item>
|
|
49
|
-
)}
|
|
50
97
|
</>
|
|
51
|
-
);
|
|
98
|
+
) : null;
|
|
52
99
|
};
|
|
53
100
|
|
|
54
101
|
DomainDetail.propTypes = {
|
|
55
|
-
|
|
56
|
-
name: PropTypes.string,
|
|
57
|
-
description: PropTypes.string,
|
|
58
|
-
domain_group: PropTypes.object,
|
|
102
|
+
id: PropTypes.number,
|
|
59
103
|
};
|
|
60
104
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
export default connect(mapStateToProps)(DomainDetail);
|
|
105
|
+
export default DomainDetail;
|
|
@@ -2,16 +2,11 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { Button, Form } from "semantic-ui-react";
|
|
5
|
-
import { connect } from "react-redux";
|
|
6
5
|
import { useIntl } from "react-intl";
|
|
7
6
|
import { useForm, Controller } from "react-hook-form";
|
|
8
7
|
import { HistoryBackButton } from "@truedat/core/components";
|
|
9
8
|
import { accentInsensitiveOrder } from "@truedat/core/services/sort";
|
|
10
|
-
import {
|
|
11
|
-
getDomainGroups,
|
|
12
|
-
getDomainTypes,
|
|
13
|
-
domainParentOptionsSelector,
|
|
14
|
-
} from "../selectors";
|
|
9
|
+
import { useDomains } from "../../hooks/useDomains";
|
|
15
10
|
|
|
16
11
|
const toOption = (t, i) => ({ key: i, text: t, value: t });
|
|
17
12
|
|
|
@@ -24,6 +19,25 @@ const buildOptions = (collection, value) =>
|
|
|
24
19
|
_.map.convert({ cap: false })(toOption)
|
|
25
20
|
)(collection);
|
|
26
21
|
|
|
22
|
+
const getDomainGroups = _.flow(
|
|
23
|
+
_.map(_.path("domain_group.name")),
|
|
24
|
+
_.filter(_.isString),
|
|
25
|
+
_.sortBy(_.toLower)
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const getDomainTypes = _.flow(
|
|
29
|
+
_.map("type"),
|
|
30
|
+
_.filter(_.isString),
|
|
31
|
+
_.uniq,
|
|
32
|
+
_.sortBy(_.toLower)
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const getDomainParentOptions = (parentableIds = []) =>
|
|
36
|
+
_.flow(
|
|
37
|
+
_.filter((d) => _.includes(d.id)(parentableIds)),
|
|
38
|
+
_.map(({ id, name }) => ({ key: id, text: name, value: id }))
|
|
39
|
+
);
|
|
40
|
+
|
|
27
41
|
const DEFAULTS = {
|
|
28
42
|
description: "",
|
|
29
43
|
external_id: "",
|
|
@@ -33,16 +47,10 @@ const DEFAULTS = {
|
|
|
33
47
|
domain_group: null,
|
|
34
48
|
};
|
|
35
49
|
|
|
36
|
-
export const DomainForm = ({
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
domainGroups,
|
|
40
|
-
domainParentOptions,
|
|
41
|
-
domainTypes,
|
|
42
|
-
onSubmit,
|
|
43
|
-
}) => {
|
|
50
|
+
export const DomainForm = ({ domain = {}, onSubmit }) => {
|
|
51
|
+
const { data: domains } = useDomains();
|
|
52
|
+
|
|
44
53
|
const { formatMessage } = useIntl();
|
|
45
|
-
// const domainGroup = domain?.domain_group;
|
|
46
54
|
const { handleSubmit, control, formState, watch } = useForm({
|
|
47
55
|
mode: "all",
|
|
48
56
|
defaultValues: {
|
|
@@ -52,12 +60,19 @@ export const DomainForm = ({
|
|
|
52
60
|
},
|
|
53
61
|
});
|
|
54
62
|
const [group, type] = watch(["domain_group", "type"]);
|
|
63
|
+
const domainTypes = getDomainTypes(domains);
|
|
64
|
+
const domainGroups = getDomainGroups(domains);
|
|
55
65
|
const domainGroupOptions = buildOptions(domainGroups, group);
|
|
56
66
|
const domainTypeOptions = buildOptions(domainTypes, type);
|
|
57
67
|
const groupClearable =
|
|
58
68
|
domain?.domain_group?.status === "root" || !domain?.domain_group;
|
|
59
69
|
|
|
60
70
|
const { errors, isDirty, isValid } = formState;
|
|
71
|
+
|
|
72
|
+
const parentableIds = domain.parentable_ids || [];
|
|
73
|
+
const domainParentOptions =
|
|
74
|
+
domain?.id && domains ? getDomainParentOptions(parentableIds)(domains) : [];
|
|
75
|
+
|
|
61
76
|
return (
|
|
62
77
|
<Form onSubmit={handleSubmit(onSubmit)}>
|
|
63
78
|
<Controller
|
|
@@ -199,7 +214,7 @@ export const DomainForm = ({
|
|
|
199
214
|
placeholder={formatMessage({
|
|
200
215
|
id: "domain.props.description.placeholder",
|
|
201
216
|
})}
|
|
202
|
-
value={value}
|
|
217
|
+
value={value || ""}
|
|
203
218
|
/>
|
|
204
219
|
)}
|
|
205
220
|
/>
|
|
@@ -208,14 +223,10 @@ export const DomainForm = ({
|
|
|
208
223
|
floated="right"
|
|
209
224
|
type="submit"
|
|
210
225
|
primary
|
|
211
|
-
|
|
212
|
-
disabled={isSubmitting || !isDirty || !isValid}
|
|
226
|
+
disabled={!isDirty || !isValid}
|
|
213
227
|
content={formatMessage({ id: "actions.save" })}
|
|
214
228
|
/>
|
|
215
|
-
<HistoryBackButton
|
|
216
|
-
content={formatMessage({ id: "actions.cancel" })}
|
|
217
|
-
disabled={isSubmitting}
|
|
218
|
-
/>
|
|
229
|
+
<HistoryBackButton content={formatMessage({ id: "actions.cancel" })} />
|
|
219
230
|
</div>
|
|
220
231
|
</Form>
|
|
221
232
|
);
|
|
@@ -223,20 +234,7 @@ export const DomainForm = ({
|
|
|
223
234
|
|
|
224
235
|
DomainForm.propTypes = {
|
|
225
236
|
domain: PropTypes.object,
|
|
226
|
-
isSubmitting: PropTypes.bool,
|
|
227
|
-
domainGroups: PropTypes.array,
|
|
228
|
-
domainParentOptions: PropTypes.array,
|
|
229
|
-
domainTypes: PropTypes.array,
|
|
230
237
|
onSubmit: PropTypes.func.isRequired,
|
|
231
238
|
};
|
|
232
239
|
|
|
233
|
-
|
|
234
|
-
domainTypes: getDomainTypes(state),
|
|
235
|
-
domainGroups: getDomainGroups(state),
|
|
236
|
-
domainParentOptions: ownProps.domain?.id
|
|
237
|
-
? domainParentOptionsSelector(state)
|
|
238
|
-
: [],
|
|
239
|
-
isSubmitting: state.domainCreating || state.domainUpdating,
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
export default connect(mapStateToProps)(DomainForm);
|
|
240
|
+
export default DomainForm;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { connect } from "react-redux";
|
|
4
3
|
|
|
5
4
|
const ImplementationFiltersLoader = React.lazy(() =>
|
|
6
5
|
import("@truedat/dq/components/ImplementationFiltersLoader")
|
|
@@ -32,6 +31,4 @@ DomainImplementations.propTypes = {
|
|
|
32
31
|
domain: PropTypes.object.isRequired,
|
|
33
32
|
};
|
|
34
33
|
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
export default connect(mapStateToProps)(DomainImplementations);
|
|
34
|
+
export default DomainImplementations;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import ResourceMembers from "@truedat/core/components/ResourceMembers";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
3
4
|
|
|
4
|
-
export const DomainMembers = () =>
|
|
5
|
+
export const DomainMembers = ({ domainId }) => (
|
|
6
|
+
<ResourceMembers type="domain" id={domainId} />
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
DomainMembers.propTypes = {
|
|
10
|
+
domainId: PropTypes.number,
|
|
11
|
+
};
|
|
5
12
|
|
|
6
13
|
export default DomainMembers;
|
|
@@ -2,66 +2,19 @@ import React from "react";
|
|
|
2
2
|
import { Route, Switch } from "react-router-dom";
|
|
3
3
|
import { Unauthorized } from "@truedat/core/components";
|
|
4
4
|
import { useAuthorized } from "@truedat/core/hooks";
|
|
5
|
-
import {
|
|
6
|
-
DOMAIN,
|
|
7
|
-
DOMAIN_CONCEPTS,
|
|
8
|
-
DOMAINS,
|
|
9
|
-
DOMAINS_NEW,
|
|
10
|
-
DOMAINS_SEARCH,
|
|
11
|
-
DOMAIN_EDIT,
|
|
12
|
-
DOMAIN_IMPLEMENTATIONS,
|
|
13
|
-
DOMAIN_MEMBERS,
|
|
14
|
-
DOMAIN_MEMBERS_NEW,
|
|
15
|
-
DOMAIN_NEW,
|
|
16
|
-
DOMAIN_STRUCTURES,
|
|
17
|
-
} from "@truedat/core/routes";
|
|
18
|
-
import Domain from "./Domain";
|
|
19
|
-
import DomainLoader from "./DomainLoader";
|
|
20
|
-
import DomainMembersLoader from "./DomainMembersLoader";
|
|
21
|
-
import Domains from "./Domains";
|
|
22
|
-
import DomainsLoader from "./DomainsLoader";
|
|
23
|
-
import EditDomain from "./EditDomain";
|
|
5
|
+
import { DOMAINS, DOMAIN, DOMAINS_NEW } from "@truedat/core/routes";
|
|
24
6
|
import NewDomain from "./NewDomain";
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
const RolesLoader = React.lazy(() =>
|
|
28
|
-
import("@truedat/auth/roles/components/RolesLoader")
|
|
29
|
-
);
|
|
7
|
+
import Domains from "./Domains";
|
|
30
8
|
|
|
31
9
|
const DomainRoutes = () => (
|
|
32
|
-
|
|
33
|
-
<Route
|
|
34
|
-
<Route
|
|
35
|
-
<Route exact path={
|
|
36
|
-
|
|
37
|
-
<Route exact path={DOMAIN_IMPLEMENTATIONS} component={Domain} />
|
|
38
|
-
<Route exact path={DOMAIN_STRUCTURES} component={Domain} />
|
|
39
|
-
<Route exact path={DOMAIN_MEMBERS} component={Domain} />
|
|
40
|
-
<Route exact path={DOMAIN_EDIT} render={() => <EditDomain />} />
|
|
41
|
-
<Route exact path={DOMAIN_NEW} component={NewDomain} />
|
|
42
|
-
<Route
|
|
43
|
-
path={DOMAIN_MEMBERS_NEW}
|
|
44
|
-
render={({ match }) => (
|
|
45
|
-
<>
|
|
46
|
-
<RolesLoader />
|
|
47
|
-
<AddDomainMember id={parseInt(match?.params?.id)} />
|
|
48
|
-
</>
|
|
49
|
-
)}
|
|
50
|
-
/>
|
|
51
|
-
</>
|
|
10
|
+
<Switch>
|
|
11
|
+
<Route exact path={DOMAINS_NEW} render={() => <NewDomain />} />
|
|
12
|
+
<Route path={DOMAIN} render={() => <Domains />} />
|
|
13
|
+
<Route exact path={DOMAINS} render={() => <Domains />} />
|
|
14
|
+
</Switch>
|
|
52
15
|
);
|
|
53
16
|
|
|
54
|
-
const AuthorizedRoutes = () =>
|
|
55
|
-
<>
|
|
56
|
-
<Route component={DomainsLoader} />
|
|
57
|
-
<Route path={DOMAINS} component={Domains} exact />
|
|
58
|
-
<Switch>
|
|
59
|
-
<Route path={DOMAINS_SEARCH} component={Domains} exact />
|
|
60
|
-
<Route path={DOMAINS_NEW} component={NewDomain} exact />
|
|
61
|
-
<Route path={DOMAIN} render={() => <DomainRoutes />} />
|
|
62
|
-
</Switch>
|
|
63
|
-
</>
|
|
64
|
-
);
|
|
17
|
+
const AuthorizedRoutes = () => <DomainRoutes />;
|
|
65
18
|
|
|
66
19
|
const DomainsRoutes = () => {
|
|
67
20
|
const authorized = useAuthorized(["taxonomy", "taxonomy_membership"]);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { connect } from "react-redux";
|
|
4
3
|
import StructuresView from "@truedat/dd/components/StructuresView";
|
|
5
4
|
|
|
6
5
|
export const DomainStructures = ({ domain = {} }) => {
|
|
@@ -14,6 +13,4 @@ DomainStructures.propTypes = {
|
|
|
14
13
|
domain: PropTypes.object.isRequired,
|
|
15
14
|
};
|
|
16
15
|
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
export default connect(mapStateToProps)(DomainStructures);
|
|
16
|
+
export default DomainStructures;
|
|
@@ -1,45 +1,29 @@
|
|
|
1
|
-
import _ from "lodash/fp";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import { FormattedMessage } from "react-intl";
|
|
5
|
-
import {
|
|
6
|
-
import { Link } from "react-router-dom";
|
|
4
|
+
import { Link, useLocation } from "react-router-dom";
|
|
7
5
|
import { Menu } from "semantic-ui-react";
|
|
8
|
-
import {
|
|
6
|
+
import { compile } from "path-to-regexp";
|
|
7
|
+
import { useAuthorized } from "@truedat/core/hooks";
|
|
9
8
|
import {
|
|
10
|
-
DOMAIN,
|
|
11
9
|
DOMAIN_CONCEPTS,
|
|
12
10
|
DOMAIN_IMPLEMENTATIONS,
|
|
13
11
|
DOMAIN_MEMBERS,
|
|
12
|
+
DOMAIN_MEMBERS_NEW,
|
|
14
13
|
DOMAIN_STRUCTURES,
|
|
15
14
|
linkTo,
|
|
16
15
|
} from "@truedat/core/routes";
|
|
17
16
|
|
|
18
17
|
const DomainTabs = ({ domain }) => {
|
|
19
|
-
const path =
|
|
18
|
+
const { pathname: path } = useLocation();
|
|
20
19
|
const ddAuthorized = useAuthorized("data_dictionary");
|
|
21
20
|
const dqAuthorized = useAuthorized("quality");
|
|
22
|
-
const id = domain
|
|
21
|
+
const id = domain.id;
|
|
22
|
+
|
|
23
23
|
return (
|
|
24
24
|
<Menu attached="top" pointing secondary tabular>
|
|
25
25
|
<Menu.Item
|
|
26
|
-
active={path ===
|
|
27
|
-
as={Link}
|
|
28
|
-
to={linkTo.DOMAIN(domain)}
|
|
29
|
-
replace
|
|
30
|
-
>
|
|
31
|
-
<FormattedMessage id="tabs.subdomains" />
|
|
32
|
-
</Menu.Item>
|
|
33
|
-
<Menu.Item
|
|
34
|
-
active={path === DOMAIN_MEMBERS}
|
|
35
|
-
as={Link}
|
|
36
|
-
to={linkTo.DOMAIN_MEMBERS({ id })}
|
|
37
|
-
replace
|
|
38
|
-
>
|
|
39
|
-
<FormattedMessage id="tabs.members" />
|
|
40
|
-
</Menu.Item>
|
|
41
|
-
<Menu.Item
|
|
42
|
-
active={path === DOMAIN_CONCEPTS}
|
|
26
|
+
active={path === compile(DOMAIN_CONCEPTS)({ id })}
|
|
43
27
|
as={Link}
|
|
44
28
|
to={linkTo.DOMAIN_CONCEPTS({ id })}
|
|
45
29
|
replace
|
|
@@ -48,7 +32,7 @@ const DomainTabs = ({ domain }) => {
|
|
|
48
32
|
</Menu.Item>
|
|
49
33
|
{ddAuthorized ? (
|
|
50
34
|
<Menu.Item
|
|
51
|
-
active={path === DOMAIN_STRUCTURES}
|
|
35
|
+
active={path === compile(DOMAIN_STRUCTURES)({ id })}
|
|
52
36
|
as={Link}
|
|
53
37
|
to={linkTo.DOMAIN_STRUCTURES({ id })}
|
|
54
38
|
replace
|
|
@@ -58,7 +42,7 @@ const DomainTabs = ({ domain }) => {
|
|
|
58
42
|
) : null}
|
|
59
43
|
{dqAuthorized ? (
|
|
60
44
|
<Menu.Item
|
|
61
|
-
active={path === DOMAIN_IMPLEMENTATIONS}
|
|
45
|
+
active={path === compile(DOMAIN_IMPLEMENTATIONS)({ id })}
|
|
62
46
|
as={Link}
|
|
63
47
|
to={linkTo.DOMAIN_IMPLEMENTATIONS({ id })}
|
|
64
48
|
replace
|
|
@@ -66,6 +50,17 @@ const DomainTabs = ({ domain }) => {
|
|
|
66
50
|
<FormattedMessage id="tabs.implementations" />
|
|
67
51
|
</Menu.Item>
|
|
68
52
|
) : null}
|
|
53
|
+
<Menu.Item
|
|
54
|
+
active={
|
|
55
|
+
path === compile(DOMAIN_MEMBERS)({ id }) ||
|
|
56
|
+
path === compile(DOMAIN_MEMBERS_NEW)({ id })
|
|
57
|
+
}
|
|
58
|
+
as={Link}
|
|
59
|
+
to={linkTo.DOMAIN_MEMBERS({ id })}
|
|
60
|
+
replace
|
|
61
|
+
>
|
|
62
|
+
<FormattedMessage id="tabs.members" />
|
|
63
|
+
</Menu.Item>
|
|
69
64
|
</Menu>
|
|
70
65
|
);
|
|
71
66
|
};
|
|
@@ -74,6 +69,4 @@ DomainTabs.propTypes = {
|
|
|
74
69
|
domain: PropTypes.object,
|
|
75
70
|
};
|
|
76
71
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
export default connect(mapStateToProps)(DomainTabs);
|
|
72
|
+
export default DomainTabs;
|