Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/validate_bicep_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def parse_parameters_env_vars(json_path: Path) -> dict[str, list[str]]:
data = json.loads(sanitized)
params = data.get("parameters", {})
except json.JSONDecodeError:
pass
pass # File is not valid JSON after azd variable substitution; fall through to regex scan

# Walk each top-level parameter and scan its entire serialized value
# for ${VAR} references from the original text.
Expand Down
2 changes: 1 addition & 1 deletion src/backend-api/src/app/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def _register_dependencies(self):
)
.add_singleton(ILoggerService, ConsoleLoggerService)
.add_transient(IHttpService, HttpClientService)
.add_singleton(IDataService, lambda: InMemoryDataService())
.add_singleton(IDataService, InMemoryDataService)
)

def run(self, host: str = "0.0.0.0", port: int = 8000, reload: bool = True):
Expand Down
6 changes: 3 additions & 3 deletions src/backend-api/src/app/libs/base/SKLogicBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _init_agent(self):
"""
raise NotImplementedError("This method should be overridden in subclasses")

async def execute(func_params: dict[str, any]):
async def execute(self, func_params: dict[str, any]):
raise NotImplementedError("Execute method not implemented")
Comment thread
VishalS-Microsoft marked this conversation as resolved.

@overload
Expand All @@ -92,7 +92,7 @@ async def execute_thread(
thread: AgentThread | AssistantAgentThread | AzureAIAgentThread = None,
) -> tuple[str, AgentThread | AssistantAgentThread | AzureAIAgentThread]:
"""When response_format is None, returns string response."""
...
pass

@overload
async def execute_thread(
Expand All @@ -102,7 +102,7 @@ async def execute_thread(
thread: AgentThread | AssistantAgentThread | AzureAIAgentThread = None,
) -> tuple[T, AgentThread | AssistantAgentThread | AzureAIAgentThread]:
"""When response_format is provided, returns typed Pydantic BaseModel response."""
...
pass

@abstractmethod
async def execute_thread(
Expand Down
3 changes: 2 additions & 1 deletion src/backend-api/src/app/libs/base/fastapi_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class FastAPIWithContext(Protocol):
app_context: AppContext

# Include essential FastAPI methods for type checking
def include_router(self, *args, **kwargs) -> None: ...
def include_router(self, *args, **kwargs) -> None:
pass


def add_app_context_to_fastapi(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def test_factory_registration():
app_context = AppContext()

# Register with factory function
app_context.add_singleton(IDataService, lambda: InMemoryDataService())
app_context.add_singleton(IDataService, InMemoryDataService)

data_service = app_context.get_service(IDataService)
assert isinstance(data_service, InMemoryDataService)
Expand Down
3 changes: 1 addition & 2 deletions src/frontend/frontend_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dotenv import load_dotenv
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import FileResponse, HTMLResponse, JSONResponse
from fastapi.responses import FileResponse, JSONResponse
from fastapi.staticfiles import StaticFiles

# Load environment variables from .env file
Expand Down Expand Up @@ -42,7 +42,6 @@ async def serve_index():
async def get_config(request: Request):
# Only serve config to same-origin requests by checking the Referer/Origin
origin = request.headers.get("origin") or ""
referer = request.headers.get("referer") or ""
host = request.headers.get("host") or ""
if origin and not origin.endswith(host):
return JSONResponse(status_code=403, content={"detail": "Forbidden"})
Comment thread
VishalS-Microsoft marked this conversation as resolved.
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/api/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ export const renderErrorSection = (batchSummary, expandedSections, setExpandedSe

export const renderErrorContent = (batchSummary) => {
// Group errors by file
const errorFiles = batchSummary.files.filter(file => file.error_count && file.error_count);
const errorFiles = batchSummary.files.filter(file => file.error_count > 0);
if (errorFiles.length === 0) {
return (
<div className={useStyles().errorItem}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const ProgressModal: React.FC<ProgressModalProps> = ({
}) => {
// Calculate progress percentage based on step (stable step-level identifier)
const getProgressPercentage = () => {
if (processingCompleted) return 100;
if (migrationError) return 0; // Show 0% progress for errors
if (processingCompleted && !migrationError) return 100;
if (!apiData) return 0;

// Use apiData.step (stable: "analysis", "design", "yaml_conversion", "documentation")
Expand Down
42 changes: 1 addition & 41 deletions src/frontend/src/components/batchHistoryPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface BatchHistoryItem {
status: string;
}
const HistoryPanel: React.FC<HistoryPanelProps> = ({ isOpen, onClose }) => {
const headers = {}
const headers = {};
const [batchHistory, setBatchHistory] = useState<BatchHistoryItem[]>([]);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
Expand Down Expand Up @@ -81,46 +81,6 @@ const HistoryPanel: React.FC<HistoryPanelProps> = ({ isOpen, onClose }) => {
}
};

// Function to categorize batches
const categorizeBatches = () => {
const now = new Date();
const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;

// Get start of "Today", "Past 7 days", and "Past 30 days" in LOCAL time
const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate());
const past7DaysStart = new Date(todayStart);
const past30DaysStart = new Date(todayStart);

past7DaysStart.setDate(todayStart.getDate() - 7);
past30DaysStart.setDate(todayStart.getDate() - 30);

const todayBatches: BatchHistoryItem[] = [];
const past7DaysBatches: BatchHistoryItem[] = [];
const past30DaysBatches: BatchHistoryItem[] = [];

batchHistory.forEach(batch => {
// Convert UTC timestamp to user's local date
const updatedAtUTC = new Date(batch.created_at);
const updatedAtLocal = new Date(updatedAtUTC.toLocaleString("en-US", { timeZone: userTimeZone }));

// Extract only the local **date** part for comparison
const updatedDate = new Date(updatedAtLocal.getFullYear(), updatedAtLocal.getMonth(), updatedAtLocal.getDate());

// Categorize based on **exact day comparison**
if (updatedDate.getTime() === todayStart.getTime()) {
todayBatches.push(batch);
} else if (updatedDate.getTime() >= past7DaysStart.getTime()) {
past7DaysBatches.push(batch);
} else if (updatedDate.getTime() >= past30DaysStart.getTime()) {
past30DaysBatches.push(batch);
}
});

return { todayBatches, past7DaysBatches, past30DaysBatches };
};

// const { todayBatches, past7DaysBatches, past30DaysBatches } = categorizeBatches();

const deleteBatchFromHistory = (batchId: string) => {
// Get the current URL path
const currentPath = window.location.pathname;
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/components/bottomBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, Dropdown, DropdownProps, Option } from "@fluentui/react-components"
import React, { useState } from "react"
import React from "react"
import { useNavigate } from "react-router-dom"

// Define possible upload states
Expand Down
9 changes: 1 addition & 8 deletions src/frontend/src/components/uploadButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Tooltip,
} from "@fluentui/react-components";
import { MessageBar, MessageBarType } from "@fluentui/react";
import { deleteBatch, deleteFileFromBatch, createProcess, uploadFiles, startProcessing, deleteFile } from '../slices/batchSlice';
import { deleteBatch, createProcess, uploadFiles, startProcessing, deleteFile } from '../slices/batchSlice';
import { useDispatch } from 'react-redux';
import ConfirmationDialog from '../commonComponents/ConfirmationDialog/confirmationDialogue';
import { AppDispatch } from '../store/store'
Expand Down Expand Up @@ -53,7 +53,6 @@ const FileUploadZone: React.FC<FileUploadZoneProps> = ({
const [allUploadsComplete, setAllUploadsComplete] = useState(false);
const [fileLimitExceeded, setFileLimitExceeded] = useState(false);
const [showFileLimitDialog, setShowFileLimitDialog] = useState(false);
const [isCreatingProcess, setIsCreatingProcess] = useState(false);
const [rejectedFiles, setRejectedFiles] = useState<FileRejection[]>([]);
const [showFileRejectionError, setShowFileRejectionError] = useState(false);
const [showNetworkError, setShowNetworkError] = useState(false);
Expand Down Expand Up @@ -823,12 +822,6 @@ const FileUploadZone: React.FC<FileUploadZoneProps> = ({
}, [showFileRejectionError]);


const handleStartProcessing = () => {
if (uploadState === 'COMPLETED' && onStartTranslating) {
onStartTranslating();
}
};

return (
<div
className="upload-container"
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Main = () => {
const initMsal = async () => {
try {
const response = await fetch('/config');
let config = defaultConfig;
let config;

if (response.ok) {
config = await response.json();
Expand Down
1 change: 0 additions & 1 deletion src/frontend/src/msal-auth/apiHeaders.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// apiHeaders.ts - Utility for creating API headers with user info
import { getMsalInstance } from './msalInstance';

export interface ApiHeaders {
'Authorization': string;
Expand Down
37 changes: 1 addition & 36 deletions src/frontend/src/pages/batchView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
Card,
tokens,
Spinner,
Tooltip,
} from "@fluentui/react-components"
import {
DismissCircle24Regular,
Expand Down Expand Up @@ -183,7 +182,6 @@ const BatchStoryPage = () => {
const [selectedFileId, setSelectedFileId] = useState<string>("");
const [expandedSections, setExpandedSections] = useState(["errors"]);
const [batchSummary, setBatchSummary] = useState<BatchSummary | null>(null);
const [selectedFileContent, setSelectedFileContent] = useState<string>("");
const [selectedFileTranslatedContent, setSelectedFileTranslatedContent] = useState<string>("");
const [telemetryData, setTelemetryData] = useState<any>(null);

Expand Down Expand Up @@ -339,7 +337,6 @@ const BatchStoryPage = () => {
const data = await apiService.get(`/process/${batchId}/file/${encodeURIComponent(selectedFileId)}`);

if (data) {
setSelectedFileContent(data.content || "");
setSelectedFileTranslatedContent(data.content || ""); // Use content for both since we only have one version
}

Expand All @@ -354,38 +351,6 @@ const BatchStoryPage = () => {
}, [selectedFileId]);


const renderWarningContent = () => {
if (!expandedSections.includes("warnings")) return null;

if (!batchSummary) return null;

// Group warnings by file
const warningFiles = files.filter(file => file.warningCount && file.warningCount > 0 && file.id !== "summary");

if (warningFiles.length === 0) {
return (
<div className={styles.errorItem}>
<Text>No warnings found.</Text>
</div>
);
}

return (
<div>
{warningFiles.map((file, fileIndex) => (
<div key={fileIndex} className={styles.errorItem}>
<div className={styles.errorTitle}>
<Text weight="semibold">{file.name} ({file.warningCount})</Text>
<Text className={styles.errorSource}>source</Text>
</div>
<div className={styles.errorDetails}>
<Text>Warning in file processing. See file for details.</Text>
</div>
</div>
))}
</div>
);
};

// Helper function to count JSON/YAML files
const getJsonYamlFileCount = () => {
Expand Down Expand Up @@ -601,7 +566,7 @@ const BatchStoryPage = () => {
}

// Show the summary page when summary is selected
if (selectedFile.id === "summary" && batchSummary) {
if (selectedFile.id === "summary") {
// Check if there are no errors and all JSON/YAML files are processed successfully
const noErrors = (batchSummary.error_count === 0);
const jsonYamlFileCount = getJsonYamlFileCount();
Expand Down
15 changes: 1 addition & 14 deletions src/frontend/src/pages/landingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ declare global {
startTranslating?: () => Promise<string | null>;
}
}
import {
Button,
Tooltip,
} from "@fluentui/react-components";
import Content from "../components/Content/Content";
import Header from "../components/Header/Header";
import HeaderTools from "../components/Header/HeaderTools";
Expand All @@ -29,7 +25,6 @@ export const History = bundleIcon(HistoryFilled, HistoryRegular);

export const LandingPage = (): JSX.Element => {
const dispatch = useDispatch(); // Add dispatch hook
const batchHistoryRef = useRef<{ triggerDeleteAll: () => void } | null>(null);
const isPanelOpen = useSelector((state: RootState) => state.historyPanel.isOpen);
const navigate = useNavigate();

Expand All @@ -43,21 +38,13 @@ export const LandingPage = (): JSX.Element => {
setUploadState(state);
};

const handleCancelUploads = () => {
// This function will be called from BottomBar
if (window.cancelUploads) {
window.cancelUploads();
}
setUploadState('IDLE');
};

const handleStartTranslating = async () => {
console.log('Starting translation...');

try {
if (window.startTranslating) {
// Get the batchId from startTranslating first
const resultBatchId = await window.startTranslating();
await window.startTranslating();
navigate('/start');
// if (resultBatchId) {
// // Once processing is complete, navigate to the modern page
Expand Down
Loading
Loading