Skip to content

Commit 344fd17

Browse files
committed
Ai Explanation service dashboard fixes
1 parent 03869ae commit 344fd17

1 file changed

Lines changed: 41 additions & 23 deletions

File tree

dev-tools-ui/src/main/resources/static/dashboard.js

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,50 @@
44

55
const SAMPLE = [
66
{
7-
id: 'a1b2c3', timestamp: '2026-04-20T10:30:00Z', type: 'HTTP_REQUEST',
8-
exceptionClass: 'java.lang.NullPointerException', message: 'Cannot invoke getUser()',
9-
rootCauseClass: 'java.lang.NullPointerException', rootCauseMessage: 'Cannot invoke getUser()',
10-
httpMethod: 'POST', requestUri: '/api/users', requestBody: '{"name":"John"}',
11-
context: { thread: 'http-nio-8080', method: 'UserService.createUser' },
7+
id: 'demo-event-001',
8+
timestamp: '2026-04-20T10:30:00Z',
9+
type: 'HTTP_REQUEST',
10+
exceptionClass: 'com.example.DemoException',
11+
message: 'Simulated error message for demo purposes only',
12+
rootCauseClass: 'com.example.DemoException',
13+
rootCauseMessage: 'Placeholder failure used to preview the UI',
14+
httpMethod: 'POST',
15+
requestUri: '/api/demo-users',
16+
requestBody: '{"name":"Sample User"}',
17+
context: {
18+
thread: 'demo-thread-1',
19+
method: 'DemoUserService.createSampleUser'
20+
},
1221
recentLogs: [
13-
{ level: 'WARN', message: 'Validation skipped', loggerName: 'com.example.UserService', threadName: 'http-nio-8080', timestamp: '2026-04-20T10:29:59Z' },
14-
{ level: 'INFO', message: 'Request received: POST /api/users', loggerName: 'com.example.RequestFilter', threadName: 'http-nio-8080', timestamp: '2026-04-20T10:29:58Z' }
22+
{
23+
level: 'WARN',
24+
message: 'Dummy validation warning for sample display',
25+
loggerName: 'com.example.DemoUserService',
26+
threadName: 'demo-thread-1',
27+
timestamp: '2026-04-20T10:29:59Z'
28+
},
29+
{
30+
level: 'INFO',
31+
message: 'Sample request received: POST /api/demo-users',
32+
loggerName: 'com.example.DemoRequestFilter',
33+
threadName: 'demo-thread-1',
34+
timestamp: '2026-04-20T10:29:58Z'
35+
}
1536
],
1637
aiExplanation: {
17-
summary: 'A null value was returned by getUser() and dereferenced without a null check, causing a NullPointerException during user creation.',
18-
causes: ['UserRepository.findById() returned null and was not checked before use', 'The user lookup was skipped due to missing validation in the request pipeline'],
19-
fixes: ['Add a null check after calling getUser() and return a 404 if the user is absent', 'Ensure request validation runs before the service layer is invoked', 'Consider using Optional<User> to make null-safety explicit']
38+
summary: 'This is placeholder diagnostic data showing how an exception analysis might appear in the UI.',
39+
causes: [
40+
'A simulated null value was introduced for demo purposes',
41+
'This sample intentionally mimics a service-layer failure'
42+
],
43+
fixes: [
44+
'Replace this mock entry with live backend data',
45+
'Keep placeholder labels so demo content is clearly non-production',
46+
'Use additional sample cases to test different UI states'
47+
]
2048
}
21-
},
22-
{
23-
id: 'd4e5f6', timestamp: '2026-04-20T10:28:00Z', type: 'SCHEDULED',
24-
exceptionClass: 'org.springframework.dao.DataAccessException', message: 'Unable to acquire JDBC connection',
25-
rootCauseClass: 'java.sql.SQLTransientConnectionException', rootCauseMessage: 'Connection pool exhausted',
26-
context: { thread: 'scheduling-1', method: 'ReportJob.generateDaily' },
27-
recentLogs: [
28-
{ level: 'ERROR', message: 'Failed to obtain connection from pool', loggerName: 'com.zaxxer.hikari.pool.HikariPool', threadName: 'scheduling-1', timestamp: '2026-04-20T10:27:58Z' }
29-
],
30-
aiExplanation: null
31-
},
32-
];
49+
}
50+
]
3351

3452
// ── State ─────────────────────────────────────────────────
3553
let errors = [];
@@ -240,7 +258,7 @@
240258
}
241259
});
242260

243-
eventSource.addEventListener('ai-ready', async ev => {
261+
eventSource.addEventListener('ai-insight-ready', async ev => {
244262
const { id } = JSON.parse(ev.data);
245263
try {
246264
const fullEvent = await fetchById(id);

0 commit comments

Comments
 (0)