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

[Observability] [Timelines] Reduce number of alerts per page in Alerts table #111100

Closed
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ import {
getAlertsPermissions,
useGetUserAlertsPermissions,
} from '../../hooks/use_alert_permission';
import type { TimelinesUIStart, TGridType, SortDirection } from '../../../../timelines/public';
import type {
TimelinesUIStart,
GetTGridProps,
TGridType,
SortDirection,
} from '../../../../timelines/public';
import { useStatusBulkActionItems } from '../../../../timelines/public';
import type { TopAlert } from './';
import { useKibana } from '../../../../../../src/plugins/kibana_react/public';
Expand Down Expand Up @@ -370,7 +375,10 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) {
filters: [],
hasAlertsCrudPermissions,
indexNames,
itemsPerPageOptions: [10, 25, 50],
// Limited to 10 to work around performance issues as described in
// https://github.com/elastic/kibana/issues/110758
itemsPerPage: 10,
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be nice to have a comment regarding why we only have 10. If there's an issue covering the EUI update maybe reference that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a comment!

itemsPerPageOptions: [],
loadingText: i18n.translate('xpack.observability.alertsTable.loadingTextLabel', {
defaultMessage: 'loading alerts',
}),
Expand Down Expand Up @@ -400,7 +408,7 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) {
values: { totalAlerts },
defaultMessage: '{totalAlerts, plural, =1 {alert} other {alerts}}',
}),
};
} as GetTGridProps<typeof type>;
}, [
casePermissions,
addToQuery,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export interface TGridStandaloneProps {
}) => boolean;
height?: number;
indexNames: string[];
itemsPerPage: number;
itemsPerPageOptions: number[];
query: Query;
onRuleChange?: () => void;
Expand Down Expand Up @@ -133,6 +134,7 @@ const TGridStandaloneComponent: React.FC<TGridStandaloneProps> = ({
filterStatus,
hasAlertsCrudPermissions,
indexNames,
itemsPerPage,
itemsPerPageOptions,
onRuleChange,
query,
Expand Down Expand Up @@ -311,7 +313,7 @@ const TGridStandaloneComponent: React.FC<TGridStandaloneProps> = ({
end,
},
indexNames,
itemsPerPage: itemsPerPageStore,
itemsPerPage,
itemsPerPageOptions,
showCheckboxes: true,
})
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/timelines/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export type {
export { Direction } from '../common/search_strategy/common';
export { tGridReducer } from './store/t_grid/reducer';
export type { TGridModelForTimeline, TimelineState, TimelinesUIStart } from './types';
export { TGridType, SortDirection } from './types';
export { TGridType, GetTGridProps, SortDirection } from './types';
export {
ARIA_COLINDEX_ATTRIBUTE,
ARIA_ROWINDEX_ATTRIBUTE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
it('Renders the correct number of cells', async () => {
// NOTE: This isn't ideal, but EuiDataGrid doesn't really have the concept of "rows"
const cells = await testSubjects.findAll('dataGridRowCell');
expect(cells.length).to.be(54);
expect(cells.length).to.be(10);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const AppRoot = React.memo(
footerText: 'Events',
filters: [],
hasAlertsCrudPermissions,
itemsPerPage: 50,
itemsPerPageOptions: [1, 2, 3],
loadingText: 'Loading events',
renderCellValue: () => <div data-test-subj="timeline-wrapper">test</div>,
Expand Down