Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enterprise Search][Behavioral Analytics] Set limit on 10k results for explore tables #156237

Merged
merged 1 commit into from
May 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
EuiFieldSearch,
EuiFlexGroup,
EuiHorizontalRule,
EuiI18nNumber,
EuiSpacer,
EuiTab,
EuiTabs,
Expand Down Expand Up @@ -270,6 +271,7 @@ const tableSettings: {
},
},
};
const MAX_ITEMS = 10000;

export const AnalyticsCollectionExplorerTable = () => {
const { euiTheme } = useEuiTheme();
Expand All @@ -292,6 +294,8 @@ export const AnalyticsCollectionExplorerTable = () => {
const handleTableChange = ({ sort, page }: Criteria<ExploreTableItem>) => {
onTableChange({ page, sort });
};
const startNumberItemsOnPage = pageSize * pageIndex + (items.length ? 1 : 0);
const endNumberItemsOnPage = pageSize * pageIndex + items.length;

useEffect(() => {
if (!selectedTable) {
Expand Down Expand Up @@ -335,19 +339,33 @@ export const AnalyticsCollectionExplorerTable = () => {
<EuiSpacer size="xl" />

<EuiText size="xs">
<FormattedMessage
id="xpack.enterpriseSearch.analytics.collectionsView.explorer.tableSummary"
defaultMessage="Showing {items} of {totalItemsCount}"
values={{
items: (
<strong>
{pageSize * pageIndex + Number(!!items.length)}-
{pageSize * pageIndex + items.length}
</strong>
),
totalItemsCount,
}}
/>
{totalItemsCount > MAX_ITEMS ? (
<FormattedMessage
id="xpack.enterpriseSearch.analytics.collectionsView.explorer.tableSummaryIndeterminate"
defaultMessage="Showing {items} of first {maxItemsCount} results"
values={{
items: (
<strong>
{startNumberItemsOnPage}-{endNumberItemsOnPage}
</strong>
),
maxItemsCount: <EuiI18nNumber value={MAX_ITEMS} />,
}}
/>
) : (
<FormattedMessage
id="xpack.enterpriseSearch.analytics.collectionsView.explorer.tableSummary"
defaultMessage="Showing {items} of {totalItemsCount}"
values={{
items: (
<strong>
{startNumberItemsOnPage}-{endNumberItemsOnPage}
</strong>
),
totalItemsCount,
}}
/>
)}
</EuiText>

<EuiSpacer size="m" />
Expand All @@ -365,7 +383,7 @@ export const AnalyticsCollectionExplorerTable = () => {
pageSize,
pageSizeOptions: [10, 20, 50],
showPerPageOptions: true,
totalItemCount: totalItemsCount,
totalItemCount: Math.min(totalItemsCount, MAX_ITEMS),
}}
onChange={handleTableChange}
/>
Expand Down