@truedat/bg 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/concepts/components/ConceptLinksUploadButton.js +0 -4
- package/src/concepts/components/ConceptRoutes.js +28 -46
- package/src/concepts/components/__tests__/ConceptRoutes.spec.js +201 -0
- package/src/concepts/components/__tests__/__snapshots__/ConceptRoutes.spec.js.snap +165 -0
- package/src/concepts/relations/api.js +9 -1
- package/src/concepts/relations/components/ConceptImplementationLinks.js +2 -1
- package/src/concepts/relations/components/ConceptLinksApprovalResults.js +91 -0
- package/src/concepts/relations/components/ConceptLinksApprovals.js +225 -0
- package/src/concepts/relations/components/ConceptLinksApprovalsLabelResults.js +42 -0
- package/src/concepts/relations/components/ConceptLinksApprovalsRow.js +43 -0
- package/src/concepts/relations/components/ConceptLinksApprovalsTable.js +104 -0
- package/src/concepts/relations/components/__tests__/ConceptLinksApprovalResults.spec.js +123 -0
- package/src/concepts/relations/components/__tests__/ConceptLinksApprovals.spec.js +77 -0
- package/src/concepts/relations/components/__tests__/ConceptLinksApprovalsLabelResults.spec.js +46 -0
- package/src/concepts/relations/components/__tests__/ConceptLinksApprovalsRow.spec.js +68 -0
- package/src/concepts/relations/components/__tests__/ConceptLinksApprovalsTable.spec.js +107 -0
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptImplementationLinks.spec.js.snap +32 -32
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptLinksApprovalResults.spec.js.snap +217 -0
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptLinksApprovals.spec.js.snap +559 -0
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptLinksApprovalsLabelResults.spec.js.snap +34 -0
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptLinksApprovalsRow.spec.js.snap +47 -0
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptLinksApprovalsTable.spec.js.snap +132 -0
- package/src/concepts/relations/hooks/useLinks.js +25 -0
- package/src/concepts/relations/selectors/getLinksSearchColumns.js +106 -0
- package/src/concepts/relations/selectors/index.js +2 -0
- package/src/concepts/relations/styles/ConceptLinksApprovals.less +15 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`ConceptLinksApprovalsTable matches the latest snapshot while loading 1`] = `<div />`;
|
|
4
|
+
|
|
5
|
+
exports[`ConceptLinksApprovalsTable matches the latest snapshot with data 1`] = `
|
|
6
|
+
<div>
|
|
7
|
+
<table
|
|
8
|
+
class="ui selectable sortable table"
|
|
9
|
+
>
|
|
10
|
+
<thead
|
|
11
|
+
class=""
|
|
12
|
+
>
|
|
13
|
+
<tr
|
|
14
|
+
class=""
|
|
15
|
+
>
|
|
16
|
+
<th
|
|
17
|
+
class="center aligned"
|
|
18
|
+
>
|
|
19
|
+
<div
|
|
20
|
+
class="ui fitted checkbox"
|
|
21
|
+
>
|
|
22
|
+
<input
|
|
23
|
+
class="hidden"
|
|
24
|
+
id="selectLink"
|
|
25
|
+
readonly=""
|
|
26
|
+
tabindex="0"
|
|
27
|
+
type="checkbox"
|
|
28
|
+
/>
|
|
29
|
+
<label
|
|
30
|
+
for="selectLink"
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
</th>
|
|
34
|
+
<th
|
|
35
|
+
class="four wide disabled"
|
|
36
|
+
>
|
|
37
|
+
source_name
|
|
38
|
+
</th>
|
|
39
|
+
<th
|
|
40
|
+
class="four wide disabled"
|
|
41
|
+
>
|
|
42
|
+
target_name
|
|
43
|
+
</th>
|
|
44
|
+
<th
|
|
45
|
+
class="two wide disabled"
|
|
46
|
+
>
|
|
47
|
+
tag_type
|
|
48
|
+
</th>
|
|
49
|
+
<th
|
|
50
|
+
class="two wide disabled"
|
|
51
|
+
>
|
|
52
|
+
status
|
|
53
|
+
</th>
|
|
54
|
+
<th
|
|
55
|
+
class="two wide disabled"
|
|
56
|
+
>
|
|
57
|
+
updated_at
|
|
58
|
+
</th>
|
|
59
|
+
</tr>
|
|
60
|
+
</thead>
|
|
61
|
+
<tbody
|
|
62
|
+
class=""
|
|
63
|
+
>
|
|
64
|
+
<tr
|
|
65
|
+
class=""
|
|
66
|
+
>
|
|
67
|
+
<td
|
|
68
|
+
class="collapsing center aligned one wide"
|
|
69
|
+
>
|
|
70
|
+
<div
|
|
71
|
+
class="ui fitted checkbox"
|
|
72
|
+
>
|
|
73
|
+
<input
|
|
74
|
+
class="hidden"
|
|
75
|
+
id="1"
|
|
76
|
+
readonly=""
|
|
77
|
+
tabindex="0"
|
|
78
|
+
type="checkbox"
|
|
79
|
+
/>
|
|
80
|
+
<label
|
|
81
|
+
for="1"
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
</td>
|
|
85
|
+
<td
|
|
86
|
+
class=""
|
|
87
|
+
>
|
|
88
|
+
Concept 1
|
|
89
|
+
</td>
|
|
90
|
+
<td
|
|
91
|
+
class=""
|
|
92
|
+
>
|
|
93
|
+
Structure 1
|
|
94
|
+
</td>
|
|
95
|
+
<td
|
|
96
|
+
class=""
|
|
97
|
+
>
|
|
98
|
+
relates_to
|
|
99
|
+
</td>
|
|
100
|
+
<td
|
|
101
|
+
class=""
|
|
102
|
+
>
|
|
103
|
+
pending
|
|
104
|
+
</td>
|
|
105
|
+
<td
|
|
106
|
+
class=""
|
|
107
|
+
>
|
|
108
|
+
2023-01-01
|
|
109
|
+
</td>
|
|
110
|
+
</tr>
|
|
111
|
+
</tbody>
|
|
112
|
+
</table>
|
|
113
|
+
</div>
|
|
114
|
+
`;
|
|
115
|
+
|
|
116
|
+
exports[`ConceptLinksApprovalsTable matches the latest snapshot with empty data 1`] = `
|
|
117
|
+
<div>
|
|
118
|
+
<h4
|
|
119
|
+
class="ui header"
|
|
120
|
+
>
|
|
121
|
+
<i
|
|
122
|
+
aria-hidden="true"
|
|
123
|
+
class="search icon"
|
|
124
|
+
/>
|
|
125
|
+
<div
|
|
126
|
+
class="content"
|
|
127
|
+
>
|
|
128
|
+
conceptRelations.approvals.links.empty
|
|
129
|
+
</div>
|
|
130
|
+
</h4>
|
|
131
|
+
</div>
|
|
132
|
+
`;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import useSWRMutations from "swr/mutation";
|
|
2
|
+
import { apiJsonPost } from "@truedat/core/services/api";
|
|
3
|
+
import {
|
|
4
|
+
API_RELATIONS_SEARCH,
|
|
5
|
+
API_RELATIONS_FILTERS,
|
|
6
|
+
API_RELATIONS_BULK_UPDATE_STATUS,
|
|
7
|
+
} from "../api";
|
|
8
|
+
|
|
9
|
+
export const useLinksBulkUpdateStatus = () => {
|
|
10
|
+
return useSWRMutations(API_RELATIONS_BULK_UPDATE_STATUS, (url, { arg }) =>
|
|
11
|
+
apiJsonPost(url, arg)
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const useLinksSearch = () => {
|
|
16
|
+
return useSWRMutations(API_RELATIONS_SEARCH, (url, { arg }) =>
|
|
17
|
+
apiJsonPost(url, arg)
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const useLinksFilters = () => {
|
|
22
|
+
return useSWRMutations(API_RELATIONS_FILTERS, (url, { arg }) =>
|
|
23
|
+
apiJsonPost(url, arg)
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import { Header, Icon, Popup } from "semantic-ui-react";
|
|
3
|
+
import { createSelector } from "reselect";
|
|
4
|
+
import { linkTo } from "@truedat/core/routes";
|
|
5
|
+
import { Link } from "react-router";
|
|
6
|
+
import { useIntl } from "react-intl";
|
|
7
|
+
import PropTypes, { node } from "prop-types";
|
|
8
|
+
import Moment from "react-moment";
|
|
9
|
+
|
|
10
|
+
const DateDecorator = ({ date }) => {
|
|
11
|
+
const { locale } = useIntl();
|
|
12
|
+
return date ? (
|
|
13
|
+
<Moment locale={locale} date={date} format="YYYY-MM-DD HH:mm" />
|
|
14
|
+
) : null;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
DateDecorator.propTypes = {
|
|
18
|
+
date: PropTypes.string,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const StatusDecorator = ({ status }) => {
|
|
22
|
+
const { formatMessage } = useIntl();
|
|
23
|
+
return status ? (
|
|
24
|
+
<>{formatMessage({ id: `conceptRelations.approvals.status.${status}` })}</>
|
|
25
|
+
) : null;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
StatusDecorator.propTypes = {
|
|
29
|
+
status: PropTypes.string,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const nodeDecorator = ({ link, nodeRole }) => {
|
|
33
|
+
const nodeData = _.flow(
|
|
34
|
+
(link) =>
|
|
35
|
+
nodeRole === "source"
|
|
36
|
+
? _.pick(["source_type", "source_id", "source_name"])(link)
|
|
37
|
+
: _.pick(["target_type", "target_id", "target_name"])(link),
|
|
38
|
+
(obj) => ({
|
|
39
|
+
type: obj[`${nodeRole}_type`],
|
|
40
|
+
id: obj[`${nodeRole}_id`],
|
|
41
|
+
name: obj[`${nodeRole}_name`],
|
|
42
|
+
})
|
|
43
|
+
)(link);
|
|
44
|
+
|
|
45
|
+
const linkToNode =
|
|
46
|
+
nodeData.type === "business_concept"
|
|
47
|
+
? linkTo.CONCEPT_VERSION({
|
|
48
|
+
business_concept_id: nodeData.id,
|
|
49
|
+
id: "current",
|
|
50
|
+
})
|
|
51
|
+
: linkTo.STRUCTURE({
|
|
52
|
+
id: nodeData.id,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<Link onClick={(e) => e.stopPropagation()} to={linkToNode}>
|
|
57
|
+
{nodeData.name}
|
|
58
|
+
</Link>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const defaultLinksSearchTableColumns = [
|
|
63
|
+
{
|
|
64
|
+
name: "source_name",
|
|
65
|
+
sort: { name: "source_name.sort" },
|
|
66
|
+
fieldSelector: (link) => ({ link, nodeRole: "source" }),
|
|
67
|
+
fieldDecorator: nodeDecorator,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "tag_type",
|
|
71
|
+
sort: { name: "tag_type.sort" },
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "target_name",
|
|
75
|
+
sort: { name: "target_name.sort" },
|
|
76
|
+
fieldSelector: (link) => ({ link, nodeRole: "target" }),
|
|
77
|
+
fieldDecorator: nodeDecorator,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "status",
|
|
81
|
+
sort: { name: "status" },
|
|
82
|
+
fieldSelector: (link) => link,
|
|
83
|
+
fieldDecorator: StatusDecorator,
|
|
84
|
+
width: 2,
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
{
|
|
88
|
+
name: "updated_at",
|
|
89
|
+
sort: { name: "updated_at" },
|
|
90
|
+
fieldSelector: (link) => ({
|
|
91
|
+
date: link?.updated_at,
|
|
92
|
+
}),
|
|
93
|
+
fieldDecorator: DateDecorator,
|
|
94
|
+
textAlign: "center",
|
|
95
|
+
width: 2,
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
export const getLinksSearchColumns = createSelector(
|
|
100
|
+
[_.prop("linksSearchColumns")],
|
|
101
|
+
(linksSearchColumns) => {
|
|
102
|
+
return _.flow(_.defaultTo(defaultLinksSearchTableColumns))(
|
|
103
|
+
linksSearchColumns
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
);
|