@truedat/dd 8.8.6 → 8.8.7
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "8.8.
|
|
3
|
+
"version": "8.8.7",
|
|
4
4
|
"description": "Truedat Web Data Dictionary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@testing-library/jest-dom": "^6.6.3",
|
|
52
52
|
"@testing-library/react": "^16.3.0",
|
|
53
53
|
"@testing-library/user-event": "^14.6.1",
|
|
54
|
-
"@truedat/test": "8.8.
|
|
54
|
+
"@truedat/test": "8.8.7",
|
|
55
55
|
"identity-obj-proxy": "^3.0.0",
|
|
56
56
|
"jest": "^29.7.0",
|
|
57
57
|
"redux-saga-test-plan": "^4.0.6"
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"svg-pan-zoom": "^3.6.2",
|
|
87
87
|
"swr": "^2.3.3"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "ece3f2e166776ff7827198a134bad5a28b029dc7"
|
|
90
90
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import { Button, Checkbox, Form, Header } from "semantic-ui-react";
|
|
3
|
+
import { Button, Checkbox, Form, Header, Icon } from "semantic-ui-react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { connect } from "react-redux";
|
|
@@ -17,18 +17,61 @@ export const EditDomainForm = ({
|
|
|
17
17
|
const { formatMessage } = useIntl();
|
|
18
18
|
const [domainIds, setDomainIds] = useState(structure?.domain_ids || []);
|
|
19
19
|
const [inherit, setInherit] = useState(true);
|
|
20
|
+
const [showConfirm, setShowConfirm] = useState(false);
|
|
20
21
|
|
|
21
|
-
const
|
|
22
|
+
const doUpdate = () => {
|
|
22
23
|
const data_structure = { id: structure.id, domain_ids: domainIds };
|
|
23
|
-
|
|
24
24
|
updateStructure({ data_structure, inherit });
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
const onSubmit = () => {
|
|
28
|
+
if (inherit) {
|
|
29
|
+
setShowConfirm(true);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
doUpdate();
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const handleConfirm = () => {
|
|
36
|
+
setShowConfirm(false);
|
|
37
|
+
doUpdate();
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const handleCancel = () => {
|
|
41
|
+
setShowConfirm(false);
|
|
42
|
+
};
|
|
43
|
+
|
|
27
44
|
const handleReset = () => {
|
|
28
45
|
setDomainIds(structure?.domain_ids || []);
|
|
29
46
|
setInherit(true);
|
|
30
47
|
};
|
|
31
48
|
|
|
49
|
+
if (showConfirm) {
|
|
50
|
+
return (
|
|
51
|
+
<div className="edit-domain-form">
|
|
52
|
+
<div className="confirm-content">
|
|
53
|
+
<div className="confirm-icon pulse-warning">
|
|
54
|
+
<Icon name="exclamation triangle" />
|
|
55
|
+
</div>
|
|
56
|
+
<p className="confirm-message">
|
|
57
|
+
{formatMessage(
|
|
58
|
+
{ id: "structure.edit_domain.confirm_inherit" },
|
|
59
|
+
{ name: <b>{structure.name}</b> },
|
|
60
|
+
)}
|
|
61
|
+
</p>
|
|
62
|
+
<div className="confirm-actions">
|
|
63
|
+
<Button type="button" size="tiny" onClick={handleCancel}>
|
|
64
|
+
{formatMessage({ id: "structure.edit_domain.close" })}
|
|
65
|
+
</Button>
|
|
66
|
+
<Button type="button" primary size="tiny" onClick={handleConfirm}>
|
|
67
|
+
{formatMessage({ id: "structureDomain.actions.update" })}
|
|
68
|
+
</Button>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
32
75
|
return (
|
|
33
76
|
<div className="edit-domain-form">
|
|
34
77
|
<div className="header-wrapper">
|
|
@@ -79,6 +122,7 @@ export const EditDomainForm = ({
|
|
|
79
122
|
type="button"
|
|
80
123
|
secondary
|
|
81
124
|
size="tiny"
|
|
125
|
+
disabled={_.isEqual(domainIds, structure?.domain_ids)}
|
|
82
126
|
content={formatMessage({ id: "structure.edit_domain.reset" })}
|
|
83
127
|
onClick={handleReset}
|
|
84
128
|
/>
|
|
@@ -88,7 +132,7 @@ export const EditDomainForm = ({
|
|
|
88
132
|
disabled={
|
|
89
133
|
saving ||
|
|
90
134
|
_.isEmpty(domainIds) ||
|
|
91
|
-
domainIds
|
|
135
|
+
_.isEqual(domainIds, structure?.domain_ids)
|
|
92
136
|
}
|
|
93
137
|
primary
|
|
94
138
|
content={formatMessage({ id: "structureDomain.actions.update" })}
|
|
@@ -108,7 +152,7 @@ EditDomainForm.propTypes = {
|
|
|
108
152
|
};
|
|
109
153
|
|
|
110
154
|
const mapStateToProps = ({ structure, structureUpdating }) => ({
|
|
111
|
-
structure: _.pick(["id", "domain_ids"])(structure),
|
|
155
|
+
structure: _.pick(["id", "domain_ids", "name"])(structure),
|
|
112
156
|
saving: structureUpdating,
|
|
113
157
|
});
|
|
114
158
|
|
|
@@ -49,7 +49,7 @@ describe("<EditDomainForm />", () => {
|
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
it("invokes function when send button clicked", async () => {
|
|
52
|
+
it("invokes function when send button clicked and confirm modal confirmed", async () => {
|
|
53
53
|
const rendered = render(<EditDomainForm {...props} />, renderOpts);
|
|
54
54
|
await waitForLoad(rendered);
|
|
55
55
|
|
|
@@ -63,6 +63,13 @@ describe("<EditDomainForm />", () => {
|
|
|
63
63
|
expect(button).not.toBeDisabled();
|
|
64
64
|
});
|
|
65
65
|
userEvent.click(button);
|
|
66
|
+
await waitFor(() => {
|
|
67
|
+
expect(
|
|
68
|
+
rendered.getByText("structure.edit_domain.confirm_inherit"),
|
|
69
|
+
).toBeInTheDocument();
|
|
70
|
+
});
|
|
71
|
+
const confirmButton = rendered.getByRole("button", { name: /update/i });
|
|
72
|
+
userEvent.click(confirmButton);
|
|
66
73
|
await waitFor(() => {
|
|
67
74
|
expect(updateStructure.mock.calls.length).toBe(1);
|
|
68
75
|
});
|
|
@@ -100,7 +107,7 @@ describe("<EditDomainForm />", () => {
|
|
|
100
107
|
);
|
|
101
108
|
});
|
|
102
109
|
|
|
103
|
-
it("send selected multiple domain ids when button clicked", async () => {
|
|
110
|
+
it("send selected multiple domain ids when button clicked and confirm modal confirmed", async () => {
|
|
104
111
|
const rendered = render(<EditDomainForm {...props} />, renderOpts);
|
|
105
112
|
await waitForLoad(rendered);
|
|
106
113
|
|
|
@@ -115,6 +122,13 @@ describe("<EditDomainForm />", () => {
|
|
|
115
122
|
expect(button).not.toBeDisabled();
|
|
116
123
|
});
|
|
117
124
|
userEvent.click(button);
|
|
125
|
+
await waitFor(() => {
|
|
126
|
+
expect(
|
|
127
|
+
rendered.getByText("structure.edit_domain.confirm_inherit"),
|
|
128
|
+
).toBeInTheDocument();
|
|
129
|
+
});
|
|
130
|
+
const confirmButton = rendered.getByRole("button", { name: /update/i });
|
|
131
|
+
userEvent.click(confirmButton);
|
|
118
132
|
await waitFor(() => {
|
|
119
133
|
expect(updateStructure.mock.calls.length).toBe(1);
|
|
120
134
|
});
|
|
@@ -75,3 +75,53 @@
|
|
|
75
75
|
background: #f8fafc;
|
|
76
76
|
margin: 1.5rem -1.5rem -1.5rem;
|
|
77
77
|
}
|
|
78
|
+
|
|
79
|
+
.edit-domain-form .footer-actions .button,
|
|
80
|
+
.edit-domain-form .confirm-actions .button {
|
|
81
|
+
max-width: 120px;
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
text-overflow: ellipsis;
|
|
84
|
+
white-space: nowrap;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.edit-domain-form .confirm-content {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
align-items: center;
|
|
91
|
+
justify-content: center;
|
|
92
|
+
padding: 2.5rem 1.5rem 2rem;
|
|
93
|
+
text-align: center;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.edit-domain-form .confirm-icon {
|
|
97
|
+
font-size: 2.5rem;
|
|
98
|
+
color: #f59e0b;
|
|
99
|
+
margin-bottom: 1rem;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.edit-domain-form .confirm-message {
|
|
103
|
+
font-size: 0.9rem;
|
|
104
|
+
color: #334155;
|
|
105
|
+
margin: 0 0 1.5rem;
|
|
106
|
+
line-height: 1.5;
|
|
107
|
+
font-weight: 500;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.edit-domain-form .confirm-actions {
|
|
111
|
+
display: flex;
|
|
112
|
+
gap: 0.75rem;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@keyframes pulse-warning {
|
|
116
|
+
0%,
|
|
117
|
+
100% {
|
|
118
|
+
transform: scale(1);
|
|
119
|
+
}
|
|
120
|
+
50% {
|
|
121
|
+
transform: scale(1.25);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.confirm-icon.pulse-warning i {
|
|
126
|
+
animation: pulse-warning 0.9s ease-in-out 2;
|
|
127
|
+
}
|