|
6 | 6 |
|
7 | 7 | import React from 'react'; |
8 | 8 | import { InfraWaffleMapOptions, InfraWaffleMapBounds } from '../../lib/lib'; |
9 | | -import { InfraNodeType, InfraSnapshotNode, InfraTimerangeInput } from '../../graphql/types'; |
| 9 | +import { |
| 10 | + InfraNodeType, |
| 11 | + InfraSnapshotNode, |
| 12 | + InfraTimerangeInput, |
| 13 | + InfraSnapshotMetricInput, |
| 14 | + InfraSnapshotGroupbyInput, |
| 15 | +} from '../../graphql/types'; |
10 | 16 | import { KueryFilterQuery } from '../../store/local/waffle_filter'; |
11 | 17 |
|
12 | 18 | import { NodesOverview } from '../nodes_overview'; |
13 | 19 | import { Toolbar } from './toolbars/toolbar'; |
14 | 20 | import { PageContent } from '../page'; |
| 21 | +import { useSnapshot } from '../../containers/waffle/use_snaphot'; |
15 | 22 |
|
16 | 23 | export interface LayoutProps { |
17 | 24 | options: InfraWaffleMapOptions; |
18 | 25 | nodeType: InfraNodeType; |
19 | | - nodes: InfraSnapshotNode[]; |
20 | | - loading: boolean; |
21 | | - reload: () => void; |
22 | 26 | onDrilldown: (filter: KueryFilterQuery) => void; |
23 | 27 | timeRange: InfraTimerangeInput; |
24 | 28 | onViewChange: (view: string) => void; |
25 | 29 | view: string; |
26 | 30 | boundsOverride: InfraWaffleMapBounds; |
27 | 31 | autoBounds: boolean; |
| 32 | + |
| 33 | + filterQuery: string | null | undefined; |
| 34 | + metric: InfraSnapshotMetricInput; |
| 35 | + groupBy: InfraSnapshotGroupbyInput[]; |
| 36 | + sourceId: string; |
| 37 | + timerange: InfraTimerangeInput; |
28 | 38 | } |
29 | 39 |
|
30 | 40 | export const Layout = (props: LayoutProps) => { |
| 41 | + const { loading, nodes, reload } = useSnapshot( |
| 42 | + props.filterQuery, |
| 43 | + props.metric, |
| 44 | + props.groupBy, |
| 45 | + props.nodeType, |
| 46 | + props.sourceId, |
| 47 | + props.timerange |
| 48 | + ); |
31 | 49 | return ( |
32 | 50 | <> |
33 | 51 | <Toolbar nodeType={props.nodeType} /> |
34 | 52 | <PageContent> |
35 | | - <NodesOverview {...props} /> |
| 53 | + <NodesOverview |
| 54 | + nodes={nodes} |
| 55 | + options={props.options} |
| 56 | + nodeType={props.nodeType} |
| 57 | + loading={loading} |
| 58 | + reload={reload} |
| 59 | + onDrilldown={props.onDrilldown} |
| 60 | + timeRange={props.timeRange} |
| 61 | + onViewChange={props.onViewChange} |
| 62 | + view={props.view} |
| 63 | + autoBounds={props.autoBounds} |
| 64 | + boundsOverride={props.boundsOverride} |
| 65 | + /> |
36 | 66 | </PageContent> |
37 | 67 | </> |
38 | 68 | ); |
|
0 commit comments