Skip to content

Commit

Permalink
Add fixed range and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jennypavlova committed Oct 14, 2022
1 parent 4153f3b commit 5ae30be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,16 @@
* 2.0.
*/

import type { Query, TimeRange } from '@kbn/es-query';
import React from 'react';
import type { DataView } from '@kbn/data-views-plugin/public';
import { EuiBasicTable } from '@elastic/eui';
import { SnapshotNode } from '../../../../../common/http_api';
import { HostsTableColumns } from './hosts_table_columns';
import { useHostTable } from '../hooks/use_host_table';
interface Props {
dataView: DataView;
timeRange: TimeRange;
query: Query;
nodes: SnapshotNode[];
}

export const HostsTable: React.FunctionComponent<Props> = ({
dataView,
timeRange,
query,
nodes,
}) => {
export const HostsTable: React.FunctionComponent<Props> = ({ nodes }) => {
const items = useHostTable(nodes);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export const HostsContent: React.FunctionComponent = () => {
{ type: 'memory' },
{ type: 'cpuCores' },
{ type: 'memoryTotal' },
// add others
];

const { loading, nodes, reload } = useSnapshot(
Expand All @@ -51,10 +50,16 @@ export const HostsContent: React.FunctionComponent = () => {
[],
'host',
sourceId,
1665482950000, // currentTime. need to add support for TimeRange?
1665748800000, // currentTime. need to add support for TimeRange?
'',
'',
true
true,
{
from: 1665748800000, // dynamic time range needs to be supported
interval: '1m',
lookbackSize: 5,
to: 1665752400000,
}
);

const noData = !loading && nodes && nodes.length === 0;
Expand Down Expand Up @@ -94,12 +99,7 @@ export const HostsContent: React.FunctionComponent = () => {
onQuerySubmit={onQuerySubmit}
/>
<EuiSpacer />
<HostsTable
dataView={metricsDataView}
timeRange={dateRange}
query={query}
nodes={nodes}
/>
<HostsTable nodes={nodes} />
</>
)
) : hasFailedCreatingDataView || hasFailedFetchingDataView ? (
Expand Down

0 comments on commit 5ae30be

Please sign in to comment.