Show actual number of selected hosts (#46334)
**Related issue:** Resolves #40502 # Checklist for submitter - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. ## Testing - [x] Added/updated automated tests - [x] QA'd all new/changed functionality manually <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Fixed "select all matching hosts" to display the actual total count instead of showing an estimate like "50+" in table headers and delete confirmation dialogs. * **Tests** * Updated test cases to reflect accurate host count display behavior when selecting all matching hosts. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/fleetdm/fleet/pull/46334?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -50,6 +50,7 @@ interface IDataTableProps {
|
||||
isAllPagesSelected: boolean; // TODO: make dependent on showMarkAllPages
|
||||
toggleAllPagesSelected?: any; // TODO: an event type and make it dependent on showMarkAllPages
|
||||
resultsTitle?: string;
|
||||
totalCount?: number;
|
||||
defaultPageSize: number;
|
||||
defaultPageIndex?: number;
|
||||
defaultSelectedRows?: Record<string, boolean>;
|
||||
@@ -109,6 +110,7 @@ const DataTable = ({
|
||||
isAllPagesSelected,
|
||||
toggleAllPagesSelected,
|
||||
resultsTitle = "results",
|
||||
totalCount,
|
||||
defaultPageSize,
|
||||
defaultPageIndex,
|
||||
defaultSelectedRows = {},
|
||||
@@ -452,8 +454,10 @@ const DataTable = ({
|
||||
return (
|
||||
<p>
|
||||
<span>
|
||||
{selectedCount}
|
||||
{isAllPagesSelected && "+"}
|
||||
{isAllPagesSelected && totalCount !== undefined
|
||||
? totalCount
|
||||
: selectedCount}
|
||||
{isAllPagesSelected && totalCount === undefined && "+"}
|
||||
</span>{" "}
|
||||
selected
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user