Skip to content

Commit 2071908

Browse files
author
Shreyas-Microsoft
committed
fix bug and Managed identity changes
1 parent 72c6faa commit 2071908

5 files changed

Lines changed: 28 additions & 26 deletions

File tree

src/backend/.env.sample

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME = ""
2828
APP_ENV = "dev"
2929

3030
# Basic application logging (default: INFO level)
31-
AZURE_BASIC_LOGGING_LEVEL=INFO
31+
AZURE_BASIC_LOGGING_LEVEL=DEBUG
3232
# Azure package logging (default: WARNING level to suppress INFO)
33-
AZURE_PACKAGE_LOGGING_LEVEL=WARNING
33+
AZURE_PACKAGE_LOGGING_LEVEL=DEBUG
3434
# Comma-separated list of specific logger names to configure (default: empty - no custom loggers)
3535
# Example: AZURE_LOGGING_PACKAGES=azure.identity.aio._internal,azure.monitor.opentelemetry.exporter.export._base
3636
AZURE_LOGGING_PACKAGES=

src/backend/common/config/config.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import os
1616

1717
from azure.identity.aio import ClientSecretCredential
18+
from azure.identity.aio import DefaultAzureCredential as AioDefaultAzureCredential
19+
from azure.identity.aio import ManagedIdentityCredential as AioManagedIdentityCredential
1820

1921
from helper.azure_credential_utils import get_azure_credential
2022

@@ -54,13 +56,15 @@ def __init__(self):
5456

5557
def get_azure_credentials(self):
5658
"""Retrieve Azure credentials, either from environment variables or managed identity."""
57-
if all([self.azure_tenant_id, self.azure_client_id, self.azure_client_secret]):
58-
return ClientSecretCredential(
59-
tenant_id=self.azure_tenant_id,
60-
client_id=self.azure_client_id,
61-
client_secret=self.azure_client_secret,
62-
)
63-
return self.__azure_credentials
59+
if os.getenv("APP_ENV", "prod").lower() == "dev":
60+
if all([self.azure_tenant_id, self.azure_client_id, self.azure_client_secret]):
61+
return ClientSecretCredential(
62+
tenant_id=self.azure_tenant_id,
63+
client_id=self.azure_client_id,
64+
client_secret=self.azure_client_secret,
65+
)
66+
return AioDefaultAzureCredential()
67+
return AioManagedIdentityCredential(client_id=self.azure_client_id)
6468

6569

6670
app_config = Config()

src/backend/sql_agents/convert_script.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ async def convert_script(
6666

6767
# orchestrate the chat
6868
current_migration = "No migration"
69-
while True:
69+
is_complete: bool = False
70+
while not is_complete:
7071
await comms_manager.group_chat.add_chat_message(
7172
ChatMessageContent(role=AuthorRole.USER, content=source_script)
7273
)
@@ -273,7 +274,9 @@ async def convert_script(
273274
break
274275

275276
if comms_manager.group_chat.is_complete:
276-
break
277+
is_complete = True
278+
279+
break
277280

278281
migrated_query = current_migration
279282

src/frontend/.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
.git

src/frontend/src/pages/modernizationPage.tsx

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { Light as SyntaxHighlighter } from "react-syntax-highlighter"
3131
import { vs } from "react-syntax-highlighter/dist/esm/styles/hljs"
3232
import sql from "react-syntax-highlighter/dist/cjs/languages/hljs/sql"
3333
import { useNavigate, useParams } from "react-router-dom"
34-
import { useState, useEffect, useCallback } from "react"
34+
import { useState, useEffect, useCallback, useRef } from "react"
3535
import { getApiUrl, headerBuilder } from '../api/config';
3636
import BatchHistoryPanel from "../components/batchHistoryPanel"
3737
import PanelRight from "../components/Panels/PanelRight";
@@ -497,6 +497,7 @@ const ModernizationPage = () => {
497497
const [fileId, setFileId] = React.useState<string>("");
498498
const [expandedSections, setExpandedSections] = React.useState<string[]>([]);
499499
const [allFilesCompleted, setAllFilesCompleted] = useState(false);
500+
const [progressPercentage, setProgressPercentage] = useState(0);
500501
const [isZipButtonDisabled, setIsZipButtonDisabled] = useState(true);
501502
const [fileLoading, setFileLoading] = useState(false);
502503
const [lastActivityTime, setLastActivityTime] = useState<number>(Date.now());
@@ -514,18 +515,9 @@ const ModernizationPage = () => {
514515
if (!selectedFile || !selectedFile.translatedCode) {
515516
setFileLoading(true);
516517
const newFileUpdate = await fetchFileFromAPI(selectedFile?.fileId || "");
517-
setFiles((prevFiles) =>
518-
prevFiles.map((file) =>
519-
file.fileId === selectedFile?.fileId
520-
? {
521-
...file,
522-
code: newFileUpdate.content,
523-
translatedCode: newFileUpdate.translated_content,
524-
}
525-
: file
526-
)
527-
);
528518
setFileLoading(false);
519+
} else {
520+
529521
}
530522

531523
} catch (err) {
@@ -1013,16 +1005,16 @@ useEffect(() => {
10131005
};
10141006
}, [handleWebSocketMessage]);
10151007

1016-
// Set a timeout for initial loading - if still loading after 30 seconds, show a warning message
1008+
// Set a timeout for initial loading - if no progress after 30 seconds, show error
10171009
useEffect(() => {
10181010
const loadingTimeout = setTimeout(() => {
1019-
if (showLoading) {
1011+
if (progressPercentage < 5 && showLoading) {
10201012
setLoadingError('Processing is taking longer than expected. You can continue waiting or try again later.');
10211013
}
10221014
}, 30000);
10231015

10241016
return () => clearTimeout(loadingTimeout);
1025-
}, [showLoading]);
1017+
}, [progressPercentage, showLoading]);
10261018

10271019
// Add timeout mechanism to navigate if no activity for 30 seconds
10281020
useEffect(() => {

0 commit comments

Comments
 (0)