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

[Cases] Show warning when all cases table reaches 10k cases message #164323

Merged
merged 13 commits into from
Aug 24, 2023
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ describe('AllCasesListGeneric', () => {
expect(
screen.getAllByTestId('case-table-column-createdAt')[0].querySelector('.euiToolTipAnchor')
).toHaveTextContent(removeMsFromDate(useGetCasesMockState.data.cases[0].createdAt));
expect(screen.getByTestId('case-table-case-count')).toHaveTextContent('Showing 10 cases');
expect(screen.getByTestId('case-table-case-count')).toHaveTextContent(
`Showing 10 of ${useGetCasesMockState.data.total} cases`
);
expect(screen.queryByTestId('all-cases-maximum-limit-warning')).not.toBeInTheDocument();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export const CasesTable: FunctionComponent<CasesTableProps> = ({
) : (
<>
<CasesTableUtilityBar
pagination={pagination}
isSelectorView={isSelectorView}
totalCases={data.total ?? 0}
selectedCases={selectedCases}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,28 @@ export const SHOWING_SELECTED_CASES = (totalRules: number) =>
defaultMessage: 'Selected {totalRules} {totalRules, plural, =1 {case} other {cases}}',
});

export const SHOWING_CASES = (totalRules: number) =>
export const SHOWING_CASES = (totalCases: number, pageSize: number) =>
i18n.translate('xpack.cases.caseTable.showingCasesTitle', {
values: { totalRules },
defaultMessage: 'Showing {totalRules} {totalRules, plural, =1 {case} other {cases}}',
values: { totalCases, pageSize },
defaultMessage:
'Showing {pageSize} of {totalCases} {totalCases, plural, =1 {case} other {cases}}',
});

export const MAX_CASES = (totalCases: number) =>
i18n.translate('xpack.cases.caseTable.maxCases', {
values: { totalCases },
defaultMessage:
'The results were capped at {totalCases} to maintain performance. Try limiting your search to reduce the results.',
});

export const DISMISS = i18n.translate('xpack.cases.caseTable.dismiss', {
defaultMessage: 'Dismiss',
});

export const NOT_SHOW_AGAIN = i18n.translate('xpack.cases.caseTable.notShowAgain', {
defaultMessage: 'Do not show again',
});

export const UNIT = (totalCount: number) =>
i18n.translate('xpack.cases.caseTable.unit', {
values: { totalCount },
Expand Down
Loading