@truedat/auth 8.14.0 → 8.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.
Files changed (65) hide show
  1. package/package.json +4 -4
  2. package/src/groups/components/EditGroup.js +64 -20
  3. package/src/groups/components/Group.js +39 -41
  4. package/src/groups/components/GroupCard.js +51 -54
  5. package/src/groups/components/GroupCards.js +60 -25
  6. package/src/groups/components/GroupDeleteModal.js +98 -0
  7. package/src/groups/components/GroupDropdown.js +92 -0
  8. package/src/groups/components/GroupForm.js +165 -84
  9. package/src/groups/components/GroupFormModal.js +137 -0
  10. package/src/groups/components/GroupInfoModal.js +114 -0
  11. package/src/groups/components/GroupMemberPicker.js +364 -0
  12. package/src/groups/components/GroupRouteModal.js +46 -0
  13. package/src/groups/components/GroupUsers.js +31 -14
  14. package/src/groups/components/GroupUsersTable.js +136 -83
  15. package/src/groups/components/NewGroup.js +38 -10
  16. package/src/groups/components/__tests__/EditGroup.spec.js +105 -0
  17. package/src/groups/components/__tests__/Group.spec.js +29 -47
  18. package/src/groups/components/__tests__/GroupCard.spec.js +8 -20
  19. package/src/groups/components/__tests__/GroupDropdown.spec.js +27 -0
  20. package/src/groups/components/__tests__/GroupForm.spec.js +32 -5
  21. package/src/groups/components/__tests__/GroupMemberPicker.spec.js +378 -0
  22. package/src/groups/components/__tests__/GroupModals.spec.js +210 -0
  23. package/src/groups/components/__tests__/GroupUsers.spec.js +17 -2
  24. package/src/groups/components/__tests__/GroupUsersTable.spec.js +34 -2
  25. package/src/groups/components/__tests__/__snapshots__/Group.spec.js.snap +1 -0
  26. package/src/groups/components/__tests__/__snapshots__/GroupCard.spec.js.snap +32 -30
  27. package/src/groups/components/__tests__/__snapshots__/GroupCards.spec.js.snap +90 -77
  28. package/src/groups/components/__tests__/__snapshots__/GroupUsers.spec.js.snap +75 -11
  29. package/src/groups/components/__tests__/__snapshots__/GroupUsersTable.spec.js.snap +70 -13
  30. package/src/groups/components/index.js +0 -4
  31. package/src/groups/hooks/__tests__/useGroupOperation.spec.js +167 -0
  32. package/src/groups/hooks/__tests__/useGroups.spec.js +90 -0
  33. package/src/groups/hooks/useGroupOperation.js +83 -0
  34. package/src/groups/hooks/useGroups.js +64 -0
  35. package/src/groups/reducers/index.js +0 -4
  36. package/src/groups/routines.js +0 -7
  37. package/src/groups/sagas/index.js +2 -24
  38. package/src/hooks/useRoles.js +6 -3
  39. package/src/styles/Groups.less +1009 -0
  40. package/src/users/components/AdminUserRoutes.js +1 -14
  41. package/src/users/components/GroupUserCrumbs.js +7 -12
  42. package/src/users/components/UserRoutes.js +12 -35
  43. package/src/users/components/UsersAndGroups.js +3 -6
  44. package/src/users/components/__tests__/GroupUserCrumbs.spec.js +26 -30
  45. package/src/users/components/__tests__/UserRoutes.spec.js +4 -6
  46. package/src/users/components/__tests__/UsersAndGroups.spec.js +5 -7
  47. package/src/users/components/__tests__/__snapshots__/UserRoutes.spec.js.snap +9 -55
  48. package/src/groups/components/GroupLoader.js +0 -27
  49. package/src/groups/components/GroupsLoader.js +0 -30
  50. package/src/groups/components/__tests__/GroupLoader.spec.js +0 -71
  51. package/src/groups/components/__tests__/__snapshots__/GroupLoader.spec.js.snap +0 -11
  52. package/src/groups/reducers/__tests__/groupRedirect.spec.js +0 -51
  53. package/src/groups/reducers/__tests__/groupUsers.spec.js +0 -60
  54. package/src/groups/reducers/group.js +0 -56
  55. package/src/groups/reducers/groupRedirect.js +0 -20
  56. package/src/groups/reducers/groupUsers.js +0 -16
  57. package/src/groups/reducers/groups.js +0 -29
  58. package/src/groups/sagas/__tests__/deleteGroup.spec.js +0 -93
  59. package/src/groups/sagas/__tests__/deleteGroupUser.spec.js +0 -80
  60. package/src/groups/sagas/createGroup.js +0 -27
  61. package/src/groups/sagas/deleteGroup.js +0 -31
  62. package/src/groups/sagas/deleteGroupUser.js +0 -35
  63. package/src/groups/sagas/fetchGroup.js +0 -30
  64. package/src/groups/sagas/fetchGroups.js +0 -26
  65. package/src/groups/sagas/updateGroup.js +0 -28
@@ -1,5 +1,5 @@
1
1
  import userEvent from "@testing-library/user-event";
2
- import { renderWithIntl as render } from "@truedat/test/renderWithIntl";
2
+ import { render } from "@truedat/test/render";
3
3
  import { waitForLoad } from "@truedat/test/waitForLoad";
4
4
  import { GroupUsersTable } from "../GroupUsersTable";
5
5
 
@@ -54,7 +54,7 @@ describe("<GroupUsersTable />", () => {
54
54
 
55
55
  // Click on the username column header to sort
56
56
  const usernameHeader = rendered.getByText(/user_name/i);
57
- await userEvent.click(usernameHeader);
57
+ await userEvent.setup({ delay: null }).click(usernameHeader);
58
58
 
59
59
  // First row should now contain "auser_3" after sorting
60
60
  const firstRowCells = rendered.container.querySelectorAll(
@@ -63,3 +63,35 @@ describe("<GroupUsersTable />", () => {
63
63
  expect(firstRowCells[1].textContent).toContain("auser_3");
64
64
  });
65
65
  });
66
+
67
+ it("fills external IDs from users arriving after group members and searches them", () => {
68
+ const groupUsers = [{ id: 9, full_name: "Ana", user_name: "ana" }];
69
+ const ui = render(<GroupUsersTable groupUsers={groupUsers} readOnly />);
70
+ expect(ui.queryByText("EXT-009")).not.toBeInTheDocument();
71
+ ui.rerender(
72
+ <GroupUsersTable
73
+ groupUsers={groupUsers}
74
+ users={[
75
+ { id: "9", external_id: "EXT-009" },
76
+ { id: 10, external_id: "OTHER" },
77
+ ]}
78
+ filter="ext-009"
79
+ readOnly
80
+ />,
81
+ );
82
+ expect(ui.getByText("EXT-009")).toBeInTheDocument();
83
+ expect(ui.container.querySelectorAll("tbody tr")).toHaveLength(1);
84
+ expect(ui.queryByText("OTHER")).not.toBeInTheDocument();
85
+ });
86
+
87
+ it("preserves an external ID already supplied by the group", () => {
88
+ const ui = render(
89
+ <GroupUsersTable
90
+ groupUsers={[{ id: 9, full_name: "Ana", external_id: "GROUP-ID" }]}
91
+ users={[{ id: 9, external_id: "DIRECTORY-ID" }]}
92
+ readOnly
93
+ />,
94
+ );
95
+ expect(ui.getByText("GROUP-ID")).toBeInTheDocument();
96
+ expect(ui.queryByText("DIRECTORY-ID")).not.toBeInTheDocument();
97
+ });
@@ -50,6 +50,7 @@ exports[`<Group /> matches the latest snapshot 1`] = `
50
50
  >
51
51
  <button
52
52
  class="ui button"
53
+ type="button"
53
54
  >
54
55
  <i
55
56
  aria-hidden="true"
@@ -2,50 +2,52 @@
2
2
 
3
3
  exports[`<GroupCard /> matches the latest snapshot 1`] = `
4
4
  <div>
5
- <div
6
- class="ui card"
5
+ <article
6
+ class="td-group-card"
7
7
  >
8
- <div
9
- class="content"
8
+ <a
9
+ class="gc-content"
10
+ data-discover="true"
11
+ href="/groups/1"
10
12
  >
11
- <a
12
- class="header"
13
- data-discover="true"
14
- href="/groups/1"
13
+ <span
14
+ aria-hidden="true"
15
+ class="gc-avatar"
15
16
  >
16
17
  <i
17
18
  aria-hidden="true"
18
- class="group icon"
19
+ class="users icon"
19
20
  />
21
+ </span>
22
+ <h3>
20
23
  administrators
21
- </a>
22
- <div
23
- class="description"
24
+ </h3>
25
+ <p
26
+ class="gc-description"
24
27
  >
25
28
  Administrators
26
- </div>
27
- </div>
29
+ </p>
30
+ </a>
28
31
  <div
29
- class="extra content"
32
+ class="gc-actions"
30
33
  >
31
- <div
32
- class="ui two buttons"
34
+ <a
35
+ aria-label="actions.edit"
36
+ data-discover="true"
37
+ href="/groups/1/edit"
38
+ title="actions.edit"
33
39
  >
34
- <a
35
- class="ui green basic button"
36
- data-discover="true"
37
- href="/groups/1/edit"
38
- role="button"
40
+ <i
41
+ aria-hidden="true"
42
+ class="pencil alternate icon"
43
+ />
44
+ <span
45
+ class="gc-action-label"
39
46
  >
40
47
  actions.edit
41
- </a>
42
- <button
43
- class="ui basic negative button"
44
- >
45
- actions.delete
46
- </button>
47
- </div>
48
+ </span>
49
+ </a>
48
50
  </div>
49
- </div>
51
+ </article>
50
52
  </div>
51
53
  `;
@@ -3,122 +3,135 @@
3
3
  exports[`<GroupCards /> matches the latest snapshot 1`] = `
4
4
  <div>
5
5
  <div
6
- class="ui cards"
6
+ class="groups-toolbar"
7
7
  >
8
8
  <a
9
- class="ui link card create group"
9
+ class="ui primary button group-create-button"
10
10
  data-discover="true"
11
11
  href="/groups/new"
12
+ role="button"
12
13
  >
13
- <div
14
- class="center aligned content"
14
+ <span
15
+ aria-hidden="true"
16
+ class="group-create-icon"
15
17
  >
16
- <div
17
- class="header"
18
- >
19
- groups.actions.create
20
- </div>
21
- <div
22
- class="description"
18
+ <i
19
+ aria-hidden="true"
20
+ class="users icon"
21
+ />
22
+ <svg
23
+ focusable="false"
24
+ viewBox="0 0 16 16"
23
25
  >
24
- <i
25
- aria-hidden="true"
26
- class="add massive icon"
27
- floated="center"
26
+ <path
27
+ d="M8 3v10M3 8h10"
28
+ fill="none"
29
+ stroke="currentColor"
30
+ stroke-linecap="round"
31
+ stroke-width="2"
28
32
  />
29
- </div>
30
- </div>
33
+ </svg>
34
+ </span>
35
+ groups.actions.create
31
36
  </a>
32
- <div
33
- class="ui card"
37
+ </div>
38
+ <div
39
+ class="groups-card-list"
40
+ >
41
+ <article
42
+ class="td-group-card"
34
43
  >
35
- <div
36
- class="content"
44
+ <a
45
+ class="gc-content"
46
+ data-discover="true"
47
+ href="/groups/1"
37
48
  >
38
- <a
39
- class="header"
40
- data-discover="true"
41
- href="/groups/1"
49
+ <span
50
+ aria-hidden="true"
51
+ class="gc-avatar"
42
52
  >
43
53
  <i
44
54
  aria-hidden="true"
45
- class="group icon"
55
+ class="users icon"
46
56
  />
57
+ </span>
58
+ <h3>
47
59
  administrators
48
- </a>
49
- <div
50
- class="description"
60
+ </h3>
61
+ <p
62
+ class="gc-description"
51
63
  >
52
64
  Administrators
53
- </div>
54
- </div>
65
+ </p>
66
+ </a>
55
67
  <div
56
- class="extra content"
68
+ class="gc-actions"
57
69
  >
58
- <div
59
- class="ui two buttons"
70
+ <a
71
+ aria-label="actions.edit"
72
+ data-discover="true"
73
+ href="/groups/1/edit"
74
+ title="actions.edit"
60
75
  >
61
- <a
62
- class="ui green basic button"
63
- data-discover="true"
64
- href="/groups/1/edit"
65
- role="button"
76
+ <i
77
+ aria-hidden="true"
78
+ class="pencil alternate icon"
79
+ />
80
+ <span
81
+ class="gc-action-label"
66
82
  >
67
83
  actions.edit
68
- </a>
69
- <button
70
- class="ui basic negative button"
71
- >
72
- actions.delete
73
- </button>
74
- </div>
84
+ </span>
85
+ </a>
75
86
  </div>
76
- </div>
77
- <div
78
- class="ui card"
87
+ </article>
88
+ <article
89
+ class="td-group-card"
79
90
  >
80
- <div
81
- class="content"
91
+ <a
92
+ class="gc-content"
93
+ data-discover="true"
94
+ href="/groups/2"
82
95
  >
83
- <a
84
- class="header"
85
- data-discover="true"
86
- href="/groups/2"
96
+ <span
97
+ aria-hidden="true"
98
+ class="gc-avatar"
87
99
  >
88
100
  <i
89
101
  aria-hidden="true"
90
- class="group icon"
102
+ class="users icon"
91
103
  />
104
+ </span>
105
+ <h3>
92
106
  users
93
- </a>
94
- <div
95
- class="description"
107
+ </h3>
108
+ <p
109
+ class="gc-description"
96
110
  >
97
111
  Regular users
98
- </div>
99
- </div>
112
+ </p>
113
+ </a>
100
114
  <div
101
- class="extra content"
115
+ class="gc-actions"
102
116
  >
103
- <div
104
- class="ui two buttons"
117
+ <a
118
+ aria-label="actions.edit"
119
+ data-discover="true"
120
+ href="/groups/2/edit"
121
+ title="actions.edit"
105
122
  >
106
- <a
107
- class="ui green basic button"
108
- data-discover="true"
109
- href="/groups/2/edit"
110
- role="button"
123
+ <i
124
+ aria-hidden="true"
125
+ class="pencil alternate icon"
126
+ />
127
+ <span
128
+ class="gc-action-label"
111
129
  >
112
130
  actions.edit
113
- </a>
114
- <button
115
- class="ui basic negative button"
116
- >
117
- actions.delete
118
- </button>
119
- </div>
131
+ </span>
132
+ </a>
120
133
  </div>
121
- </div>
134
+ </article>
122
135
  </div>
123
136
  </div>
124
137
  `;
@@ -25,19 +25,83 @@ exports[`<GroupUsers /> matches the latest snapshot 1`] = `
25
25
  <div
26
26
  class="ui hidden divider"
27
27
  />
28
- <h4
29
- class="ui header"
28
+ <table
29
+ class="ui sortable unstackable table group-users-table"
30
30
  >
31
- <i
32
- aria-hidden="true"
33
- class="search icon"
34
- />
35
- <div
36
- class="content"
31
+ <thead
32
+ class=""
33
+ >
34
+ <tr
35
+ class=""
36
+ >
37
+ <th
38
+ class="two wide ascending sorted"
39
+ tabindex="0"
40
+ >
41
+ <div
42
+ class="group-column-heading"
43
+ >
44
+ <span>
45
+ user.props.full_name
46
+ </span>
47
+ </div>
48
+ </th>
49
+ <th
50
+ class="two wide"
51
+ tabindex="0"
52
+ >
53
+ <div
54
+ class="group-column-heading"
55
+ >
56
+ <span>
57
+ user.props.user_name
58
+ </span>
59
+ </div>
60
+ </th>
61
+ <th
62
+ class="two wide"
63
+ tabindex="0"
64
+ >
65
+ <div
66
+ class="group-column-heading"
67
+ >
68
+ <span>
69
+ user.props.email
70
+ </span>
71
+ </div>
72
+ </th>
73
+ <th
74
+ class="two wide"
75
+ tabindex="0"
76
+ >
77
+ <div
78
+ class="group-column-heading"
79
+ >
80
+ <span>
81
+ user.form.external_id
82
+ </span>
83
+ </div>
84
+ </th>
85
+ <th
86
+ class="one wide"
87
+ />
88
+ </tr>
89
+ </thead>
90
+ <tbody
91
+ class=""
37
92
  >
38
- groupUsers.search.results.empty
39
- </div>
40
- </h4>
93
+ <tr
94
+ class=""
95
+ >
96
+ <td
97
+ class=""
98
+ colspan="5"
99
+ >
100
+ groupUsers.search.results.empty
101
+ </td>
102
+ </tr>
103
+ </tbody>
104
+ </table>
41
105
  </div>
42
106
  </div>
43
107
  `;
@@ -3,7 +3,7 @@
3
3
  exports[`<GroupUsersTable /> matches the latest snapshot 1`] = `
4
4
  <div>
5
5
  <table
6
- class="ui sortable table"
6
+ class="ui sortable unstackable table group-users-table"
7
7
  >
8
8
  <thead
9
9
  class=""
@@ -13,18 +13,51 @@ exports[`<GroupUsersTable /> matches the latest snapshot 1`] = `
13
13
  >
14
14
  <th
15
15
  class="two wide ascending sorted"
16
+ tabindex="0"
16
17
  >
17
- user.props.full_name
18
+ <div
19
+ class="group-column-heading"
20
+ >
21
+ <span>
22
+ user.props.full_name
23
+ </span>
24
+ </div>
25
+ </th>
26
+ <th
27
+ class="two wide"
28
+ tabindex="0"
29
+ >
30
+ <div
31
+ class="group-column-heading"
32
+ >
33
+ <span>
34
+ user.props.user_name
35
+ </span>
36
+ </div>
18
37
  </th>
19
38
  <th
20
39
  class="two wide"
40
+ tabindex="0"
21
41
  >
22
- user.props.user_name
42
+ <div
43
+ class="group-column-heading"
44
+ >
45
+ <span>
46
+ user.props.email
47
+ </span>
48
+ </div>
23
49
  </th>
24
50
  <th
25
51
  class="two wide"
52
+ tabindex="0"
26
53
  >
27
- user.props.email
54
+ <div
55
+ class="group-column-heading"
56
+ >
57
+ <span>
58
+ user.form.external_id
59
+ </span>
60
+ </div>
28
61
  </th>
29
62
  <th
30
63
  class="one wide"
@@ -40,7 +73,10 @@ exports[`<GroupUsersTable /> matches the latest snapshot 1`] = `
40
73
  <td
41
74
  class="two wide pointer"
42
75
  >
43
- <a>
76
+ <a
77
+ data-discover="true"
78
+ href="/users/4"
79
+ >
44
80
  a user 3
45
81
  </a>
46
82
  </td>
@@ -54,15 +90,20 @@ exports[`<GroupUsersTable /> matches the latest snapshot 1`] = `
54
90
  >
55
91
  test3@test.com
56
92
  </td>
93
+ <td
94
+ class="two wide"
95
+ />
57
96
  <td
58
97
  class="center aligned pointer"
59
98
  >
60
99
  <button
61
- class="ui red mini basic icon button"
100
+ aria-label="groupUsers.actions.delete.confirmation.header"
101
+ class="ui mini basic icon negative button"
102
+ type="button"
62
103
  >
63
104
  <i
64
105
  aria-hidden="true"
65
- class="red trash alternate outline icon"
106
+ class="trash alternate outline icon"
66
107
  />
67
108
  </button>
68
109
  </td>
@@ -73,7 +114,10 @@ exports[`<GroupUsersTable /> matches the latest snapshot 1`] = `
73
114
  <td
74
115
  class="two wide pointer"
75
116
  >
76
- <a>
117
+ <a
118
+ data-discover="true"
119
+ href="/users/9"
120
+ >
77
121
  user 1
78
122
  </a>
79
123
  </td>
@@ -87,15 +131,20 @@ exports[`<GroupUsersTable /> matches the latest snapshot 1`] = `
87
131
  >
88
132
  test1@test.com
89
133
  </td>
134
+ <td
135
+ class="two wide"
136
+ />
90
137
  <td
91
138
  class="center aligned pointer"
92
139
  >
93
140
  <button
94
- class="ui red mini basic icon button"
141
+ aria-label="groupUsers.actions.delete.confirmation.header"
142
+ class="ui mini basic icon negative button"
143
+ type="button"
95
144
  >
96
145
  <i
97
146
  aria-hidden="true"
98
- class="red trash alternate outline icon"
147
+ class="trash alternate outline icon"
99
148
  />
100
149
  </button>
101
150
  </td>
@@ -106,7 +155,10 @@ exports[`<GroupUsersTable /> matches the latest snapshot 1`] = `
106
155
  <td
107
156
  class="two wide pointer"
108
157
  >
109
- <a>
158
+ <a
159
+ data-discover="true"
160
+ href="/users/3"
161
+ >
110
162
  user 2
111
163
  </a>
112
164
  </td>
@@ -120,15 +172,20 @@ exports[`<GroupUsersTable /> matches the latest snapshot 1`] = `
120
172
  >
121
173
  test2@test.com
122
174
  </td>
175
+ <td
176
+ class="two wide"
177
+ />
123
178
  <td
124
179
  class="center aligned pointer"
125
180
  >
126
181
  <button
127
- class="ui red mini basic icon button"
182
+ aria-label="groupUsers.actions.delete.confirmation.header"
183
+ class="ui mini basic icon negative button"
184
+ type="button"
128
185
  >
129
186
  <i
130
187
  aria-hidden="true"
131
- class="red trash alternate outline icon"
188
+ class="trash alternate outline icon"
132
189
  />
133
190
  </button>
134
191
  </td>
@@ -3,8 +3,6 @@ import Group from "./Group";
3
3
  import GroupCard from "./GroupCard";
4
4
  import GroupCards from "./GroupCards";
5
5
  import GroupForm from "./GroupForm";
6
- import GroupLoader from "./GroupLoader";
7
- import GroupsLoader from "./GroupsLoader";
8
6
  import GroupsSearchLoader from "./GroupsSearchLoader";
9
7
  import GroupUsers from "./GroupUsers";
10
8
  import GroupUsersTable from "./GroupUsersTable";
@@ -16,10 +14,8 @@ export {
16
14
  GroupCard,
17
15
  GroupCards,
18
16
  GroupForm,
19
- GroupLoader,
20
17
  GroupUsers,
21
18
  GroupUsersTable,
22
- GroupsLoader,
23
19
  GroupsSearchLoader,
24
20
  NewGroup,
25
21
  };