Skip to content

Commit 987f474

Browse files
Props name changes (#811)
* Props name changes * removed the accesstoken from row on copy action * props changes for dropzone component * graph view changes --------- Co-authored-by: Prakriti Solankey <[email protected]>
1 parent 9e477c8 commit 987f474

File tree

11 files changed

+176
-170
lines changed

11 files changed

+176
-170
lines changed

frontend/src/components/ChatBot/ChunkInfo.tsx

Lines changed: 88 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { FC, useContext, useState } from 'react';
22
import { ChunkProps, UserCredentials } from '../../types';
33
import { Box, LoadingSpinner, TextLink, Typography } from '@neo4j-ndl/react';
4-
import { DocumentTextIconOutline, GlobeAltIconOutline, MagnifyingGlassCircleIconSolid } from '@neo4j-ndl/react/icons';
4+
import { DocumentTextIconOutline, GlobeAltIconOutline } from '@neo4j-ndl/react/icons';
55
import wikipedialogo from '../../assets/images/wikipedia.svg';
66
import youtubelogo from '../../assets/images/youtube.svg';
77
import gcslogo from '../../assets/images/gcs.webp';
@@ -13,7 +13,6 @@ import { chatModeLables } from '../../utils/Constants';
1313
import { useCredentials } from '../../context/UserCredentials';
1414
import GraphViewModal from '../Graph/GraphViewModal';
1515
import { handleGraphNodeClick } from './chatInfo';
16-
import { IconButtonWithToolTip } from '../UI/IconButtonToolTip';
1716

1817
const ChunkInfo: FC<ChunkProps> = ({ loading, chunks, mode }) => {
1918
const themeUtils = useContext(ThemeWrapperContext);
@@ -24,7 +23,7 @@ const ChunkInfo: FC<ChunkProps> = ({ loading, chunks, mode }) => {
2423
const [viewPoint, setViewPoint] = useState('');
2524
const [_, setLoadingGraphView] = useState(false);
2625

27-
const handleChunkClick = (elementId: string, viewMode: string) => {
26+
const handleChunkClick = (elementId: string, viewMode: string) => {
2827
handleGraphNodeClick(
2928
userCredentials as UserCredentials,
3029
elementId,
@@ -52,16 +51,6 @@ const ChunkInfo: FC<ChunkProps> = ({ loading, chunks, mode }) => {
5251
<>
5352
<div className='flex flex-row inline-block items-center'>
5453
<>
55-
<IconButtonWithToolTip
56-
placement='left'
57-
text='Graph'
58-
size='large'
59-
label='Graph view'
60-
clean
61-
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
62-
>
63-
<MagnifyingGlassCircleIconSolid />
64-
</IconButtonWithToolTip>
6554
<DocumentTextIconOutline className='w-4 h-4 inline-block mr-2' />
6655
<Typography
6756
variant='body-medium'
@@ -80,20 +69,19 @@ const ChunkInfo: FC<ChunkProps> = ({ loading, chunks, mode }) => {
8069
<div>
8170
<Typography variant='subheading-small'>Page: {chunk?.page_number}</Typography>
8271
</div>
72+
<div>
73+
<TextLink
74+
as='medium'
75+
label='Graph view'
76+
className='cursor-pointer'
77+
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
78+
>{'Graph'}
79+
</TextLink>
80+
</div>
8381
</>
8482
) : chunk?.url && chunk?.start_time ? (
8583
<>
8684
<div className='flex flex-row inline-block justiy-between items-center'>
87-
<IconButtonWithToolTip
88-
placement='left'
89-
text='Graph'
90-
size='large'
91-
label='Graph view'
92-
clean
93-
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
94-
>
95-
<MagnifyingGlassCircleIconSolid />
96-
</IconButtonWithToolTip>
9785
<img src={youtubelogo} width={20} height={20} className='mr-2' />
9886
<TextLink href={generateYouTubeLink(chunk?.url, chunk?.start_time)} externalLink={true}>
9987
<Typography
@@ -107,90 +95,94 @@ const ChunkInfo: FC<ChunkProps> = ({ loading, chunks, mode }) => {
10795
{mode !== chatModeLables.global_vector &&
10896
mode !== chatModeLables.entity_vector &&
10997
mode !== chatModeLables.graph && (
110-
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
98+
<>
99+
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
100+
<div>
101+
<TextLink
102+
as='medium'
103+
className='cursor-pointer'
104+
label='Graph view'
105+
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
106+
>{'Graph'}
107+
</TextLink>
108+
</div>
109+
</>
111110
)}
112111
</>
113112
) : chunk?.url && new URL(chunk.url).host === 'wikipedia.org' ? (
114113
<>
115114
<div className='flex flex-row inline-block justiy-between items-center'>
116-
<IconButtonWithToolTip
117-
placement='left'
118-
text='Graph'
119-
size='large'
120-
label='Graph view'
121-
clean
122-
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
123-
>
124-
<MagnifyingGlassCircleIconSolid />
125-
</IconButtonWithToolTip>
126115
<img src={wikipedialogo} width={20} height={20} className='mr-2' />
127116
<Typography variant='subheading-medium'>{chunk?.fileName}</Typography>
128117
</div>
129118
{mode !== chatModeLables.global_vector &&
130119
mode !== chatModeLables.entity_vector &&
131120
mode !== chatModeLables.graph && (
132-
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
121+
<>
122+
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
123+
<div>
124+
<TextLink
125+
as='medium'
126+
className='cursor-pointer'
127+
label='Graph view'
128+
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
129+
>{'Graph'}
130+
</TextLink>
131+
</div>
132+
</>
133133
)}
134134
</>
135135
) : chunk?.url && new URL(chunk.url).host === 'storage.googleapis.com' ? (
136136
<>
137137
<div className='flex flex-row inline-block justiy-between items-center'>
138-
<IconButtonWithToolTip
139-
placement='left'
140-
text='Graph'
141-
size='large'
142-
label='Graph view'
143-
clean
144-
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
145-
>
146-
<MagnifyingGlassCircleIconSolid />
147-
</IconButtonWithToolTip>
148138
<img src={gcslogo} width={20} height={20} className='mr-2' />
149139
<Typography variant='subheading-medium'>{chunk?.fileName}</Typography>
150140
</div>
151141
{mode !== chatModeLables.global_vector &&
152142
mode !== chatModeLables.entity_vector &&
153143
mode !== chatModeLables.graph && (
154-
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
144+
<>
145+
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
146+
<div>
147+
<TextLink
148+
as='medium'
149+
className='cursor-pointer'
150+
label='Graph view'
151+
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
152+
>{'Graph'}
153+
</TextLink>
154+
</div>
155+
</>
155156
)}
156157
</>
157158
) : chunk?.url && chunk?.url.startsWith('s3://') ? (
158159
<>
159160
<div className='flex flex-row inline-block justiy-between items-center'>
160-
<IconButtonWithToolTip
161-
placement='left'
162-
text='Graph'
163-
size='large'
164-
label='Graph view'
165-
clean
166-
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
167-
>
168-
<MagnifyingGlassCircleIconSolid />
169-
</IconButtonWithToolTip>
170161
<img src={s3logo} width={20} height={20} className='mr-2' />
171162
<Typography variant='subheading-medium'>{chunk?.fileName}</Typography>
172163
</div>
173164
{mode !== chatModeLables.global_vector &&
174165
mode !== chatModeLables.entity_vector &&
175166
mode !== chatModeLables.graph && (
176-
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
167+
<>
168+
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
169+
<div>
170+
<TextLink
171+
as='medium'
172+
className='cursor-pointer'
173+
label='Graph view'
174+
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
175+
>{'Graph'}
176+
</TextLink>
177+
</div>
178+
</>
177179
)}
178180
</>
179181
) : chunk?.url &&
180182
!chunk?.url.startsWith('s3://') &&
181183
!isAllowedHost(chunk?.url, ['storage.googleapis.com', 'wikipedia.org', 'youtube.com']) ? (
182184
<>
183185
<div className='flex flex-row inline-block items-center'>
184-
<IconButtonWithToolTip
185-
placement='left'
186-
text='Graph'
187-
size='large'
188-
label='Graph view'
189-
clean
190-
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
191-
>
192-
<MagnifyingGlassCircleIconSolid />
193-
</IconButtonWithToolTip>
194186
<GlobeAltIconOutline className='n-size-token-7' />
195187
<TextLink href={chunk?.url} externalLink={true}>
196188
<Typography variant='body-medium'>{chunk?.url}</Typography>
@@ -199,22 +191,23 @@ const ChunkInfo: FC<ChunkProps> = ({ loading, chunks, mode }) => {
199191
{mode !== chatModeLables.global_vector &&
200192
mode !== chatModeLables.entity_vector &&
201193
mode !== chatModeLables.graph && (
202-
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
194+
<>
195+
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
196+
<div>
197+
<TextLink
198+
as='medium'
199+
className='cursor-pointer'
200+
label='Graph view'
201+
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
202+
>{'Graph'}
203+
</TextLink>
204+
</div>
205+
</>
203206
)}
204207
</>
205208
) : (
206209
<>
207210
<div className='flex flex-row inline-block items-center'>
208-
<IconButtonWithToolTip
209-
placement='left'
210-
text='Graph'
211-
size='large'
212-
label='Graph view'
213-
clean
214-
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
215-
>
216-
<MagnifyingGlassCircleIconSolid />
217-
</IconButtonWithToolTip>
218211
{chunk.fileSource === 'local file' ? (
219212
<DocumentTextIconOutline className='n-size-token-7 mr-2' />
220213
) : (
@@ -225,12 +218,23 @@ const ChunkInfo: FC<ChunkProps> = ({ loading, chunks, mode }) => {
225218
className='mr-2'
226219
/>
227220
)}
228-
<Typography
229-
variant='body-medium'
230-
className='text-ellipsis whitespace-nowrap overflow-hidden max-w-lg'
231-
>
232-
{chunk.fileName}
233-
</Typography>
221+
<>
222+
<Typography
223+
variant='body-medium'
224+
className='text-ellipsis whitespace-nowrap overflow-hidden max-w-lg'
225+
>
226+
{chunk.fileName}
227+
</Typography>
228+
<div>
229+
<TextLink
230+
as='medium'
231+
className='cursor-pointer'
232+
label='Graph view'
233+
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
234+
>{'Graph'}
235+
</TextLink>
236+
</div>
237+
</>
234238
</div>
235239
</>
236240
)}

frontend/src/components/Content.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,16 +310,17 @@ const Content: React.FC<ContentProps> = ({
310310
userCredentials as UserCredentials,
311311
fileItem.fileSource,
312312
fileItem.retryOption ?? '',
313-
fileItem.source_url,
313+
fileItem.sourceUrl,
314314
localStorage.getItem('accesskey'),
315315
localStorage.getItem('secretkey'),
316316
fileItem.name ?? '',
317317
fileItem.gcsBucket ?? '',
318318
fileItem.gcsBucketFolder ?? '',
319319
selectedNodes.map((l) => l.value),
320320
selectedRels.map((t) => t.value),
321-
fileItem.google_project_id,
322-
fileItem.language
321+
fileItem.googleProjectId,
322+
fileItem.language,
323+
fileItem.accessToken
323324
);
324325

325326
if (apiResponse?.status === 'Failed') {
@@ -576,8 +577,8 @@ const Content: React.FC<ContentProps> = ({
576577
...f,
577578
status: 'Reprocess',
578579
processingProgress: isStartFromBegining ? 0 : f.processingProgress,
579-
NodesCount: isStartFromBegining ? 0 : f.NodesCount,
580-
relationshipCount: isStartFromBegining ? 0 : f.relationshipCount,
580+
NodesCount: isStartFromBegining ? 0 : f.nodesCount,
581+
relationshipCount: isStartFromBegining ? 0 : f.relationshipsCount,
581582
}
582583
: f;
583584
});

frontend/src/components/DataSources/AWS/S3Modal.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ const S3Modal: React.FC<S3ModalProps> = ({ hideModal, open }) => {
3030

3131
const submitHandler = async (url: string) => {
3232
const defaultValues: CustomFileBase = {
33-
processing: 0,
33+
processingTotalTime: 0,
3434
status: 'New',
35-
NodesCount: 0,
36-
relationshipCount: 0,
35+
nodesCount: 0,
36+
relationshipsCount: 0,
3737
type: 'PDF',
3838
model: model,
3939
fileSource: 's3 bucket',
@@ -84,7 +84,7 @@ const S3Modal: React.FC<S3ModalProps> = ({ hideModal, open }) => {
8484
copiedFilesData.unshift({
8585
name: item.fileName,
8686
size: item.fileSize,
87-
source_url: item.url,
87+
sourceUrl: item.url,
8888
// total_pages: 'N/A',
8989
id: uuidv4(),
9090
...defaultValues,
@@ -95,9 +95,9 @@ const S3Modal: React.FC<S3ModalProps> = ({ hideModal, open }) => {
9595
copiedFilesData.unshift({
9696
...tempFileData,
9797
status: defaultValues.status,
98-
NodesCount: defaultValues.NodesCount,
99-
relationshipCount: defaultValues.relationshipCount,
100-
processing: defaultValues.processing,
98+
nodesCount: defaultValues.nodesCount,
99+
relationshipsCount: defaultValues.relationshipsCount,
100+
processingTotalTime: defaultValues.processingTotalTime,
101101
model: defaultValues.model,
102102
fileSource: defaultValues.fileSource,
103103
processingProgress: defaultValues.processingProgress,

frontend/src/components/DataSources/GCS/GCSModal.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ const GCSModal: React.FC<GCSModalProps> = ({ hideModal, open, openGCSModal }) =>
2323
const { setFilesData, model, filesData } = useFileContext();
2424

2525
const defaultValues: CustomFileBase = {
26-
processing: 0,
26+
processingTotalTime: 0,
2727
status: 'New',
28-
NodesCount: 0,
29-
relationshipCount: 0,
28+
nodesCount: 0,
29+
relationshipsCount: 0,
3030
type: 'TEXT',
3131
model: model,
3232
fileSource: 'gcs bucket',
@@ -101,9 +101,9 @@ const GCSModal: React.FC<GCSModalProps> = ({ hideModal, open, openGCSModal }) =>
101101
size: item.fileSize ?? 0,
102102
gcsBucket: item.gcsBucketName,
103103
gcsBucketFolder: item.gcsBucketFolder,
104-
google_project_id: item.gcsProjectId,
104+
googleProjectId: item.gcsProjectId,
105105
id: uuidv4(),
106-
access_token: codeResponse.access_token,
106+
accessToken: codeResponse.access_token,
107107
...defaultValues,
108108
});
109109
} else {
@@ -112,13 +112,13 @@ const GCSModal: React.FC<GCSModalProps> = ({ hideModal, open, openGCSModal }) =>
112112
copiedFilesData.unshift({
113113
...tempFileData,
114114
status: defaultValues.status,
115-
NodesCount: defaultValues.NodesCount,
116-
relationshipCount: defaultValues.relationshipCount,
117-
processing: defaultValues.processing,
115+
nodesCount: defaultValues.nodesCount,
116+
relationshipsCount: defaultValues.relationshipsCount,
117+
processingTotalTime: defaultValues.processingTotalTime,
118118
model: defaultValues.model,
119119
fileSource: defaultValues.fileSource,
120120
processingProgress: defaultValues.processingProgress,
121-
access_token: codeResponse.access_token,
121+
accessToken: codeResponse.access_token,
122122
});
123123
}
124124
}

0 commit comments

Comments
 (0)