create-ekka-desktop-app 0.2.2
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.
- package/README.md +137 -0
- package/bin/cli.js +72 -0
- package/package.json +23 -0
- package/template/branding/app.json +6 -0
- package/template/branding/icon.icns +0 -0
- package/template/eslint.config.js +98 -0
- package/template/index.html +29 -0
- package/template/package.json +40 -0
- package/template/src/app/App.tsx +24 -0
- package/template/src/demo/DemoApp.tsx +260 -0
- package/template/src/demo/components/Banner.tsx +82 -0
- package/template/src/demo/components/EmptyState.tsx +61 -0
- package/template/src/demo/components/InfoPopover.tsx +171 -0
- package/template/src/demo/components/InfoTooltip.tsx +76 -0
- package/template/src/demo/components/LearnMore.tsx +98 -0
- package/template/src/demo/components/NodeCredentialsOnboarding.tsx +219 -0
- package/template/src/demo/components/SetupWizard.tsx +48 -0
- package/template/src/demo/components/StatusBadge.tsx +83 -0
- package/template/src/demo/components/index.ts +10 -0
- package/template/src/demo/hooks/index.ts +6 -0
- package/template/src/demo/hooks/useAuditEvents.ts +30 -0
- package/template/src/demo/layout/Shell.tsx +110 -0
- package/template/src/demo/layout/Sidebar.tsx +192 -0
- package/template/src/demo/pages/AuditLogPage.tsx +235 -0
- package/template/src/demo/pages/DocGenPage.tsx +874 -0
- package/template/src/demo/pages/HomeSetupPage.tsx +182 -0
- package/template/src/demo/pages/LoginPage.tsx +192 -0
- package/template/src/demo/pages/PathPermissionsPage.tsx +873 -0
- package/template/src/demo/pages/RunnerPage.tsx +445 -0
- package/template/src/demo/pages/SystemPage.tsx +557 -0
- package/template/src/demo/pages/VaultPage.tsx +805 -0
- package/template/src/ekka/__tests__/demo-backend.test.ts +187 -0
- package/template/src/ekka/audit/index.ts +7 -0
- package/template/src/ekka/audit/store.ts +68 -0
- package/template/src/ekka/audit/types.ts +22 -0
- package/template/src/ekka/auth/client.ts +212 -0
- package/template/src/ekka/auth/index.ts +30 -0
- package/template/src/ekka/auth/storage.ts +114 -0
- package/template/src/ekka/auth/types.ts +67 -0
- package/template/src/ekka/backend/demo.ts +151 -0
- package/template/src/ekka/backend/interface.ts +36 -0
- package/template/src/ekka/config.ts +48 -0
- package/template/src/ekka/constants.ts +143 -0
- package/template/src/ekka/errors.ts +54 -0
- package/template/src/ekka/index.ts +516 -0
- package/template/src/ekka/internal/backend.ts +156 -0
- package/template/src/ekka/internal/index.ts +7 -0
- package/template/src/ekka/ops/auth.ts +29 -0
- package/template/src/ekka/ops/debug.ts +68 -0
- package/template/src/ekka/ops/home.ts +101 -0
- package/template/src/ekka/ops/index.ts +16 -0
- package/template/src/ekka/ops/nodeCredentials.ts +131 -0
- package/template/src/ekka/ops/nodeSession.ts +145 -0
- package/template/src/ekka/ops/paths.ts +183 -0
- package/template/src/ekka/ops/runner.ts +86 -0
- package/template/src/ekka/ops/runtime.ts +31 -0
- package/template/src/ekka/ops/setup.ts +47 -0
- package/template/src/ekka/ops/vault.ts +459 -0
- package/template/src/ekka/ops/workflowRuns.ts +116 -0
- package/template/src/ekka/types.ts +82 -0
- package/template/src/ekka/utils/idempotency.ts +14 -0
- package/template/src/ekka/utils/index.ts +7 -0
- package/template/src/ekka/utils/time.ts +77 -0
- package/template/src/main.tsx +12 -0
- package/template/src/vite-env.d.ts +12 -0
- package/template/src-tauri/Cargo.toml +41 -0
- package/template/src-tauri/build.rs +3 -0
- package/template/src-tauri/capabilities/default.json +11 -0
- package/template/src-tauri/icons/icon.icns +0 -0
- package/template/src-tauri/icons/icon.png +0 -0
- package/template/src-tauri/resources/ekka-engine-bootstrap +0 -0
- package/template/src-tauri/src/bootstrap.rs +37 -0
- package/template/src-tauri/src/commands.rs +1215 -0
- package/template/src-tauri/src/device_secret.rs +111 -0
- package/template/src-tauri/src/engine_process.rs +538 -0
- package/template/src-tauri/src/grants.rs +129 -0
- package/template/src-tauri/src/handlers/home.rs +65 -0
- package/template/src-tauri/src/handlers/mod.rs +7 -0
- package/template/src-tauri/src/handlers/paths.rs +128 -0
- package/template/src-tauri/src/handlers/vault.rs +680 -0
- package/template/src-tauri/src/main.rs +243 -0
- package/template/src-tauri/src/node_auth.rs +858 -0
- package/template/src-tauri/src/node_credentials.rs +541 -0
- package/template/src-tauri/src/node_runner.rs +882 -0
- package/template/src-tauri/src/node_vault_crypto.rs +113 -0
- package/template/src-tauri/src/node_vault_store.rs +267 -0
- package/template/src-tauri/src/ops/auth.rs +50 -0
- package/template/src-tauri/src/ops/home.rs +251 -0
- package/template/src-tauri/src/ops/mod.rs +7 -0
- package/template/src-tauri/src/ops/runtime.rs +21 -0
- package/template/src-tauri/src/state.rs +639 -0
- package/template/src-tauri/src/types.rs +84 -0
- package/template/src-tauri/tauri.conf.json +41 -0
- package/template/tsconfig.json +26 -0
- package/template/tsconfig.tsbuildinfo +1 -0
- package/template/vite.config.ts +34 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sidebar Navigation
|
|
3
|
+
* Clean admin-style left navigation
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { type CSSProperties, type ReactElement } from 'react';
|
|
7
|
+
|
|
8
|
+
export type Page = 'audit-log' | 'path-permissions' | 'vault' | 'doc-gen' | 'runner' | 'system';
|
|
9
|
+
|
|
10
|
+
interface SidebarProps {
|
|
11
|
+
selectedPage: Page;
|
|
12
|
+
onNavigate: (page: Page) => void;
|
|
13
|
+
darkMode: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function Sidebar({ selectedPage, onNavigate, darkMode }: SidebarProps): ReactElement {
|
|
17
|
+
const colors = {
|
|
18
|
+
bg: darkMode ? '#2c2c2e' : '#f5f5f7',
|
|
19
|
+
border: darkMode ? '#3a3a3c' : '#e5e5e5',
|
|
20
|
+
text: darkMode ? '#ffffff' : '#1d1d1f',
|
|
21
|
+
textMuted: darkMode ? '#98989d' : '#86868b',
|
|
22
|
+
hover: darkMode ? 'rgba(255, 255, 255, 0.06)' : 'rgba(0, 0, 0, 0.04)',
|
|
23
|
+
active: darkMode ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.08)',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const styles: Record<string, CSSProperties> = {
|
|
27
|
+
sidebar: {
|
|
28
|
+
width: '220px',
|
|
29
|
+
minWidth: '220px',
|
|
30
|
+
height: '100vh',
|
|
31
|
+
background: colors.bg,
|
|
32
|
+
borderRight: `1px solid ${colors.border}`,
|
|
33
|
+
display: 'flex',
|
|
34
|
+
flexDirection: 'column',
|
|
35
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif',
|
|
36
|
+
},
|
|
37
|
+
logo: {
|
|
38
|
+
padding: '20px 16px 16px',
|
|
39
|
+
borderBottom: `1px solid ${colors.border}`,
|
|
40
|
+
},
|
|
41
|
+
logoText: {
|
|
42
|
+
fontSize: '14px',
|
|
43
|
+
fontWeight: 600,
|
|
44
|
+
color: colors.text,
|
|
45
|
+
letterSpacing: '-0.01em',
|
|
46
|
+
},
|
|
47
|
+
nav: {
|
|
48
|
+
flex: 1,
|
|
49
|
+
padding: '12px 8px',
|
|
50
|
+
overflowY: 'auto',
|
|
51
|
+
},
|
|
52
|
+
sectionLabel: {
|
|
53
|
+
fontSize: '11px',
|
|
54
|
+
fontWeight: 600,
|
|
55
|
+
color: colors.textMuted,
|
|
56
|
+
textTransform: 'uppercase',
|
|
57
|
+
letterSpacing: '0.04em',
|
|
58
|
+
padding: '12px 10px 6px',
|
|
59
|
+
marginTop: '4px',
|
|
60
|
+
},
|
|
61
|
+
navItem: {
|
|
62
|
+
display: 'flex',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
gap: '8px',
|
|
65
|
+
width: '100%',
|
|
66
|
+
padding: '8px 10px',
|
|
67
|
+
margin: '1px 0',
|
|
68
|
+
background: 'transparent',
|
|
69
|
+
border: 'none',
|
|
70
|
+
borderRadius: '6px',
|
|
71
|
+
fontSize: '13px',
|
|
72
|
+
fontWeight: 400,
|
|
73
|
+
color: colors.text,
|
|
74
|
+
textAlign: 'left' as const,
|
|
75
|
+
cursor: 'pointer',
|
|
76
|
+
transition: 'background 0.15s ease',
|
|
77
|
+
},
|
|
78
|
+
navItemActive: {
|
|
79
|
+
background: colors.active,
|
|
80
|
+
fontWeight: 500,
|
|
81
|
+
},
|
|
82
|
+
bottomSection: {
|
|
83
|
+
padding: '8px',
|
|
84
|
+
borderTop: `1px solid ${colors.border}`,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const NavButton = ({
|
|
89
|
+
page,
|
|
90
|
+
label,
|
|
91
|
+
icon,
|
|
92
|
+
}: {
|
|
93
|
+
page: Page;
|
|
94
|
+
label: string;
|
|
95
|
+
icon: ReactElement;
|
|
96
|
+
}) => {
|
|
97
|
+
const isActive = selectedPage === page;
|
|
98
|
+
return (
|
|
99
|
+
<button
|
|
100
|
+
onClick={() => onNavigate(page)}
|
|
101
|
+
style={{
|
|
102
|
+
...styles.navItem,
|
|
103
|
+
...(isActive ? styles.navItemActive : {}),
|
|
104
|
+
}}
|
|
105
|
+
onMouseEnter={(e) => {
|
|
106
|
+
if (!isActive) e.currentTarget.style.background = colors.hover;
|
|
107
|
+
}}
|
|
108
|
+
onMouseLeave={(e) => {
|
|
109
|
+
if (!isActive) e.currentTarget.style.background = 'transparent';
|
|
110
|
+
}}
|
|
111
|
+
>
|
|
112
|
+
{icon}
|
|
113
|
+
{label}
|
|
114
|
+
</button>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<aside style={styles.sidebar}>
|
|
120
|
+
<div style={styles.logo}>
|
|
121
|
+
<span style={styles.logoText}>EKKA Desktop</span>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
<nav style={styles.nav}>
|
|
125
|
+
<div style={styles.sectionLabel}>Tools</div>
|
|
126
|
+
<NavButton page="path-permissions" label="Path Permissions" icon={<PathIcon />} />
|
|
127
|
+
<NavButton page="vault" label="Vault" icon={<VaultIcon />} />
|
|
128
|
+
<NavButton page="doc-gen" label="Generate Docs" icon={<DocGenIcon />} />
|
|
129
|
+
<NavButton page="runner" label="Runner" icon={<RunnerIcon />} />
|
|
130
|
+
<NavButton page="audit-log" label="Audit Log" icon={<AuditIcon />} />
|
|
131
|
+
</nav>
|
|
132
|
+
|
|
133
|
+
<div style={styles.bottomSection}>
|
|
134
|
+
<NavButton page="system" label="System" icon={<SystemIcon />} />
|
|
135
|
+
</div>
|
|
136
|
+
</aside>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function PathIcon(): ReactElement {
|
|
141
|
+
return (
|
|
142
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" style={{ opacity: 0.7 }}>
|
|
143
|
+
<path d="M1 3.5A1.5 1.5 0 0 1 2.5 2h2.764c.958 0 1.764.382 2.236 1l.472.707c.188.282.51.543 1.028.543h4.5A1.5 1.5 0 0 1 15 5.75v6.75A1.5 1.5 0 0 1 13.5 14h-11A1.5 1.5 0 0 1 1 12.5v-9zm1.5-.5a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h11a.5.5 0 0 0 .5-.5V5.75a.5.5 0 0 0-.5-.5H9a2.016 2.016 0 0 1-1.528-.793l-.472-.707C6.764 3.393 6.366 3 5.264 3H2.5z" />
|
|
144
|
+
</svg>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function AuditIcon(): ReactElement {
|
|
149
|
+
return (
|
|
150
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" style={{ opacity: 0.7 }}>
|
|
151
|
+
<path d="M2.5 2a.5.5 0 0 0-.5.5v11a.5.5 0 0 0 .5.5h11a.5.5 0 0 0 .5-.5v-11a.5.5 0 0 0-.5-.5h-11zm0-1h11A1.5 1.5 0 0 1 15 2.5v11a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 1 13.5v-11A1.5 1.5 0 0 1 2.5 1z" />
|
|
152
|
+
<path d="M4 4.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5z" />
|
|
153
|
+
</svg>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function VaultIcon(): ReactElement {
|
|
158
|
+
return (
|
|
159
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" style={{ opacity: 0.7 }}>
|
|
160
|
+
<path d="M4 4a3 3 0 0 1 3-3h2a3 3 0 0 1 3 3v1h1a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h1V4zm3-2a2 2 0 0 0-2 2v1h6V4a2 2 0 0 0-2-2H7zM3 6a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H3z" />
|
|
161
|
+
<path d="M8 9a1 1 0 0 0-1 1v1a1 1 0 1 0 2 0v-1a1 1 0 0 0-1-1z" />
|
|
162
|
+
</svg>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function SystemIcon(): ReactElement {
|
|
167
|
+
return (
|
|
168
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" style={{ opacity: 0.7 }}>
|
|
169
|
+
<path d="M8 0L1 3v5c0 4.5 3 7.5 7 9 4-1.5 7-4.5 7-9V3L8 0zm0 1.2L14 3.7v4.8c0 3.8-2.5 6.3-6 7.7-3.5-1.4-6-3.9-6-7.7V3.7L8 1.2z" />
|
|
170
|
+
<path d="M6.5 7.5L5 9l2 2 4-4-1.5-1.5L7 8l-.5-.5z" />
|
|
171
|
+
</svg>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function DocGenIcon(): ReactElement {
|
|
176
|
+
return (
|
|
177
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" style={{ opacity: 0.7 }}>
|
|
178
|
+
<path d="M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5L14 4.5zM9.5 4V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5h-3.5z" />
|
|
179
|
+
<path d="M4.5 12.5A.5.5 0 0 1 5 12h3a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm0-2A.5.5 0 0 1 5 10h6a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm0-2A.5.5 0 0 1 5 8h6a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm0-2A.5.5 0 0 1 5 6h6a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5z" />
|
|
180
|
+
</svg>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function RunnerIcon(): ReactElement {
|
|
185
|
+
return (
|
|
186
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" style={{ opacity: 0.7 }}>
|
|
187
|
+
<path d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
|
|
188
|
+
<path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
|
|
189
|
+
<path d="M8 8a.5.5 0 1 1 0-1 .5.5 0 0 1 0 1z" />
|
|
190
|
+
</svg>
|
|
191
|
+
);
|
|
192
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audit Log Page
|
|
3
|
+
* Displays audit events with expandable technical details.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { type CSSProperties, type ReactElement } from 'react';
|
|
7
|
+
import { clearAuditEvents, type AuditEvent } from '../../ekka/audit';
|
|
8
|
+
import { formatLocalTime, formatRelativeTime } from '../../ekka/utils';
|
|
9
|
+
import { useAuditEvents } from '../hooks/useAuditEvents';
|
|
10
|
+
import { EmptyState } from '../components/EmptyState';
|
|
11
|
+
import { LearnMore } from '../components/LearnMore';
|
|
12
|
+
|
|
13
|
+
interface AuditLogPageProps {
|
|
14
|
+
darkMode: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function AuditLogPage({ darkMode }: AuditLogPageProps): ReactElement {
|
|
18
|
+
const events = useAuditEvents();
|
|
19
|
+
|
|
20
|
+
const colors = {
|
|
21
|
+
text: darkMode ? '#ffffff' : '#1d1d1f',
|
|
22
|
+
textMuted: darkMode ? '#98989d' : '#6e6e73',
|
|
23
|
+
bg: darkMode ? '#2c2c2e' : '#fafafa',
|
|
24
|
+
border: darkMode ? '#3a3a3c' : '#e5e5e5',
|
|
25
|
+
cardBg: darkMode ? '#2c2c2e' : '#ffffff',
|
|
26
|
+
codeBg: darkMode ? 'rgba(255, 255, 255, 0.08)' : 'rgba(0, 0, 0, 0.04)',
|
|
27
|
+
buttonBg: darkMode ? '#3a3a3c' : '#f3f4f6',
|
|
28
|
+
buttonHover: darkMode ? '#48484a' : '#e5e7eb',
|
|
29
|
+
buttonText: darkMode ? '#ffffff' : '#1d1d1f',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const styles: Record<string, CSSProperties> = {
|
|
33
|
+
header: {
|
|
34
|
+
display: 'flex',
|
|
35
|
+
justifyContent: 'space-between',
|
|
36
|
+
alignItems: 'flex-start',
|
|
37
|
+
marginBottom: '32px',
|
|
38
|
+
},
|
|
39
|
+
headerText: {},
|
|
40
|
+
title: {
|
|
41
|
+
fontSize: '28px',
|
|
42
|
+
fontWeight: 700,
|
|
43
|
+
color: colors.text,
|
|
44
|
+
marginBottom: '8px',
|
|
45
|
+
letterSpacing: '-0.02em',
|
|
46
|
+
},
|
|
47
|
+
description: {
|
|
48
|
+
fontSize: '13px',
|
|
49
|
+
lineHeight: 1.5,
|
|
50
|
+
color: colors.textMuted,
|
|
51
|
+
},
|
|
52
|
+
clearButton: {
|
|
53
|
+
padding: '8px 14px',
|
|
54
|
+
fontSize: '13px',
|
|
55
|
+
fontWeight: 500,
|
|
56
|
+
color: colors.buttonText,
|
|
57
|
+
background: colors.buttonBg,
|
|
58
|
+
border: 'none',
|
|
59
|
+
borderRadius: '6px',
|
|
60
|
+
cursor: 'pointer',
|
|
61
|
+
transition: 'background 0.15s ease',
|
|
62
|
+
},
|
|
63
|
+
card: {
|
|
64
|
+
background: colors.cardBg,
|
|
65
|
+
border: `1px solid ${colors.border}`,
|
|
66
|
+
borderRadius: '8px',
|
|
67
|
+
overflow: 'hidden',
|
|
68
|
+
},
|
|
69
|
+
eventList: {
|
|
70
|
+
listStyle: 'none',
|
|
71
|
+
margin: 0,
|
|
72
|
+
padding: 0,
|
|
73
|
+
},
|
|
74
|
+
eventItem: {
|
|
75
|
+
padding: '14px 16px',
|
|
76
|
+
borderBottom: `1px solid ${colors.border}`,
|
|
77
|
+
},
|
|
78
|
+
eventItemLast: {
|
|
79
|
+
padding: '14px 16px',
|
|
80
|
+
},
|
|
81
|
+
eventHeader: {
|
|
82
|
+
display: 'flex',
|
|
83
|
+
justifyContent: 'space-between',
|
|
84
|
+
alignItems: 'flex-start',
|
|
85
|
+
marginBottom: '4px',
|
|
86
|
+
},
|
|
87
|
+
eventType: {
|
|
88
|
+
fontSize: '12px',
|
|
89
|
+
fontWeight: 600,
|
|
90
|
+
color: colors.text,
|
|
91
|
+
fontFamily: 'SF Mono, Monaco, Consolas, monospace',
|
|
92
|
+
background: colors.codeBg,
|
|
93
|
+
padding: '2px 8px',
|
|
94
|
+
borderRadius: '4px',
|
|
95
|
+
},
|
|
96
|
+
eventTime: {
|
|
97
|
+
fontSize: '12px',
|
|
98
|
+
color: colors.textMuted,
|
|
99
|
+
},
|
|
100
|
+
eventDescription: {
|
|
101
|
+
fontSize: '13px',
|
|
102
|
+
color: colors.text,
|
|
103
|
+
marginBottom: '4px',
|
|
104
|
+
lineHeight: 1.4,
|
|
105
|
+
},
|
|
106
|
+
eventExplanation: {
|
|
107
|
+
fontSize: '12px',
|
|
108
|
+
color: colors.textMuted,
|
|
109
|
+
fontStyle: 'italic',
|
|
110
|
+
marginBottom: '8px',
|
|
111
|
+
},
|
|
112
|
+
technicalSection: {
|
|
113
|
+
marginTop: '10px',
|
|
114
|
+
},
|
|
115
|
+
technicalContent: {
|
|
116
|
+
fontFamily: 'SF Mono, Monaco, Consolas, monospace',
|
|
117
|
+
fontSize: '11px',
|
|
118
|
+
whiteSpace: 'pre-wrap',
|
|
119
|
+
wordBreak: 'break-word',
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const handleClear = (): void => {
|
|
124
|
+
clearAuditEvents();
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const renderEmptyIcon = (): ReactElement => (
|
|
128
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none">
|
|
129
|
+
<rect
|
|
130
|
+
x="8"
|
|
131
|
+
y="6"
|
|
132
|
+
width="32"
|
|
133
|
+
height="36"
|
|
134
|
+
rx="3"
|
|
135
|
+
stroke="currentColor"
|
|
136
|
+
strokeWidth="2"
|
|
137
|
+
/>
|
|
138
|
+
<line
|
|
139
|
+
x1="14"
|
|
140
|
+
y1="14"
|
|
141
|
+
x2="34"
|
|
142
|
+
y2="14"
|
|
143
|
+
stroke="currentColor"
|
|
144
|
+
strokeWidth="2"
|
|
145
|
+
strokeLinecap="round"
|
|
146
|
+
/>
|
|
147
|
+
<line
|
|
148
|
+
x1="14"
|
|
149
|
+
y1="22"
|
|
150
|
+
x2="28"
|
|
151
|
+
y2="22"
|
|
152
|
+
stroke="currentColor"
|
|
153
|
+
strokeWidth="2"
|
|
154
|
+
strokeLinecap="round"
|
|
155
|
+
/>
|
|
156
|
+
<line
|
|
157
|
+
x1="14"
|
|
158
|
+
y1="30"
|
|
159
|
+
x2="32"
|
|
160
|
+
y2="30"
|
|
161
|
+
stroke="currentColor"
|
|
162
|
+
strokeWidth="2"
|
|
163
|
+
strokeLinecap="round"
|
|
164
|
+
/>
|
|
165
|
+
</svg>
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
const renderEvent = (event: AuditEvent, isLast: boolean): ReactElement => (
|
|
169
|
+
<li key={event.id} style={isLast ? styles.eventItemLast : styles.eventItem}>
|
|
170
|
+
<div style={styles.eventHeader}>
|
|
171
|
+
<span style={styles.eventType}>{event.type}</span>
|
|
172
|
+
<span style={styles.eventTime} title={formatLocalTime(event.timestamp)}>
|
|
173
|
+
{formatRelativeTime(event.timestamp)}
|
|
174
|
+
</span>
|
|
175
|
+
</div>
|
|
176
|
+
<p style={styles.eventDescription}>{event.description}</p>
|
|
177
|
+
{event.explanation && (
|
|
178
|
+
<p style={styles.eventExplanation}>{event.explanation}</p>
|
|
179
|
+
)}
|
|
180
|
+
{event.technical && Object.keys(event.technical).length > 0 && (
|
|
181
|
+
<div style={styles.technicalSection}>
|
|
182
|
+
<LearnMore title="Technical Details" darkMode={darkMode}>
|
|
183
|
+
<pre style={styles.technicalContent}>
|
|
184
|
+
{JSON.stringify(event.technical, null, 2)}
|
|
185
|
+
</pre>
|
|
186
|
+
</LearnMore>
|
|
187
|
+
</div>
|
|
188
|
+
)}
|
|
189
|
+
</li>
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
return (
|
|
193
|
+
<div>
|
|
194
|
+
<header style={styles.header}>
|
|
195
|
+
<div style={styles.headerText}>
|
|
196
|
+
<h1 style={styles.title}>Audit Log</h1>
|
|
197
|
+
<p style={styles.description}>
|
|
198
|
+
Track system events and operations for debugging and compliance.
|
|
199
|
+
</p>
|
|
200
|
+
</div>
|
|
201
|
+
{events.length > 0 && (
|
|
202
|
+
<button
|
|
203
|
+
style={styles.clearButton}
|
|
204
|
+
onClick={handleClear}
|
|
205
|
+
onMouseEnter={(e) => {
|
|
206
|
+
e.currentTarget.style.background = colors.buttonHover;
|
|
207
|
+
}}
|
|
208
|
+
onMouseLeave={(e) => {
|
|
209
|
+
e.currentTarget.style.background = colors.buttonBg;
|
|
210
|
+
}}
|
|
211
|
+
>
|
|
212
|
+
Clear
|
|
213
|
+
</button>
|
|
214
|
+
)}
|
|
215
|
+
</header>
|
|
216
|
+
|
|
217
|
+
<div style={styles.card}>
|
|
218
|
+
{events.length === 0 ? (
|
|
219
|
+
<EmptyState
|
|
220
|
+
icon={renderEmptyIcon()}
|
|
221
|
+
message="No audit events yet"
|
|
222
|
+
hint="Events will appear here as you interact with the system."
|
|
223
|
+
darkMode={darkMode}
|
|
224
|
+
/>
|
|
225
|
+
) : (
|
|
226
|
+
<ul style={styles.eventList}>
|
|
227
|
+
{events.map((event, index) =>
|
|
228
|
+
renderEvent(event, index === events.length - 1)
|
|
229
|
+
)}
|
|
230
|
+
</ul>
|
|
231
|
+
)}
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
);
|
|
235
|
+
}
|