-
Notifications
You must be signed in to change notification settings - Fork 540
fix: add shouldIgnoreRowClick guard to all unprotected tables #4562
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ import {useState} from "react" | |
| import type {User} from "@agenta/shared/types" | ||
| import {message} from "@agenta/ui/app-message" | ||
| import {EditOutlined, MoreOutlined, SyncOutlined} from "@ant-design/icons" | ||
| import {ArrowClockwise, Trash} from "@phosphor-icons/react" | ||
| import {ArrowClockwise, Key, Trash} from "@phosphor-icons/react" | ||
| import {Button, Dropdown, Input, Modal, Space, Tag, Tooltip, Typography} from "antd" | ||
|
|
||
| import AlertPopup from "@/oss/components/AlertPopup/AlertPopup" | ||
|
|
@@ -12,7 +12,7 @@ import {isEmailInvitationsEnabled} from "@/oss/lib/helpers/isEE" | |
| import {useEntitlements} from "@/oss/lib/helpers/useEntitlements" | ||
| import {snakeToTitle} from "@/oss/lib/helpers/utils" | ||
| import {WorkspaceMember} from "@/oss/lib/Types" | ||
| import {updateUsername} from "@/oss/services/profile" | ||
| import {resetPassword, updateUsername} from "@/oss/services/profile" | ||
| import { | ||
| assignWorkspaceRole, | ||
| removeFromWorkspace, | ||
|
|
@@ -23,6 +23,9 @@ import {useOrgData} from "@/oss/state/org" | |
| import {useProfileData} from "@/oss/state/profile" | ||
| import {useWorkspaceRoles} from "@/oss/state/workspace" | ||
|
|
||
| import GenerateResetLinkModal from "./Modals/GenerateResetLinkModal" | ||
| import PasswordResetLinkModal from "./Modals/PasswordResetLinkModal" | ||
|
|
||
| export const Actions: React.FC<{ | ||
| member: WorkspaceMember | ||
| hidden?: boolean | ||
|
|
@@ -39,6 +42,10 @@ export const Actions: React.FC<{ | |
| const {refetch: refetchProfile} = useProfileData() | ||
| const [renameOpen, setRenameOpen] = useState(false) | ||
| const [renameValue, setRenameValue] = useState(user.username || "") | ||
| const [generateResetLinkOpen, setGenerateResetLinkOpen] = useState(false) | ||
| const [resetLinkOpen, setResetLinkOpen] = useState(false) | ||
| const [resetLink, setResetLink] = useState("") | ||
| const [resetLoading, setResetLoading] = useState(false) | ||
|
|
||
| if (hidden && !selfMenu) return null | ||
|
|
||
|
|
@@ -90,6 +97,24 @@ export const Actions: React.FC<{ | |
| } | ||
| } | ||
|
|
||
| const handleResetPassword = async () => { | ||
| setResetLoading(true) | ||
| try { | ||
| const link = await resetPassword(user.id) | ||
| setGenerateResetLinkOpen(false) | ||
| setResetLink(link) | ||
| setResetLinkOpen(true) | ||
| } catch (error: any) { | ||
| const detail = | ||
| error?.response?.data?.detail || | ||
| error?.message || | ||
| "Unable to generate reset password link" | ||
| message.error(detail) | ||
| } finally { | ||
| setResetLoading(false) | ||
| } | ||
| } | ||
|
|
||
| return ( | ||
| <> | ||
| <Dropdown | ||
|
|
@@ -127,6 +152,19 @@ export const Actions: React.FC<{ | |
| }, | ||
| ] | ||
| : []), | ||
| ...(isMember | ||
| ? [ | ||
| { | ||
| key: "reset_password", | ||
| label: "Reset password", | ||
| icon: <Key size={16} />, | ||
| onClick: (e: any) => { | ||
| e.domEvent.stopPropagation() | ||
| setGenerateResetLinkOpen(true) | ||
| }, | ||
| }, | ||
| ] | ||
| : []), | ||
| { | ||
| key: "remove", | ||
| label: "Remove", | ||
|
|
@@ -165,6 +203,21 @@ export const Actions: React.FC<{ | |
| placeholder="New username" | ||
| /> | ||
| </Modal> | ||
|
|
||
| <GenerateResetLinkModal | ||
| open={generateResetLinkOpen} | ||
| username={user.username} | ||
| onCancel={() => setGenerateResetLinkOpen(false)} | ||
| onOk={handleResetPassword} | ||
| confirmLoading={resetLoading} | ||
| /> | ||
|
|
||
| <PasswordResetLinkModal | ||
| open={resetLinkOpen} | ||
| username={user.username} | ||
| generatedLink={resetLink} | ||
| onCancel={() => setResetLinkOpen(false)} | ||
| /> | ||
|
Comment on lines
+207
to
+220
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check if the modal components use EnhancedModal or raw antd Modal
fd -e tsx -e ts 'GenerateResetLinkModal|PasswordResetLinkModal' web/oss/src/components/pages/settings/WorkspaceManage/Modals/ --exec cat {}Repository: Agenta-AI/agenta Length of output: 4194 Switch WorkspaceManage reset modals to EnhancedModal
Source: Coding guidelines
Comment on lines
+215
to
+220
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clear the generated reset link when closing the modal. On Line 219, close only toggles Suggested patch <PasswordResetLinkModal
open={resetLinkOpen}
username={user.username}
generatedLink={resetLink}
- onCancel={() => setResetLinkOpen(false)}
+ onCancel={() => {
+ setResetLinkOpen(false)
+ setResetLink("")
+ }}
/> |
||
| </> | ||
| ) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,3 +56,17 @@ export const changePassword = async (payload: { | |
| body: JSON.stringify(payload), | ||
| }) | ||
| } | ||
|
|
||
| /** | ||
| * Generate a password reset link for a user (admin action). | ||
| * Returns the reset password link string. | ||
| */ | ||
| export const resetPassword = async (userId: string): Promise<string> => { | ||
| const base = getBaseUrl() | ||
| const url = new URL("api/profile/reset-password", base) | ||
| url.searchParams.set("user_id", userId) | ||
| const data = await fetchJson<string>(url, { | ||
| method: "POST", | ||
| }) | ||
| return data | ||
| } | ||
|
Comment on lines
+60
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify the Fern-generated client exports a method for password reset
rg -n -C3 'resetUserPassword|reset.*password' --type=ts --iglob '**/agenta-api-client/**'Repository: Agenta-AI/agenta Length of output: 5484 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Find ResetUserPasswordRequest shape and response handling
rg -n --type=ts 'ResetUserPasswordRequest' web/packages/agenta-api-client/src/generated/api -SRepository: Agenta-AI/agenta Length of output: 809 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Read the request interface
echo "---- ResetUserPasswordRequest.ts ----"
sed -n '1,120p' web/packages/agenta-api-client/src/generated/api/resources/users/client/requests/ResetUserPasswordRequest.ts
# Read the relevant portion of UsersClient.resetUserPassword
echo "---- Client.ts (resetUserPassword) ----"
sed -n '130,260p' web/packages/agenta-api-client/src/generated/api/resources/users/client/Client.tsRepository: Agenta-AI/agenta Length of output: 4067 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n --type=ts --type=tsx '\.resetUserPassword\(' web/oss web/ee web -SRepository: Agenta-AI/agenta Length of output: 88 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n '\.resetUserPassword\(' -S --glob '**/*.ts' --glob '**/*.tsx' web/oss web/eeRepository: Agenta-AI/agenta Length of output: 42 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n 'resetUserPassword' -S --glob '**/*.ts' --glob '**/*.tsx' web/oss web/eeRepository: Agenta-AI/agenta Length of output: 42 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n --glob '**/*.ts' --glob '**/*.tsx' 'getAgentaSdkClient\(\{host: getAgentaApiUrl\(\)\}\)' web/oss web/eeRepository: Agenta-AI/agenta Length of output: 153 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '1,120p' web/oss/src/components/pages/_app/index.tsxRepository: Agenta-AI/agenta Length of output: 3896 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n 'ResetUserPasswordResponse|resetUserPassword.*Response|reset password' web/packages/agenta-api-client/src/generated/api/resources/users/client -SRepository: Agenta-AI/agenta Length of output: 233 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n 'reset-password|ResetUserPassword' web/packages/agenta-api-client/src/generated/api -SRepository: Agenta-AI/agenta Length of output: 1139 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n 'profile/reset-password|reset_password|resetUserPassword' web/packages/agenta-api-client/src/generated/api -SRepository: Agenta-AI/agenta Length of output: 1066 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Find how the SDK responses are consumed (e.g., `.data`)
rg -n --glob '**/*.ts' --glob '**/*.tsx' \
'\.data(\b|$)|rawResponse|HttpResponsePromise' web/oss/src web/ee/src \
|| trueRepository: Agenta-AI/agenta Length of output: 50373 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Find how the SDK client return values are consumed (e.g., awaiting and reading `.data`)
rg -n --glob '**/*.ts' --glob '**/*.tsx' 'getAgentaSdkClient\(' web/oss web/eeRepository: Agenta-AI/agenta Length of output: 153 Use the Fern-generated client for
Source: Coding guidelines |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win
Route reset-password through the Fern SDK client, not the manual fetch path.
This handler now depends on a new API call path, but
resetPasswordis implemented with manualURL+fetchJsoninstead of the Fern client contract used inweb/**/*.{ts,tsx}. Please migrate that service call togetAgentaSdkClient({host: getAgentaApiUrl()})and pass params via{queryParams: {...}}before merge.As per coding guidelines, all new frontend API code must go through the Fern-generated client and use
{queryParams}rather than axios/fetch-style params.Source: Coding guidelines