@truedat/auth 7.5.9 → 7.5.11
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 +40 -64
- package/src/groups/components/EditGroup.js +0 -1
- package/src/groups/components/Group.js +0 -1
- package/src/groups/components/GroupBreadcrumbs.js +1 -2
- package/src/groups/components/GroupCard.js +3 -3
- package/src/groups/components/GroupCards.js +2 -3
- package/src/groups/components/GroupForm.js +0 -1
- package/src/groups/components/GroupLoader.js +19 -51
- package/src/groups/components/GroupUsers.js +4 -3
- package/src/groups/components/GroupUsersTable.js +4 -4
- package/src/groups/components/GroupsLoader.js +2 -2
- package/src/groups/components/GroupsSearchLoader.js +1 -1
- package/src/groups/components/NewGroup.js +0 -1
- package/src/groups/components/__tests__/Group.spec.js +0 -1
- package/src/groups/components/__tests__/GroupCard.spec.js +23 -7
- package/src/groups/components/__tests__/GroupCards.spec.js +9 -6
- package/src/groups/components/__tests__/GroupLoader.spec.js +71 -0
- package/src/groups/components/__tests__/GroupUsers.spec.js +8 -12
- package/src/groups/components/__tests__/GroupUsersTable.spec.js +34 -42
- package/src/groups/components/__tests__/GroupsSearchLoader.spec.js +0 -1
- package/src/groups/components/__tests__/__snapshots__/Group.spec.js.snap +1 -2
- package/src/groups/components/__tests__/__snapshots__/GroupCard.spec.js.snap +43 -94
- package/src/groups/components/__tests__/__snapshots__/GroupCards.spec.js.snap +118 -53
- package/src/groups/components/__tests__/__snapshots__/GroupLoader.spec.js.snap +11 -0
- package/src/groups/components/__tests__/__snapshots__/GroupUsers.spec.js.snap +38 -45
- package/src/groups/components/__tests__/__snapshots__/GroupUsersTable.spec.js.snap +121 -213
- package/src/groups/components/index.js +1 -1
- package/src/groups/sagas/__tests__/deleteGroupUser.spec.js +6 -6
- package/src/groups/sagas/deleteGroup.js +1 -1
- package/src/groups/sagas/deleteGroupUser.js +2 -2
- package/src/groups/sagas/fetchGroup.js +1 -1
- package/src/groups/sagas/updateGroup.js +1 -1
- package/src/roles/components/NewRole.js +0 -1
- package/src/roles/components/PermissionGroup.js +0 -1
- package/src/roles/components/Role.js +8 -3
- package/src/roles/components/RoleCards.js +2 -3
- package/src/roles/components/RoleForm.js +1 -1
- package/src/roles/components/RoleLoader.js +26 -39
- package/src/roles/components/RoleRoutes.js +29 -32
- package/src/roles/components/RoleSelector.js +0 -1
- package/src/roles/components/Roles.js +1 -3
- package/src/roles/components/RolesLoader.js +2 -2
- package/src/roles/components/__tests__/PermissionGroup.spec.js +7 -17
- package/src/roles/components/__tests__/Role.spec.js +0 -1
- package/src/roles/components/__tests__/RoleCards.spec.js +11 -10
- package/src/roles/components/__tests__/RoleRoutes.spec.js +53 -7
- package/src/roles/components/__tests__/RoleSelector.spec.js +0 -1
- package/src/roles/components/__tests__/Roles.spec.js +2 -3
- package/src/roles/components/__tests__/__snapshots__/PermissionGroup.spec.js.snap +3 -5
- package/src/roles/components/__tests__/__snapshots__/Role.spec.js.snap +4 -4
- package/src/roles/components/__tests__/__snapshots__/RoleCards.spec.js.snap +57 -127
- package/src/roles/components/__tests__/__snapshots__/RoleRoutes.spec.js.snap +38 -5
- package/src/roles/components/__tests__/__snapshots__/RoleSelector.spec.js.snap +1 -1
- package/src/roles/components/__tests__/__snapshots__/Roles.spec.js.snap +6 -3
- package/src/roles/components/index.js +1 -1
- package/src/roles/reducers/rolePermissions.js +1 -1
- package/src/roles/reducers/roleRedirect.js +1 -1
- package/src/roles/sagas/deleteRole.js +1 -1
- package/src/roles/sagas/fetchRole.js +1 -1
- package/src/roles/sagas/fetchRolePermissions.js +1 -1
- package/src/roles/sagas/updateRole.js +1 -1
- package/src/roles/sagas/updateRolePermissions.js +1 -1
- package/src/sessions/components/Auth0Callback.js +5 -4
- package/src/sessions/components/Auth0LoginButton.js +2 -2
- package/src/sessions/components/AuthMethodsLoader.js +10 -19
- package/src/sessions/components/LoginButtons.js +4 -4
- package/src/sessions/components/NonceCallback.js +21 -38
- package/src/sessions/components/OidcLoginButton.js +0 -1
- package/src/sessions/components/OpenIDConnect.js +5 -4
- package/src/sessions/components/PrivateRoute.js +25 -57
- package/src/sessions/components/ProxyLoginCallback.js +0 -2
- package/src/sessions/components/SamlCallback.js +0 -2
- package/src/sessions/components/UnauthorizedRoute.js +28 -31
- package/src/sessions/components/__tests__/Auth0LoginButton.spec.js +12 -12
- package/src/sessions/components/__tests__/AuthMethodsLoader.spec.js +15 -12
- package/src/sessions/components/__tests__/NonceCallback.spec.js +84 -0
- package/src/sessions/components/__tests__/OidcLoginButton.spec.js +10 -10
- package/src/sessions/components/__tests__/OpenIDConnect.spec.js +7 -8
- package/src/sessions/components/__tests__/PrivateRoute.spec.js +90 -0
- package/src/sessions/components/__tests__/UnauthorizedRoute.spec.js +88 -0
- package/src/sessions/components/__tests__/__snapshots__/Auth0LoginButton.spec.js.snap +22 -24
- package/src/sessions/components/__tests__/__snapshots__/NonceCallback.spec.js.snap +18 -0
- package/src/sessions/components/__tests__/__snapshots__/OidcLoginButton.spec.js.snap +18 -18
- package/src/sessions/components/__tests__/__snapshots__/PrivateRoute.spec.js.snap +9 -0
- package/src/sessions/components/__tests__/__snapshots__/UnauthorizedRoute.spec.js.snap +9 -0
- package/src/sessions/components/index.js +1 -1
- package/src/sessions/sagas/__tests__/login.spec.js +4 -4
- package/src/sessions/sagas/__tests__/refresh.spec.js +2 -2
- package/src/sessions/sagas/__tests__/token.spec.js +4 -4
- package/src/sessions/sagas/login.js +5 -5
- package/src/sessions/sagas/refresh.js +2 -2
- package/src/sessions/sagas/token.js +2 -2
- package/src/users/components/AdminUserRoutes.js +35 -51
- package/src/users/components/EditUser.js +0 -1
- package/src/users/components/GroupUserCrumbs.js +8 -8
- package/src/users/components/InitialUser.js +0 -1
- package/src/users/components/NewUser.js +0 -1
- package/src/users/components/Password.js +0 -1
- package/src/users/components/User.js +2 -2
- package/src/users/components/UserAclRow.js +1 -2
- package/src/users/components/UserAcls.js +0 -1
- package/src/users/components/UserActions.js +17 -9
- package/src/users/components/UserBreadcrumbs.js +2 -3
- package/src/users/components/UserCard.js +3 -3
- package/src/users/components/UserCards.js +5 -4
- package/src/users/components/UserDomainsFilter.js +2 -5
- package/src/users/components/UserForm.js +8 -33
- package/src/users/components/UserGroupAclRow.js +1 -2
- package/src/users/components/UserGroupAcls.js +0 -1
- package/src/users/components/UserLoader.js +21 -48
- package/src/users/components/UserPassword.js +0 -1
- package/src/users/components/UserRoutes.js +73 -7
- package/src/users/components/UserSelector.js +0 -1
- package/src/users/components/UserTabs.js +1 -2
- package/src/users/components/UsersAndGroups.js +6 -6
- package/src/users/components/UsersLoader.js +2 -2
- package/src/users/components/UsersSearchLoader.js +2 -1
- package/src/users/components/__tests__/CanInitLoader.spec.js +6 -13
- package/src/users/components/__tests__/EditUser.spec.js +4 -33
- package/src/users/components/__tests__/InitialUser.spec.js +4 -34
- package/src/users/components/__tests__/NewUser.spec.js +4 -35
- package/src/users/components/__tests__/Password.spec.js +59 -69
- package/src/users/components/__tests__/User.spec.js +1 -2
- package/src/users/components/__tests__/UserAclRow.spec.js +5 -7
- package/src/users/components/__tests__/UserAcls.spec.js +8 -9
- package/src/users/components/__tests__/UserActions.spec.js +4 -5
- package/src/users/components/__tests__/UserCard.spec.js +11 -11
- package/src/users/components/__tests__/UserCards.spec.js +39 -31
- package/src/users/components/__tests__/UserDomainsFilter.spec.js +12 -22
- package/src/users/components/__tests__/UserForm.spec.js +24 -44
- package/src/users/components/__tests__/UserGroupAclRow.spec.js +1 -2
- package/src/users/components/__tests__/UserGroupAcls.spec.js +8 -9
- package/src/users/components/__tests__/UserLoader.spec.js +85 -0
- package/src/users/components/__tests__/UserPassword.spec.js +8 -21
- package/src/users/components/__tests__/UserRoutes.spec.js +129 -4
- package/src/users/components/__tests__/UserSelector.spec.js +0 -1
- package/src/users/components/__tests__/UsersAndGroups.spec.js +45 -5
- package/src/users/components/__tests__/UsersSearchLoader.spec.js +0 -1
- package/src/users/components/__tests__/__snapshots__/EditUser.spec.js.snap +23 -21
- package/src/users/components/__tests__/__snapshots__/InitialUser.spec.js.snap +22 -21
- package/src/users/components/__tests__/__snapshots__/NewUser.spec.js.snap +25 -23
- package/src/users/components/__tests__/__snapshots__/Password.spec.js.snap +8 -7
- package/src/users/components/__tests__/__snapshots__/User.spec.js.snap +7 -6
- package/src/users/components/__tests__/__snapshots__/UserAclRow.spec.js.snap +12 -11
- package/src/users/components/__tests__/__snapshots__/UserActions.spec.js.snap +56 -67
- package/src/users/components/__tests__/__snapshots__/UserCard.spec.js.snap +56 -70
- package/src/users/components/__tests__/__snapshots__/UserCards.spec.js.snap +117 -83
- package/src/users/components/__tests__/__snapshots__/UserDomainsFilter.spec.js.snap +2 -2
- package/src/users/components/__tests__/__snapshots__/UserForm.spec.js.snap +21 -20
- package/src/users/components/__tests__/__snapshots__/UserLoader.spec.js.snap +3 -0
- package/src/users/components/__tests__/__snapshots__/UserPassword.spec.js.snap +9 -7
- package/src/users/components/__tests__/__snapshots__/UserRoutes.spec.js.snap +170 -16
- package/src/users/components/__tests__/__snapshots__/UserSelector.spec.js.snap +1 -1
- package/src/users/components/__tests__/__snapshots__/UsersAndGroups.spec.js.snap +75 -14
- package/src/users/reducers/__tests__/userRedirect.spec.js +1 -1
- package/src/users/reducers/userRedirect.js +1 -1
- package/src/users/sagas/__tests__/fetchUser.spec.js +3 -5
- package/src/users/sagas/__tests__/updateUser.spec.js +1 -1
- package/src/users/sagas/deleteUser.js +1 -1
- package/src/users/sagas/fetchUser.js +1 -1
- package/src/users/sagas/updateUser.js +1 -1
- package/src/users/components/__tests__/__snapshots__/CanInitLoader.spec.js.snap +0 -3
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import PropTypes from "prop-types";
|
|
3
2
|
import { connect } from "react-redux";
|
|
4
3
|
import { Button, Header, Segment, Icon } from "semantic-ui-react";
|
|
5
4
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
6
|
-
import { Link } from "react-router
|
|
5
|
+
import { Link } from "react-router";
|
|
7
6
|
import { linkTo } from "@truedat/core/routes";
|
|
8
7
|
import RoleCards from "./RoleCards";
|
|
9
8
|
|
|
@@ -33,7 +32,6 @@ export const Roles = ({ roles, rolesLoading }) => {
|
|
|
33
32
|
</Header.Subheader>
|
|
34
33
|
</Header.Content>
|
|
35
34
|
</Header>
|
|
36
|
-
|
|
37
35
|
<RoleCards roles={roles} />
|
|
38
36
|
</Segment>
|
|
39
37
|
);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Component } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { connect } from "react-redux";
|
|
4
4
|
import { Loading } from "@truedat/core/components";
|
|
5
5
|
import { fetchRoles, clearRoles } from "../routines";
|
|
6
6
|
|
|
7
|
-
class RolesLoader extends
|
|
7
|
+
class RolesLoader extends Component {
|
|
8
8
|
static propTypes = {
|
|
9
9
|
fetchRoles: PropTypes.func,
|
|
10
10
|
clearRoles: PropTypes.func,
|
|
@@ -1,32 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
1
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
3
2
|
import { PermissionGroup } from "../PermissionGroup";
|
|
4
3
|
|
|
5
|
-
const renderOpts = {
|
|
6
|
-
messages: {
|
|
7
|
-
en: {
|
|
8
|
-
"permission.group.Taxonomy": "Taxonomy",
|
|
9
|
-
"permission.perm1": "Perm1",
|
|
10
|
-
"permission.perm4": "Perm4"
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
|
|
15
4
|
describe("<PermissionGroup />", () => {
|
|
16
5
|
const id = 1;
|
|
17
6
|
const name = "Taxonomy";
|
|
18
7
|
const permissions = [
|
|
19
8
|
{ id: 1, name: "perm1" },
|
|
20
|
-
{ id: 4, name: "perm4" }
|
|
9
|
+
{ id: 4, name: "perm4" },
|
|
21
10
|
];
|
|
22
11
|
const rolePermissions = [
|
|
23
12
|
{ id: 1, name: "perm1" },
|
|
24
|
-
{ id: 3, name: "perm3" }
|
|
13
|
+
{ id: 3, name: "perm3" },
|
|
25
14
|
];
|
|
26
15
|
const props = { id, name, rolePermissions, permissions };
|
|
27
16
|
|
|
28
|
-
it("matches the latest snapshot", () => {
|
|
29
|
-
const
|
|
30
|
-
|
|
17
|
+
it("matches the latest snapshot", async () => {
|
|
18
|
+
const rendered = render(<PermissionGroup {...props} />);
|
|
19
|
+
await waitForLoad(rendered);
|
|
20
|
+
expect(rendered.container).toMatchSnapshot();
|
|
31
21
|
});
|
|
32
22
|
});
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { shallowWithIntl } from "@truedat/test/intl-stub";
|
|
1
|
+
import { render } from "@truedat/test/render";
|
|
2
|
+
import en from "messages/en";
|
|
4
3
|
import { RoleCards } from "../RoleCards";
|
|
5
4
|
|
|
5
|
+
const renderOpts = { messages: { en } };
|
|
6
|
+
|
|
6
7
|
describe("<RoleCards />", () => {
|
|
7
8
|
const roles = [
|
|
8
|
-
{ id: 3, is_default: false, name: "Data Owner" },
|
|
9
|
-
{ id: 2, is_default: false, name: "Data Q" }
|
|
9
|
+
{ id: "3", is_default: false, name: "Data Owner" },
|
|
10
|
+
{ id: "2", is_default: false, name: "Data Q" },
|
|
10
11
|
];
|
|
11
12
|
const props = { roles };
|
|
12
13
|
|
|
13
14
|
it("matches the latest snapshot", () => {
|
|
14
|
-
const
|
|
15
|
-
expect(
|
|
15
|
+
const { container } = render(<RoleCards {...props} />, renderOpts);
|
|
16
|
+
expect(container).toMatchSnapshot();
|
|
16
17
|
});
|
|
17
18
|
|
|
18
19
|
it("contains a card for each source", () => {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
expect(
|
|
20
|
+
const { container } = render(<RoleCards {...props} />, renderOpts);
|
|
21
|
+
|
|
22
|
+
expect(container.querySelectorAll("div.ui.card")).toHaveLength(2);
|
|
22
23
|
});
|
|
23
24
|
});
|
|
@@ -1,14 +1,60 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
3
|
+
import RoleRoutes from "../RoleRoutes";
|
|
4
|
+
import { useAuthorized } from "@truedat/core/hooks/useAuthorized";
|
|
5
|
+
import { absolutePath } from "@truedat/core/routesTree";
|
|
4
6
|
|
|
5
|
-
jest.mock("@truedat/core/hooks", () => ({
|
|
6
|
-
useAuthorized: jest.fn(() => true)
|
|
7
|
+
jest.mock("@truedat/core/hooks/useAuthorized", () => ({
|
|
8
|
+
useAuthorized: jest.fn(() => true),
|
|
7
9
|
}));
|
|
8
10
|
|
|
11
|
+
// Mock all components used in RoleRoutes
|
|
12
|
+
jest.mock("../Roles", () => () => <div>Roles</div>);
|
|
13
|
+
jest.mock("../Role", () => () => <div>Role</div>);
|
|
14
|
+
jest.mock("../NewRole", () => () => <div>NewRole</div>);
|
|
15
|
+
jest.mock("../RolesLoader", () => () => <div>RolesLoader</div>);
|
|
16
|
+
jest.mock("../RoleLoader", () => () => <div>RoleLoader</div>);
|
|
17
|
+
jest.mock("@truedat/core/router/Unauthorized", () => () => (
|
|
18
|
+
<div>Unauthorized</div>
|
|
19
|
+
));
|
|
20
|
+
|
|
9
21
|
describe("<RoleRoutes />", () => {
|
|
10
|
-
it("
|
|
11
|
-
const
|
|
12
|
-
|
|
22
|
+
it("renders correctly with default route", async () => {
|
|
23
|
+
const rendered = render(<RoleRoutes />);
|
|
24
|
+
await waitForLoad(rendered);
|
|
25
|
+
expect(rendered.container).toMatchSnapshot();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("renders correctly with ROLES route", async () => {
|
|
29
|
+
const rendered = render(<RoleRoutes />, {
|
|
30
|
+
routes: [absolutePath("roles")],
|
|
31
|
+
});
|
|
32
|
+
await waitForLoad(rendered);
|
|
33
|
+
expect(rendered.container).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("renders correctly with ROLES_NEW route", async () => {
|
|
37
|
+
const rendered = render(<RoleRoutes />, {
|
|
38
|
+
routes: [absolutePath("roles/new")],
|
|
39
|
+
});
|
|
40
|
+
await waitForLoad(rendered);
|
|
41
|
+
expect(rendered.container).toMatchSnapshot();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("renders correctly with ROLE route", async () => {
|
|
45
|
+
const rendered = render(<RoleRoutes />, {
|
|
46
|
+
routes: ["/roles/123"],
|
|
47
|
+
});
|
|
48
|
+
await waitForLoad(rendered);
|
|
49
|
+
expect(rendered.container).toMatchSnapshot();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("renders unauthorized component when not authorized", async () => {
|
|
53
|
+
useAuthorized.mockReturnValueOnce(false);
|
|
54
|
+
const rendered = render(<RoleRoutes />, {
|
|
55
|
+
routes: [absolutePath("roles")],
|
|
56
|
+
});
|
|
57
|
+
await waitForLoad(rendered);
|
|
58
|
+
expect(rendered.container).toMatchSnapshot();
|
|
13
59
|
});
|
|
14
60
|
});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { render } from "@truedat/test/render";
|
|
3
2
|
import Roles from "../Roles";
|
|
4
3
|
|
|
5
4
|
describe("<Roles />", () => {
|
|
6
5
|
const roles = [
|
|
7
|
-
{ id: 3, is_default: false, name: "Data Owner" },
|
|
8
|
-
{ id: 2, is_default: false, name: "Data Q" },
|
|
6
|
+
{ id: "3", is_default: false, name: "Data Owner" },
|
|
7
|
+
{ id: "2", is_default: false, name: "Data Q" },
|
|
9
8
|
];
|
|
10
9
|
const state = { roles };
|
|
11
10
|
|
|
@@ -8,7 +8,7 @@ exports[`<PermissionGroup /> matches the latest snapshot 1`] = `
|
|
|
8
8
|
<h4
|
|
9
9
|
class="ui header"
|
|
10
10
|
>
|
|
11
|
-
Taxonomy
|
|
11
|
+
permission.group.Taxonomy
|
|
12
12
|
</h4>
|
|
13
13
|
<div
|
|
14
14
|
class="ui small list"
|
|
@@ -27,10 +27,9 @@ exports[`<PermissionGroup /> matches the latest snapshot 1`] = `
|
|
|
27
27
|
readonly=""
|
|
28
28
|
tabindex="0"
|
|
29
29
|
type="checkbox"
|
|
30
|
-
value=""
|
|
31
30
|
/>
|
|
32
31
|
<label>
|
|
33
|
-
|
|
32
|
+
perm1
|
|
34
33
|
</label>
|
|
35
34
|
</div>
|
|
36
35
|
</div>
|
|
@@ -46,10 +45,9 @@ exports[`<PermissionGroup /> matches the latest snapshot 1`] = `
|
|
|
46
45
|
readonly=""
|
|
47
46
|
tabindex="0"
|
|
48
47
|
type="checkbox"
|
|
49
|
-
value=""
|
|
50
48
|
/>
|
|
51
49
|
<label>
|
|
52
|
-
|
|
50
|
+
perm4
|
|
53
51
|
</label>
|
|
54
52
|
</div>
|
|
55
53
|
</div>
|
|
@@ -7,9 +7,10 @@ exports[`<Role /> matches the latest snapshot 1`] = `
|
|
|
7
7
|
>
|
|
8
8
|
<a
|
|
9
9
|
class="section"
|
|
10
|
+
data-discover="true"
|
|
10
11
|
href="/roles"
|
|
11
12
|
>
|
|
12
|
-
|
|
13
|
+
navigation.members.roles
|
|
13
14
|
</a>
|
|
14
15
|
<i
|
|
15
16
|
aria-hidden="true"
|
|
@@ -40,7 +41,7 @@ exports[`<Role /> matches the latest snapshot 1`] = `
|
|
|
40
41
|
<div
|
|
41
42
|
class="sub header"
|
|
42
43
|
>
|
|
43
|
-
|
|
44
|
+
role.subheader
|
|
44
45
|
</div>
|
|
45
46
|
</div>
|
|
46
47
|
</h2>
|
|
@@ -52,10 +53,9 @@ exports[`<Role /> matches the latest snapshot 1`] = `
|
|
|
52
53
|
readonly=""
|
|
53
54
|
tabindex="0"
|
|
54
55
|
type="checkbox"
|
|
55
|
-
value=""
|
|
56
56
|
/>
|
|
57
57
|
<label>
|
|
58
|
-
|
|
58
|
+
roles.default
|
|
59
59
|
</label>
|
|
60
60
|
</div>
|
|
61
61
|
</div>
|
|
@@ -1,142 +1,72 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<RoleCards /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="ui cards"
|
|
7
7
|
>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
as={
|
|
11
|
-
{
|
|
12
|
-
"$$typeof": Symbol(react.forward_ref),
|
|
13
|
-
"displayName": "Link",
|
|
14
|
-
"propTypes": {
|
|
15
|
-
"innerRef": [Function],
|
|
16
|
-
"onClick": [Function],
|
|
17
|
-
"replace": [Function],
|
|
18
|
-
"target": [Function],
|
|
19
|
-
"to": [Function],
|
|
20
|
-
},
|
|
21
|
-
"render": [Function],
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
to="/roles/3"
|
|
25
|
-
>
|
|
26
|
-
Data Owner
|
|
27
|
-
</CardHeader>
|
|
28
|
-
</CardContent>
|
|
29
|
-
<CardContent
|
|
30
|
-
extra={true}
|
|
8
|
+
<div
|
|
9
|
+
class="ui card"
|
|
31
10
|
>
|
|
32
11
|
<div
|
|
33
|
-
|
|
12
|
+
class="content"
|
|
34
13
|
>
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
Data Owner
|
|
43
|
-
</b>,
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/>
|
|
47
|
-
}
|
|
48
|
-
header={
|
|
49
|
-
<Memo(MemoizedFormattedMessage)
|
|
50
|
-
id="roles.actions.delete.confirmation.header"
|
|
51
|
-
/>
|
|
52
|
-
}
|
|
53
|
-
icon="trash"
|
|
54
|
-
onConfirm={[Function]}
|
|
55
|
-
trigger={
|
|
56
|
-
<Button
|
|
57
|
-
as="button"
|
|
58
|
-
basic={true}
|
|
59
|
-
color="red"
|
|
60
|
-
icon={
|
|
61
|
-
<Icon
|
|
62
|
-
as="i"
|
|
63
|
-
color="red"
|
|
64
|
-
name="trash alternate outline"
|
|
65
|
-
/>
|
|
66
|
-
}
|
|
67
|
-
/>
|
|
68
|
-
}
|
|
69
|
-
/>
|
|
14
|
+
<a
|
|
15
|
+
class="header"
|
|
16
|
+
data-discover="true"
|
|
17
|
+
href="/roles/3"
|
|
18
|
+
>
|
|
19
|
+
Data Owner
|
|
20
|
+
</a>
|
|
70
21
|
</div>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<Card
|
|
74
|
-
key="1"
|
|
75
|
-
>
|
|
76
|
-
<CardContent>
|
|
77
|
-
<CardHeader
|
|
78
|
-
as={
|
|
79
|
-
{
|
|
80
|
-
"$$typeof": Symbol(react.forward_ref),
|
|
81
|
-
"displayName": "Link",
|
|
82
|
-
"propTypes": {
|
|
83
|
-
"innerRef": [Function],
|
|
84
|
-
"onClick": [Function],
|
|
85
|
-
"replace": [Function],
|
|
86
|
-
"target": [Function],
|
|
87
|
-
"to": [Function],
|
|
88
|
-
},
|
|
89
|
-
"render": [Function],
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
to="/roles/2"
|
|
22
|
+
<div
|
|
23
|
+
class="extra content"
|
|
93
24
|
>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
25
|
+
<div
|
|
26
|
+
class="ui actions"
|
|
27
|
+
>
|
|
28
|
+
<button
|
|
29
|
+
class="ui red basic icon button"
|
|
30
|
+
>
|
|
31
|
+
<i
|
|
32
|
+
aria-hidden="true"
|
|
33
|
+
class="red trash alternate outline icon"
|
|
34
|
+
/>
|
|
35
|
+
</button>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div
|
|
40
|
+
class="ui card"
|
|
99
41
|
>
|
|
100
42
|
<div
|
|
101
|
-
|
|
43
|
+
class="content"
|
|
102
44
|
>
|
|
103
|
-
<
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
trigger={
|
|
124
|
-
<Button
|
|
125
|
-
as="button"
|
|
126
|
-
basic={true}
|
|
127
|
-
color="red"
|
|
128
|
-
icon={
|
|
129
|
-
<Icon
|
|
130
|
-
as="i"
|
|
131
|
-
color="red"
|
|
132
|
-
name="trash alternate outline"
|
|
133
|
-
/>
|
|
134
|
-
}
|
|
45
|
+
<a
|
|
46
|
+
class="header"
|
|
47
|
+
data-discover="true"
|
|
48
|
+
href="/roles/2"
|
|
49
|
+
>
|
|
50
|
+
Data Q
|
|
51
|
+
</a>
|
|
52
|
+
</div>
|
|
53
|
+
<div
|
|
54
|
+
class="extra content"
|
|
55
|
+
>
|
|
56
|
+
<div
|
|
57
|
+
class="ui actions"
|
|
58
|
+
>
|
|
59
|
+
<button
|
|
60
|
+
class="ui red basic icon button"
|
|
61
|
+
>
|
|
62
|
+
<i
|
|
63
|
+
aria-hidden="true"
|
|
64
|
+
class="red trash alternate outline icon"
|
|
135
65
|
/>
|
|
136
|
-
|
|
137
|
-
|
|
66
|
+
</button>
|
|
67
|
+
</div>
|
|
138
68
|
</div>
|
|
139
|
-
</
|
|
140
|
-
</
|
|
141
|
-
</
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
142
72
|
`;
|
|
@@ -1,8 +1,41 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<RoleRoutes />
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
exports[`<RoleRoutes /> renders correctly with ROLE route 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div>
|
|
6
|
+
RoleLoader
|
|
7
|
+
</div>
|
|
8
|
+
<div>
|
|
9
|
+
Role
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
exports[`<RoleRoutes /> renders correctly with ROLES route 1`] = `
|
|
15
|
+
<div>
|
|
16
|
+
<div>
|
|
17
|
+
RolesLoader
|
|
18
|
+
</div>
|
|
19
|
+
<div>
|
|
20
|
+
Roles
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
exports[`<RoleRoutes /> renders correctly with ROLES_NEW route 1`] = `
|
|
26
|
+
<div>
|
|
27
|
+
<div>
|
|
28
|
+
NewRole
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
exports[`<RoleRoutes /> renders correctly with default route 1`] = `<div />`;
|
|
34
|
+
|
|
35
|
+
exports[`<RoleRoutes /> renders unauthorized component when not authorized 1`] = `
|
|
36
|
+
<div>
|
|
37
|
+
<div>
|
|
38
|
+
Unauthorized
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
8
41
|
`;
|
|
@@ -10,10 +10,11 @@ exports[`<Roles /> matches the latest snapshot 1`] = `
|
|
|
10
10
|
>
|
|
11
11
|
<a
|
|
12
12
|
class="ui primary right floated button"
|
|
13
|
+
data-discover="true"
|
|
13
14
|
href="/roles/new"
|
|
14
15
|
role="button"
|
|
15
16
|
>
|
|
16
|
-
|
|
17
|
+
roles.create
|
|
17
18
|
</a>
|
|
18
19
|
<i
|
|
19
20
|
aria-hidden="true"
|
|
@@ -22,11 +23,11 @@ exports[`<Roles /> matches the latest snapshot 1`] = `
|
|
|
22
23
|
<div
|
|
23
24
|
class="content"
|
|
24
25
|
>
|
|
25
|
-
|
|
26
|
+
roles.header
|
|
26
27
|
<div
|
|
27
28
|
class="sub header"
|
|
28
29
|
>
|
|
29
|
-
|
|
30
|
+
roles.subheader
|
|
30
31
|
</div>
|
|
31
32
|
</div>
|
|
32
33
|
</h2>
|
|
@@ -41,6 +42,7 @@ exports[`<Roles /> matches the latest snapshot 1`] = `
|
|
|
41
42
|
>
|
|
42
43
|
<a
|
|
43
44
|
class="header"
|
|
45
|
+
data-discover="true"
|
|
44
46
|
href="/roles/3"
|
|
45
47
|
>
|
|
46
48
|
Data Owner
|
|
@@ -71,6 +73,7 @@ exports[`<Roles /> matches the latest snapshot 1`] = `
|
|
|
71
73
|
>
|
|
72
74
|
<a
|
|
73
75
|
class="header"
|
|
76
|
+
data-discover="true"
|
|
74
77
|
href="/roles/2"
|
|
75
78
|
>
|
|
76
79
|
Data Q
|
|
@@ -10,7 +10,7 @@ export const roleRedirect = (state = initialState, { type, payload }) => {
|
|
|
10
10
|
return initialState;
|
|
11
11
|
case createRole.SUCCESS:
|
|
12
12
|
const {
|
|
13
|
-
data: { id }
|
|
13
|
+
data: { id },
|
|
14
14
|
} = payload;
|
|
15
15
|
return linkTo.ROLE({ id: id.toString() });
|
|
16
16
|
case deleteRole.SUCCESS:
|
|
@@ -7,7 +7,7 @@ import { API_ROLE } from "../api";
|
|
|
7
7
|
export function* deleteRoleSaga({ payload }) {
|
|
8
8
|
try {
|
|
9
9
|
const { id } = payload;
|
|
10
|
-
const url = compile(API_ROLE)({ id });
|
|
10
|
+
const url = compile(API_ROLE)({ id: `${id}` });
|
|
11
11
|
yield put(deleteRole.request());
|
|
12
12
|
const { data } = yield call(apiJsonDelete, url, JSON_OPTS);
|
|
13
13
|
yield put(deleteRole.success(data));
|
|
@@ -7,7 +7,7 @@ import { API_ROLE } from "../api";
|
|
|
7
7
|
export function* fetchRoleSaga({ payload }) {
|
|
8
8
|
try {
|
|
9
9
|
const { id } = payload;
|
|
10
|
-
const url = compile(API_ROLE)({ id });
|
|
10
|
+
const url = compile(API_ROLE)({ id: `${id}` });
|
|
11
11
|
yield put(fetchRole.request());
|
|
12
12
|
const { data } = yield call(apiJson, url, JSON_OPTS);
|
|
13
13
|
yield put(fetchRole.success(data));
|
|
@@ -7,7 +7,7 @@ import { API_ROLE_PERMISSIONS } from "../api";
|
|
|
7
7
|
export function* fetchRolePermissionsSaga({ payload }) {
|
|
8
8
|
try {
|
|
9
9
|
const { id } = payload;
|
|
10
|
-
const url = compile(API_ROLE_PERMISSIONS)({ id });
|
|
10
|
+
const url = compile(API_ROLE_PERMISSIONS)({ id: `${id}` });
|
|
11
11
|
yield put(fetchRolePermissions.request());
|
|
12
12
|
const { data } = yield call(apiJson, url, JSON_OPTS);
|
|
13
13
|
yield put(fetchRolePermissions.success(data));
|
|
@@ -7,7 +7,7 @@ import { API_ROLE } from "../api";
|
|
|
7
7
|
export function* updateRoleSaga({ payload }) {
|
|
8
8
|
try {
|
|
9
9
|
const { id, role } = payload;
|
|
10
|
-
const url = compile(API_ROLE)({ id });
|
|
10
|
+
const url = compile(API_ROLE)({ id: `${id}` });
|
|
11
11
|
const { data } = yield call(apiJsonPatch, url, { role }, JSON_OPTS);
|
|
12
12
|
yield put(updateRole.success(data));
|
|
13
13
|
} catch (error) {
|
|
@@ -7,7 +7,7 @@ import { API_ROLE_PERMISSIONS } from "../api";
|
|
|
7
7
|
export function* updateRolePermissionsSaga({ payload }) {
|
|
8
8
|
try {
|
|
9
9
|
const { id, permissions } = payload;
|
|
10
|
-
const url = compile(API_ROLE_PERMISSIONS)({ id });
|
|
10
|
+
const url = compile(API_ROLE_PERMISSIONS)({ id: `${id}` });
|
|
11
11
|
const body = { permissions };
|
|
12
12
|
yield put(updateRolePermissions.request());
|
|
13
13
|
const { data } = yield call(apiJsonPut, url, body, JSON_OPTS);
|