Skip to content

Commit 183cd0d

Browse files
Updated the all the files
1 parent ae0e967 commit 183cd0d

8 files changed

Lines changed: 4 additions & 91 deletions

File tree

src/frontend/src/components/batchHistoryPanel.tsx

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState, useEffect, useRef } from "react";
22

3-
import { useDispatch, useSelector } from 'react-redux';
3+
import { useDispatch } from 'react-redux';
44
import { Card, Spinner, Tooltip } from "@fluentui/react-components";
55
import { useNavigate } from "react-router-dom";
66
import ConfirmationDialog from "../commonComponents/ConfirmationDialog/confirmationDialogue";
@@ -81,46 +81,6 @@ const HistoryPanel: React.FC<HistoryPanelProps> = ({ isOpen, onClose }) => {
8181
}
8282
};
8383

84-
// Function to categorize batches
85-
const categorizeBatches = () => {
86-
const now = new Date();
87-
const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
88-
89-
// Get start of "Today", "Past 7 days", and "Past 30 days" in LOCAL time
90-
const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate());
91-
const past7DaysStart = new Date(todayStart);
92-
const past30DaysStart = new Date(todayStart);
93-
94-
past7DaysStart.setDate(todayStart.getDate() - 7);
95-
past30DaysStart.setDate(todayStart.getDate() - 30);
96-
97-
const todayBatches: BatchHistoryItem[] = [];
98-
const past7DaysBatches: BatchHistoryItem[] = [];
99-
const past30DaysBatches: BatchHistoryItem[] = [];
100-
101-
batchHistory.forEach(batch => {
102-
// Convert UTC timestamp to user's local date
103-
const updatedAtUTC = new Date(batch.created_at);
104-
const updatedAtLocal = new Date(updatedAtUTC.toLocaleString("en-US", { timeZone: userTimeZone }));
105-
106-
// Extract only the local **date** part for comparison
107-
const updatedDate = new Date(updatedAtLocal.getFullYear(), updatedAtLocal.getMonth(), updatedAtLocal.getDate());
108-
109-
// Categorize based on **exact day comparison**
110-
if (updatedDate.getTime() === todayStart.getTime()) {
111-
todayBatches.push(batch);
112-
} else if (updatedDate.getTime() >= past7DaysStart.getTime()) {
113-
past7DaysBatches.push(batch);
114-
} else if (updatedDate.getTime() >= past30DaysStart.getTime()) {
115-
past30DaysBatches.push(batch);
116-
}
117-
});
118-
119-
return { todayBatches, past7DaysBatches, past30DaysBatches };
120-
};
121-
122-
// const { todayBatches, past7DaysBatches, past30DaysBatches } = categorizeBatches();
123-
12484
const deleteBatchFromHistory = (batchId: string) => {
12585
// Get the current URL path
12686
const currentPath = window.location.pathname;

src/frontend/src/components/bottomBar.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Button, Card, Dropdown, DropdownProps, Option } from "@fluentui/react-components"
2-
import React, { useState } from "react"
3-
import { useNavigate } from "react-router-dom"
2+
import React from "react"
43

54
// Define possible upload states
65
const UploadState = {

src/frontend/src/components/uploadButton.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ const FileUploadZone: React.FC<FileUploadZoneProps> = ({
6868
const [uploadIntervals, setUploadIntervals] = useState<{ [key: string]: ReturnType<typeof setTimeout> }>({});
6969
const [showCancelDialog, setShowCancelDialog] = useState(false);
7070
const [showLogoCancelDialog, setShowLogoCancelDialog] = useState(false);
71-
const [uploadState, setUploadState] = useState<'IDLE' | 'UPLOADING' | 'COMPLETED'>('IDLE');
7271
const [batchId, setBatchId] = useState<string>(uuidv4());
7372
const [allUploadsComplete, setAllUploadsComplete] = useState(false);
7473
const [fileLimitExceeded, setFileLimitExceeded] = useState(false);
@@ -98,7 +97,6 @@ const FileUploadZone: React.FC<FileUploadZoneProps> = ({
9897
}
9998
}
10099

101-
setUploadState(newState);
102100
onUploadStateChange?.(newState);
103101
}, [uploadingFiles, onUploadStateChange]);
104102

src/frontend/src/main.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const Main = () => {
5050
const baseURL = config.API_URL.replace(/\/api$/, ''); // Remove '/api' if it appears at the end
5151
console.log('Checking connection to:', baseURL);
5252
try {
53-
const response = await fetch(`${baseURL}/health`);
53+
await fetch(`${baseURL}/health`);
5454
} catch (error) {
5555
console.error('Error connecting to backend:', error);
5656
}

src/frontend/src/pages/batchView.tsx

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import PanelRight from "../components/Panels/PanelRight";
3333
import PanelRightToolbar from "../components/Panels/PanelRightToolbar";
3434
import BatchHistoryPanel from "../components/batchHistoryPanel";
3535
import ConfirmationDialog from "../commonComponents/ConfirmationDialog/confirmationDialogue";
36-
import { determineFileStatus, filesLogsBuilder, renderErrorSection, useStyles, renderFileError, filesErrorCounter, completedFiles, hasFiles, fileErrorCounter, BatchSummary, fileWarningCounter } from "../api/utils";
36+
import { determineFileStatus, filesLogsBuilder, renderErrorSection, useStyles, renderFileError, filesErrorCounter, completedFiles, hasFiles, fileErrorCounter, BatchSummary } from "../api/utils";
3737
export const History = bundleIcon(HistoryFilled, HistoryRegular);
3838
import { format } from "sql-formatter";
3939

@@ -73,7 +73,6 @@ const BatchStoryPage = () => {
7373
const [selectedFileId, setSelectedFileId] = useState<string>("");
7474
const [expandedSections, setExpandedSections] = useState(["errors"]);
7575
const [batchSummary, setBatchSummary] = useState<BatchSummary | null>(null);
76-
const [selectedFileContent, setSelectedFileContent] = useState<string>("");
7776
const [selectedFileTranslatedContent, setSelectedFileTranslatedContent] = useState<string>("");
7877

7978

@@ -209,40 +208,6 @@ const BatchStoryPage = () => {
209208
fetchFileContent();
210209
}, [selectedFileId]);
211210

212-
213-
const renderWarningContent = () => {
214-
if (!expandedSections.includes("warnings")) return null;
215-
216-
if (!batchSummary) return null;
217-
218-
// Group warnings by file
219-
const warningFiles = files.filter(file => file.warningCount && file.warningCount > 0 && file.id !== "summary");
220-
221-
if (warningFiles.length === 0) {
222-
return (
223-
<div className={styles.errorItem}>
224-
<Text>No warnings found.</Text>
225-
</div>
226-
);
227-
}
228-
229-
return (
230-
<div>
231-
{warningFiles.map((file, fileIndex) => (
232-
<div key={fileIndex} className={styles.errorItem}>
233-
<div className={styles.errorTitle}>
234-
<Text weight="semibold">{file.name} ({file.warningCount})</Text>
235-
<Text className={styles.errorSource}>source</Text>
236-
</div>
237-
<div className={styles.errorDetails}>
238-
<Text>Warning in file processing. See file for details.</Text>
239-
</div>
240-
</div>
241-
))}
242-
</div>
243-
);
244-
};
245-
246211
const renderContent = () => {
247212
// Define header content based on selected file
248213
const renderHeader = () => {

src/frontend/src/pages/landingPage.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export const LandingPage = (): JSX.Element => {
3333
const dispatch = useDispatch(); // Add dispatch hook
3434
const [selectedTargetLanguage, setSelectedTargetLanguage] = useState<string[]>(["T-SQL"]);
3535
const [selectedCurrentLanguage, setSelectedCurrentLanguage] = useState<string[]>(["Informix"]);
36-
const batchHistoryRef = useRef<{ triggerDeleteAll: () => void } | null>(null);
3736
const isPanelOpen = useSelector((state: RootState) => state.historyPanel.isOpen);
3837
const navigate = useNavigate();
3938

src/frontend/src/pages/modernizationPage.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -492,16 +492,13 @@ const ModernizationPage = () => {
492492

493493
// State for the loading component
494494
const [showLoading, setShowLoading] = useState(true);
495-
const [loadingError, setLoadingError] = useState<string | null>(null);
496495
const [selectedFilebg, setSelectedFile] = useState<string | null>(null);
497496
const [selectedFileId, setSelectedFileId] = React.useState<string>("");
498497
const [fileId, setFileId] = React.useState<string>("");
499498
const [expandedSections, setExpandedSections] = React.useState<string[]>([]);
500-
const [progressPercentage, setProgressPercentage] = useState(0);
501499
const [allFilesCompleted, setAllFilesCompleted] = useState(false);
502500
const [isZipButtonDisabled, setIsZipButtonDisabled] = useState(true);
503501
const [fileLoading, setFileLoading] = useState(false);
504-
const [selectedFileTranslatedContent, setSelectedFileTranslatedContent] = useState<string>("");
505502
const [lastActivityTime, setLastActivityTime] = useState<number>(Date.now());
506503
const [pageLoadTime] = useState<number>(Date.now());
507504

@@ -517,11 +514,9 @@ const ModernizationPage = () => {
517514
if (!selectedFile || !selectedFile.translatedCode) {
518515
setFileLoading(true);
519516
const newFileUpdate = await fetchFileFromAPI(selectedFile?.fileId || "");
520-
setSelectedFileTranslatedContent(newFileUpdate.translatedContent);
521517
setFileLoading(false);
522518
} else {
523519

524-
setSelectedFileTranslatedContent(selectedFile.translatedCode);
525520
}
526521

527522
} catch (err) {
@@ -799,8 +794,6 @@ const ModernizationPage = () => {
799794
}
800795
}, [batchId]);
801796

802-
const highestProgressRef = useRef(0);
803-
const currentProcessingFileRef = useRef<string | null>(null);
804797

805798

806799
//new PT FR ends

src/frontend/vite.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { defineConfig } from 'vite'
22
import react from '@vitejs/plugin-react'
3-
import path from 'path'
43
import tailwindcss from '@tailwindcss/vite'
54

65
export default defineConfig({

0 commit comments

Comments
 (0)