Skip to content

Commit 7dc93ea

Browse files
graph view changes
1 parent 4148b76 commit 7dc93ea

File tree

8 files changed

+224
-144
lines changed

8 files changed

+224
-144
lines changed

frontend/src/HOC/CustomDropdown.tsx

Lines changed: 0 additions & 30 deletions
This file was deleted.

frontend/src/components/ConnectionModal.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Button, Dialog, TextInput, Dropdown, Banner } from '@neo4j-ndl/react';
22
import { useState } from 'react';
3-
import { setDriver } from '../utils/Driver';
43
import { useCredentials } from '../context/UserCredentials';
54
import { ConnectionModalProps } from '../types';
65
import connectAPI from '../services/ConnectAPI';
@@ -18,7 +17,7 @@ const ConnectionModal: React.FunctionComponent<ConnectionModalProps> = ({
1817
const [database, setDatabase] = useState<string>(localStorage.getItem('database') ?? 'neo4j');
1918
const [username, setUsername] = useState<string>(localStorage.getItem('username') ?? 'neo4j');
2019
const [password, setPassword] = useState<string>('');
21-
const { setUserCredentials } = useCredentials();
20+
const { setUserCredentials, userCredentials } = useCredentials();
2221
const [statusMessage, setStatusMessage] = useState<string>('');
2322
const [status, setStatus] = useState<'unknown' | 'success' | 'info' | 'warning' | 'danger'>('unknown');
2423
const [loading, setLoading] = useState<boolean>(false);
@@ -32,14 +31,14 @@ const ConnectionModal: React.FunctionComponent<ConnectionModalProps> = ({
3231
localStorage.setItem('database', database);
3332
localStorage.setItem('selectedProtocol', selectedProtocol);
3433
setLoading(true);
35-
const status = await connectAPI(connectionURI);
36-
if (status === 'success') {
34+
const response = await connectAPI(userCredentials);
35+
if (response.data.status === 'Success') {
3736
setOpenConnection(false);
3837
setConnectionStatus(true);
3938
setStatusMessage('');
4039
} else {
4140
setStatus('danger');
42-
setStatusMessage(status);
41+
setStatusMessage(response.data.message);
4342
setConnectionStatus(false);
4443
setTimeout(() => {
4544
setStatus('unknown');

frontend/src/components/Content.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { ContentProps } from '../types';
1212
import { updateGraphAPI } from '../services/UpdateGraph';
1313
import GraphViewModal from './GraphViewModal';
1414

15-
1615
const Content: React.FC<ContentProps> = ({ isExpanded, showChatBot, openChatBot }) => {
1716
const [init, setInit] = useState<boolean>(false);
1817
const [openConnection, setOpenConnection] = useState<boolean>(false);
@@ -23,8 +22,6 @@ const Content: React.FC<ContentProps> = ({ isExpanded, showChatBot, openChatBot
2322
const { filesData, files, setFilesData, setModel, model } = useFileContext();
2423
const [errorMessage, setErrorMessage] = useState<string>('');
2524
const [showAlert, setShowAlert] = useState<boolean>(false);
26-
const [showGraph, setShowGraph] = useState<boolean>(false);
27-
const [selectedValue, setSelectedValue] = useState<string>('');
2825
const [viewPoint, setViewPoint] = useState<string>('tableView');
2926

3027
useEffect(() => {
@@ -159,23 +156,23 @@ const Content: React.FC<ContentProps> = ({ isExpanded, showChatBot, openChatBot
159156
setShowAlert(false);
160157
};
161158

162-
const openGraphUrl = ` https://bloom-latest.s3.eu-west-2.amazonaws.com/assets/index.html?connectURL=${userCredentials?.userName
163-
}@${localStorage.getItem('hostname')}%3A${localStorage.getItem('port') ?? '7687'}&search=Show+me+a+graph`;
159+
const openGraphUrl = ` https://bloom-latest.s3.eu-west-2.amazonaws.com/assets/index.html?connectURL=${
160+
userCredentials?.userName
161+
}@${localStorage.getItem('hostname')}%3A${localStorage.getItem('port') ?? '7687'}&search=Show+me+a+graph`;
164162

165163
const classNameCheck =
166164
isExpanded && showChatBot
167165
? 'contentWithBothDrawers'
168166
: isExpanded
169-
? 'contentWithExpansion'
170-
: showChatBot
171-
? 'contentWithChatBot'
172-
: 'contentWithNoExpansion';
173-
167+
? 'contentWithExpansion'
168+
: showChatBot
169+
? 'contentWithChatBot'
170+
: 'contentWithNoExpansion';
174171

175172
const handleGraphView = () => {
176173
setOpenGraphView(true);
177174
setViewPoint('showGraphView');
178-
}
175+
};
179176

180177
return (
181178
<>

frontend/src/components/FileTable.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,20 @@ const FileTable: React.FC<FileTableProps> = ({ isExpanded, connectionStatus, set
114114
}),
115115
columnHelper.accessor((row) => row.status, {
116116
id: 'inspect',
117-
cell: (info) => <> <IconButton aria-label='Toggle settings'
118-
size='large' disabled={statusCheck(info.getValue()) !== 'success'}
119-
clean onClick={() => onInspect(info.row.original.name)}>
120-
<MagnifyingGlassCircleIconSolid />
121-
</IconButton></>,
117+
cell: (info) => (
118+
<>
119+
{' '}
120+
<IconButton
121+
aria-label='Toggle settings'
122+
size='large'
123+
disabled={statusCheck(info.getValue()) !== 'success'}
124+
clean
125+
onClick={() => onInspect(info.row.original.name)}
126+
>
127+
<MagnifyingGlassCircleIconSolid />
128+
</IconButton>
129+
</>
130+
),
122131
header: () => <span>View</span>,
123132
footer: (info) => info.column.id,
124133
}),
@@ -129,8 +138,8 @@ const FileTable: React.FC<FileTableProps> = ({ isExpanded, connectionStatus, set
129138
try {
130139
setIsLoading(true);
131140
const res: any = await getSourceNodes(userCredentials);
132-
if(!res.data){
133-
throw new Error('Please check backend connection');
141+
if (!res.data) {
142+
throw new Error('Please check backend connection');
134143
}
135144
if (res.data.status !== 'Failed') {
136145
const prefiles: any[] = [];

0 commit comments

Comments
 (0)