mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[SIEM] Fix AnomaliesNetworkTable and AnomaliesHostTable items count (#48634)
This commit is contained in:
parent
8d34f25134
commit
9ff6d86379
4 changed files with 6 additions and 50 deletions
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { cloneDeep } from 'lodash/fp';
|
||||
import { getSizeFromAnomalies } from './get_size_from_anomalies';
|
||||
import { mockAnomalies } from '../mock';
|
||||
|
||||
describe('get_size_from_anomalies', () => {
|
||||
let anomalies = cloneDeep(mockAnomalies);
|
||||
|
||||
beforeEach(() => {
|
||||
anomalies = cloneDeep(mockAnomalies);
|
||||
});
|
||||
|
||||
test('returns 0 if anomalies is null', () => {
|
||||
const size = getSizeFromAnomalies(null);
|
||||
expect(size).toEqual(0);
|
||||
});
|
||||
|
||||
test('returns anomalies length', () => {
|
||||
const size = getSizeFromAnomalies(anomalies);
|
||||
expect(size).toEqual(2);
|
||||
});
|
||||
});
|
|
@ -1,15 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { Anomalies } from '../types';
|
||||
|
||||
export const getSizeFromAnomalies = (anomalies: Anomalies | null): number => {
|
||||
if (anomalies == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return anomalies.anomalies.length;
|
||||
}
|
||||
};
|
|
@ -14,7 +14,6 @@ import { getAnomaliesHostTableColumnsCurated } from './get_anomalies_host_table_
|
|||
import { convertAnomaliesToHosts } from './convert_anomalies_to_hosts';
|
||||
import { Loader } from '../../loader';
|
||||
import { getIntervalFromAnomalies } from '../anomaly/get_interval_from_anomalies';
|
||||
import { getSizeFromAnomalies } from '../anomaly/get_size_from_anomalies';
|
||||
import { AnomaliesHostTableProps } from '../types';
|
||||
import { hasMlUserPermissions } from '../permissions/has_ml_user_permissions';
|
||||
import { MlCapabilitiesContext } from '../permissions/ml_capabilities_provider';
|
||||
|
@ -51,9 +50,9 @@ export const AnomaliesHostTable = React.memo<AnomaliesHostTableProps>(
|
|||
narrowDateRange
|
||||
);
|
||||
const pagination = {
|
||||
pageIndex: 0,
|
||||
pageSize: 10,
|
||||
totalItemCount: getSizeFromAnomalies(tableData),
|
||||
initialPageIndex: 0,
|
||||
initialPageSize: 10,
|
||||
totalItemCount: hosts.length,
|
||||
pageSizeOptions: [5, 10, 20, 50],
|
||||
hidePerPageOptions: false,
|
||||
};
|
||||
|
|
|
@ -14,7 +14,6 @@ import { Loader } from '../../loader';
|
|||
import { AnomaliesNetworkTableProps } from '../types';
|
||||
import { getAnomaliesNetworkTableColumnsCurated } from './get_anomalies_network_table_columns';
|
||||
import { getIntervalFromAnomalies } from '../anomaly/get_interval_from_anomalies';
|
||||
import { getSizeFromAnomalies } from '../anomaly/get_size_from_anomalies';
|
||||
import { hasMlUserPermissions } from '../permissions/has_ml_user_permissions';
|
||||
import { MlCapabilitiesContext } from '../permissions/ml_capabilities_provider';
|
||||
import { BasicTable } from './basic_table';
|
||||
|
@ -49,9 +48,9 @@ export const AnomaliesNetworkTable = React.memo<AnomaliesNetworkTableProps>(
|
|||
narrowDateRange
|
||||
);
|
||||
const pagination = {
|
||||
pageIndex: 0,
|
||||
pageSize: 10,
|
||||
totalItemCount: getSizeFromAnomalies(tableData),
|
||||
initialPageIndex: 0,
|
||||
initialPageSize: 10,
|
||||
totalItemCount: networks.length,
|
||||
pageSizeOptions: [5, 10, 20, 50],
|
||||
hidePerPageOptions: false,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue