Skip to content

Commit 2a5025c

Browse files
feat(site): add view activity on user context menu (#7897)
1 parent eb11b50 commit 2a5025c

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

site/src/components/UsersTable/UsersTable.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface UsersTableProps {
2727
onActivateUser: (user: TypesGen.User) => void
2828
onDeleteUser: (user: TypesGen.User) => void
2929
onListWorkspaces: (user: TypesGen.User) => void
30+
onViewActivity: (user: TypesGen.User) => void
3031
onResetUserPassword: (user: TypesGen.User) => void
3132
onUpdateUserRoles: (
3233
user: TypesGen.User,
@@ -42,6 +43,7 @@ export const UsersTable: FC<React.PropsWithChildren<UsersTableProps>> = ({
4243
onSuspendUser,
4344
onDeleteUser,
4445
onListWorkspaces,
46+
onViewActivity,
4547
onActivateUser,
4648
onResetUserPassword,
4749
onUpdateUserRoles,
@@ -80,6 +82,7 @@ export const UsersTable: FC<React.PropsWithChildren<UsersTableProps>> = ({
8082
onActivateUser={onActivateUser}
8183
onDeleteUser={onDeleteUser}
8284
onListWorkspaces={onListWorkspaces}
85+
onViewActivity={onViewActivity}
8386
onResetUserPassword={onResetUserPassword}
8487
onSuspendUser={onSuspendUser}
8588
onUpdateUserRoles={onUpdateUserRoles}

site/src/components/UsersTable/UsersTableBody.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ interface UsersTableBodyProps {
3737
onSuspendUser: (user: TypesGen.User) => void
3838
onDeleteUser: (user: TypesGen.User) => void
3939
onListWorkspaces: (user: TypesGen.User) => void
40+
onViewActivity: (user: TypesGen.User) => void
4041
onActivateUser: (user: TypesGen.User) => void
4142
onResetUserPassword: (user: TypesGen.User) => void
4243
onUpdateUserRoles: (
@@ -55,6 +56,7 @@ export const UsersTableBody: FC<
5556
onSuspendUser,
5657
onDeleteUser,
5758
onListWorkspaces,
59+
onViewActivity,
5860
onActivateUser,
5961
onResetUserPassword,
6062
onUpdateUserRoles,
@@ -183,14 +185,19 @@ export const UsersTableBody: FC<
183185
onClick: onDeleteUser,
184186
disabled: user.id === actorID,
185187
},
188+
{
189+
label: t("resetPasswordMenuItem"),
190+
onClick: onResetUserPassword,
191+
disabled: false,
192+
},
186193
{
187194
label: t("listWorkspacesMenuItem"),
188195
onClick: onListWorkspaces,
189196
disabled: false,
190197
},
191198
{
192-
label: t("resetPasswordMenuItem"),
193-
onClick: onResetUserPassword,
199+
label: "View activity",
200+
onClick: onViewActivity,
194201
disabled: false,
195202
},
196203
)

site/src/pages/UsersPage/UsersPage.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ export const UsersPage: FC<{ children?: ReactNode }> = () => {
112112
encodeURIComponent(`owner:${user.username}`),
113113
)
114114
}}
115+
onViewActivity={(user) => {
116+
navigate(
117+
"/audit?filter=" + encodeURIComponent(`username:${user.username}`),
118+
)
119+
}}
115120
onDeleteUser={(user) => {
116121
usersSend({
117122
type: "DELETE_USER",

site/src/pages/UsersPage/UsersPageView.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface UsersPageViewProps {
2323
onSuspendUser: (user: TypesGen.User) => void
2424
onDeleteUser: (user: TypesGen.User) => void
2525
onListWorkspaces: (user: TypesGen.User) => void
26+
onViewActivity: (user: TypesGen.User) => void
2627
onActivateUser: (user: TypesGen.User) => void
2728
onResetUserPassword: (user: TypesGen.User) => void
2829
onUpdateUserRoles: (
@@ -44,6 +45,7 @@ export const UsersPageView: FC<React.PropsWithChildren<UsersPageViewProps>> = ({
4445
onSuspendUser,
4546
onDeleteUser,
4647
onListWorkspaces,
48+
onViewActivity,
4749
onActivateUser,
4850
onResetUserPassword,
4951
onUpdateUserRoles,
@@ -86,6 +88,7 @@ export const UsersPageView: FC<React.PropsWithChildren<UsersPageViewProps>> = ({
8688
onSuspendUser={onSuspendUser}
8789
onDeleteUser={onDeleteUser}
8890
onListWorkspaces={onListWorkspaces}
91+
onViewActivity={onViewActivity}
8992
onActivateUser={onActivateUser}
9093
onResetUserPassword={onResetUserPassword}
9194
onUpdateUserRoles={onUpdateUserRoles}

0 commit comments

Comments
 (0)