Skip to content

feat(site): add view activity on user context menu #7897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions site/src/components/UsersTable/UsersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface UsersTableProps {
onActivateUser: (user: TypesGen.User) => void
onDeleteUser: (user: TypesGen.User) => void
onListWorkspaces: (user: TypesGen.User) => void
onViewActivity: (user: TypesGen.User) => void
onResetUserPassword: (user: TypesGen.User) => void
onUpdateUserRoles: (
user: TypesGen.User,
Expand All @@ -42,6 +43,7 @@ export const UsersTable: FC<React.PropsWithChildren<UsersTableProps>> = ({
onSuspendUser,
onDeleteUser,
onListWorkspaces,
onViewActivity,
onActivateUser,
onResetUserPassword,
onUpdateUserRoles,
Expand Down Expand Up @@ -80,6 +82,7 @@ export const UsersTable: FC<React.PropsWithChildren<UsersTableProps>> = ({
onActivateUser={onActivateUser}
onDeleteUser={onDeleteUser}
onListWorkspaces={onListWorkspaces}
onViewActivity={onViewActivity}
onResetUserPassword={onResetUserPassword}
onSuspendUser={onSuspendUser}
onUpdateUserRoles={onUpdateUserRoles}
Expand Down
11 changes: 9 additions & 2 deletions site/src/components/UsersTable/UsersTableBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ interface UsersTableBodyProps {
onSuspendUser: (user: TypesGen.User) => void
onDeleteUser: (user: TypesGen.User) => void
onListWorkspaces: (user: TypesGen.User) => void
onViewActivity: (user: TypesGen.User) => void
onActivateUser: (user: TypesGen.User) => void
onResetUserPassword: (user: TypesGen.User) => void
onUpdateUserRoles: (
Expand All @@ -55,6 +56,7 @@ export const UsersTableBody: FC<
onSuspendUser,
onDeleteUser,
onListWorkspaces,
onViewActivity,
onActivateUser,
onResetUserPassword,
onUpdateUserRoles,
Expand Down Expand Up @@ -183,14 +185,19 @@ export const UsersTableBody: FC<
onClick: onDeleteUser,
disabled: user.id === actorID,
},
{
label: t("resetPasswordMenuItem"),
onClick: onResetUserPassword,
disabled: false,
},
{
label: t("listWorkspacesMenuItem"),
onClick: onListWorkspaces,
disabled: false,
},
{
label: t("resetPasswordMenuItem"),
onClick: onResetUserPassword,
label: "View activity",
onClick: onViewActivity,
disabled: false,
},
)
Expand Down
5 changes: 5 additions & 0 deletions site/src/pages/UsersPage/UsersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ export const UsersPage: FC<{ children?: ReactNode }> = () => {
encodeURIComponent(`owner:${user.username}`),
)
}}
onViewActivity={(user) => {
navigate(
"/audit?filter=" + encodeURIComponent(`username:${user.username}`),
)
}}
onDeleteUser={(user) => {
usersSend({
type: "DELETE_USER",
Expand Down
3 changes: 3 additions & 0 deletions site/src/pages/UsersPage/UsersPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface UsersPageViewProps {
onSuspendUser: (user: TypesGen.User) => void
onDeleteUser: (user: TypesGen.User) => void
onListWorkspaces: (user: TypesGen.User) => void
onViewActivity: (user: TypesGen.User) => void
onActivateUser: (user: TypesGen.User) => void
onResetUserPassword: (user: TypesGen.User) => void
onUpdateUserRoles: (
Expand All @@ -44,6 +45,7 @@ export const UsersPageView: FC<React.PropsWithChildren<UsersPageViewProps>> = ({
onSuspendUser,
onDeleteUser,
onListWorkspaces,
onViewActivity,
onActivateUser,
onResetUserPassword,
onUpdateUserRoles,
Expand Down Expand Up @@ -86,6 +88,7 @@ export const UsersPageView: FC<React.PropsWithChildren<UsersPageViewProps>> = ({
onSuspendUser={onSuspendUser}
onDeleteUser={onDeleteUser}
onListWorkspaces={onListWorkspaces}
onViewActivity={onViewActivity}
onActivateUser={onActivateUser}
onResetUserPassword={onResetUserPassword}
onUpdateUserRoles={onUpdateUserRoles}
Expand Down