@kb-labs/studio-app 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/.env.example +10 -0
  2. package/README.md +74 -0
  3. package/UI-KIT-COMPONENTS.md +783 -0
  4. package/UI-KIT-PLAN.md +326 -0
  5. package/eslint-rules/no-direct-antd-import.js +151 -0
  6. package/eslint.config.ts +27 -0
  7. package/index.html +17 -0
  8. package/package.json +72 -0
  9. package/postcss.config.js +7 -0
  10. package/public/favicon.ico +0 -0
  11. package/public/favicon.svg +7 -0
  12. package/rspack.config.mjs +118 -0
  13. package/src/App.tsx +46 -0
  14. package/src/components/devtools/devtools-log-feed.module.css +165 -0
  15. package/src/components/devtools/devtools-log-feed.tsx +300 -0
  16. package/src/components/devtools/devtools-panel.module.css +121 -0
  17. package/src/components/devtools/devtools-panel.tsx +115 -0
  18. package/src/components/empty-state.tsx +28 -0
  19. package/src/components/error-boundary.tsx +210 -0
  20. package/src/components/health-banner.module.css +103 -0
  21. package/src/components/health-banner.tsx +134 -0
  22. package/src/components/health-indicator.tsx +12 -0
  23. package/src/components/page-header.tsx +49 -0
  24. package/src/components/page-transition.tsx +24 -0
  25. package/src/components/role-switcher.tsx +148 -0
  26. package/src/components/run-badge.tsx +13 -0
  27. package/src/components/ui/icons.tsx +509 -0
  28. package/src/components/ui/index.ts +25 -0
  29. package/src/components/ui/kb-config-provider.tsx +130 -0
  30. package/src/components/ui/kb-header.module.css +51 -0
  31. package/src/components/ui/kb-header.tsx +112 -0
  32. package/src/components/ui/kb-notification-bell.module.css +103 -0
  33. package/src/components/ui/kb-notification-bell.tsx +199 -0
  34. package/src/components/ui/kb-page-layout.tsx +66 -0
  35. package/src/components/ui/kb-quick-search.module.css +86 -0
  36. package/src/components/ui/kb-quick-search.tsx +196 -0
  37. package/src/components/ui/kb-sidebar.module.css +47 -0
  38. package/src/components/ui/kb-sidebar.tsx +196 -0
  39. package/src/components/ui/kb-stat-card.module.css +21 -0
  40. package/src/components/ui/kb-stat-card.tsx +22 -0
  41. package/src/components/ui/kb-stat-grid.tsx +22 -0
  42. package/src/components/ui/kb-status-bar.module.css +49 -0
  43. package/src/components/ui/kb-status-bar.tsx +145 -0
  44. package/src/components/ui/kb-system-health-indicator.tsx +229 -0
  45. package/src/components/ui/kb-theme-toggle.tsx +42 -0
  46. package/src/components/ui/theme-adapter.ts +812 -0
  47. package/src/components/ui/theme-transition-overlay.tsx +70 -0
  48. package/src/components/ui/utils.ts +6 -0
  49. package/src/components/widget-error-boundary.tsx +172 -0
  50. package/src/config/env.ts +5 -0
  51. package/src/config/feature-flags.ts +482 -0
  52. package/src/config/studio.config.schema.ts +88 -0
  53. package/src/config/studio.config.ts +84 -0
  54. package/src/env.d.ts +23 -0
  55. package/src/hooks/use-command-palette.ts +6 -0
  56. package/src/hooks/use-devtools-store.ts +25 -0
  57. package/src/hooks/use-feature-flags.ts +101 -0
  58. package/src/index.css +10 -0
  59. package/src/layouts/dashboard-grid.tsx +122 -0
  60. package/src/layouts/index.ts +12 -0
  61. package/src/layouts/two-pane.tsx +134 -0
  62. package/src/main.tsx +15 -0
  63. package/src/modules/analytics/components/analytics-daily-stats-chart.tsx +257 -0
  64. package/src/modules/analytics/components/analytics-date-range-picker.tsx +121 -0
  65. package/src/modules/analytics/pages/analytics-cache-page.tsx +285 -0
  66. package/src/modules/analytics/pages/analytics-embeddings-page.tsx +274 -0
  67. package/src/modules/analytics/pages/analytics-events-page.tsx +425 -0
  68. package/src/modules/analytics/pages/analytics-llm-page.tsx +434 -0
  69. package/src/modules/analytics/pages/analytics-overview-page.tsx +336 -0
  70. package/src/modules/analytics/pages/analytics-page.tsx +20 -0
  71. package/src/modules/analytics/pages/analytics-storage-page.tsx +344 -0
  72. package/src/modules/analytics/pages/analytics-vectorstore-page.tsx +279 -0
  73. package/src/modules/analytics/routes/index.tsx +133 -0
  74. package/src/modules/analytics/utils/formatters.test.ts +148 -0
  75. package/src/modules/analytics/utils/formatters.ts +100 -0
  76. package/src/modules/auth/pages/login-page.module.css +113 -0
  77. package/src/modules/auth/pages/login-page.tsx +80 -0
  78. package/src/modules/auth/routes/index.tsx +24 -0
  79. package/src/modules/dashboard/components/ActivityTimelineWidget.tsx +199 -0
  80. package/src/modules/dashboard/components/AiInsightsWidget.tsx +358 -0
  81. package/src/modules/dashboard/components/AnimatedMetricCard.css +88 -0
  82. package/src/modules/dashboard/components/AnimatedMetricCard.tsx +125 -0
  83. package/src/modules/dashboard/components/HeroMetricCard.css +114 -0
  84. package/src/modules/dashboard/components/HeroMetricCard.tsx +152 -0
  85. package/src/modules/dashboard/components/HeroMetricsWidget.tsx +146 -0
  86. package/src/modules/dashboard/components/SystemResourcesWidget.tsx +197 -0
  87. package/src/modules/dashboard/components/dashboard-empty.tsx +22 -0
  88. package/src/modules/dashboard/components/dashboard-kpis-widget.tsx +59 -0
  89. package/src/modules/dashboard/components/dashboard-kpis.tsx +13 -0
  90. package/src/modules/dashboard/components/dashboard-latency-percentiles-widget.tsx +85 -0
  91. package/src/modules/dashboard/components/dashboard-metrics-widget.tsx +78 -0
  92. package/src/modules/dashboard/components/dashboard-plugins-widget.tsx +67 -0
  93. package/src/modules/dashboard/components/dashboard-requests-widget.tsx +62 -0
  94. package/src/modules/dashboard/layouts/dashboard-layout.tsx +16 -0
  95. package/src/modules/dashboard/pages/ai-insights-page.tsx +563 -0
  96. package/src/modules/dashboard/pages/dashboard-animations.css +317 -0
  97. package/src/modules/dashboard/pages/dashboard-page.tsx +13 -0
  98. package/src/modules/dashboard/routes/index.tsx +70 -0
  99. package/src/modules/observability/pages/devkit-page.tsx +263 -0
  100. package/src/modules/observability/pages/incident-detail-page.tsx +571 -0
  101. package/src/modules/observability/pages/incidents-page.tsx +370 -0
  102. package/src/modules/observability/pages/log-detail-page.tsx +508 -0
  103. package/src/modules/observability/pages/logs-page.tsx +1129 -0
  104. package/src/modules/observability/pages/prometheus-metrics-page.tsx +486 -0
  105. package/src/modules/observability/pages/state-broker-page.tsx +229 -0
  106. package/src/modules/observability/pages/system-events-page.tsx +255 -0
  107. package/src/modules/observability/routes/index.tsx +133 -0
  108. package/src/modules/plugins/components/marketplace-card.tsx +153 -0
  109. package/src/modules/plugins/components/plugin-ai-assistant-modal.tsx +374 -0
  110. package/src/modules/plugins/components/plugin-card.tsx +136 -0
  111. package/src/modules/plugins/components/plugin-detail/capabilities-summary.tsx +101 -0
  112. package/src/modules/plugins/components/plugin-detail/cli-commands-table.tsx +101 -0
  113. package/src/modules/plugins/components/plugin-detail/index.ts +7 -0
  114. package/src/modules/plugins/components/plugin-detail/jobs-table.tsx +64 -0
  115. package/src/modules/plugins/components/plugin-detail/permissions/env-permissions.tsx +30 -0
  116. package/src/modules/plugins/components/plugin-detail/permissions/filesystem-permissions.tsx +68 -0
  117. package/src/modules/plugins/components/plugin-detail/permissions/index.ts +6 -0
  118. package/src/modules/plugins/components/plugin-detail/permissions/network-permissions.tsx +43 -0
  119. package/src/modules/plugins/components/plugin-detail/permissions/platform-services.tsx +242 -0
  120. package/src/modules/plugins/components/plugin-detail/permissions/resource-quotas.tsx +96 -0
  121. package/src/modules/plugins/components/plugin-detail/permissions/shell-permissions.tsx +55 -0
  122. package/src/modules/plugins/components/plugin-detail/permissions-view.tsx +47 -0
  123. package/src/modules/plugins/components/plugin-detail/plugin-header.tsx +169 -0
  124. package/src/modules/plugins/components/plugin-detail/rest-routes-table.tsx +159 -0
  125. package/src/modules/plugins/components/plugin-detail/workflows-table.tsx +40 -0
  126. package/src/modules/plugins/components/plugin-grid.tsx +20 -0
  127. package/src/modules/plugins/components/plugin-table.tsx +178 -0
  128. package/src/modules/plugins/pages/marketplace-page.tsx +200 -0
  129. package/src/modules/plugins/pages/plugin-detail-page.tsx +1145 -0
  130. package/src/modules/plugins/routes/index.tsx +48 -0
  131. package/src/modules/plugins/utils/index.ts +1 -0
  132. package/src/modules/plugins/utils/schema-helpers.ts +21 -0
  133. package/src/modules/settings/components/api-routes-viewer.tsx +415 -0
  134. package/src/modules/settings/components/appearance-settings.tsx +200 -0
  135. package/src/modules/settings/components/configuration-settings.tsx +321 -0
  136. package/src/modules/settings/components/data-privacy-settings.tsx +111 -0
  137. package/src/modules/settings/components/experimental-settings.tsx +243 -0
  138. package/src/modules/settings/components/navigation-settings.tsx +198 -0
  139. package/src/modules/settings/components/notifications-settings.tsx +40 -0
  140. package/src/modules/settings/pages/settings-page.tsx +298 -0
  141. package/src/modules/settings/routes/index.tsx +47 -0
  142. package/src/pages/README-assistant.md +91 -0
  143. package/src/pages/login-page.tsx +177 -0
  144. package/src/pages/not-found-page.tsx +85 -0
  145. package/src/providers/auth-provider.tsx +40 -0
  146. package/src/providers/command-palette-provider.tsx +193 -0
  147. package/src/providers/data-sources-provider.tsx +27 -0
  148. package/src/providers/devtools-provider.tsx +72 -0
  149. package/src/providers/navigation-items-provider.tsx +38 -0
  150. package/src/providers/registry-v2-provider.tsx +93 -0
  151. package/src/providers/settings-provider.tsx +158 -0
  152. package/src/router.tsx +302 -0
  153. package/src/routes/helpers.tsx +25 -0
  154. package/src/routes/plugin-page-v2.tsx +52 -0
  155. package/src/routes/types.ts +18 -0
  156. package/src/styles/antd-overrides.css +211 -0
  157. package/src/styles/base.css +190 -0
  158. package/src/styles/settings.css +75 -0
  159. package/src/styles/variables.css +94 -0
  160. package/src/utils/analytics.ts +183 -0
  161. package/src/utils/apply-navigation-categories.ts +83 -0
  162. package/src/utils/commands.ts +252 -0
  163. package/src/utils/export.ts +174 -0
  164. package/src/utils/format-date.ts +166 -0
  165. package/src/utils/logger.ts +110 -0
  166. package/tailwind.config.ts +13 -0
  167. package/tsconfig.json +13 -0
  168. package/vitest-setup.ts +1 -0
@@ -0,0 +1,508 @@
1
+ import {
2
+ UICard,
3
+ UIAlert,
4
+ UIBadge,
5
+ UITag,
6
+ UITypographyText,
7
+ UITypographyParagraph,
8
+ UISpace,
9
+ UIButton,
10
+ UIDescriptions,
11
+ UIDescriptionsItem,
12
+ UITooltip,
13
+ UIMessage,
14
+ UISpin,
15
+ UITimeline,
16
+ UIEmptyState,
17
+ UIIcon,
18
+ } from '@kb-labs/studio-ui-kit';
19
+ import { useState, useEffect } from 'react';
20
+ import { useParams, useNavigate } from 'react-router-dom';
21
+ import { useDataSources } from '../../../providers/data-sources-provider';
22
+ import type { LogRecord } from '@kb-labs/studio-data-client';
23
+ import { UIPage, UIPageHeader } from '@kb-labs/studio-ui-kit';
24
+
25
+ /**
26
+ * Format timestamp to full datetime with milliseconds
27
+ */
28
+ function formatDateTime(timestamp: string | number): string {
29
+ const date = new Date(typeof timestamp === 'number' ? timestamp : timestamp);
30
+ return date.toLocaleString('en-US', {
31
+ year: 'numeric',
32
+ month: '2-digit',
33
+ day: '2-digit',
34
+ hour: '2-digit',
35
+ minute: '2-digit',
36
+ second: '2-digit',
37
+ hour12: false,
38
+ }) + '.' + date.getMilliseconds().toString().padStart(3, '0');
39
+ }
40
+
41
+ /**
42
+ * Format relative time (e.g., "2 minutes ago")
43
+ */
44
+ function formatRelativeTime(timestamp: string | number): string {
45
+ const ms = typeof timestamp === 'number' ? timestamp : new Date(timestamp).getTime();
46
+ const seconds = Math.floor((Date.now() - ms) / 1000);
47
+
48
+ if (seconds < 60) {return `${seconds}s ago`;}
49
+ if (seconds < 3600) {return `${Math.floor(seconds / 60)}m ago`;}
50
+ if (seconds < 86400) {return `${Math.floor(seconds / 3600)}h ago`;}
51
+ return `${Math.floor(seconds / 86400)}d ago`;
52
+ }
53
+
54
+ /**
55
+ * Get log level icon
56
+ */
57
+ function getLevelIcon(level: LogRecord['level'] | string) {
58
+ switch (level) {
59
+ case 'trace':
60
+ case 'debug':
61
+ return <UIIcon name="BugOutlined" style={{ fontSize: 20, color: '#8c8c8c' }} />;
62
+ case 'info':
63
+ return <UIIcon name="InfoCircleOutlined" style={{ fontSize: 20, color: '#1890ff' }} />;
64
+ case 'warn':
65
+ return <UIIcon name="WarningOutlined" style={{ fontSize: 20, color: '#faad14' }} />;
66
+ case 'error':
67
+ case 'fatal':
68
+ default:
69
+ return <UIIcon name="CloseCircleOutlined" style={{ fontSize: 20, color: '#ff4d4f' }} />;
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Get log level tag color
75
+ */
76
+ function getLevelColor(level: LogRecord['level'] | string): string {
77
+ switch (level) {
78
+ case 'trace':
79
+ case 'debug':
80
+ return 'default';
81
+ case 'info':
82
+ return 'blue';
83
+ case 'warn':
84
+ return 'orange';
85
+ case 'error':
86
+ case 'fatal':
87
+ default:
88
+ return 'red';
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Copy text to clipboard
94
+ */
95
+ function copyToClipboard(text: string, label: string) {
96
+ navigator.clipboard.writeText(text);
97
+ UIMessage.success(`${label} copied to clipboard`);
98
+ }
99
+
100
+ /**
101
+ * Log Detail Page
102
+ *
103
+ * Shows detailed view of a single log with:
104
+ * - Full log context (message, level, source, timestamp)
105
+ * - Error details (stack trace if available)
106
+ * - Related logs timeline (based on correlation IDs)
107
+ * - All log metadata fields
108
+ */
109
+ export function LogDetailPage() {
110
+ const { id } = useParams<{ id: string }>();
111
+ const navigate = useNavigate();
112
+ const sources = useDataSources();
113
+
114
+ const [loading, setLoading] = useState(true);
115
+ const [error, setError] = useState<Error | null>(null);
116
+ const [log, setLog] = useState<LogRecord | null>(null);
117
+ const [relatedLogs, setRelatedLogs] = useState<LogRecord[]>([]);
118
+ const [correlationKeys, setCorrelationKeys] = useState<any>(null);
119
+
120
+ useEffect(() => {
121
+ if (!id) {return;}
122
+
123
+ const loadLog = async () => {
124
+ setLoading(true);
125
+ setError(null);
126
+
127
+ try {
128
+ // Fetch log with related logs
129
+ const response = await sources.observability.getLog(id, true);
130
+
131
+ setLog(response.log);
132
+ setRelatedLogs(response.related || []);
133
+ } catch (err: any) {
134
+ setError(err);
135
+ } finally {
136
+ setLoading(false);
137
+ }
138
+ };
139
+
140
+ loadLog();
141
+ }, [id, sources.observability]);
142
+
143
+ // Load correlation keys separately if we have the log
144
+ useEffect(() => {
145
+ if (!id || !log) {return;}
146
+
147
+ const loadRelated = async () => {
148
+ try {
149
+ const response = await sources.observability.getRelatedLogs(id);
150
+ setCorrelationKeys(response.correlationKeys);
151
+ } catch (err) {
152
+ // Silent fail - correlation keys are nice-to-have
153
+ console.error('Failed to load correlation keys:', err);
154
+ }
155
+ };
156
+
157
+ loadRelated();
158
+ }, [id, log, sources.observability]);
159
+
160
+ if (loading) {
161
+ return (
162
+ <UIPage>
163
+ <div style={{ textAlign: 'center', padding: '100px 0' }}>
164
+ <UISpin size="large" tip="Loading log details..." />
165
+ </div>
166
+ </UIPage>
167
+ );
168
+ }
169
+
170
+ if (error || !log) {
171
+ return (
172
+ <UIPage>
173
+ <UIPageHeader
174
+ title="Log Not Found"
175
+ description="The requested log could not be found"
176
+ onBack={() => navigate('/observability/logs')}
177
+ />
178
+ <UIAlert
179
+ message={error ? 'Error loading log' : 'Log not found'}
180
+ description={error ? error.message : `Log with ID '${id}' does not exist`}
181
+ variant="error"
182
+ showIcon
183
+ />
184
+ </UIPage>
185
+ );
186
+ }
187
+
188
+ // Extract correlation ID fields (not part of LogRecord type, accessed via index signature)
189
+ const logTraceId = log.traceId as string | undefined;
190
+ const logRequestId = log.requestId as string | undefined;
191
+ const logSessionId = log.sessionId as string | undefined;
192
+
193
+ // Extract error details if present
194
+ const errorDetails = (log.err || log.error) as { name?: string; message?: string; stack?: string } | undefined;
195
+ const hasError = !!errorDetails;
196
+
197
+ // Build metadata fields (exclude standard fields and error)
198
+ const metadataFields: Record<string, unknown> = { ...log };
199
+ delete metadataFields['time'];
200
+ delete metadataFields['level'];
201
+ delete metadataFields['msg'];
202
+ delete metadataFields['plugin'];
203
+ delete metadataFields['err'];
204
+ delete metadataFields['error'];
205
+ delete metadataFields['traceId'];
206
+ delete metadataFields['executionId'];
207
+ delete metadataFields['requestId'];
208
+ delete metadataFields['sessionId'];
209
+
210
+ return (
211
+ <UIPage>
212
+ <UIPageHeader
213
+ title="Log Details"
214
+ description={`Viewing log from ${formatRelativeTime(log.time)}`}
215
+ onBack={() => navigate('/observability/logs')}
216
+ actions={[
217
+ <UIButton
218
+ key="copy-link"
219
+ icon={<UIIcon name="LinkOutlined" />}
220
+ onClick={() => copyToClipboard(window.location.href, 'Link')}
221
+ >
222
+ Copy Link
223
+ </UIButton>,
224
+ <UIButton
225
+ key="copy-json"
226
+ icon={<UIIcon name="CopyOutlined" />}
227
+ onClick={() => copyToClipboard(JSON.stringify(log, null, 2), 'JSON')}
228
+ >
229
+ Export JSON
230
+ </UIButton>,
231
+ ]}
232
+ />
233
+
234
+ {/* Log Overview Card */}
235
+ <UICard
236
+ style={{ marginBottom: 16 }}
237
+ title={
238
+ <UISpace>
239
+ {getLevelIcon(log.level)}
240
+ <span>Log Overview</span>
241
+ <UITag color={getLevelColor(log.level)}>{log.level.toUpperCase()}</UITag>
242
+ </UISpace>
243
+ }
244
+ >
245
+ <UIDescriptions column={2} bordered>
246
+ <UIDescriptionsItem label="Timestamp">
247
+ <UISpace>
248
+ <UIIcon name="ClockCircleOutlined" />
249
+ <UITypographyText code>{formatDateTime(log.time)}</UITypographyText>
250
+ <UITypographyText type="secondary">({formatRelativeTime(log.time)})</UITypographyText>
251
+ </UISpace>
252
+ </UIDescriptionsItem>
253
+
254
+ <UIDescriptionsItem label="Source">
255
+ <UITag color="purple">{String(log.plugin || log.source || 'unknown')}</UITag>
256
+ </UIDescriptionsItem>
257
+
258
+ <UIDescriptionsItem label="Message" span={2}>
259
+ <UITypographyText strong style={{ fontSize: 14 }}>
260
+ {String(log.msg || '(no message)')}
261
+ </UITypographyText>
262
+ </UIDescriptionsItem>
263
+
264
+ {/* Correlation IDs */}
265
+ {logTraceId && (
266
+ <UIDescriptionsItem label="Trace ID">
267
+ <UISpace>
268
+ <UITypographyText code>{logTraceId}</UITypographyText>
269
+ <UITooltip title="Copy trace ID">
270
+ <UIButton
271
+ size="small"
272
+ icon={<UIIcon name="CopyOutlined" />}
273
+ onClick={() => copyToClipboard(logTraceId, 'Trace ID')}
274
+ />
275
+ </UITooltip>
276
+ </UISpace>
277
+ </UIDescriptionsItem>
278
+ )}
279
+
280
+ {Boolean(log.executionId) && (
281
+ <UIDescriptionsItem label="Execution ID">
282
+ <UISpace>
283
+ <UITypographyText code>{String(log.executionId)}</UITypographyText>
284
+ <UITooltip title="Copy execution ID">
285
+ <UIButton
286
+ size="small"
287
+ icon={<UIIcon name="CopyOutlined" />}
288
+ onClick={() => copyToClipboard(String(log.executionId), 'Execution ID')}
289
+ />
290
+ </UITooltip>
291
+ </UISpace>
292
+ </UIDescriptionsItem>
293
+ )}
294
+
295
+ {logRequestId && (
296
+ <UIDescriptionsItem label="Request ID">
297
+ <UISpace>
298
+ <UITypographyText code>{logRequestId}</UITypographyText>
299
+ <UITooltip title="Copy request ID">
300
+ <UIButton
301
+ size="small"
302
+ icon={<UIIcon name="CopyOutlined" />}
303
+ onClick={() => copyToClipboard(logRequestId, 'Request ID')}
304
+ />
305
+ </UITooltip>
306
+ </UISpace>
307
+ </UIDescriptionsItem>
308
+ )}
309
+
310
+ {logSessionId && (
311
+ <UIDescriptionsItem label="Session ID">
312
+ <UISpace>
313
+ <UITypographyText code>{logSessionId}</UITypographyText>
314
+ <UITooltip title="Copy session ID">
315
+ <UIButton
316
+ size="small"
317
+ icon={<UIIcon name="CopyOutlined" />}
318
+ onClick={() => copyToClipboard(logSessionId, 'Session ID')}
319
+ />
320
+ </UITooltip>
321
+ </UISpace>
322
+ </UIDescriptionsItem>
323
+ )}
324
+ </UIDescriptions>
325
+ </UICard>
326
+
327
+ {/* Error Details Card (if error exists) */}
328
+ {hasError && (
329
+ <UICard
330
+ style={{ marginBottom: 16 }}
331
+ title={
332
+ <UISpace>
333
+ <UIIcon name="CloseCircleOutlined" style={{ color: '#ff4d4f' }} />
334
+ <span>Error Details</span>
335
+ </UISpace>
336
+ }
337
+ type="inner"
338
+ >
339
+ <UISpace direction="vertical" style={{ width: '100%' }} size="middle">
340
+ {errorDetails.name && (
341
+ <div>
342
+ <UITypographyText type="secondary">Error Type:</UITypographyText>
343
+ <br />
344
+ <UITag color="red">{errorDetails.name}</UITag>
345
+ </div>
346
+ )}
347
+
348
+ {errorDetails.message && (
349
+ <div>
350
+ <UITypographyText type="secondary">Error Message:</UITypographyText>
351
+ <br />
352
+ <UITypographyText strong>{errorDetails.message}</UITypographyText>
353
+ </div>
354
+ )}
355
+
356
+ {errorDetails.stack && (
357
+ <div>
358
+ <UITypographyText type="secondary">Stack Trace:</UITypographyText>
359
+ <UITypographyParagraph
360
+ copyable
361
+ code
362
+ style={{
363
+ marginTop: 8,
364
+ backgroundColor: '#fafafa',
365
+ padding: 12,
366
+ borderRadius: 4,
367
+ fontSize: 12,
368
+ fontFamily: 'monospace',
369
+ whiteSpace: 'pre-wrap',
370
+ maxHeight: 300,
371
+ overflow: 'auto',
372
+ }}
373
+ >
374
+ {errorDetails.stack}
375
+ </UITypographyParagraph>
376
+ </div>
377
+ )}
378
+ </UISpace>
379
+ </UICard>
380
+ )}
381
+
382
+ {/* Related Logs Timeline */}
383
+ <UICard
384
+ style={{ marginBottom: 16 }}
385
+ title={
386
+ <UISpace>
387
+ <UIIcon name="ClockCircleOutlined" />
388
+ <span>Related Logs Timeline</span>
389
+ {relatedLogs.length > 0 && (
390
+ <UIBadge count={relatedLogs.length} style={{ backgroundColor: '#52c41a' }} />
391
+ )}
392
+ </UISpace>
393
+ }
394
+ >
395
+ {relatedLogs.length === 0 ? (
396
+ <UIEmptyState
397
+ description="No related logs found"
398
+ image={UIEmptyState.PRESENTED_IMAGE_SIMPLE}
399
+ />
400
+ ) : (
401
+ <>
402
+ {correlationKeys && (
403
+ <UIAlert
404
+ message="Correlation Keys"
405
+ description={
406
+ <UISpace wrap>
407
+ {correlationKeys.requestId && (
408
+ <UITag>Request: {correlationKeys.requestId}</UITag>
409
+ )}
410
+ {correlationKeys.traceId && (
411
+ <UITag>Trace: {correlationKeys.traceId}</UITag>
412
+ )}
413
+ {correlationKeys.executionId && (
414
+ <UITag>Execution: {correlationKeys.executionId}</UITag>
415
+ )}
416
+ {correlationKeys.sessionId && (
417
+ <UITag>Session: {correlationKeys.sessionId}</UITag>
418
+ )}
419
+ </UISpace>
420
+ }
421
+ variant="info"
422
+ style={{ marginBottom: 16 }}
423
+ closable
424
+ />
425
+ )}
426
+
427
+ <UITimeline
428
+ mode="left"
429
+ items={relatedLogs.map((relatedLog) => {
430
+ const isCurrentLog = relatedLog.id === id;
431
+
432
+ return {
433
+ color: isCurrentLog ? 'red' : getLevelColor(relatedLog.level),
434
+ dot: isCurrentLog ? (
435
+ <UIBadge variant="info" />
436
+ ) : (
437
+ getLevelIcon(relatedLog.level)
438
+ ),
439
+ label: (
440
+ <UITypographyText type="secondary" style={{ fontSize: 12 }}>
441
+ {formatDateTime(relatedLog.time)}
442
+ </UITypographyText>
443
+ ),
444
+ children: (
445
+ <UICard
446
+ size="small"
447
+ style={{
448
+ backgroundColor: isCurrentLog ? '#fff7e6' : undefined,
449
+ borderColor: isCurrentLog ? '#ffa940' : undefined,
450
+ }}
451
+ >
452
+ <UISpace direction="vertical" style={{ width: '100%' }} size="small">
453
+ <UISpace>
454
+ <UITag color={getLevelColor(relatedLog.level)}>
455
+ {relatedLog.level.toUpperCase()}
456
+ </UITag>
457
+ {relatedLog.plugin && (
458
+ <UITag color="purple">{String(relatedLog.plugin)}</UITag>
459
+ )}
460
+ {isCurrentLog && (
461
+ <UITag color="orange">YOU ARE HERE</UITag>
462
+ )}
463
+ </UISpace>
464
+ <UITypographyText>{String(relatedLog.msg || '(no message)')}</UITypographyText>
465
+ {relatedLog.err && (
466
+ <UITag color="red" icon={<UIIcon name="CloseCircleOutlined" />}>
467
+ {String(relatedLog.err.name || 'Error')}
468
+ </UITag>
469
+ )}
470
+ </UISpace>
471
+ </UICard>
472
+ ),
473
+ };
474
+ })}
475
+ />
476
+ </>
477
+ )}
478
+ </UICard>
479
+
480
+ {/* All Log Fields */}
481
+ <UICard
482
+ title={
483
+ <UISpace>
484
+ <UIIcon name="FileTextOutlined" />
485
+ <span>All Log Fields</span>
486
+ </UISpace>
487
+ }
488
+ >
489
+ <UITypographyParagraph
490
+ copyable
491
+ code
492
+ style={{
493
+ backgroundColor: '#fafafa',
494
+ padding: 16,
495
+ borderRadius: 4,
496
+ fontSize: 12,
497
+ fontFamily: 'monospace',
498
+ whiteSpace: 'pre-wrap',
499
+ maxHeight: 500,
500
+ overflow: 'auto',
501
+ }}
502
+ >
503
+ {JSON.stringify(log, null, 2)}
504
+ </UITypographyParagraph>
505
+ </UICard>
506
+ </UIPage>
507
+ );
508
+ }