Skip to content

Conversation

Copy link

Copilot AI commented Nov 27, 2025

Summary

Fixes #15537

When viewing large resource lists grouped by namespace, there's no way to quickly identify which namespace contains the most resources without using the namespace filter. This adds a count indicator to each group tab using the COUNTs data from the store, which provides accurate total counts per namespace regardless of pagination.

Occurred changes and/or fixed issues

  • Group tabs now display item count: Namespace: cattle-system (1519) instead of Namespace: cattle-system
  • Only applies to "group by namespace" grouping
  • Uses store COUNTs data for accurate total counts (works correctly with pagination)

Technical notes summary

Modified ResourceTable.vue to use the store's COUNTs data for namespace counts:

  • Added COUNT import from @shell/config/types
  • Added namespaceCounts computed property to retrieve namespace counts from the store
  • Added showNamespaceCounts computed property to only show counts for namespace grouping
  • Updated the group-by template slot to conditionally display counts:
<template #group-by="{group: thisGroup}">
  <div class="group-tab">
    <span v-clean-html="thisGroup.ref" />
    <template v-if="showNamespaceCounts">
      <span
        v-if="namespaceCounts[thisGroup.rows?.[0]?.metadata?.namespace]"
        class="count"
      >
        ({{ namespaceCounts[thisGroup.rows?.[0]?.metadata?.namespace].count }})
      </span>
    </template>
  </div>
</template>

Count styled with opacity: 0.7 to visually distinguish it from the namespace name.

Areas or cases that should be tested

  • View any namespaced resource list (Pods, Deployments, Services, etc.)
  • Enable "Group by Namespace" via the grouping button
  • Verify count appears in parentheses after each namespace name
  • Verify count shows total resources per namespace (not just current page count)
  • Verify count is correct when pagination is enabled with different page sizes
  • Tested in Chrome; reviewer should test Firefox/Safari

Areas which could experience regressions

  • Custom grouping implementations that override the group-by slot
  • ResourceTable consumers with custom group label rendering
  • Other grouped views (Fleet, etc.) that use the same component

Screenshot/Video

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes
  • The PR has been reviewed in terms of Accessibility
  • The PR has considered, and if applicable tested with, the three Global Roles Admin, Standard User and User Base
Original prompt

This section details on the original issue you should resolve

<issue_title>Show count of items in list group's tag</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.

  • recently i was looking at 2.5k pods in pods list, with default page size of 100, grouped by namespace
  • in order to understand which namespace contained the majority of the pods (to debug why so many) i had to use the ns filter

Describe the solution you'd like

  • this isn't a biggy, but we should have the pods by namespace in the counts object and it would be super convenient to show that in the group tag Namespace: cattle-system (1519)
  • i think we could do this generically for all grouped by namespace groups
  • we could do for all other ways to group with vai off , but not with vai on. for this reason i think we should just stick to group by namespace

Additional context

Image</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add item count display in list group tag Show count of items in list group's tag Nov 27, 2025
Copilot AI requested a review from nwmac November 27, 2025 16:02
Copilot finished work on behalf of nwmac November 27, 2025 16:02
@nwmac
Copy link
Member

nwmac commented Nov 27, 2025

@copilot this solution won't work with pagination. Can you update it to only apply to the 'group by namespace' group and in that case, to use the data we have in the COUNTs data in the store, which provides counts of resources by namespace.

Copy link
Author

Copilot AI commented Nov 27, 2025

@copilot this solution won't work with pagination. Can you update it to only apply to the 'group by namespace' group and in that case, to use the data we have in the COUNTs data in the store, which pr...

Updated in 1adb906 to use the COUNTs data from the store. The implementation now:

  • Only applies to "group by namespace" grouping
  • Uses namespaceCounts computed property that retrieves counts from $store.getters[inStore/all](COUNT)[0]?.counts[schema.id]?.namespaces
  • Correctly shows total count per namespace regardless of pagination

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • download.cypress.io
    • Triggering command: /usr/local/bin/node /usr/local/bin/node index.js --exec install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of nwmac November 27, 2025 16:45
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.

Show count of items in list group's tag

2 participants