-
setViewAndPersist("grid")}
- >
-
-
- Cards
-
-
-
setViewAndPersist("list")}
- >
-
-
- List
-
-
+
+
+
- ) : null
+ {agents && agents.length > 0 ? (
+
+ setViewAndPersist("grid")}
+ >
+
+
+ Cards
+
+
+ setViewAndPersist("list")}
+ >
+
+
+ List
+
+
+
+ ) : null}
+
}
/>
{agents?.length === 0 ? (
-
No agents yet
-
Create an agent to run it in your cluster and wire models and tools in one place.
+
+ {selectedNamespace
+ ? `No agents found in namespace "${selectedNamespace}".`
+ : "No agents yet"}
+
+
+ {selectedNamespace
+ ? "Create an agent in this namespace or switch namespaces."
+ : "Create an agent to run it in your cluster and wire models and tools in one place."}
+
-
+
New Agent
) : view === "list" ? (
-
+
) : (
-
+
)}
);
diff --git a/ui/src/components/AgentListView.tsx b/ui/src/components/AgentListView.tsx
index 501d23169..db7d47a60 100644
--- a/ui/src/components/AgentListView.tsx
+++ b/ui/src/components/AgentListView.tsx
@@ -28,6 +28,7 @@ import { isOpenshellSandboxRow, openshellTerminalHref } from "@/lib/openshellSan
interface AgentListViewProps {
agentResponse: AgentResponse[];
+ onAgentsChanged?: () => Promise
| void;
}
type SortKey = "name" | "type" | "providerModel" | "toolCount" | "skillsCount" | "state";
@@ -214,7 +215,7 @@ function SortableTh({ col, label, className, textAlign = "left", sort, onSort }:
);
}
-function AgentListRow({ item }: { item: AgentResponse }) {
+function AgentListRow({ item, onAgentsChanged }: { item: AgentResponse; onAgentsChanged?: () => Promise | void }) {
const { agent, deploymentReady, accepted } = item;
const router = useRouter();
const [memoriesOpen, setMemoriesOpen] = useState(false);
@@ -389,6 +390,7 @@ function AgentListRow({ item }: { item: AgentResponse }) {
@@ -406,7 +408,7 @@ function AgentListRow({ item }: { item: AgentResponse }) {
return trBody;
}
-export function AgentListView({ agentResponse }: AgentListViewProps) {
+export function AgentListView({ agentResponse, onAgentsChanged }: AgentListViewProps) {
const [sort, setSort] = useState<{ key: SortKey; dir: SortDir }>({ key: "name", dir: "asc" });
const onSort = useCallback((col: SortKey) => {
@@ -453,10 +455,10 @@ export function AgentListView({ agentResponse }: AgentListViewProps) {
item.agent.metadata.namespace || "",
item.agent.metadata.name || "",
);
- return ;
+ return ;
})}
);
-}
\ No newline at end of file
+}
diff --git a/ui/src/components/AgentsProvider.tsx b/ui/src/components/AgentsProvider.tsx
index da8f28e7d..b216ee8e6 100644
--- a/ui/src/components/AgentsProvider.tsx
+++ b/ui/src/components/AgentsProvider.tsx
@@ -280,11 +280,6 @@ export function AgentsProvider({ children }: AgentsProviderProps) {
const result = await createAgent(agentData);
- if (!result.error) {
- // Refresh agents to get the newly created one
- await fetchAgents();
- }
-
return result;
} catch (error) {
console.error("Error creating agent:", error);
@@ -293,7 +288,7 @@ export function AgentsProvider({ children }: AgentsProviderProps) {
error: error instanceof Error ? error.message : "Failed to create agent",
};
}
- }, [fetchAgents, validateAgentData]);
+ }, [validateAgentData]);
// Update existing agent
const updateAgent = useCallback(async (agentData: AgentFormData): Promise