Skip to content
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

Resolve for issue #9082: Marketplace - "Select All" doesn't work in Agent Dashboard #9247

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const AgentTable: React.FC<AgentTableProps> = ({
<div key={agent.id} className="md:block">
<AgentTableRow
{...agent}
selectedAgents={selectedAgents}
onEditSubmission={onEditSubmission}
onDeleteSubmission={onDeleteSubmission}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export interface AgentTableRowProps {
rating: number;
dateSubmitted: string;
id: number;
selectedAgents: Set<string>;
setSelectedAgents: React.Dispatch<React.SetStateAction<Set<string>>>;
onEditSubmission: (submission: StoreSubmissionRequest) => void;
onDeleteSubmission: (submission_id: string) => void;
}
Expand All @@ -37,6 +39,8 @@ export const AgentTableRow: React.FC<AgentTableRowProps> = ({
runs,
rating,
id,
selectedAgents,
setSelectedAgents,
onEditSubmission,
onDeleteSubmission,
}) => {
Expand Down Expand Up @@ -68,6 +72,15 @@ export const AgentTableRow: React.FC<AgentTableRowProps> = ({
onDeleteSubmission(agent_id);
}, [agent_id, onDeleteSubmission]);

const handleCheckboxChange = React.useCallback(() => {
if (selectedAgents.has(agent_id)) {
selectedAgents.delete(agent_id);
} else {
selectedAgents.add(agent_id);
}
setSelectedAgents(new Set(selectedAgents));
}, [agent_id, selectedAgents, setSelectedAgents]);

return (
<div className="hidden items-center border-b border-neutral-300 px-4 py-4 hover:bg-neutral-50 dark:border-neutral-700 dark:hover:bg-neutral-800 md:flex">
<div className="flex items-center">
Expand All @@ -77,6 +90,8 @@ export const AgentTableRow: React.FC<AgentTableRowProps> = ({
id={checkboxId}
aria-label={`Select ${agentName}`}
className="mr-4 h-5 w-5 rounded border-2 border-neutral-400 dark:border-neutral-600"
checked={selectedAgents.has(agent_id)}
onChange={handleCheckboxChange}
/>
{/* Single label instead of multiple */}
<label htmlFor={checkboxId} className="sr-only">
Expand Down
Loading