-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathOlsToolUIPersesWrapper.tsx
More file actions
47 lines (43 loc) · 1.36 KB
/
OlsToolUIPersesWrapper.tsx
File metadata and controls
47 lines (43 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React from 'react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { VariableProvider } from '@perses-dev/dashboards';
import { TimeRangeProviderBasic } from '@perses-dev/plugin-system';
import type { DurationString } from '@perses-dev/prometheus-plugin';
import {
PersesWrapper,
PersesPrometheusDatasourceWrapper,
} from '../dashboards/perses/PersesWrapper';
const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: false,
refetchOnWindowFocus: false,
},
},
});
interface OlsToolUIPersesWrapperProps {
children: React.ReactNode;
height?: string;
initialTimeRange?: {
pastDuration: DurationString;
};
}
export const OlsToolUIPersesWrapper: React.FC<OlsToolUIPersesWrapperProps> = ({
children,
initialTimeRange = { pastDuration: '1h' as DurationString },
height = '300px',
}) => {
return (
<QueryClientProvider client={queryClient}>
<PersesWrapper project={null}>
<TimeRangeProviderBasic initialTimeRange={initialTimeRange}>
<VariableProvider>
<PersesPrometheusDatasourceWrapper queries={[]}>
<div style={{ width: '100%', height: height }}>{children}</div>
</PersesPrometheusDatasourceWrapper>
</VariableProvider>
</TimeRangeProviderBasic>
</PersesWrapper>
</QueryClientProvider>
);
};