Skip to content

Commit 0144279

Browse files
Add the latest version of the webpage
1 parent 31bd281 commit 0144279

File tree

3 files changed

+179
-27
lines changed

3 files changed

+179
-27
lines changed

mcp_nexus_web/index.html

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,16 @@ <h2>📊 Job Details</h2>
328328
const analyses = await response.json();
329329
console.log('Available analyses:', analyses);
330330

331-
// Find the analysis that matches this job name
332-
const analysis = analyses.find(a => a.name === jobName);
333-
console.log('Found analysis:', analysis);
331+
// Find the analysis that matches this job name (handle timing mismatches)
332+
let analysis = analyses.find(a => a.name === jobName);
333+
334+
if (!analysis && jobName.startsWith('dump_') && jobName.length >= 19) {
335+
// Handle timing mismatches - look for directories with similar pattern
336+
const basePattern = jobName.substring(0, 19); // dump_20250928_1938
337+
console.log('Looking for analysis with base pattern:', basePattern);
338+
analysis = analyses.find(a => a.name.startsWith(basePattern));
339+
console.log('Found analysis with pattern matching:', analysis);
340+
}
334341

335342
if (analysis) {
336343
console.log('Analysis files:', analysis.files);
@@ -339,6 +346,7 @@ <h2>📊 Job Details</h2>
339346
updateTabStates(analysis);
340347
} else {
341348
console.log('No analysis found for job:', jobName);
349+
console.log('Available analysis names:', analyses.map(a => a.name));
342350
document.getElementById('viewerBody').innerHTML = '<p>Analysis results not found. The analysis may still be processing.</p>';
343351
}
344352
} catch (error) {
@@ -348,16 +356,22 @@ <h2>📊 Job Details</h2>
348356
}
349357

350358
function updateTabStates(analysis) {
359+
console.log('updateTabStates called with analysis:', analysis);
360+
console.log('Available files:', analysis.files);
351361
const tabs = document.querySelectorAll('.tab');
352362
tabs.forEach(tab => {
353363
const type = tab.dataset.type;
364+
console.log('Processing tab type:', type);
354365
if (type === 'jobinfo') {
355366
// Job Info tab is always available
356367
tab.classList.remove('disabled');
368+
console.log('Enabled jobinfo tab');
357369
} else if (analysis.files && analysis.files[type]) {
358370
tab.classList.remove('disabled');
371+
console.log('Enabled tab:', type, 'with file:', analysis.files[type]);
359372
} else {
360373
tab.classList.add('disabled');
374+
console.log('Disabled tab:', type, 'no file found');
361375
}
362376
});
363377
}
@@ -560,7 +574,16 @@ <h3>Dump File Information</h3>
560574
`;
561575
} else {
562576
// Show text content (console, cdb_analyze)
563-
viewerBody.innerHTML = `<div class="analysis-content"><div class="text-content">${content}</div></div>`;
577+
console.log('Loading text content for type:', type);
578+
console.log('Content length:', content.length);
579+
// Escape HTML in content to prevent rendering issues
580+
const escapedContent = content
581+
.replace(/&/g, '&amp;')
582+
.replace(/</g, '&lt;')
583+
.replace(/>/g, '&gt;')
584+
.replace(/"/g, '&quot;')
585+
.replace(/'/g, '&#39;');
586+
viewerBody.innerHTML = `<div class="analysis-content"><pre class="text-content">${escapedContent}</pre></div>`;
564587
}
565588
} catch (error) {
566589
console.error('Failed to load content:', error);
@@ -608,7 +631,14 @@ <h3>Dump File Information</h3>
608631
fetch('analysis-list.aspx')
609632
.then(response => response.json())
610633
.then(analyses => {
611-
const analysis = analyses.find(a => a.name === selectedJob.name);
634+
// Find analysis with flexible matching (handle timing mismatches)
635+
let analysis = analyses.find(a => a.name === selectedJob.name);
636+
637+
if (!analysis && selectedJob.name.startsWith('dump_') && selectedJob.name.length >= 19) {
638+
const basePattern = selectedJob.name.substring(0, 19);
639+
analysis = analyses.find(a => a.name.startsWith(basePattern));
640+
}
641+
612642
if (analysis) {
613643
loadAnalysisContent(analysis, type);
614644
}

mcp_nexus_web/process.aspx

Lines changed: 84 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ void ProcessQueue()
4444
for (int i = 0; i < jobs.Count; i++)
4545
{
4646
var jobDict = jobs[i] as Dictionary<string, object>;
47-
if (jobDict != null && jobDict.ContainsKey("status") && jobDict["status"].ToString() == "processing")
47+
if (jobDict != null && jobDict.ContainsKey("status") &&
48+
(jobDict["status"].ToString() == "processing" ||
49+
(jobDict["status"].ToString() == "completed" && jobDict.ContainsKey("note"))))
4850
{
4951
string filePath = jobDict["filePath"].ToString();
5052
string jobId = jobDict["id"].ToString();
@@ -55,12 +57,48 @@ void ProcessQueue()
5557
string expectedDir = Path.Combine(analysisDir, fileNameWithoutExt);
5658
5759
bool hasAnalysis = false;
60+
string actualDir = null;
61+
62+
// Try exact match first
5863
if (Directory.Exists(expectedDir))
5964
{
60-
string[] expectedFiles = { fileNameWithoutExt + ".md", "analysis.md", "console.txt", "cdb_analyze.txt" };
65+
actualDir = expectedDir;
66+
}
67+
else
68+
{
69+
// Handle timing mismatches - look for directories with similar pattern
70+
if (Directory.Exists(analysisDir))
71+
{
72+
string basePattern = fileNameWithoutExt;
73+
if (fileNameWithoutExt.Length >= 19 && fileNameWithoutExt.StartsWith("dump_"))
74+
{
75+
// For dump_20250928_193822 -> look for dump_20250928_1938*
76+
basePattern = fileNameWithoutExt.Substring(0, 19); // dump_20250928_1938
77+
}
78+
else if (fileNameWithoutExt.Length >= 17)
79+
{
80+
basePattern = fileNameWithoutExt.Substring(0, 17);
81+
}
82+
83+
var matchingDirs = Directory.GetDirectories(analysisDir)
84+
.Where(d => Path.GetFileName(d).StartsWith(basePattern))
85+
.OrderByDescending(d => Directory.GetLastWriteTime(d))
86+
.ToArray();
87+
88+
if (matchingDirs.Length > 0)
89+
{
90+
actualDir = matchingDirs[0];
91+
}
92+
}
93+
}
94+
95+
if (actualDir != null)
96+
{
97+
string actualDirName = Path.GetFileName(actualDir);
98+
string[] expectedFiles = { fileNameWithoutExt + ".md", actualDirName + ".md", "analysis.md", "console.txt", "cdb_analyze.txt" };
6199
foreach (string expectedFile in expectedFiles)
62100
{
63-
if (File.Exists(Path.Combine(expectedDir, expectedFile)))
101+
if (File.Exists(Path.Combine(actualDir, expectedFile)))
64102
{
65103
hasAnalysis = true;
66104
break;
@@ -70,7 +108,32 @@ void ProcessQueue()
70108
71109
if (hasAnalysis)
72110
{
73-
UpdateJobStatus(jobId, "completed");
111+
// Check if this is a full analysis (has MD file) or partial
112+
bool hasFullAnalysis = false;
113+
if (actualDir != null)
114+
{
115+
string actualDirName = Path.GetFileName(actualDir);
116+
string[] fullAnalysisFiles = { fileNameWithoutExt + ".md", actualDirName + ".md", "analysis.md" };
117+
foreach (string file in fullAnalysisFiles)
118+
{
119+
if (File.Exists(Path.Combine(actualDir, file)))
120+
{
121+
hasFullAnalysis = true;
122+
break;
123+
}
124+
}
125+
}
126+
127+
if (hasFullAnalysis)
128+
{
129+
// Full analysis available - clear any previous notes
130+
UpdateJobStatus(jobId, "completed", null);
131+
}
132+
else
133+
{
134+
// Only partial analysis available
135+
UpdateJobStatus(jobId, "completed", "Partial analysis - AI component failed but WinDbg analysis completed successfully");
136+
}
74137
}
75138
}
76139
}
@@ -263,25 +326,35 @@ void UpdateJobStatus(string jobId, string status, string error = null)
263326
{
264327
jobDict["status"] = status;
265328
jobDict["updated"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
266-
if (error != null)
329+
330+
if (status == "completed")
267331
{
268-
if (status == "completed")
332+
if (error != null)
269333
{
270334
// For completed jobs with messages, use "note" instead of "error"
271335
jobDict["note"] = error;
272-
if (jobDict.ContainsKey("error"))
273-
{
274-
jobDict.Remove("error");
275-
}
276336
}
277337
else
278338
{
279-
jobDict["error"] = error;
339+
// Clear any existing notes for fully completed jobs
280340
if (jobDict.ContainsKey("note"))
281341
{
282342
jobDict.Remove("note");
283343
}
284344
}
345+
// Always remove error for completed jobs
346+
if (jobDict.ContainsKey("error"))
347+
{
348+
jobDict.Remove("error");
349+
}
350+
}
351+
else if (error != null)
352+
{
353+
jobDict["error"] = error;
354+
if (jobDict.ContainsKey("note"))
355+
{
356+
jobDict.Remove("note");
357+
}
285358
}
286359
}
287360
jobs.Add(job);

mcp_nexus_web/queue-status.aspx

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,68 @@
4444
if (status == "completed")
4545
{
4646
string analysisDir = Server.MapPath("~/analysis/" + jobName);
47+
string actualAnalysisDir = null;
4748
48-
// Check for analysis report (MD file) - prefer clean naming
49-
enhancedJob["hasAnalysis"] = File.Exists(Path.Combine(analysisDir, "analysis.md")) ||
50-
File.Exists(Path.Combine(analysisDir, jobName + ".md"));
49+
// Try exact match first
50+
if (Directory.Exists(analysisDir))
51+
{
52+
actualAnalysisDir = analysisDir;
53+
}
54+
else
55+
{
56+
// Handle timing mismatches - look for directories with similar pattern
57+
string analysisRootDir = Server.MapPath("~/analysis");
58+
if (Directory.Exists(analysisRootDir))
59+
{
60+
string basePattern = jobName;
61+
if (jobName.Length >= 19 && jobName.StartsWith("dump_"))
62+
{
63+
// For dump_20250928_193822 -> look for dump_20250928_1938*
64+
basePattern = jobName.Substring(0, 19); // dump_20250928_1938
65+
}
66+
else if (jobName.Length >= 17)
67+
{
68+
basePattern = jobName.Substring(0, 17);
69+
}
70+
71+
var matchingDirs = Directory.GetDirectories(analysisRootDir)
72+
.Where(d => Path.GetFileName(d).StartsWith(basePattern))
73+
.OrderByDescending(d => Directory.GetLastWriteTime(d))
74+
.ToArray();
75+
76+
if (matchingDirs.Length > 0)
77+
{
78+
actualAnalysisDir = matchingDirs[0];
79+
}
80+
}
81+
}
5182
52-
// Check for WinDbg output
53-
enhancedJob["hasWinDbg"] = File.Exists(Path.Combine(analysisDir, "cdb_analyze.txt"));
54-
55-
// Check for console log
56-
enhancedJob["hasConsole"] = File.Exists(Path.Combine(analysisDir, "console.txt"));
57-
58-
// Check for dump file (should always be true for completed jobs)
59-
enhancedJob["hasDump"] = Directory.GetFiles(analysisDir, "*.dmp").Length > 0;
83+
if (actualAnalysisDir != null)
84+
{
85+
string actualDirName = Path.GetFileName(actualAnalysisDir);
86+
87+
// Check for analysis report (MD file) - prefer clean naming
88+
enhancedJob["hasAnalysis"] = File.Exists(Path.Combine(actualAnalysisDir, "analysis.md")) ||
89+
File.Exists(Path.Combine(actualAnalysisDir, jobName + ".md")) ||
90+
File.Exists(Path.Combine(actualAnalysisDir, actualDirName + ".md"));
91+
92+
// Check for WinDbg output
93+
enhancedJob["hasWinDbg"] = File.Exists(Path.Combine(actualAnalysisDir, "cdb_analyze.txt"));
94+
95+
// Check for console log
96+
enhancedJob["hasConsole"] = File.Exists(Path.Combine(actualAnalysisDir, "console.txt"));
97+
98+
// Check for dump file (should always be true for completed jobs)
99+
enhancedJob["hasDump"] = Directory.GetFiles(actualAnalysisDir, "*.dmp").Length > 0;
100+
}
101+
else
102+
{
103+
// No analysis directory found
104+
enhancedJob["hasAnalysis"] = false;
105+
enhancedJob["hasWinDbg"] = false;
106+
enhancedJob["hasConsole"] = false;
107+
enhancedJob["hasDump"] = false;
108+
}
60109
}
61110
else
62111
{

0 commit comments

Comments
 (0)