@truedat/auth 6.14.0 → 6.14.2
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 +4 -4
- package/src/groups/components/Group.js +9 -2
- package/src/groups/components/NewGroup.js +25 -17
- package/src/groups/components/__tests__/Group.spec.js +10 -6
- package/src/groups/components/__tests__/__snapshots__/Group.spec.js.snap +55 -46
- package/src/roles/components/NewRole.js +20 -12
- package/src/roles/components/Role.js +17 -4
- package/src/roles/components/Roles.js +31 -22
- package/src/roles/components/__tests__/Role.spec.js +8 -4
- package/src/roles/components/__tests__/__snapshots__/Role.spec.js.snap +53 -73
- package/src/users/components/Password.js +8 -3
- package/src/users/components/User.js +12 -4
- package/src/users/components/UsersAndGroups.js +29 -20
- package/src/users/components/__tests__/User.spec.js +9 -6
- package/src/users/components/__tests__/UsersAndGroups.spec.js +3 -3
- package/src/users/components/__tests__/__snapshots__/User.spec.js.snap +108 -39
- package/src/users/components/__tests__/__snapshots__/UsersAndGroups.spec.js.snap +41 -36
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/auth",
|
|
3
|
-
"version": "6.14.
|
|
3
|
+
"version": "6.14.2",
|
|
4
4
|
"description": "Truedat Web Auth",
|
|
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": "6.
|
|
37
|
+
"@truedat/test": "6.14.2",
|
|
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,7 +86,7 @@
|
|
|
86
86
|
]
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@truedat/core": "6.14.
|
|
89
|
+
"@truedat/core": "6.14.2",
|
|
90
90
|
"auth0-js": "9.23.3",
|
|
91
91
|
"decode-uri-component": "^0.2.2",
|
|
92
92
|
"jwt-decode": "^2.2.0",
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
"react-dom": ">= 16.8.6 < 17",
|
|
110
110
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
111
111
|
},
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "753c6b170d39f136f655db597c695e4de3526615"
|
|
113
113
|
}
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { connect } from "react-redux";
|
|
4
4
|
import { Header, Button, Icon, Grid } from "semantic-ui-react";
|
|
5
|
-
import { FormattedMessage } from "react-intl";
|
|
5
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
6
6
|
import { ConfirmModal, GroupActions } from "@truedat/core/components";
|
|
7
7
|
import { deleteGroup } from "../routines";
|
|
8
8
|
|
|
@@ -36,6 +36,7 @@ ModalDelete.propTypes = {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
export const Group = ({ group, groupLoading, deleteGroup }) => {
|
|
39
|
+
const { formatMessage } = useIntl();
|
|
39
40
|
if (groupLoading || !group.id) return null;
|
|
40
41
|
const actions = [
|
|
41
42
|
{
|
|
@@ -54,7 +55,13 @@ export const Group = ({ group, groupLoading, deleteGroup }) => {
|
|
|
54
55
|
<Grid>
|
|
55
56
|
<Grid.Column width={12}>
|
|
56
57
|
<Header as="h2">
|
|
57
|
-
<Icon
|
|
58
|
+
<Icon
|
|
59
|
+
circular
|
|
60
|
+
name={formatMessage({
|
|
61
|
+
id: "group.header.icon",
|
|
62
|
+
defaultMessage: "users",
|
|
63
|
+
})}
|
|
64
|
+
/>
|
|
58
65
|
<Header.Content>
|
|
59
66
|
{group.name}{" "}
|
|
60
67
|
<Header.Subheader>{group.description}</Header.Subheader>
|
|
@@ -2,28 +2,36 @@ import React from "react";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { Header, Icon, Container, Segment } from "semantic-ui-react";
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
|
-
import { FormattedMessage } from "react-intl";
|
|
5
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
6
6
|
import { createGroup } from "../routines";
|
|
7
7
|
import GroupForm from "./GroupForm";
|
|
8
8
|
import GroupBreadcrumbs from "./GroupBreadcrumbs";
|
|
9
9
|
|
|
10
|
-
const NewGroup = ({ createGroup }) =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
<Header
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
const NewGroup = ({ createGroup }) => {
|
|
11
|
+
const { formatMessage } = useIntl();
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<GroupBreadcrumbs name="groups.actions.create" />
|
|
15
|
+
<Container text as={Segment}>
|
|
16
|
+
<Header as="h2">
|
|
17
|
+
<Icon
|
|
18
|
+
name={formatMessage({
|
|
19
|
+
id: "group.header.icon",
|
|
20
|
+
defaultMessage: "users",
|
|
21
|
+
})}
|
|
20
22
|
/>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
<Header.Content>
|
|
24
|
+
<FormattedMessage
|
|
25
|
+
id="groups.actions.create"
|
|
26
|
+
defaultMessage="New group"
|
|
27
|
+
/>
|
|
28
|
+
</Header.Content>
|
|
29
|
+
</Header>
|
|
30
|
+
<GroupForm onSubmit={createGroup} />
|
|
31
|
+
</Container>
|
|
32
|
+
</>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
27
35
|
|
|
28
36
|
NewGroup.propTypes = {
|
|
29
37
|
createGroup: PropTypes.func,
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import Group from "../Group";
|
|
4
|
+
|
|
5
|
+
const group = { id: 2, name: "grupo1 ", description: "aaa bbb cc" };
|
|
6
|
+
|
|
7
|
+
const renderOpts = {
|
|
8
|
+
state: { group, deleteGroup: jest.fn() },
|
|
9
|
+
};
|
|
4
10
|
|
|
5
11
|
describe("<Group />", () => {
|
|
6
12
|
it("matches the latest snapshot", () => {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const wrapper = shallow(<Group {...props} />);
|
|
10
|
-
expect(wrapper).toMatchSnapshot();
|
|
13
|
+
const { container } = render(<Group />, renderOpts);
|
|
14
|
+
expect(container).toMatchSnapshot();
|
|
11
15
|
});
|
|
12
16
|
});
|
|
@@ -1,52 +1,61 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<Group /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="ui grid"
|
|
7
7
|
>
|
|
8
|
-
<
|
|
9
|
-
|
|
8
|
+
<div
|
|
9
|
+
class="twelve wide column"
|
|
10
10
|
>
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
11
|
+
<h2
|
|
12
|
+
class="ui header"
|
|
13
|
+
>
|
|
14
|
+
<i
|
|
15
|
+
aria-hidden="true"
|
|
16
|
+
class="users circular icon"
|
|
17
|
+
/>
|
|
18
|
+
<div
|
|
19
|
+
class="content"
|
|
20
|
+
>
|
|
21
|
+
grupo1
|
|
22
|
+
|
|
23
|
+
<div
|
|
24
|
+
class="sub header"
|
|
25
|
+
>
|
|
26
|
+
aaa bbb cc
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</h2>
|
|
30
|
+
</div>
|
|
31
|
+
<div
|
|
32
|
+
class="right aligned four wide column"
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
aria-expanded="false"
|
|
36
|
+
class="ui floating dropdown button icon group-actions"
|
|
37
|
+
role="listbox"
|
|
38
|
+
tabindex="0"
|
|
39
|
+
>
|
|
40
|
+
<i
|
|
41
|
+
aria-hidden="true"
|
|
42
|
+
class="ellipsis vertical icon"
|
|
43
|
+
/>
|
|
44
|
+
<div
|
|
45
|
+
class="left menu transition"
|
|
46
|
+
>
|
|
47
|
+
<button
|
|
48
|
+
class="ui button"
|
|
49
|
+
>
|
|
50
|
+
<i
|
|
51
|
+
aria-hidden="true"
|
|
52
|
+
class="trash icon"
|
|
53
|
+
/>
|
|
54
|
+
Delete
|
|
55
|
+
</button>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
52
61
|
`;
|
|
@@ -2,21 +2,29 @@ import React from "react";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { Header, Icon, Container, Segment } from "semantic-ui-react";
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
|
-
import { FormattedMessage } from "react-intl";
|
|
5
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
6
6
|
import { createRole } from "../routines";
|
|
7
7
|
import RoleForm from "./RoleForm";
|
|
8
8
|
|
|
9
|
-
const NewRole = ({ createRole }) =>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<Header
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
const NewRole = ({ createRole }) => {
|
|
10
|
+
const { formatMessage } = useIntl();
|
|
11
|
+
return (
|
|
12
|
+
<Container text as={Segment}>
|
|
13
|
+
<Header as="h2">
|
|
14
|
+
<Icon
|
|
15
|
+
name={formatMessage({
|
|
16
|
+
id: "role.header.icon",
|
|
17
|
+
defaultMessage: "student",
|
|
18
|
+
})}
|
|
19
|
+
/>
|
|
20
|
+
<Header.Content>
|
|
21
|
+
<FormattedMessage id="role.new.role" />
|
|
22
|
+
</Header.Content>
|
|
23
|
+
</Header>
|
|
24
|
+
<RoleForm onSubmit={createRole} />
|
|
25
|
+
</Container>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
20
28
|
|
|
21
29
|
NewRole.propTypes = {
|
|
22
30
|
createRole: PropTypes.func,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { FormattedMessage } from "react-intl";
|
|
4
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
5
5
|
import { Link } from "react-router-dom";
|
|
6
6
|
import { connect } from "react-redux";
|
|
7
7
|
import {
|
|
@@ -60,8 +60,15 @@ class RoleName extends React.Component {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export const Role = ({
|
|
64
|
-
id
|
|
63
|
+
export const Role = ({
|
|
64
|
+
id,
|
|
65
|
+
name,
|
|
66
|
+
is_default,
|
|
67
|
+
permissionGroups,
|
|
68
|
+
updateRole,
|
|
69
|
+
}) => {
|
|
70
|
+
const { formatMessage } = useIntl();
|
|
71
|
+
return id && permissionGroups ? (
|
|
65
72
|
<>
|
|
66
73
|
<Breadcrumb>
|
|
67
74
|
<Breadcrumb.Section as={Link} to={ROLES} active={false}>
|
|
@@ -72,7 +79,12 @@ export const Role = ({ id, name, is_default, permissionGroups, updateRole }) =>
|
|
|
72
79
|
</Breadcrumb>
|
|
73
80
|
<Segment>
|
|
74
81
|
<Header as="h2">
|
|
75
|
-
<Icon
|
|
82
|
+
<Icon
|
|
83
|
+
name={formatMessage({
|
|
84
|
+
id: "role.header.icon",
|
|
85
|
+
defaultMessage: "student",
|
|
86
|
+
})}
|
|
87
|
+
/>
|
|
76
88
|
<Header.Content>
|
|
77
89
|
<RoleName
|
|
78
90
|
name={name}
|
|
@@ -102,6 +114,7 @@ export const Role = ({ id, name, is_default, permissionGroups, updateRole }) =>
|
|
|
102
114
|
</Segment>
|
|
103
115
|
</>
|
|
104
116
|
) : null;
|
|
117
|
+
};
|
|
105
118
|
|
|
106
119
|
Role.propTypes = {
|
|
107
120
|
id: PropTypes.number,
|
|
@@ -2,33 +2,42 @@ import React from "react";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { connect } from "react-redux";
|
|
4
4
|
import { Button, Header, Segment, Icon } from "semantic-ui-react";
|
|
5
|
-
import { FormattedMessage } from "react-intl";
|
|
5
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
6
6
|
import { Link } from "react-router-dom";
|
|
7
7
|
import { linkTo } from "@truedat/core/routes";
|
|
8
8
|
import RoleCards from "./RoleCards";
|
|
9
9
|
|
|
10
|
-
export const Roles = ({ roles, rolesLoading }) =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
10
|
+
export const Roles = ({ roles, rolesLoading }) => {
|
|
11
|
+
const { formatMessage } = useIntl();
|
|
12
|
+
return (
|
|
13
|
+
<Segment loading={rolesLoading}>
|
|
14
|
+
<Header as="h2">
|
|
15
|
+
<Button
|
|
16
|
+
primary
|
|
17
|
+
floated="right"
|
|
18
|
+
as={Link}
|
|
19
|
+
to={linkTo.ROLES_NEW()}
|
|
20
|
+
content={<FormattedMessage id="roles.create" />}
|
|
21
|
+
/>
|
|
22
|
+
<Icon
|
|
23
|
+
circular
|
|
24
|
+
name={formatMessage({
|
|
25
|
+
id: "roles.header.icon",
|
|
26
|
+
defaultMessage: "student",
|
|
27
|
+
})}
|
|
28
|
+
/>
|
|
29
|
+
<Header.Content>
|
|
30
|
+
<FormattedMessage id="roles.header" />
|
|
31
|
+
<Header.Subheader>
|
|
32
|
+
<FormattedMessage id="roles.subheader" />
|
|
33
|
+
</Header.Subheader>
|
|
34
|
+
</Header.Content>
|
|
35
|
+
</Header>
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
);
|
|
37
|
+
<RoleCards roles={roles} />
|
|
38
|
+
</Segment>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
32
41
|
|
|
33
42
|
Roles.propTypes = {
|
|
34
43
|
roles: PropTypes.array,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import Role from "../Role";
|
|
4
|
+
|
|
5
|
+
const renderOpts = {
|
|
6
|
+
state: { deleteRole: jest.fn(), updateRole: jest.fn() },
|
|
7
|
+
};
|
|
4
8
|
|
|
5
9
|
describe("<Role />", () => {
|
|
6
10
|
const id = 1;
|
|
@@ -10,7 +14,7 @@ describe("<Role />", () => {
|
|
|
10
14
|
const props = { id, name, rolePermissions, permissionGroups };
|
|
11
15
|
|
|
12
16
|
it("matches the latest snapshot", () => {
|
|
13
|
-
const
|
|
14
|
-
expect(
|
|
17
|
+
const { container } = render(<Role {...props} />, renderOpts);
|
|
18
|
+
expect(container).toMatchSnapshot();
|
|
15
19
|
});
|
|
16
20
|
});
|
|
@@ -1,83 +1,63 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<Role /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"displayName": "Link",
|
|
12
|
-
"propTypes": {
|
|
13
|
-
"innerRef": [Function],
|
|
14
|
-
"onClick": [Function],
|
|
15
|
-
"replace": [Function],
|
|
16
|
-
"target": [Function],
|
|
17
|
-
"to": [Function],
|
|
18
|
-
},
|
|
19
|
-
"render": [Function],
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
to="/roles"
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="ui breadcrumb"
|
|
7
|
+
>
|
|
8
|
+
<a
|
|
9
|
+
class="section"
|
|
10
|
+
href="/roles"
|
|
23
11
|
>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
icon="right angle"
|
|
12
|
+
Roles
|
|
13
|
+
</a>
|
|
14
|
+
<i
|
|
15
|
+
aria-hidden="true"
|
|
16
|
+
class="right angle icon divider"
|
|
30
17
|
/>
|
|
31
|
-
<
|
|
32
|
-
active
|
|
18
|
+
<div
|
|
19
|
+
class="active section"
|
|
33
20
|
>
|
|
34
21
|
Data Steward
|
|
35
|
-
</
|
|
36
|
-
</
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
<div
|
|
25
|
+
class="ui segment"
|
|
26
|
+
>
|
|
27
|
+
<h2
|
|
28
|
+
class="ui header"
|
|
40
29
|
>
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
30
|
+
<i
|
|
31
|
+
aria-hidden="true"
|
|
32
|
+
class="student icon"
|
|
44
33
|
/>
|
|
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
|
-
"id": 1,
|
|
75
|
-
"name": "perm1",
|
|
76
|
-
},
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
roleId={1}
|
|
80
|
-
/>
|
|
81
|
-
</Segment>
|
|
82
|
-
</Fragment>
|
|
34
|
+
<div
|
|
35
|
+
class="content"
|
|
36
|
+
>
|
|
37
|
+
<span>
|
|
38
|
+
Data Steward
|
|
39
|
+
</span>
|
|
40
|
+
<div
|
|
41
|
+
class="sub header"
|
|
42
|
+
>
|
|
43
|
+
Role
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</h2>
|
|
47
|
+
<div
|
|
48
|
+
class="ui checkbox"
|
|
49
|
+
>
|
|
50
|
+
<input
|
|
51
|
+
class="hidden"
|
|
52
|
+
readonly=""
|
|
53
|
+
tabindex="0"
|
|
54
|
+
type="checkbox"
|
|
55
|
+
value=""
|
|
56
|
+
/>
|
|
57
|
+
<label>
|
|
58
|
+
Default
|
|
59
|
+
</label>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
83
63
|
`;
|
|
@@ -2,10 +2,9 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { Container, Header, Icon, Segment } from "semantic-ui-react";
|
|
5
|
-
import { FormattedMessage } from "react-intl";
|
|
5
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
6
6
|
import { connect } from "react-redux";
|
|
7
7
|
import { useForm, Controller } from "react-hook-form";
|
|
8
|
-
import { useIntl } from "react-intl";
|
|
9
8
|
import { Button, Form } from "semantic-ui-react";
|
|
10
9
|
import { HistoryBackButton } from "@truedat/core/components";
|
|
11
10
|
import { updatePassword } from "../routines";
|
|
@@ -50,7 +49,13 @@ export const Password = ({
|
|
|
50
49
|
return (
|
|
51
50
|
<Container text as={Segment}>
|
|
52
51
|
<Header as="h2">
|
|
53
|
-
<Icon
|
|
52
|
+
<Icon
|
|
53
|
+
circular
|
|
54
|
+
name={formatMessage({
|
|
55
|
+
id: "user.password.header.icon",
|
|
56
|
+
defaultMessage: "user",
|
|
57
|
+
})}
|
|
58
|
+
/>
|
|
54
59
|
<Header.Content>
|
|
55
60
|
{_.isEmpty(userName) ? (
|
|
56
61
|
<FormattedMessage id="user.password.header" />
|
|
@@ -3,21 +3,28 @@ import React from "react";
|
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { Divider, Header, Grid, Icon, Segment } from "semantic-ui-react";
|
|
5
5
|
import { connect } from "react-redux";
|
|
6
|
-
import { FormattedMessage } from "react-intl";
|
|
6
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
7
7
|
import UserActions from "./UserActions";
|
|
8
8
|
import UserAcls from "./UserAcls";
|
|
9
9
|
import UserBreadcrumbs from "./UserBreadcrumbs";
|
|
10
10
|
import UserGroupAcls from "./UserGroupAcls";
|
|
11
11
|
|
|
12
|
-
export const User = ({ user }) =>
|
|
13
|
-
|
|
12
|
+
export const User = ({ user }) => {
|
|
13
|
+
const { formatMessage } = useIntl();
|
|
14
|
+
return _.isEmpty(user) ? null : (
|
|
14
15
|
<>
|
|
15
16
|
<UserBreadcrumbs name={user.user_name} />
|
|
16
17
|
<Segment>
|
|
17
18
|
<Grid>
|
|
18
19
|
<Grid.Column width={8}>
|
|
19
20
|
<Header floated="left" as="h2">
|
|
20
|
-
<Icon
|
|
21
|
+
<Icon
|
|
22
|
+
circular
|
|
23
|
+
name={formatMessage({
|
|
24
|
+
id: "users.header.icon",
|
|
25
|
+
defaultMessage: "users",
|
|
26
|
+
})}
|
|
27
|
+
/>
|
|
21
28
|
<Header.Content>
|
|
22
29
|
{user.user_name}
|
|
23
30
|
<Header.Subheader>
|
|
@@ -43,6 +50,7 @@ export const User = ({ user }) =>
|
|
|
43
50
|
</Segment>
|
|
44
51
|
</>
|
|
45
52
|
);
|
|
53
|
+
};
|
|
46
54
|
|
|
47
55
|
User.propTypes = {
|
|
48
56
|
user: PropTypes.object,
|
|
@@ -2,32 +2,41 @@ import React from "react";
|
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
import { Route, Switch } from "react-router-dom";
|
|
4
4
|
import { Header, Icon, Segment } from "semantic-ui-react";
|
|
5
|
-
import { FormattedMessage } from "react-intl";
|
|
5
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
6
6
|
import { GROUPS, USERS } from "@truedat/core/routes";
|
|
7
7
|
import GroupCards from "../../groups/components/GroupCards";
|
|
8
8
|
import UserCards from "./UserCards";
|
|
9
9
|
import UserTabs from "./UserTabs";
|
|
10
10
|
|
|
11
|
-
export const UsersAndGroups = () =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<Header
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
11
|
+
export const UsersAndGroups = () => {
|
|
12
|
+
const { formatMessage } = useIntl();
|
|
13
|
+
return (
|
|
14
|
+
<Segment>
|
|
15
|
+
<Header as="h2">
|
|
16
|
+
<Icon
|
|
17
|
+
circular
|
|
18
|
+
name={formatMessage({
|
|
19
|
+
id: "users.header.icon",
|
|
20
|
+
defaultMessage: "users",
|
|
21
|
+
})}
|
|
22
|
+
/>
|
|
23
|
+
<Header.Content>
|
|
24
|
+
<FormattedMessage id="users.header" />
|
|
25
|
+
<Header.Subheader>
|
|
26
|
+
<FormattedMessage id="users.subheader" />
|
|
27
|
+
</Header.Subheader>
|
|
28
|
+
</Header.Content>
|
|
29
|
+
</Header>
|
|
30
|
+
<UserTabs />
|
|
31
|
+
<Segment attached="bottom">
|
|
32
|
+
<Switch>
|
|
33
|
+
<Route path={USERS} render={() => <UserCards />} exact />
|
|
34
|
+
<Route path={GROUPS} render={() => <GroupCards />} exact />
|
|
35
|
+
</Switch>
|
|
36
|
+
</Segment>
|
|
28
37
|
</Segment>
|
|
29
|
-
|
|
30
|
-
|
|
38
|
+
);
|
|
39
|
+
};
|
|
31
40
|
|
|
32
41
|
const mapStateToProps = ({ usersLoading }) => ({ usersLoading });
|
|
33
42
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import User from "../User";
|
|
4
4
|
|
|
5
5
|
describe("<User />", () => {
|
|
6
6
|
const user = {
|
|
@@ -8,12 +8,15 @@ describe("<User />", () => {
|
|
|
8
8
|
user_name: "joe",
|
|
9
9
|
role: "admin",
|
|
10
10
|
full_name: "Joe Bloggs",
|
|
11
|
-
email: "joe@bloggs.net"
|
|
11
|
+
email: "joe@bloggs.net",
|
|
12
|
+
};
|
|
13
|
+
const renderOpts = {
|
|
14
|
+
state: { user },
|
|
12
15
|
};
|
|
13
|
-
const props = { user };
|
|
14
16
|
|
|
15
17
|
it("matches the latest snapshot", () => {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
+
const { container, debug } = render(<User />, renderOpts);
|
|
19
|
+
debug();
|
|
20
|
+
expect(container).toMatchSnapshot();
|
|
18
21
|
});
|
|
19
22
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
3
|
import { UsersAndGroups } from "../UsersAndGroups";
|
|
4
4
|
|
|
5
5
|
describe("<UsersAndGroups />", () => {
|
|
6
6
|
it("matches the latest snapshot", () => {
|
|
7
|
-
const
|
|
8
|
-
expect(
|
|
7
|
+
const { container } = render(<UsersAndGroups />);
|
|
8
|
+
expect(container).toMatchSnapshot();
|
|
9
9
|
});
|
|
10
10
|
});
|
|
@@ -1,54 +1,123 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<User /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="ui breadcrumb"
|
|
7
|
+
>
|
|
8
|
+
<a
|
|
9
|
+
class="section"
|
|
10
|
+
href="/users"
|
|
11
|
+
>
|
|
12
|
+
Users
|
|
13
|
+
</a>
|
|
14
|
+
<i
|
|
15
|
+
aria-hidden="true"
|
|
16
|
+
class="right angle icon divider"
|
|
17
|
+
/>
|
|
18
|
+
<div
|
|
19
|
+
class="active section"
|
|
20
|
+
>
|
|
21
|
+
joe
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
<div
|
|
25
|
+
class="ui segment"
|
|
26
|
+
>
|
|
27
|
+
<div
|
|
28
|
+
class="ui grid"
|
|
29
|
+
>
|
|
30
|
+
<div
|
|
31
|
+
class="eight wide column"
|
|
12
32
|
>
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
floated="left"
|
|
33
|
+
<h2
|
|
34
|
+
class="ui left floated header"
|
|
16
35
|
>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
circular
|
|
20
|
-
name="user"
|
|
36
|
+
<i
|
|
37
|
+
aria-hidden="true"
|
|
38
|
+
class="users circular icon"
|
|
21
39
|
/>
|
|
22
|
-
<
|
|
40
|
+
<div
|
|
41
|
+
class="content"
|
|
42
|
+
>
|
|
23
43
|
joe
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</
|
|
29
|
-
</
|
|
30
|
-
</
|
|
31
|
-
</
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
width={8}
|
|
44
|
+
<div
|
|
45
|
+
class="sub header"
|
|
46
|
+
>
|
|
47
|
+
Administrator
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</h2>
|
|
51
|
+
</div>
|
|
52
|
+
<div
|
|
53
|
+
class="right aligned eight wide column"
|
|
35
54
|
>
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
55
|
+
<div
|
|
56
|
+
aria-expanded="false"
|
|
57
|
+
class="ui floating dropdown button icon group-actions"
|
|
58
|
+
role="listbox"
|
|
59
|
+
tabindex="0"
|
|
60
|
+
>
|
|
61
|
+
<i
|
|
62
|
+
aria-hidden="true"
|
|
63
|
+
class="ellipsis vertical icon"
|
|
64
|
+
/>
|
|
65
|
+
<div
|
|
66
|
+
class="left menu transition"
|
|
67
|
+
>
|
|
68
|
+
<a
|
|
69
|
+
aria-checked="false"
|
|
70
|
+
aria-selected="false"
|
|
71
|
+
class="item"
|
|
72
|
+
href="/users/1/edit"
|
|
73
|
+
role="option"
|
|
74
|
+
style="pointer-events: all;"
|
|
75
|
+
>
|
|
76
|
+
<i
|
|
77
|
+
aria-hidden="true"
|
|
78
|
+
class="edit icon"
|
|
79
|
+
/>
|
|
80
|
+
Edit
|
|
81
|
+
</a>
|
|
82
|
+
<a
|
|
83
|
+
aria-checked="false"
|
|
84
|
+
aria-selected="false"
|
|
85
|
+
class="item"
|
|
86
|
+
href="/users/1/password"
|
|
87
|
+
role="option"
|
|
88
|
+
style="pointer-events: all;"
|
|
89
|
+
>
|
|
90
|
+
<i
|
|
91
|
+
aria-hidden="true"
|
|
92
|
+
class="unlock alternate icon"
|
|
93
|
+
/>
|
|
94
|
+
Change password
|
|
95
|
+
</a>
|
|
96
|
+
<button
|
|
97
|
+
class="ui button"
|
|
98
|
+
>
|
|
99
|
+
<i
|
|
100
|
+
aria-hidden="true"
|
|
101
|
+
class="trash icon"
|
|
102
|
+
/>
|
|
103
|
+
Delete
|
|
104
|
+
</button>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
<div
|
|
109
|
+
class="eight wide column"
|
|
40
110
|
>
|
|
41
111
|
Joe Bloggs
|
|
42
112
|
<br />
|
|
43
113
|
joe@bloggs.net
|
|
44
114
|
<br />
|
|
45
|
-
|
|
46
|
-
|
|
115
|
+
|
|
116
|
+
<div
|
|
117
|
+
class="ui hidden divider"
|
|
47
118
|
/>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
</Segment>
|
|
53
|
-
</Fragment>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
54
123
|
`;
|
|
@@ -1,42 +1,47 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<UsersAndGroups /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="ui segment"
|
|
7
7
|
>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<MemoizedFormattedMessage
|
|
15
|
-
id="users.header"
|
|
16
|
-
/>
|
|
17
|
-
<HeaderSubheader>
|
|
18
|
-
<MemoizedFormattedMessage
|
|
19
|
-
id="users.subheader"
|
|
20
|
-
/>
|
|
21
|
-
</HeaderSubheader>
|
|
22
|
-
</HeaderContent>
|
|
23
|
-
</Header>
|
|
24
|
-
<UserTabs />
|
|
25
|
-
<Segment
|
|
26
|
-
attached="bottom"
|
|
27
|
-
>
|
|
28
|
-
<Switch>
|
|
29
|
-
<Route
|
|
30
|
-
exact={true}
|
|
31
|
-
path="/users"
|
|
32
|
-
render={[Function]}
|
|
8
|
+
<h2
|
|
9
|
+
class="ui header"
|
|
10
|
+
>
|
|
11
|
+
<i
|
|
12
|
+
aria-hidden="true"
|
|
13
|
+
class="users circular icon"
|
|
33
14
|
/>
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
15
|
+
<div
|
|
16
|
+
class="content"
|
|
17
|
+
>
|
|
18
|
+
Users
|
|
19
|
+
<div
|
|
20
|
+
class="sub header"
|
|
21
|
+
>
|
|
22
|
+
Manage users and groups
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</h2>
|
|
26
|
+
<div
|
|
27
|
+
class="ui pointing secondary top attached tabular menu"
|
|
28
|
+
>
|
|
29
|
+
<a
|
|
30
|
+
class="item"
|
|
31
|
+
href="/users"
|
|
32
|
+
>
|
|
33
|
+
Users
|
|
34
|
+
</a>
|
|
35
|
+
<a
|
|
36
|
+
class="item"
|
|
37
|
+
href="/groups"
|
|
38
|
+
>
|
|
39
|
+
Groups
|
|
40
|
+
</a>
|
|
41
|
+
</div>
|
|
42
|
+
<div
|
|
43
|
+
class="ui bottom attached segment"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
42
47
|
`;
|