Skip to content

Commit dfcc887

Browse files
code format
1 parent d11e0bf commit dfcc887

File tree

8 files changed

+62
-45
lines changed

8 files changed

+62
-45
lines changed

frontend/src/HOC/CustomModal.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ const CustomModal: React.FC<CustomModalProps> = ({
2323
>
2424
<Dialog.Content className='n-flex n-flex-col n-gap-token-4'>
2525
{status !== 'unknown' && (
26-
<Banner closeable description={statusMessage} onClose={() => setStatus('unknown')} type={status} name='Custom Banner'/>
26+
<Banner
27+
closeable
28+
description={statusMessage}
29+
onClose={() => setStatus('unknown')}
30+
type={status}
31+
name='Custom Banner'
32+
/>
2733
)}
2834
<div className='n-flex n-flex-row n-flex-wrap'>{children}</div>
2935
<Dialog.Actions className='mt-4'>

frontend/src/components/ConnectionModal.tsx

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,42 @@ const ConnectionModal: React.FunctionComponent<ConnectionModalProps> = ({
1010
setConnectionStatus,
1111
}) => {
1212
const protocols = ['neo4j', 'neo4j+s', 'neo4j+ssc', 'bolt', 'bolt+s', 'bolt+ssc'];
13-
const [selectedProtocol, setSelectedProtocol] = useState<string>(localStorage.getItem('selectedProtocol') ?? 'neo4j+s');
13+
const [selectedProtocol, setSelectedProtocol] = useState<string>(
14+
localStorage.getItem('selectedProtocol') ?? 'neo4j+s'
15+
);
1416
const [hostname, setHostname] = useState<string>(localStorage.getItem('hostname') ?? '');
1517
const [database, setDatabase] = useState<string>(localStorage.getItem('database') ?? 'neo4j');
1618
const [username, setUsername] = useState<string>(localStorage.getItem('username') ?? 'neo4j');
1719
const [password, setPassword] = useState<string>('');
1820
const { setUserCredentials } = useCredentials();
1921
const [statusMessage, setStatusMessage] = useState<string>('');
2022
const [status, setStatus] = useState<'unknown' | 'success' | 'info' | 'warning' | 'danger'>('unknown');
21-
const [loading,setLoading] =useState<boolean>(false);
22-
23+
const [loading, setLoading] = useState<boolean>(false);
24+
2325
const [port, setPort] = useState<string>(localStorage.getItem('port') ?? '7687');
24-
const submitConnection = async() =>{
26+
const submitConnection = async () => {
2527
const connectionURI = `${selectedProtocol}://${hostname}:${port}`;
2628
setUserCredentials({ uri: connectionURI, userName: username, password: password, database: database });
2729
localStorage.setItem('username', username);
2830
localStorage.setItem('hostname', hostname);
2931
localStorage.setItem('database', database);
3032
localStorage.setItem('selectedProtocol', selectedProtocol);
3133
setLoading(true);
32-
const status = await setDriver(connectionURI, username, password, database)
33-
if (status === 'success') {
34-
setOpenConnection(false);
35-
setConnectionStatus(true);
36-
setStatusMessage('');
37-
}
38-
else {
39-
setStatus('danger');
40-
setStatusMessage(status);
41-
setConnectionStatus(false);
42-
setTimeout(() => {
43-
setStatus('unknown');
44-
}, 5000)
45-
}
46-
setLoading(false);
47-
}
34+
const status = await setDriver(connectionURI, username, password, database);
35+
if (status === 'success') {
36+
setOpenConnection(false);
37+
setConnectionStatus(true);
38+
setStatusMessage('');
39+
} else {
40+
setStatus('danger');
41+
setStatusMessage(status);
42+
setConnectionStatus(false);
43+
setTimeout(() => {
44+
setStatus('unknown');
45+
}, 5000);
46+
}
47+
setLoading(false);
48+
};
4849

4950
const isDisabled = !username || !hostname || !password;
5051
return (
@@ -53,7 +54,13 @@ const ConnectionModal: React.FunctionComponent<ConnectionModalProps> = ({
5354
<Dialog.Header id='form-dialog-title'>Connect to Neo4j</Dialog.Header>
5455
<Dialog.Content className='n-flex n-flex-col n-gap-token-4'>
5556
{status !== 'unknown' && (
56-
<Banner name='connection banner' closeable description={statusMessage} onClose={() => setStatus('unknown')} type={status} />
57+
<Banner
58+
name='connection banner'
59+
closeable
60+
description={statusMessage}
61+
onClose={() => setStatus('unknown')}
62+
type={status}
63+
/>
5764
)}
5865
<div className='n-flex n-flex-row n-flex-wrap'>
5966
<Dropdown

frontend/src/components/Content.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const Content: React.FC<ContentProps> = ({ isExpanded }) => {
8181
localStorage.getItem('accesskey'),
8282
localStorage.getItem('secretkey'),
8383
filesData[uid].max_sources,
84-
filesData[uid].wiki_query??""
84+
filesData[uid].wiki_query ?? ''
8585
);
8686
apirequests.push(apiResponse);
8787
const results = await Promise.allSettled(apirequests);
@@ -199,7 +199,11 @@ const Content: React.FC<ContentProps> = ({ isExpanded }) => {
199199
</Button>
200200
)}
201201
</Flex>
202-
<FileTable isExpanded={isExpanded} connectionStatus={connectionStatus} setConnectionStatus={setConnectionStatus}></FileTable>
202+
<FileTable
203+
isExpanded={isExpanded}
204+
connectionStatus={connectionStatus}
205+
setConnectionStatus={setConnectionStatus}
206+
></FileTable>
203207
<Flex
204208
className='w-full p-2.5 absolute bottom-4'
205209
justifyContent='space-between'

frontend/src/components/FileTable.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ const FileTable: React.FC<FileTableProps> = ({ isExpanded, connectionStatus, set
126126
item.fileSource === 's3 bucket' && localStorage.getItem('accesskey') === item?.awsAccessKeyId
127127
? item.status
128128
: item.fileSource === 'youtube'
129-
? item.status
130-
: getFileFromLocal(`${item.fileName}`) != null
131-
? item.status
132-
: 'N/A',
129+
? item.status
130+
: getFileFromLocal(`${item.fileName}`) != null
131+
? item.status
132+
: 'N/A',
133133
model: item?.model ?? model,
134134
id: uuidv4(),
135135
source_url: item.url != 'None' && item?.url != '' ? item.url : '',
@@ -170,7 +170,7 @@ const FileTable: React.FC<FileTableProps> = ({ isExpanded, connectionStatus, set
170170
};
171171
if (connectionStatus) {
172172
fetchFiles();
173-
}else{
173+
} else {
174174
setFilesData([]);
175175
setFiles([]);
176176
}

frontend/src/components/YoutubeModal.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const YoutubeModal: React.FC<S3ModalProps> = ({ hideModal, open }) => {
3737
defaultValues.max_sources = sourceLimit;
3838
}
3939
if (querySource.length) {
40-
defaultValues.wiki_query= querySource;
40+
defaultValues.wiki_query = querySource;
4141
}
4242
if (!youtubeURL) {
4343
setStatus('danger');
@@ -69,7 +69,7 @@ const YoutubeModal: React.FC<S3ModalProps> = ({ hideModal, open }) => {
6969
} else {
7070
setStatus('success');
7171
setStatusMessage(`Successfully Created Source Nodes for Link`);
72-
72+
7373
const copiedFilesData = [...filesData];
7474
const copiedFiles = [...files];
7575
const filedataIndex = copiedFilesData.findIndex(
@@ -115,7 +115,7 @@ const YoutubeModal: React.FC<S3ModalProps> = ({ hideModal, open }) => {
115115
setStatusMessage('Some Error Occurred or Please Check your Instance Connection');
116116
}
117117
}
118-
118+
119119
setTimeout(() => {
120120
setStatus('unknown');
121121
hideModal();
@@ -177,8 +177,8 @@ const YoutubeModal: React.FC<S3ModalProps> = ({ hideModal, open }) => {
177177
min={0}
178178
max={101}
179179
onChange={(e) => {
180-
console.log(e.target.max)
181-
if (parseInt(e.target.value)<=parseInt(e.target.max)) {
180+
console.log(e.target.max);
181+
if (parseInt(e.target.value) <= parseInt(e.target.max)) {
182182
setSourceLimit(parseInt(e.target.value));
183183
}
184184
}}

frontend/src/services/URLScan.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ interface ScanProps {
1414
const urlScanAPI = async (props: ScanProps) => {
1515
try {
1616
const formData = new FormData();
17-
formData.append('uri', props?.userCredentials?.uri??"");
18-
formData.append('database', props?.userCredentials?.database??"");
19-
formData.append('userName', props?.userCredentials?.userName??"");
20-
formData.append('password', props?.userCredentials?.password??"");
17+
formData.append('uri', props?.userCredentials?.uri ?? '');
18+
formData.append('database', props?.userCredentials?.database ?? '');
19+
formData.append('userName', props?.userCredentials?.userName ?? '');
20+
formData.append('password', props?.userCredentials?.password ?? '');
2121
formData.append('source_url', props?.urlParam);
2222
if (props.model != undefined) {
2323
formData.append('model', props?.model);

frontend/src/types.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export interface CustomFile extends Partial<globalThis.File> {
99
model: string;
1010
fileSource: string;
1111
source_url?: string;
12-
max_sources?: number,
13-
wiki_query?: string,
12+
max_sources?: number;
13+
wiki_query?: string;
1414
}
1515

1616
export interface OptionType {
@@ -31,8 +31,8 @@ export type ExtractParams = {
3131
source_url?: string;
3232
aws_access_key_id?: string;
3333
aws_secret_access_key?: string;
34-
max_sources?: number,
35-
wiki_query?: string,
34+
max_sources?: number;
35+
wiki_query?: string;
3636
} & { [key: string]: any };
3737

3838
export type UploadParams = {
@@ -80,8 +80,8 @@ export interface SourceNode {
8080
url?: string;
8181
awsAccessKeyId?: string;
8282
fileSource: string;
83-
max_limit?: number,
84-
query_source?: string,
83+
max_limit?: number;
84+
query_source?: string;
8585
}
8686
export interface SideNavProps {
8787
openDrawer: () => void;

frontend/src/utils/Driver.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ export const disconnect = async () => {
2626
console.error(`Disconnection error\n${err}\nCause: ${err.cause}`);
2727
return err;
2828
}
29-
}
29+
};

0 commit comments

Comments
 (0)