[Unified observability] Show 10 items per page by default in the alerts table in the observability overview page. (#129633)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Alejandro Fernández Gómez 2022-05-12 20:39:10 +02:00 committed by GitHub
parent 595522b5c2
commit 70d7de4579
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 2 deletions

View file

@ -284,6 +284,7 @@ function AlertsPage() {
setRefetch={setRefetch}
stateStorageKey={ALERT_TABLE_STATE_STORAGE_KEY}
storage={new Storage(window.localStorage)}
itemsPerPage={50}
/>
</CasesContext>
</EuiFlexItem>

View file

@ -78,6 +78,7 @@ interface AlertsTableTGridProps {
stateStorageKey: string;
storage: IStorageWrapper;
setRefetch: (ref: () => void) => void;
itemsPerPage?: number;
}
interface ObservabilityActionsProps extends ActionProps {
@ -313,7 +314,16 @@ const FIELDS_WITHOUT_CELL_ACTIONS = [
];
export function AlertsTableTGrid(props: AlertsTableTGridProps) {
const { indexNames, rangeFrom, rangeTo, kuery, setRefetch, stateStorageKey, storage } = props;
const {
indexNames,
rangeFrom,
rangeTo,
kuery,
setRefetch,
stateStorageKey,
storage,
itemsPerPage,
} = props;
const {
timelines,
@ -409,6 +419,7 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) {
filters: [],
hasAlertsCrudPermissions,
indexNames,
itemsPerPage,
itemsPerPageOptions: [10, 25, 50],
loadingText: translations.alertsTable.loadingTextLabel,
footerText: translations.alertsTable.footerTextLabel,
@ -459,6 +470,7 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) {
deletedEventIds,
onStateChange,
tGridState,
itemsPerPage,
]);
const handleFlyoutClose = () => setFlyoutAlert(undefined);

View file

@ -66,6 +66,7 @@ function calculateBucketSize({ start, end }: { start?: number; end?: number }) {
}
const ALERT_TABLE_STATE_STORAGE_KEY = 'xpack.observability.overview.alert.tableState';
const ALERTS_PER_PAGE = 10;
export function OverviewPage({ routeParams }: Props) {
const trackMetric = useUiTracker({ app: 'observability-overview' });
@ -208,6 +209,7 @@ export function OverviewPage({ routeParams }: Props) {
rangeFrom={relativeStart}
rangeTo={relativeEnd}
indexNames={indexNames}
itemsPerPage={ALERTS_PER_PAGE}
stateStorageKey={ALERT_TABLE_STATE_STORAGE_KEY}
storage={new Storage(window.localStorage)}
/>

View file

@ -96,6 +96,7 @@ export interface TGridStandaloneProps {
}) => boolean;
height?: number;
indexNames: string[];
itemsPerPage?: number;
itemsPerPageOptions: number[];
query: Query;
onRuleChange?: () => void;
@ -130,6 +131,7 @@ const TGridStandaloneComponent: React.FC<TGridStandaloneProps> = ({
filterStatus,
hasAlertsCrudPermissions,
indexNames,
itemsPerPage,
itemsPerPageOptions,
onRuleChange,
query,
@ -294,7 +296,7 @@ const TGridStandaloneComponent: React.FC<TGridStandaloneProps> = ({
end,
},
indexNames,
itemsPerPage: itemsPerPageStore,
itemsPerPage: itemsPerPage || itemsPerPageStore,
itemsPerPageOptions,
showCheckboxes,
})