Skip to content

Commit 25f7a8d

Browse files
prakriti-solankeykartikpersistent
authored andcommitted
Refresh handle (#502)
* loading Graph * refresh check * show graph check * lint fix
1 parent 06c3dea commit 25f7a8d

File tree

7 files changed

+131
-74
lines changed

7 files changed

+131
-74
lines changed

frontend/src/components/Content.tsx

+33-11
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,9 @@ const Content: React.FC<ContentProps> = ({
267267
const handleOpenGraphClick = () => {
268268
const bloomUrl = process.env.BLOOM_URL;
269269
const uriCoded = userCredentials?.uri.replace(/:\d+$/, '');
270-
const connectURL = `${uriCoded?.split('//')[0]}//${userCredentials?.userName}@${uriCoded?.split('//')[1]}:${userCredentials?.port ?? '7687'
271-
}`;
270+
const connectURL = `${uriCoded?.split('//')[0]}//${userCredentials?.userName}@${uriCoded?.split('//')[1]}:${
271+
userCredentials?.port ?? '7687'
272+
}`;
272273
const encodedURL = encodeURIComponent(connectURL);
273274
const replacedUrl = bloomUrl?.replace('{CONNECT_URL}', encodedURL);
274275
window.open(replacedUrl, '_blank');
@@ -278,10 +279,10 @@ const Content: React.FC<ContentProps> = ({
278279
isLeftExpanded && isRightExpanded
279280
? 'contentWithExpansion'
280281
: isRightExpanded
281-
? 'contentWithChatBot'
282-
: !isLeftExpanded && !isRightExpanded
283-
? 'w-[calc(100%-128px)]'
284-
: 'contentWithDropzoneExpansion';
282+
? 'contentWithChatBot'
283+
: !isLeftExpanded && !isRightExpanded
284+
? 'w-[calc(100%-128px)]'
285+
: 'contentWithDropzoneExpansion';
285286

286287
const handleGraphView = () => {
287288
setOpenGraphView(true);
@@ -317,10 +318,29 @@ const Content: React.FC<ContentProps> = ({
317318
[selectedfileslength, completedfileNo]
318319
);
319320

320-
const deleteFileClickHandler: React.MouseEventHandler<HTMLButtonElement> = () => {
321-
setshowDeletePopUp(true);
321+
const processingCheck = () => {
322+
const processingFiles = filesData.some((file) => file.status === 'Processing');
323+
const selectedRowProcessing = selectedRows.some((row) =>
324+
filesData.some((file) => file.name === row && file.status === 'Processing')
325+
);
326+
return processingFiles || selectedRowProcessing;
322327
};
323328

329+
const filesForProcessing = useMemo(() => {
330+
let newstatusfiles: CustomFile[] = [];
331+
if (selectedRows.length) {
332+
selectedRows.forEach((f) => {
333+
const parsedFile: CustomFile = JSON.parse(f);
334+
if (parsedFile.status === 'New') {
335+
newstatusfiles.push(parsedFile);
336+
}
337+
});
338+
} else if (filesData.length) {
339+
newstatusfiles = filesData.filter((f) => f.status === 'New');
340+
}
341+
return newstatusfiles;
342+
}, [filesData, selectedRows]);
343+
324344
const handleDeleteFiles = async (deleteEntities: boolean) => {
325345
try {
326346
setdeleteLoading(true);
@@ -502,7 +522,6 @@ const Content: React.FC<ContentProps> = ({
502522
});
503523
localStorage.setItem('isSchema', JSON.stringify(true));
504524
};
505-
506525
return (
507526
<>
508527
{alertDetails.showAlert && (
@@ -590,8 +609,9 @@ const Content: React.FC<ContentProps> = ({
590609
}}
591610
></FileTable>
592611
<Flex
593-
className={`${!isLeftExpanded && !isRightExpanded ? 'w-[calc(100%-128px)]' : 'w-full'
594-
} p-2.5 absolute bottom-4 mt-1.5 self-start`}
612+
className={`${
613+
!isLeftExpanded && !isRightExpanded ? 'w-[calc(100%-128px)]' : 'w-full'
614+
} p-2.5 absolute bottom-4 mt-1.5 self-start`}
595615
justifyContent='space-between'
596616
flexDirection='row'
597617
>
@@ -601,6 +621,7 @@ const Content: React.FC<ContentProps> = ({
601621
placeholder='Select LLM Model'
602622
defaultValue={defaultLLM}
603623
view='ContentView'
624+
isDisabled={false}
604625
/>
605626
<Flex flexDirection='row' gap='4' className='self-end'>
606627
<ButtonWithToolTip
@@ -659,6 +680,7 @@ const Content: React.FC<ContentProps> = ({
659680
open={openGraphView}
660681
setGraphViewOpen={setOpenGraphView}
661682
viewPoint={viewPoint}
683+
processingCheck={processingCheck()}
662684
/>
663685
</>
664686
);

frontend/src/components/Dropdown.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import { Dropdown } from '@neo4j-ndl/react';
22
import { DropdownProps, OptionType } from '../types';
33
import { useMemo } from 'react';
44
import { capitalize } from '../utils/Utils';
5+
56
interface ReusableDropdownProps extends DropdownProps {
67
options: string[];
78
placeholder?: string;
89
defaultValue?: string;
910
children?: React.ReactNode;
1011
view?: 'ContentView' | 'GraphView';
12+
isDisabled: boolean;
1113
}
1214
const DropdownComponent: React.FC<ReusableDropdownProps> = ({
1315
options,
@@ -16,6 +18,7 @@ const DropdownComponent: React.FC<ReusableDropdownProps> = ({
1618
onSelect,
1719
children,
1820
view,
21+
isDisabled,
1922
}) => {
2023
const handleChange = (selectedOption: OptionType | null | void) => {
2124
onSelect(selectedOption);
@@ -38,6 +41,7 @@ const DropdownComponent: React.FC<ReusableDropdownProps> = ({
3841
placeholder: placeholder || 'Select an option',
3942
defaultValue: defaultValue ? { label: capitalize(defaultValue), value: defaultValue } : undefined,
4043
menuPlacement: 'auto',
44+
isDisabled: isDisabled,
4145
}}
4246
size='medium'
4347
fluid

frontend/src/components/FileTable.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,8 @@ const FileTable: React.FC<FileTableProps> = ({ isExpanded, connectionStatus, set
320320
placement='right'
321321
text='Graph'
322322
size='large'
323-
disabled={!(info.getValue() === 'Completed' || info.getValue() == 'Cancelled')}
323+
label='Graph view'
324+
disabled={info.getValue() === 'New' || info.getValue() === 'Uploading'}
324325
clean
325326
onClick={() => onInspect(info?.row?.original?.name as string)}
326327
>

0 commit comments

Comments
 (0)