summaryrefslogtreecommitdiffstats
path: root/client/js/app/src/app/pages/querybuilder/query-derived/query-derived.jsx
blob: 1f200d93e364f42f437135dd85b34e660f30caa9 (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
import React from 'react';
import { Badge, Group, JsonInput, Stack, Button } from '@mantine/core';
import { useQueryBuilderContext } from 'app/pages/querybuilder/context/query-builder-provider';
import { Icon } from 'app/components';

export function QueryDerived() {
  const query = useQueryBuilderContext((ctx) => ctx.query.input);
  return (
    <Stack>
      <Group position="apart">
        <Badge variant="filled">Query</Badge>
        <Button
          leftIcon={<Icon name="paste" />}
          variant="outline"
          size="xs"
          compact
        >
          Paste JSON
        </Button>
      </Group>
      <JsonInput
        styles={{
          root: { height: '100%' },
          wrapper: { height: '100%' },
          input: { height: '100%' },
        }}
        value={query}
        validationError="Invalid json"
        minRows={21}
        formatOnBlur
      />
    </Stack>
  );
}