forked from cardosofelipe/fast-next-template
feat(agents): add sorting by sort_order and include category & display fields in agent actions
- Implemented sorting of agent types by `sort_order` in Agents page. - Added support for category, icon, color, sort_order, typical_tasks, and collaboration_hints fields in agent creation and update actions.
This commit is contained in:
@@ -73,6 +73,13 @@ export default function AgentTypeDetailPage() {
|
|||||||
mcp_servers: data.mcp_servers,
|
mcp_servers: data.mcp_servers,
|
||||||
tool_permissions: data.tool_permissions,
|
tool_permissions: data.tool_permissions,
|
||||||
is_active: data.is_active,
|
is_active: data.is_active,
|
||||||
|
// Category and display fields
|
||||||
|
category: data.category,
|
||||||
|
icon: data.icon,
|
||||||
|
color: data.color,
|
||||||
|
sort_order: data.sort_order,
|
||||||
|
typical_tasks: data.typical_tasks,
|
||||||
|
collaboration_hints: data.collaboration_hints,
|
||||||
});
|
});
|
||||||
toast.success('Agent type created', {
|
toast.success('Agent type created', {
|
||||||
description: `${result.name} has been created successfully`,
|
description: `${result.name} has been created successfully`,
|
||||||
@@ -94,6 +101,13 @@ export default function AgentTypeDetailPage() {
|
|||||||
mcp_servers: data.mcp_servers,
|
mcp_servers: data.mcp_servers,
|
||||||
tool_permissions: data.tool_permissions,
|
tool_permissions: data.tool_permissions,
|
||||||
is_active: data.is_active,
|
is_active: data.is_active,
|
||||||
|
// Category and display fields
|
||||||
|
category: data.category,
|
||||||
|
icon: data.icon,
|
||||||
|
color: data.color,
|
||||||
|
sort_order: data.sort_order,
|
||||||
|
typical_tasks: data.typical_tasks,
|
||||||
|
collaboration_hints: data.collaboration_hints,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
toast.success('Agent type updated', {
|
toast.success('Agent type updated', {
|
||||||
|
|||||||
@@ -49,10 +49,10 @@ export default function AgentTypesPage() {
|
|||||||
limit: 50,
|
limit: 50,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Get filtered agent types
|
// Get filtered and sorted agent types (sort by sort_order ascending - smaller first)
|
||||||
const filteredAgentTypes = useMemo(() => {
|
const filteredAgentTypes = useMemo(() => {
|
||||||
if (!data?.data) return [];
|
if (!data?.data) return [];
|
||||||
return data.data;
|
return [...data.data].sort((a, b) => a.sort_order - b.sort_order);
|
||||||
}, [data?.data]);
|
}, [data?.data]);
|
||||||
|
|
||||||
// Handle navigation to agent type detail
|
// Handle navigation to agent type detail
|
||||||
|
|||||||
Reference in New Issue
Block a user