@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/bg",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.6",
|
|
4
4
|
"description": "Truedat Web Business Glossary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@testing-library/jest-dom": "^5.16.5",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "7.0.
|
|
37
|
+
"@truedat/test": "7.0.6",
|
|
38
38
|
"babel-jest": "^28.1.0",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
]
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@truedat/core": "7.0.
|
|
90
|
-
"@truedat/df": "7.0.
|
|
91
|
-
"@truedat/lm": "7.0.
|
|
89
|
+
"@truedat/core": "7.0.6",
|
|
90
|
+
"@truedat/df": "7.0.6",
|
|
91
|
+
"@truedat/lm": "7.0.6",
|
|
92
92
|
"decode-uri-component": "^0.2.2",
|
|
93
93
|
"file-saver": "^2.0.5",
|
|
94
94
|
"moment": "^2.29.4",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"react-dom": ">= 16.8.6 < 17",
|
|
112
112
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
113
113
|
},
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "00bc7f5ff0c4a073987b4ed538f9547a12d2d0ad"
|
|
115
115
|
}
|
|
@@ -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 ConceptsPanel from "./ConceptsPanel";
|
|
5
4
|
|
|
6
5
|
export const DomainConcepts = ({ domain = {} }) => {
|
|
@@ -17,6 +16,4 @@ DomainConcepts.propTypes = {
|
|
|
17
16
|
domain: PropTypes.object.isRequired,
|
|
18
17
|
};
|
|
19
18
|
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
export default connect(mapStateToProps)(DomainConcepts);
|
|
19
|
+
export default DomainConcepts;
|
|
@@ -7,7 +7,7 @@ exports[`<ConceptForm /> with multiple templates matches the latest snapshot 1`]
|
|
|
7
7
|
style=""
|
|
8
8
|
>
|
|
9
9
|
<div
|
|
10
|
-
class="disabled required field fix-dropdown-selector"
|
|
10
|
+
class="disabled required field fix-dropdown-selector "
|
|
11
11
|
>
|
|
12
12
|
<label>
|
|
13
13
|
Domain
|
|
@@ -34,7 +34,7 @@ exports[`<ConceptForm /> with multiple templates matches the latest snapshot 1`]
|
|
|
34
34
|
class="menu transition"
|
|
35
35
|
>
|
|
36
36
|
<div
|
|
37
|
-
class="ui left icon input search"
|
|
37
|
+
class="ui fluid left icon input search "
|
|
38
38
|
>
|
|
39
39
|
<input
|
|
40
40
|
type="text"
|
|
@@ -40,7 +40,7 @@ exports[`<ConceptsBulkUpdate /> matches the latest snapshot 1`] = `
|
|
|
40
40
|
class="ui form"
|
|
41
41
|
>
|
|
42
42
|
<div
|
|
43
|
-
class="required field fix-dropdown-selector"
|
|
43
|
+
class="required field fix-dropdown-selector "
|
|
44
44
|
>
|
|
45
45
|
<div
|
|
46
46
|
aria-disabled="false"
|
|
@@ -62,7 +62,7 @@ exports[`<ConceptsBulkUpdate /> matches the latest snapshot 1`] = `
|
|
|
62
62
|
class="menu transition"
|
|
63
63
|
>
|
|
64
64
|
<div
|
|
65
|
-
class="ui left icon input search"
|
|
65
|
+
class="ui fluid left icon input search "
|
|
66
66
|
>
|
|
67
67
|
<input
|
|
68
68
|
type="text"
|
|
@@ -15,7 +15,7 @@ exports[`<SharedToForm /> matches the latest snapshot 1`] = `
|
|
|
15
15
|
class="ui form"
|
|
16
16
|
>
|
|
17
17
|
<div
|
|
18
|
-
class="field fix-dropdown-selector"
|
|
18
|
+
class="field fix-dropdown-selector "
|
|
19
19
|
>
|
|
20
20
|
<div
|
|
21
21
|
aria-disabled="false"
|
|
@@ -42,7 +42,7 @@ exports[`<SharedToForm /> matches the latest snapshot 1`] = `
|
|
|
42
42
|
class="menu transition"
|
|
43
43
|
>
|
|
44
44
|
<div
|
|
45
|
-
class="ui left icon input search"
|
|
45
|
+
class="ui fluid left icon input search "
|
|
46
46
|
>
|
|
47
47
|
<input
|
|
48
48
|
type="text"
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import { compile } from "path-to-regexp";
|
|
3
|
+
import useSWR, { useSWRConfig } from "swr";
|
|
4
|
+
import useSWRMutations from "swr/mutation";
|
|
5
|
+
import {
|
|
6
|
+
apiJson,
|
|
7
|
+
apiJsonPost,
|
|
8
|
+
apiJsonPatch,
|
|
9
|
+
apiJsonDelete,
|
|
10
|
+
} from "@truedat/core/services/api";
|
|
11
|
+
import { API_DOMAINS, API_DOMAIN } from "../taxonomy/api";
|
|
12
|
+
|
|
13
|
+
export const useDomains = () => {
|
|
14
|
+
const toApiPath = compile(API_DOMAINS, "api");
|
|
15
|
+
const url = toApiPath();
|
|
16
|
+
const { data, error } = useSWR(url, apiJson);
|
|
17
|
+
return {
|
|
18
|
+
data: data?.data?.data,
|
|
19
|
+
actions: data?.data?._actions,
|
|
20
|
+
error,
|
|
21
|
+
loading: !error && !data,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const useDomain = (id) => {
|
|
26
|
+
const toApiPath = compile(API_DOMAIN, "api");
|
|
27
|
+
const url = toApiPath({ id });
|
|
28
|
+
const { data, error } = useSWR(url, apiJson);
|
|
29
|
+
return {
|
|
30
|
+
data: data?.data?.data,
|
|
31
|
+
actions: data?.data?._actions,
|
|
32
|
+
error,
|
|
33
|
+
loading: !error && !data,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const useDomainCreate = () => {
|
|
38
|
+
const toApiPath = compile(API_DOMAINS, "api");
|
|
39
|
+
const url = toApiPath();
|
|
40
|
+
return useSWRMutations(url, (url, { arg }) => apiJsonPost(url, arg));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const useDomainUpdate = (id) => {
|
|
44
|
+
const { mutate } = useSWRConfig();
|
|
45
|
+
const url = compile(API_DOMAIN)({ id });
|
|
46
|
+
const mutator = useSWRMutations(url, (url, { arg }) =>
|
|
47
|
+
apiJsonPatch(url, arg)
|
|
48
|
+
);
|
|
49
|
+
return {
|
|
50
|
+
...mutator,
|
|
51
|
+
trigger: async (arg, options) => {
|
|
52
|
+
const response = await mutator.trigger(arg, options);
|
|
53
|
+
const toApiPath = compile(API_DOMAINS, "api");
|
|
54
|
+
const url = toApiPath();
|
|
55
|
+
mutate(url);
|
|
56
|
+
return response;
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const useDomainDelete = (id) => {
|
|
62
|
+
const { mutate } = useSWRConfig();
|
|
63
|
+
const url = compile(API_DOMAIN)({ id });
|
|
64
|
+
const mutator = useSWRMutations(url, (url, { arg }) =>
|
|
65
|
+
apiJsonDelete(url, arg)
|
|
66
|
+
);
|
|
67
|
+
return {
|
|
68
|
+
...mutator,
|
|
69
|
+
trigger: async (arg, options) => {
|
|
70
|
+
const response = await mutator.trigger(arg, options);
|
|
71
|
+
const toApiPath = compile(API_DOMAINS, "api");
|
|
72
|
+
const url = toApiPath();
|
|
73
|
+
mutate(url);
|
|
74
|
+
return response;
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
};
|
package/src/messages/en.js
CHANGED
|
@@ -250,6 +250,9 @@ export default {
|
|
|
250
250
|
domain: "Domain",
|
|
251
251
|
"domain.actions.add_member": "Add",
|
|
252
252
|
"domain.actions.create": "New Subdomain",
|
|
253
|
+
"domain.actions.delete": "Delete domain",
|
|
254
|
+
"domain.actions.delete.question":
|
|
255
|
+
"Are you sure you want to delete this domain?",
|
|
253
256
|
"domain.actions.edit": "Edit",
|
|
254
257
|
"domain.actions.edit.header": "Edit Domain",
|
|
255
258
|
"domain.children.empty": "This domain has no subdomains",
|
|
@@ -284,9 +287,12 @@ export default {
|
|
|
284
287
|
"domain.selector.placeholder": "Select a domain...",
|
|
285
288
|
"domains.actions.create": "New Domain",
|
|
286
289
|
"domains.search.placeholder": "Search domains...",
|
|
290
|
+
"domains.search.error.fields": "Search fields not valid",
|
|
287
291
|
"domains.search.results.count": "{count} domains found:",
|
|
288
292
|
"domains.search.results.empty": "No domains found",
|
|
289
293
|
"domains.subheader": "Manage governance structure and data domains",
|
|
294
|
+
"domains.general.message":
|
|
295
|
+
"Please, select a domain on the left pane to see the detail.",
|
|
290
296
|
"events.text": "{field} changed to {value}",
|
|
291
297
|
"fields.dropdown.placeholder": "Select one...",
|
|
292
298
|
"fields.pairlist.url.name.placeholder": "Url name",
|
package/src/messages/es.js
CHANGED
|
@@ -254,6 +254,8 @@ export default {
|
|
|
254
254
|
domain: "Dominio",
|
|
255
255
|
"domain.actions.add_member": "Añadir",
|
|
256
256
|
"domain.actions.create": "Nuevo subdominio",
|
|
257
|
+
"domain.actions.delete": "Eliminar dominio",
|
|
258
|
+
"domain.actions.delete.question": "¿Quieres eliminar este dominio?",
|
|
257
259
|
"domain.actions.edit": "Editar",
|
|
258
260
|
"domain.actions.edit.header": "Editar dominio",
|
|
259
261
|
"domain.children.empty": "Este dominio no tiene subdominios",
|
|
@@ -287,10 +289,13 @@ export default {
|
|
|
287
289
|
"domain.selector.placeholder": "Selecciona un dominio...",
|
|
288
290
|
"domains.actions.create": "Nuevo dominio",
|
|
289
291
|
"domains.search.placeholder": "Buscar dominios...",
|
|
292
|
+
"domains.search.error.fields": "Campos de búsqueda no válidos",
|
|
290
293
|
"domains.search.results.count": "{count} dominios encontrados:",
|
|
291
294
|
"domains.search.results.empty": "Ningún dominio encontrado",
|
|
292
295
|
"domains.subheader":
|
|
293
296
|
"Gestionar los dominios de negocio y los dominios de gobierno de datos",
|
|
297
|
+
"domains.general.message":
|
|
298
|
+
"Por favor, selecciona un dominio en el panel de la izquierda para ver el detalle.",
|
|
294
299
|
"events.text": "{field} actualizado a {value}",
|
|
295
300
|
"fields.dropdown.placeholder": "Selecciona...",
|
|
296
301
|
"fields.pairlist.url.name.placeholder": "Nombre de la url",
|
package/src/reducers/index.js
CHANGED
|
@@ -4,17 +4,11 @@ import { useHistory } from "react-router-dom";
|
|
|
4
4
|
|
|
5
5
|
import { linkTo } from "@truedat/core/routes";
|
|
6
6
|
import AddResourceMember from "@truedat/core/components/AddResourceMember";
|
|
7
|
-
import DomainCrumbs from "./DomainCrumbs";
|
|
8
7
|
|
|
9
8
|
const AddDomainMember = ({ id }) => {
|
|
10
9
|
const history = useHistory();
|
|
11
10
|
const onSuccess = () => history.push(linkTo.DOMAIN_MEMBERS({ id }));
|
|
12
|
-
return
|
|
13
|
-
<>
|
|
14
|
-
<DomainCrumbs />
|
|
15
|
-
<AddResourceMember type="domain" id={`${id}`} onSuccess={onSuccess} />
|
|
16
|
-
</>
|
|
17
|
-
);
|
|
11
|
+
return <AddResourceMember type="domain" id={`${id}`} onSuccess={onSuccess} />;
|
|
18
12
|
};
|
|
19
13
|
|
|
20
14
|
AddDomainMember.propTypes = {
|
|
@@ -1,115 +1,111 @@
|
|
|
1
|
-
import _ from "lodash/fp";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
|
-
import { connect } from "react-redux";
|
|
5
3
|
import { Route, Switch } from "react-router-dom";
|
|
6
4
|
import { Segment } from "semantic-ui-react";
|
|
7
5
|
import { Unauthorized } from "@truedat/core/components";
|
|
8
6
|
import { useAuthorized } from "@truedat/core/hooks";
|
|
9
7
|
import {
|
|
10
|
-
DOMAIN,
|
|
11
8
|
DOMAIN_CONCEPTS,
|
|
12
9
|
DOMAIN_IMPLEMENTATIONS,
|
|
13
10
|
DOMAIN_MEMBERS,
|
|
11
|
+
DOMAIN_MEMBERS_NEW,
|
|
14
12
|
DOMAIN_STRUCTURES,
|
|
15
|
-
|
|
13
|
+
DOMAIN_NEW,
|
|
14
|
+
DOMAIN_EDIT,
|
|
16
15
|
} from "@truedat/core/routes";
|
|
17
16
|
import UserSearchFiltersLoader from "@truedat/dd/components/UserSearchFiltersLoader";
|
|
18
17
|
import DomainConcepts from "../../concepts/components/DomainConcepts";
|
|
19
|
-
import
|
|
20
|
-
import DomainCards from "./DomainCards";
|
|
21
|
-
import DomainCrumbs from "./DomainCrumbs";
|
|
18
|
+
import { useDomain } from "../../hooks/useDomains";
|
|
22
19
|
import DomainDetail from "./DomainDetail";
|
|
23
20
|
import DomainImplementations from "./DomainImplementations";
|
|
24
21
|
import DomainMembers from "./DomainMembers";
|
|
25
|
-
import DomainSearch from "./DomainSearch";
|
|
26
22
|
import DomainStructures from "./DomainStructures";
|
|
27
23
|
import DomainTabs from "./DomainTabs";
|
|
24
|
+
import EditDomain from "./EditDomain";
|
|
25
|
+
import NewDomain from "./NewDomain";
|
|
26
|
+
import AddDomainMember from "./AddDomainMember";
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
const RolesLoader = React.lazy(() =>
|
|
29
|
+
import("@truedat/auth/roles/components/RolesLoader")
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const Domain = ({ domainId }) => {
|
|
33
|
+
const { data: domain } = useDomain(domainId);
|
|
30
34
|
const ddAuthorized = useAuthorized("data_dictionary");
|
|
31
35
|
const dqAuthorized = useAuthorized("quality");
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
37
|
+
return domain ? (
|
|
38
|
+
<Segment>
|
|
39
|
+
<Switch>
|
|
40
|
+
<Route
|
|
41
|
+
exact
|
|
42
|
+
path={DOMAIN_EDIT}
|
|
43
|
+
render={() => <EditDomain domain={domain} />}
|
|
44
|
+
/>
|
|
45
|
+
<Route
|
|
46
|
+
exact
|
|
47
|
+
path={DOMAIN_NEW}
|
|
48
|
+
render={() => <NewDomain domain={domain} />}
|
|
49
|
+
/>
|
|
50
|
+
<>
|
|
51
|
+
<DomainDetail id={domain.id} />
|
|
52
|
+
<DomainTabs domain={domain} />
|
|
53
|
+
<Segment attached="bottom">
|
|
54
|
+
<Switch>
|
|
55
|
+
<Route
|
|
56
|
+
exact
|
|
57
|
+
path={DOMAIN_CONCEPTS}
|
|
58
|
+
render={() => <DomainConcepts domain={domain} />}
|
|
59
|
+
/>
|
|
60
|
+
<Route
|
|
61
|
+
exact
|
|
62
|
+
path={DOMAIN_STRUCTURES}
|
|
63
|
+
render={() =>
|
|
64
|
+
ddAuthorized ? (
|
|
65
|
+
<DomainStructures domain={domain} />
|
|
66
|
+
) : (
|
|
67
|
+
<Unauthorized />
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
/>
|
|
71
|
+
<Route
|
|
72
|
+
exact
|
|
73
|
+
path={DOMAIN_IMPLEMENTATIONS}
|
|
74
|
+
render={() =>
|
|
75
|
+
dqAuthorized ? (
|
|
76
|
+
<>
|
|
77
|
+
<UserSearchFiltersLoader scope="rule_implementation" />
|
|
78
|
+
<DomainImplementations domain={domain} />
|
|
79
|
+
</>
|
|
80
|
+
) : (
|
|
81
|
+
<Unauthorized />
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
/>
|
|
85
|
+
<Route
|
|
86
|
+
exact
|
|
87
|
+
path={DOMAIN_MEMBERS}
|
|
88
|
+
render={() => <DomainMembers domainId={domain.id} />}
|
|
89
|
+
/>
|
|
90
|
+
<Route
|
|
91
|
+
path={DOMAIN_MEMBERS_NEW}
|
|
92
|
+
render={({ match }) => (
|
|
83
93
|
<>
|
|
84
|
-
<
|
|
85
|
-
<
|
|
94
|
+
<RolesLoader />
|
|
95
|
+
<AddDomainMember id={parseInt(match?.params?.id)} />
|
|
86
96
|
</>
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
</Segment>
|
|
95
|
-
</>
|
|
97
|
+
)}
|
|
98
|
+
/>
|
|
99
|
+
</Switch>
|
|
100
|
+
</Segment>
|
|
101
|
+
</>
|
|
102
|
+
</Switch>
|
|
103
|
+
</Segment>
|
|
96
104
|
) : null;
|
|
97
105
|
};
|
|
98
106
|
|
|
99
107
|
Domain.propTypes = {
|
|
100
|
-
|
|
101
|
-
domain: PropTypes.object,
|
|
102
|
-
domainLoading: PropTypes.bool,
|
|
108
|
+
domainId: PropTypes.number,
|
|
103
109
|
};
|
|
104
110
|
|
|
105
|
-
|
|
106
|
-
domain,
|
|
107
|
-
domainLoading,
|
|
108
|
-
hasChildren: _.flow(
|
|
109
|
-
_.filter(_.prop("parent_id")),
|
|
110
|
-
_.filter(_.propEq("parent_id", _.prop("id")(domain))),
|
|
111
|
-
_.negate(_.isEmpty)
|
|
112
|
-
)(domains),
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
export default connect(mapStateToProps)(Domain);
|
|
111
|
+
export default Domain;
|
|
@@ -2,39 +2,14 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { Link } from "react-router-dom";
|
|
5
|
-
import {
|
|
6
|
-
import { bindActionCreators } from "redux";
|
|
7
|
-
import { connect } from "react-redux";
|
|
5
|
+
import { Button } from "semantic-ui-react";
|
|
8
6
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
9
7
|
import { ConfirmModal, GroupActions } from "@truedat/core/components";
|
|
10
|
-
import { deleteDomain, filterDomains } from "../routines";
|
|
11
|
-
import { getPrimaryActions, getSecondaryActions } from "../selectors";
|
|
12
|
-
|
|
13
|
-
const DomainAction = ({ action, icon, messageId, id, ...rest }) => {
|
|
14
|
-
const { formatMessage } = useIntl();
|
|
15
|
-
return (
|
|
16
|
-
<Dropdown.Item
|
|
17
|
-
text={formatMessage({ id: messageId })}
|
|
18
|
-
icon={icon}
|
|
19
|
-
as={Link}
|
|
20
|
-
to={action(id)}
|
|
21
|
-
{...rest}
|
|
22
|
-
/>
|
|
23
|
-
);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
DomainAction.propTypes = {
|
|
27
|
-
action: PropTypes.func,
|
|
28
|
-
icon: PropTypes.string,
|
|
29
|
-
messageId: PropTypes.string,
|
|
30
|
-
id: PropTypes.number,
|
|
31
|
-
};
|
|
32
8
|
|
|
33
9
|
const DomainActionButton = ({ action, icon, messageId, id, ...rest }) => {
|
|
34
10
|
const { formatMessage } = useIntl();
|
|
35
11
|
return (
|
|
36
12
|
<Button
|
|
37
|
-
floated="right"
|
|
38
13
|
primary
|
|
39
14
|
content={formatMessage({ id: messageId })}
|
|
40
15
|
icon={icon}
|
|
@@ -56,12 +31,11 @@ const ModalDelete = ({ onConfirm }) => {
|
|
|
56
31
|
const { formatMessage } = useIntl();
|
|
57
32
|
return (
|
|
58
33
|
<ConfirmModal
|
|
59
|
-
header={formatMessage({ id: "domain" })}
|
|
60
|
-
content={formatMessage({ id: "actions.
|
|
34
|
+
header={formatMessage({ id: "domain.actions.delete" })}
|
|
35
|
+
content={formatMessage({ id: "domain.actions.delete.question" })}
|
|
61
36
|
onConfirm={onConfirm}
|
|
62
37
|
trigger={
|
|
63
38
|
<Button
|
|
64
|
-
floated="right"
|
|
65
39
|
negative
|
|
66
40
|
content={formatMessage({ id: "actions.delete" })}
|
|
67
41
|
icon="trash"
|
|
@@ -103,7 +77,10 @@ const ActionButtons = ({
|
|
|
103
77
|
}) => {
|
|
104
78
|
const availableActions = _.flow(
|
|
105
79
|
composeAvailableActions,
|
|
106
|
-
_.map(({ action, ...rest }) => ({
|
|
80
|
+
_.map(({ action, ...rest }) => ({
|
|
81
|
+
...rest,
|
|
82
|
+
to: action(id),
|
|
83
|
+
})),
|
|
107
84
|
(actions) => (deleteAction ? withDelete(actions, onConfirm) : actions)
|
|
108
85
|
)(secondaryActions);
|
|
109
86
|
|
|
@@ -121,61 +98,57 @@ const ActionButtons = ({
|
|
|
121
98
|
|
|
122
99
|
ActionButtons.propTypes = {
|
|
123
100
|
id: PropTypes.number,
|
|
101
|
+
primaryActions: PropTypes.array,
|
|
102
|
+
secondaryActions: PropTypes.array,
|
|
103
|
+
deleteAction: PropTypes.bool,
|
|
124
104
|
onConfirm: PropTypes.func,
|
|
125
105
|
};
|
|
126
106
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
domain: PropTypes.object,
|
|
130
|
-
deleteDomain: PropTypes.func,
|
|
131
|
-
domainActions: PropTypes.object,
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
handleConfirm = () => {
|
|
135
|
-
this.setState({ open: false });
|
|
136
|
-
this.props.deleteDomain(this.props.domain);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
render = () => {
|
|
140
|
-
const {
|
|
141
|
-
domain,
|
|
142
|
-
domainActions,
|
|
143
|
-
primaryActions,
|
|
144
|
-
secondaryActions,
|
|
145
|
-
deleteAction,
|
|
146
|
-
} = this.props;
|
|
147
|
-
const { id } = domain;
|
|
148
|
-
return _.isEmpty(domainActions) ? null : (
|
|
149
|
-
<ActionButtons
|
|
150
|
-
domainActions={domainActions}
|
|
151
|
-
primaryActions={primaryActions}
|
|
152
|
-
secondaryActions={secondaryActions}
|
|
153
|
-
deleteAction={deleteAction}
|
|
154
|
-
show={this.show}
|
|
155
|
-
id={id}
|
|
156
|
-
onConfirm={this.handleConfirm}
|
|
157
|
-
/>
|
|
158
|
-
);
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const hiddenActions = ["show", "index"];
|
|
163
|
-
|
|
164
|
-
const mapDispatchToProps = (dispatch) => ({
|
|
165
|
-
...bindActionCreators({ deleteDomain }, dispatch),
|
|
166
|
-
handleFilterDomains: (event) => {
|
|
167
|
-
const query = event.target.value;
|
|
168
|
-
return dispatch(filterDomains({ query }));
|
|
169
|
-
},
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
const mapStateToProps = ({ domain, domainActions }, { availableActions }) => ({
|
|
107
|
+
const DomainActions = ({
|
|
108
|
+
availableActions,
|
|
173
109
|
domain,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
110
|
+
domainAllActions,
|
|
111
|
+
onDeleteDomain,
|
|
112
|
+
}) => {
|
|
113
|
+
const hiddenActions = ["show", "index"];
|
|
114
|
+
const secondaryActionsKeys = ["delete", "update"];
|
|
115
|
+
|
|
116
|
+
const notHiddenActions = _.flow(
|
|
117
|
+
_.omit(hiddenActions),
|
|
118
|
+
_.toPairs,
|
|
119
|
+
_.map(([key, actionProps]) => ({ key, ...actionProps })),
|
|
120
|
+
_.filter(({ key }) => _.has(key)(availableActions)),
|
|
121
|
+
_.map((a) => ({ ...a, ..._.prop(_.prop("key")(a))(availableActions) }))
|
|
122
|
+
)(domainAllActions);
|
|
123
|
+
|
|
124
|
+
const primaryActions = _.filter(
|
|
125
|
+
({ key }) => !_.includes(key)(secondaryActionsKeys)
|
|
126
|
+
)(notHiddenActions);
|
|
127
|
+
|
|
128
|
+
const secondaryActions = _.filter(({ key }) =>
|
|
129
|
+
_.includes(key)(secondaryActionsKeys)
|
|
130
|
+
)(notHiddenActions);
|
|
131
|
+
|
|
132
|
+
const deleteAction =
|
|
133
|
+
_.has("delete")(domainAllActions) &&
|
|
134
|
+
_.has("deleteOption")(availableActions);
|
|
135
|
+
|
|
136
|
+
return _.isEmpty(domainAllActions) ? null : (
|
|
137
|
+
<ActionButtons
|
|
138
|
+
primaryActions={primaryActions}
|
|
139
|
+
secondaryActions={secondaryActions}
|
|
140
|
+
deleteAction={deleteAction}
|
|
141
|
+
id={domain.id}
|
|
142
|
+
onConfirm={onDeleteDomain}
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
DomainActions.propTypes = {
|
|
148
|
+
availableActions: PropTypes.object,
|
|
149
|
+
domain: PropTypes.object,
|
|
150
|
+
domainAllActions: PropTypes.object,
|
|
151
|
+
onDeleteDomain: PropTypes.func,
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export default DomainActions;
|