Skip to content

Commit 18ceeb0

Browse files
fixed processing count update on failed condtition
1 parent 6780215 commit 18ceeb0

File tree

8 files changed

+49
-30
lines changed

8 files changed

+49
-30
lines changed

frontend/src/components/Content.tsx

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ import FallBackDialog from './UI/FallBackDialog';
3131
import DeletePopUp from './Popups/DeletePopUp/DeletePopUp';
3232
import GraphEnhancementDialog from './Popups/GraphEnhancementDialog';
3333
import { tokens } from '@neo4j-ndl/base';
34+
import axios from 'axios';
35+
3436
const ConnectionModal = lazy(() => import('./Popups/ConnectionModal/ConnectionModal'));
3537
const ConfirmationDialog = lazy(() => import('./Popups/LargeFilePopUp/ConfirmationDialog'));
3638
let afterFirstRender = false;
@@ -180,6 +182,7 @@ const Content: React.FC<ContentProps> = ({
180182
};
181183

182184
const extractHandler = async (fileItem: CustomFile, uid: string) => {
185+
queue.remove(fileItem.name as string);
183186
try {
184187
setFilesData((prevfiles) =>
185188
prevfiles.map((curfile) => {
@@ -252,28 +255,45 @@ const Content: React.FC<ContentProps> = ({
252255
});
253256
}
254257
} catch (err: any) {
255-
const error = JSON.parse(err.message);
256-
if (Object.keys(error).includes('fileName')) {
257-
const { message } = error;
258-
const { fileName } = error;
259-
const errorMessage = error.message;
260-
setalertDetails({
261-
showAlert: true,
262-
alertType: 'error',
263-
alertMessage: message,
264-
});
265-
setFilesData((prevfiles) =>
266-
prevfiles.map((curfile) => {
267-
if (curfile.name == fileName) {
268-
return {
269-
...curfile,
270-
status: 'Failed',
271-
errorMessage,
272-
};
273-
}
274-
return curfile;
275-
})
276-
);
258+
if (err instanceof Error) {
259+
try {
260+
const error = JSON.parse(err.message);
261+
if (Object.keys(error).includes('fileName')) {
262+
setProcessedCount((prev) => {
263+
if (prev == batchSize) {
264+
return batchSize - 1;
265+
}
266+
return prev + 1;
267+
});
268+
const { message, fileName } = error;
269+
queue.remove(fileName);
270+
const errorMessage = error.message;
271+
setalertDetails({
272+
showAlert: true,
273+
alertType: 'error',
274+
alertMessage: message,
275+
});
276+
setFilesData((prevfiles) =>
277+
prevfiles.map((curfile) => {
278+
if (curfile.name == fileName) {
279+
return { ...curfile, status: 'Failed', errorMessage };
280+
}
281+
return curfile;
282+
})
283+
);
284+
} else {
285+
console.error('Unexpected error format:', error);
286+
}
287+
} catch (parseError) {
288+
if (axios.isAxiosError(err)) {
289+
const axiosErrorMessage = err.response?.data?.message || err.message;
290+
console.error('Axios error occurred:', axiosErrorMessage);
291+
} else {
292+
console.error('An unexpected error occurred:', err.message);
293+
}
294+
}
295+
} else {
296+
console.error('An unknown error occurred:', err);
277297
}
278298
}
279299
};
@@ -839,4 +859,4 @@ const Content: React.FC<ContentProps> = ({
839859
);
840860
};
841861

842-
export default Content;
862+
export default Content;

frontend/src/components/Graph/GraphViewModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,4 +580,4 @@ const GraphViewModal: React.FunctionComponent<GraphViewModalProps> = ({
580580
</>
581581
);
582582
};
583-
export default GraphViewModal;
583+
export default GraphViewModal;

frontend/src/components/Layout/PageLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,4 @@ export default function PageLayoutNew({
175175
/>
176176
</div>
177177
);
178-
}
178+
}

frontend/src/components/Popups/DeletePopUp/DeletePopUp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ export default function DeletePopUp({
5454
</Dialog.Actions>
5555
</Dialog>
5656
);
57-
}
57+
}

frontend/src/components/Popups/GraphEnhancementDialog/DeleteTabForOrphanNodes/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,4 +279,4 @@ export default function DeletePopUpForOrphanNodes({
279279
</Flex>
280280
</div>
281281
);
282-
}
282+
}

frontend/src/components/Popups/GraphEnhancementDialog/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,4 @@ export default function GraphEnhancementDialog({
126126
</Dialog.Content>
127127
</Dialog>
128128
);
129-
}
129+
}

frontend/src/components/Popups/LargeFilePopUp/LargeFilesAlert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ const LargeFilesAlert: FC<LargefilesProps> = ({ largeFiles, handleToggle, checke
100100
</Box>
101101
);
102102
};
103-
export default LargeFilesAlert;
103+
export default LargeFilesAlert;

frontend/src/hooks/useSse.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ export default function useServerSideEvent(
6767
}
6868
return prev + 1;
6969
});
70-
queue.remove(fileName);
7170
} else if (eventSourceRes.status === 'Failed') {
7271
setFilesData((prevfiles) => {
7372
return prevfiles.map((curfile) => {

0 commit comments

Comments
 (0)