Skip to content

implement filtering AgentList by namespace#1813

Open
maazghani wants to merge 6 commits intokagent-dev:mainfrom
maazghani:maazghani/add-filter-agent-list-by-namespace
Open

implement filtering AgentList by namespace#1813
maazghani wants to merge 6 commits intokagent-dev:mainfrom
maazghani:maazghani/add-filter-agent-list-by-namespace

Conversation

@maazghani
Copy link
Copy Markdown

addresses #1812

The agents page showed a single unscoped list across namespaces, which made the view noisy in multi-tenant clusters and harder to navigate. This change adds namespace-aware filtering to the existing agents page without changing the underlying data flow.

  • Namespace-scoped list state

    • Adds a namespace selector to the agents page header.
    • Sources the active filter from the namespace query param so the view persists across refresh/navigation.
    • Includes an explicit All namespaces option.
  • Consistent filtering across views

    • Applies the namespace filter before rendering, so both AgentGrid and AgentListView stay in sync.
    • Derives available namespace options from the loaded agent set rather than introducing a separate fetch path.
  • Filtered empty state

    • Preserves the existing global empty state when no agents exist at all.
    • Adds a namespace-specific empty state when the selected namespace has no matching agents, with a one-click reset to clear the filter.
  • Coverage

    • Adds component tests for:
      • URL-driven namespace filtering
      • namespace-filtered empty state behavior
const namespaceFilter = searchParams.get("namespace") || ALL_NAMESPACES;

const filteredAgents =
  namespaceFilter === ALL_NAMESPACES
    ? agents || []
    : (agents || []).filter(
        (item) => (item.agent.metadata.namespace || "") === namespaceFilter,
      );

Copilot AI and others added 6 commits May 7, 2026 19:02
Agent-Logs-Url: https://github.com/maazghani/kagent/sessions/c373920c-0f64-4998-afa2-0a928633e43e

Co-authored-by: maazghani <5009288+maazghani@users.noreply.github.com>
Agent-Logs-Url: https://github.com/maazghani/kagent/sessions/c373920c-0f64-4998-afa2-0a928633e43e

Co-authored-by: maazghani <5009288+maazghani@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Maaz Ghani <maazghani@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Maaz Ghani <maazghani@gmail.com>
Agent-Logs-Url: https://github.com/maazghani/kagent/sessions/cb9140cb-1ccd-44b2-93a5-cfcbcc5ba043

Co-authored-by: maazghani <5009288+maazghani@users.noreply.github.com>
Agent-Logs-Url: https://github.com/maazghani/kagent/sessions/c5137321-6f88-4e20-b1ce-b8e5138c15a9

Co-authored-by: maazghani <5009288+maazghani@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 7, 2026 19:40
@maazghani maazghani requested a review from peterj as a code owner May 7, 2026 19:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds namespace-aware filtering to the Agents page UI by deriving the active namespace from the namespace query parameter and applying the filter consistently across both grid and list views, including a namespace-specific empty state.

Changes:

  • Add a namespace selector to the Agents page header, driven by the namespace URL query param (with an “All namespaces” option).
  • Filter the rendered agents list prior to passing data into AgentGrid / AgentListView, keeping both views consistent.
  • Add Jest component tests covering URL-driven filtering, default-namespace normalization, and the filtered empty state.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
ui/src/components/AgentList.tsx Adds namespace query-param state, namespace dropdown options derived from loaded agents, filtered rendering, and a namespace-specific empty state.
ui/src/components/tests/AgentList.test.tsx Adds component tests for namespace filtering behavior and filtered empty state.
ui/jest.setup.ts Updates next/navigation mocks to reusable jest fns so tests can override return values.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@maazghani
Copy link
Copy Markdown
Author

@copilot thoughts on solutions for if the cluster has a large number of namespaces?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants