1
+ import _ from 'lodash' ;
2
+ import styles from './styles/CreateStreamModal.module.css' ;
3
+ import { appStoreReducers , useAppStore } from '@/layouts/MainLayout/providers/AppProvider' ;
4
+ import { CreatableSelect } from '@/components/Misc/CreatableSelect' ;
5
+ import {
6
+ FC ,
7
+ useCallback ,
8
+ useEffect ,
9
+ useState
10
+ } from 'react' ;
11
+ import { GetInputPropsReturnType , UseFormReturnType } from 'node_modules/@mantine/form/lib/types' ;
12
+ import { IconInfoCircleFilled , IconPlus } from '@tabler/icons-react' ;
13
+ import { LogStreamSchemaData } from '@/@types/parseable/api/stream' ;
14
+ import { notifyError } from '@/utils/notification' ;
15
+ import { useForm } from '@mantine/form' ;
16
+ import { useLogStream } from '@/hooks/useLogStream' ;
1
17
import {
2
18
ActionIcon ,
3
19
Box ,
@@ -18,17 +34,7 @@ import {
18
34
ThemeIcon ,
19
35
Tooltip ,
20
36
} from '@mantine/core' ;
21
- import { FC , useCallback , useEffect , useState } from 'react' ;
22
- import styles from './styles/CreateStreamModal.module.css' ;
23
- import { useLogStream } from '@/hooks/useLogStream' ;
24
- import { useForm } from '@mantine/form' ;
25
- import { IconInfoCircleFilled , IconPlus } from '@tabler/icons-react' ;
26
- import _ from 'lodash' ;
27
- import { CreatableSelect } from '@/components/Misc/CreatableSelect' ;
28
- import { useAppStore , appStoreReducers } from '@/layouts/MainLayout/providers/AppProvider' ;
29
- import { GetInputPropsReturnType , UseFormReturnType } from 'node_modules/@mantine/form/lib/types' ;
30
- import { notifyError } from '@/utils/notification' ;
31
- import { LogStreamSchemaData } from '@/@types/parseable/api/stream' ;
37
+
32
38
33
39
const { toggleCreateStreamModal } = appStoreReducers ;
34
40
@@ -461,9 +467,7 @@ const DetectSchemaSection = (props: { form: StreamFormType }) => {
461
467
} catch ( e ) {
462
468
console . error ( 'Error parsing json' , e ) ;
463
469
}
464
- if ( ! _ . isArray ( logRecords ) ) {
465
- return notifyError ( { message : 'Invalid JSON' } ) ;
466
- } else if ( _ . isEmpty ( logRecords ) ) {
470
+ if ( _ . isEmpty ( logRecords ) ) {
467
471
return notifyError ( { message : 'No records found' } ) ;
468
472
} else if ( _ . size ( logRecords ) > 10 ) {
469
473
return notifyError ( { message : 'More than 10 records found' } ) ;
0 commit comments