blob: 794e163ef046e9cf28ac8925f12f4b832e8f271c (
plain) (
blame)
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
48
49
50
51
52
53
54
55
56
57
58
|
import React from 'react';
import {
Badge,
Button,
Group,
Stack,
CopyButton,
Textarea,
} from '@mantine/core';
import { DownloadJaeger } from 'app/pages/querybuilder/query-response/download-jaeger';
import { useQueryBuilderContext } from 'app/pages/querybuilder/context/query-builder-provider';
import { Icon } from 'app/components';
export function QueryResponse() {
const response = useQueryBuilderContext((ctx) => ctx.http.response);
return (
<Stack>
<Group position="apart">
<Badge variant="filled">Response</Badge>
<Group spacing="xs">
<CopyButton value={response}>
{({ copied, copy }) => (
<Button
leftIcon={<Icon name={copied ? 'check' : 'copy'} />}
color={copied ? 'teal' : 'blue'}
variant="outline"
onClick={copy}
size="xs"
compact
>
Copy
</Button>
)}
</CopyButton>
<DownloadJaeger
variant="outline"
size="xs"
compact
response={response}
/>
</Group>
</Group>
<Textarea
styles={(theme) => ({
input: {
fontFamily: theme.fontFamilyMonospace,
fontSize: theme.fontSizes.xs,
},
})}
value={response ?? ''}
variant="unstyled"
minRows={21}
autosize
/>
</Stack>
);
}
|