@qwickapps/server 1.2.0 → 1.3.1
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 +392 -0
- package/dist/core/control-panel.d.ts +7 -2
- package/dist/core/control-panel.d.ts.map +1 -1
- package/dist/core/control-panel.js +120 -54
- package/dist/core/control-panel.js.map +1 -1
- package/dist/core/gateway.d.ts +159 -79
- package/dist/core/gateway.d.ts.map +1 -1
- package/dist/core/gateway.js +679 -319
- package/dist/core/gateway.js.map +1 -1
- package/dist/core/index.d.ts +3 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/plugin-registry.d.ts +307 -0
- package/dist/core/plugin-registry.d.ts.map +1 -0
- package/dist/core/plugin-registry.js +352 -0
- package/dist/core/plugin-registry.js.map +1 -0
- package/dist/core/types.d.ts +16 -33
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.d.ts +8 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/dist/plugins/auth/adapters/auth0-adapter.d.ts +14 -0
- package/dist/plugins/auth/adapters/auth0-adapter.d.ts.map +1 -0
- package/dist/plugins/auth/adapters/auth0-adapter.js +179 -0
- package/dist/plugins/auth/adapters/auth0-adapter.js.map +1 -0
- package/dist/plugins/auth/adapters/basic-adapter.d.ts +13 -0
- package/dist/plugins/auth/adapters/basic-adapter.d.ts.map +1 -0
- package/dist/plugins/auth/adapters/basic-adapter.js +51 -0
- package/dist/plugins/auth/adapters/basic-adapter.js.map +1 -0
- package/dist/plugins/auth/adapters/index.d.ts +10 -0
- package/dist/plugins/auth/adapters/index.d.ts.map +1 -0
- package/dist/plugins/auth/adapters/index.js +10 -0
- package/dist/plugins/auth/adapters/index.js.map +1 -0
- package/dist/plugins/auth/adapters/supabase-adapter.d.ts +13 -0
- package/dist/plugins/auth/adapters/supabase-adapter.d.ts.map +1 -0
- package/dist/plugins/auth/adapters/supabase-adapter.js +109 -0
- package/dist/plugins/auth/adapters/supabase-adapter.js.map +1 -0
- package/dist/plugins/auth/adapters/supertokens-adapter.d.ts +18 -0
- package/dist/plugins/auth/adapters/supertokens-adapter.d.ts.map +1 -0
- package/dist/plugins/auth/adapters/supertokens-adapter.js +267 -0
- package/dist/plugins/auth/adapters/supertokens-adapter.js.map +1 -0
- package/dist/plugins/auth/auth-plugin.d.ts +40 -0
- package/dist/plugins/auth/auth-plugin.d.ts.map +1 -0
- package/dist/plugins/auth/auth-plugin.js +255 -0
- package/dist/plugins/auth/auth-plugin.js.map +1 -0
- package/dist/plugins/auth/auth-plugin.test.d.ts +9 -0
- package/dist/plugins/auth/auth-plugin.test.d.ts.map +1 -0
- package/dist/plugins/auth/auth-plugin.test.js +147 -0
- package/dist/plugins/auth/auth-plugin.test.js.map +1 -0
- package/dist/plugins/auth/env-config.d.ts +88 -0
- package/dist/plugins/auth/env-config.d.ts.map +1 -0
- package/dist/plugins/auth/env-config.js +489 -0
- package/dist/plugins/auth/env-config.js.map +1 -0
- package/dist/plugins/auth/index.d.ts +14 -0
- package/dist/plugins/auth/index.d.ts.map +1 -0
- package/dist/plugins/auth/index.js +16 -0
- package/dist/plugins/auth/index.js.map +1 -0
- package/dist/plugins/auth/supertokens-adapter.test.d.ts +10 -0
- package/dist/plugins/auth/supertokens-adapter.test.d.ts.map +1 -0
- package/dist/plugins/auth/supertokens-adapter.test.js +486 -0
- package/dist/plugins/auth/supertokens-adapter.test.js.map +1 -0
- package/dist/plugins/auth/types.d.ts +218 -0
- package/dist/plugins/auth/types.d.ts.map +1 -0
- package/dist/plugins/auth/types.js +14 -0
- package/dist/plugins/auth/types.js.map +1 -0
- package/dist/plugins/bans/bans-plugin.d.ts +59 -0
- package/dist/plugins/bans/bans-plugin.d.ts.map +1 -0
- package/dist/plugins/bans/bans-plugin.js +428 -0
- package/dist/plugins/bans/bans-plugin.js.map +1 -0
- package/dist/plugins/bans/index.d.ts +9 -0
- package/dist/plugins/bans/index.d.ts.map +1 -0
- package/dist/plugins/bans/index.js +10 -0
- package/dist/plugins/bans/index.js.map +1 -0
- package/dist/plugins/bans/stores/index.d.ts +7 -0
- package/dist/plugins/bans/stores/index.d.ts.map +1 -0
- package/dist/plugins/bans/stores/index.js +7 -0
- package/dist/plugins/bans/stores/index.js.map +1 -0
- package/dist/plugins/bans/stores/postgres-store.d.ts +29 -0
- package/dist/plugins/bans/stores/postgres-store.d.ts.map +1 -0
- package/dist/plugins/bans/stores/postgres-store.js +132 -0
- package/dist/plugins/bans/stores/postgres-store.js.map +1 -0
- package/dist/plugins/bans/types.d.ts +128 -0
- package/dist/plugins/bans/types.d.ts.map +1 -0
- package/dist/plugins/bans/types.js +11 -0
- package/dist/plugins/bans/types.js.map +1 -0
- package/dist/plugins/cache-plugin.d.ts +14 -3
- package/dist/plugins/cache-plugin.d.ts.map +1 -1
- package/dist/plugins/cache-plugin.js +27 -7
- package/dist/plugins/cache-plugin.js.map +1 -1
- package/dist/plugins/cache-plugin.test.js +99 -32
- package/dist/plugins/cache-plugin.test.js.map +1 -1
- package/dist/plugins/config-plugin.d.ts +3 -2
- package/dist/plugins/config-plugin.d.ts.map +1 -1
- package/dist/plugins/config-plugin.js +17 -10
- package/dist/plugins/config-plugin.js.map +1 -1
- package/dist/plugins/diagnostics-plugin.d.ts +2 -2
- package/dist/plugins/diagnostics-plugin.d.ts.map +1 -1
- package/dist/plugins/diagnostics-plugin.js +17 -10
- package/dist/plugins/diagnostics-plugin.js.map +1 -1
- package/dist/plugins/entitlements/entitlements-plugin.d.ts +95 -0
- package/dist/plugins/entitlements/entitlements-plugin.d.ts.map +1 -0
- package/dist/plugins/entitlements/entitlements-plugin.js +707 -0
- package/dist/plugins/entitlements/entitlements-plugin.js.map +1 -0
- package/dist/plugins/entitlements/index.d.ts +12 -0
- package/dist/plugins/entitlements/index.d.ts.map +1 -0
- package/dist/plugins/entitlements/index.js +16 -0
- package/dist/plugins/entitlements/index.js.map +1 -0
- package/dist/plugins/entitlements/sources/index.d.ts +9 -0
- package/dist/plugins/entitlements/sources/index.d.ts.map +1 -0
- package/dist/plugins/entitlements/sources/index.js +9 -0
- package/dist/plugins/entitlements/sources/index.js.map +1 -0
- package/dist/plugins/entitlements/sources/postgres-source.d.ts +29 -0
- package/dist/plugins/entitlements/sources/postgres-source.d.ts.map +1 -0
- package/dist/plugins/entitlements/sources/postgres-source.js +169 -0
- package/dist/plugins/entitlements/sources/postgres-source.js.map +1 -0
- package/dist/plugins/entitlements/types.d.ts +232 -0
- package/dist/plugins/entitlements/types.d.ts.map +1 -0
- package/dist/plugins/entitlements/types.js +11 -0
- package/dist/plugins/entitlements/types.js.map +1 -0
- package/dist/plugins/frontend-app-plugin.d.ts +9 -3
- package/dist/plugins/frontend-app-plugin.d.ts.map +1 -1
- package/dist/plugins/frontend-app-plugin.js +14 -9
- package/dist/plugins/frontend-app-plugin.js.map +1 -1
- package/dist/plugins/health-plugin.d.ts +5 -2
- package/dist/plugins/health-plugin.d.ts.map +1 -1
- package/dist/plugins/health-plugin.js +20 -5
- package/dist/plugins/health-plugin.js.map +1 -1
- package/dist/plugins/index.d.ts +10 -2
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +10 -2
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/logs-plugin.d.ts +3 -2
- package/dist/plugins/logs-plugin.d.ts.map +1 -1
- package/dist/plugins/logs-plugin.js +21 -12
- package/dist/plugins/logs-plugin.js.map +1 -1
- package/dist/plugins/postgres-plugin.d.ts +3 -3
- package/dist/plugins/postgres-plugin.d.ts.map +1 -1
- package/dist/plugins/postgres-plugin.js +9 -7
- package/dist/plugins/postgres-plugin.js.map +1 -1
- package/dist/plugins/postgres-plugin.test.js +50 -29
- package/dist/plugins/postgres-plugin.test.js.map +1 -1
- package/dist/plugins/preferences/__tests__/deep-merge.test.d.ts +7 -0
- package/dist/plugins/preferences/__tests__/deep-merge.test.d.ts.map +1 -0
- package/dist/plugins/preferences/__tests__/deep-merge.test.js +215 -0
- package/dist/plugins/preferences/__tests__/deep-merge.test.js.map +1 -0
- package/dist/plugins/preferences/__tests__/preferences-plugin.test.d.ts +7 -0
- package/dist/plugins/preferences/__tests__/preferences-plugin.test.d.ts.map +1 -0
- package/dist/plugins/preferences/__tests__/preferences-plugin.test.js +265 -0
- package/dist/plugins/preferences/__tests__/preferences-plugin.test.js.map +1 -0
- package/dist/plugins/preferences/index.d.ts +12 -0
- package/dist/plugins/preferences/index.d.ts.map +1 -0
- package/dist/plugins/preferences/index.js +13 -0
- package/dist/plugins/preferences/index.js.map +1 -0
- package/dist/plugins/preferences/preferences-plugin.d.ts +39 -0
- package/dist/plugins/preferences/preferences-plugin.d.ts.map +1 -0
- package/dist/plugins/preferences/preferences-plugin.js +226 -0
- package/dist/plugins/preferences/preferences-plugin.js.map +1 -0
- package/dist/plugins/preferences/stores/index.d.ts +9 -0
- package/dist/plugins/preferences/stores/index.d.ts.map +1 -0
- package/dist/plugins/preferences/stores/index.js +9 -0
- package/dist/plugins/preferences/stores/index.js.map +1 -0
- package/dist/plugins/preferences/stores/postgres-store.d.ts +41 -0
- package/dist/plugins/preferences/stores/postgres-store.d.ts.map +1 -0
- package/dist/plugins/preferences/stores/postgres-store.js +181 -0
- package/dist/plugins/preferences/stores/postgres-store.js.map +1 -0
- package/dist/plugins/preferences/types.d.ts +91 -0
- package/dist/plugins/preferences/types.d.ts.map +1 -0
- package/dist/plugins/preferences/types.js +10 -0
- package/dist/plugins/preferences/types.js.map +1 -0
- package/dist/plugins/users/__tests__/users-plugin.test.d.ts +9 -0
- package/dist/plugins/users/__tests__/users-plugin.test.d.ts.map +1 -0
- package/dist/plugins/users/__tests__/users-plugin.test.js +546 -0
- package/dist/plugins/users/__tests__/users-plugin.test.js.map +1 -0
- package/dist/plugins/users/index.d.ts +12 -0
- package/dist/plugins/users/index.d.ts.map +1 -0
- package/dist/plugins/users/index.js +13 -0
- package/dist/plugins/users/index.js.map +1 -0
- package/dist/plugins/users/stores/index.d.ts +7 -0
- package/dist/plugins/users/stores/index.d.ts.map +1 -0
- package/dist/plugins/users/stores/index.js +7 -0
- package/dist/plugins/users/stores/index.js.map +1 -0
- package/dist/plugins/users/stores/postgres-store.d.ts +28 -0
- package/dist/plugins/users/stores/postgres-store.d.ts.map +1 -0
- package/dist/plugins/users/stores/postgres-store.js +157 -0
- package/dist/plugins/users/stores/postgres-store.js.map +1 -0
- package/dist/plugins/users/types.d.ts +225 -0
- package/dist/plugins/users/types.d.ts.map +1 -0
- package/dist/plugins/users/types.js +12 -0
- package/dist/plugins/users/types.js.map +1 -0
- package/dist/plugins/users/users-plugin.d.ts +45 -0
- package/dist/plugins/users/users-plugin.d.ts.map +1 -0
- package/dist/plugins/users/users-plugin.js +359 -0
- package/dist/plugins/users/users-plugin.js.map +1 -0
- package/dist-ui/assets/index-BY8OxNgO.js +465 -0
- package/dist-ui/assets/index-BY8OxNgO.js.map +1 -0
- package/dist-ui/index.html +1 -1
- package/dist-ui-lib/api/controlPanelApi.d.ts +278 -0
- package/dist-ui-lib/components/ControlPanelApp.d.ts +61 -0
- package/dist-ui-lib/components/index.d.ts +18 -0
- package/dist-ui-lib/config/AppConfig.d.ts +7 -0
- package/dist-ui-lib/dashboard/DashboardWidgetRegistry.d.ts +62 -0
- package/dist-ui-lib/dashboard/DashboardWidgetRenderer.d.ts +8 -0
- package/dist-ui-lib/dashboard/PluginWidgetRenderer.d.ts +19 -0
- package/dist-ui-lib/dashboard/WidgetComponentRegistry.d.ts +48 -0
- package/dist-ui-lib/dashboard/builtInWidgets.d.ts +25 -0
- package/dist-ui-lib/dashboard/index.d.ts +13 -0
- package/dist-ui-lib/dashboard/widgets/ServiceHealthWidget.d.ts +12 -0
- package/dist-ui-lib/dashboard/widgets/index.d.ts +6 -0
- package/dist-ui-lib/index.js +5172 -0
- package/dist-ui-lib/index.js.map +1 -0
- package/dist-ui-lib/pages/AuthPage.d.ts +1 -0
- package/dist-ui-lib/pages/ConfigPage.d.ts +1 -0
- package/dist-ui-lib/pages/DashboardPage.d.ts +1 -0
- package/dist-ui-lib/pages/DiagnosticsPage.d.ts +1 -0
- package/dist-ui-lib/pages/EntitlementsPage.d.ts +17 -0
- package/dist-ui-lib/pages/LogsPage.d.ts +1 -0
- package/dist-ui-lib/pages/NotFoundPage.d.ts +1 -0
- package/dist-ui-lib/pages/PluginPage.d.ts +15 -0
- package/dist-ui-lib/pages/PluginsPage.d.ts +1 -0
- package/dist-ui-lib/pages/SystemPage.d.ts +1 -0
- package/dist-ui-lib/pages/UsersPage.d.ts +22 -0
- package/package.json +24 -7
- package/src/core/control-panel.ts +145 -61
- package/src/core/gateway.ts +863 -403
- package/src/core/index.ts +21 -2
- package/src/core/plugin-registry.ts +716 -0
- package/src/core/types.ts +31 -37
- package/src/index.ts +125 -19
- package/src/plugins/auth/adapters/auth0-adapter.ts +214 -0
- package/src/plugins/auth/adapters/basic-adapter.ts +61 -0
- package/src/plugins/auth/adapters/index.ts +10 -0
- package/src/plugins/auth/adapters/supabase-adapter.ts +149 -0
- package/src/plugins/auth/adapters/supertokens-adapter.ts +326 -0
- package/src/plugins/auth/auth-plugin.test.ts +176 -0
- package/src/plugins/auth/auth-plugin.ts +303 -0
- package/src/plugins/auth/env-config.ts +572 -0
- package/src/plugins/auth/index.ts +42 -0
- package/src/plugins/auth/supertokens-adapter.test.ts +621 -0
- package/src/plugins/auth/types.ts +245 -0
- package/src/plugins/bans/bans-plugin.ts +485 -0
- package/src/plugins/bans/index.ts +31 -0
- package/src/plugins/bans/stores/index.ts +7 -0
- package/src/plugins/bans/stores/postgres-store.ts +195 -0
- package/src/plugins/bans/types.ts +141 -0
- package/src/plugins/cache-plugin.test.ts +108 -32
- package/src/plugins/cache-plugin.ts +40 -9
- package/src/plugins/config-plugin.ts +23 -12
- package/src/plugins/diagnostics-plugin.ts +22 -12
- package/src/plugins/entitlements/entitlements-plugin.ts +820 -0
- package/src/plugins/entitlements/index.ts +51 -0
- package/src/plugins/entitlements/sources/index.ts +9 -0
- package/src/plugins/entitlements/sources/postgres-source.ts +253 -0
- package/src/plugins/entitlements/types.ts +256 -0
- package/src/plugins/frontend-app-plugin.ts +24 -12
- package/src/plugins/health-plugin.ts +27 -7
- package/src/plugins/index.ts +132 -4
- package/src/plugins/logs-plugin.ts +28 -14
- package/src/plugins/postgres-plugin.test.ts +52 -29
- package/src/plugins/postgres-plugin.ts +11 -9
- package/src/plugins/preferences/__tests__/deep-merge.test.ts +242 -0
- package/src/plugins/preferences/__tests__/preferences-plugin.test.ts +350 -0
- package/src/plugins/preferences/index.ts +30 -0
- package/src/plugins/preferences/preferences-plugin.ts +270 -0
- package/src/plugins/preferences/stores/index.ts +9 -0
- package/src/plugins/preferences/stores/postgres-store.ts +252 -0
- package/src/plugins/preferences/types.ts +100 -0
- package/src/plugins/users/__tests__/users-plugin.test.ts +690 -0
- package/src/plugins/users/index.ts +38 -0
- package/src/plugins/users/stores/index.ts +7 -0
- package/src/plugins/users/stores/postgres-store.ts +225 -0
- package/src/plugins/users/types.ts +247 -0
- package/src/plugins/users/users-plugin.ts +418 -0
- package/ui/src/App.tsx +188 -31
- package/ui/src/api/controlPanelApi.ts +453 -1
- package/ui/src/components/ControlPanelApp.tsx +212 -0
- package/ui/src/components/index.ts +62 -0
- package/ui/src/dashboard/DashboardWidgetRegistry.tsx +129 -0
- package/ui/src/dashboard/DashboardWidgetRenderer.tsx +34 -0
- package/ui/src/dashboard/PluginWidgetRenderer.tsx +118 -0
- package/ui/src/dashboard/WidgetComponentRegistry.tsx +120 -0
- package/ui/src/dashboard/builtInWidgets.tsx +35 -0
- package/ui/src/dashboard/index.ts +35 -0
- package/ui/src/dashboard/widgets/ServiceHealthWidget.tsx +140 -0
- package/ui/src/dashboard/widgets/index.ts +7 -0
- package/ui/src/pages/AuthPage.tsx +259 -0
- package/ui/src/pages/DashboardPage.tsx +28 -149
- package/ui/src/pages/EntitlementsPage.tsx +557 -0
- package/ui/src/pages/LogsPage.tsx +174 -8
- package/ui/src/pages/PluginPage.tsx +148 -0
- package/ui/src/pages/PluginsPage.tsx +394 -0
- package/ui/src/pages/SystemPage.tsx +445 -0
- package/ui/src/pages/UsersPage.tsx +837 -0
- package/ui/tsconfig.lib.json +11 -0
- package/ui/vite.lib.config.ts +56 -0
- package/dist-ui/assets/index-CW1BviRn.js +0 -465
- package/dist-ui/assets/index-CW1BviRn.js.map +0 -1
- package/ui/src/pages/HealthPage.tsx +0 -204
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Card,
|
|
5
|
+
CardContent,
|
|
6
|
+
Typography,
|
|
7
|
+
Table,
|
|
8
|
+
TableBody,
|
|
9
|
+
TableCell,
|
|
10
|
+
TableContainer,
|
|
11
|
+
TableHead,
|
|
12
|
+
TableRow,
|
|
13
|
+
Chip,
|
|
14
|
+
CircularProgress,
|
|
15
|
+
Alert,
|
|
16
|
+
IconButton,
|
|
17
|
+
Tooltip,
|
|
18
|
+
} from '@mui/material';
|
|
19
|
+
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
|
|
20
|
+
import ErrorIcon from '@mui/icons-material/Error';
|
|
21
|
+
import BlockIcon from '@mui/icons-material/Block';
|
|
22
|
+
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
|
|
23
|
+
import RefreshIcon from '@mui/icons-material/Refresh';
|
|
24
|
+
import { api, AuthConfigStatus } from '../api/controlPanelApi';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get the status color for the auth state
|
|
28
|
+
*/
|
|
29
|
+
function getStateColor(state: string): string {
|
|
30
|
+
switch (state) {
|
|
31
|
+
case 'enabled':
|
|
32
|
+
return 'var(--theme-success)';
|
|
33
|
+
case 'error':
|
|
34
|
+
return 'var(--theme-error)';
|
|
35
|
+
case 'disabled':
|
|
36
|
+
default:
|
|
37
|
+
return 'var(--theme-text-secondary)';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Get the status icon for the auth state
|
|
43
|
+
*/
|
|
44
|
+
function getStateIcon(state: string) {
|
|
45
|
+
switch (state) {
|
|
46
|
+
case 'enabled':
|
|
47
|
+
return <CheckCircleIcon sx={{ color: 'var(--theme-success)' }} />;
|
|
48
|
+
case 'error':
|
|
49
|
+
return <ErrorIcon sx={{ color: 'var(--theme-error)' }} />;
|
|
50
|
+
case 'disabled':
|
|
51
|
+
default:
|
|
52
|
+
return <BlockIcon sx={{ color: 'var(--theme-text-secondary)' }} />;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function AuthPage() {
|
|
57
|
+
const [status, setStatus] = useState<AuthConfigStatus | null>(null);
|
|
58
|
+
const [loading, setLoading] = useState(true);
|
|
59
|
+
const [error, setError] = useState<string | null>(null);
|
|
60
|
+
const [copied, setCopied] = useState<string | null>(null);
|
|
61
|
+
|
|
62
|
+
const fetchStatus = async () => {
|
|
63
|
+
setLoading(true);
|
|
64
|
+
setError(null);
|
|
65
|
+
try {
|
|
66
|
+
const data = await api.getAuthConfig();
|
|
67
|
+
setStatus(data);
|
|
68
|
+
} catch (err) {
|
|
69
|
+
setError(err instanceof Error ? err.message : 'Failed to fetch auth status');
|
|
70
|
+
} finally {
|
|
71
|
+
setLoading(false);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
fetchStatus();
|
|
77
|
+
}, []);
|
|
78
|
+
|
|
79
|
+
const handleCopy = (key: string, value: string) => {
|
|
80
|
+
navigator.clipboard.writeText(value);
|
|
81
|
+
setCopied(key);
|
|
82
|
+
setTimeout(() => setCopied(null), 2000);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
if (loading) {
|
|
86
|
+
return (
|
|
87
|
+
<Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', minHeight: '50vh' }}>
|
|
88
|
+
<CircularProgress />
|
|
89
|
+
</Box>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (error) {
|
|
94
|
+
return (
|
|
95
|
+
<Card sx={{ bgcolor: 'var(--theme-surface)', border: '1px solid var(--theme-error)' }}>
|
|
96
|
+
<CardContent>
|
|
97
|
+
<Typography color="error">{error}</Typography>
|
|
98
|
+
</CardContent>
|
|
99
|
+
</Card>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const configEntries = status?.config ? Object.entries(status.config) : [];
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<Box>
|
|
107
|
+
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 1 }}>
|
|
108
|
+
<Typography variant="h4" sx={{ color: 'var(--theme-text-primary)' }}>
|
|
109
|
+
Authentication
|
|
110
|
+
</Typography>
|
|
111
|
+
<Tooltip title="Refresh">
|
|
112
|
+
<IconButton onClick={fetchStatus} sx={{ color: 'var(--theme-text-secondary)' }}>
|
|
113
|
+
<RefreshIcon />
|
|
114
|
+
</IconButton>
|
|
115
|
+
</Tooltip>
|
|
116
|
+
</Box>
|
|
117
|
+
<Typography variant="body2" sx={{ mb: 4, color: 'var(--theme-text-secondary)' }}>
|
|
118
|
+
Auth plugin configuration status
|
|
119
|
+
</Typography>
|
|
120
|
+
|
|
121
|
+
{/* Status Card */}
|
|
122
|
+
<Card sx={{ bgcolor: 'var(--theme-surface)', mb: 3 }}>
|
|
123
|
+
<CardContent>
|
|
124
|
+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 2, mb: 2 }}>
|
|
125
|
+
{getStateIcon(status?.state || 'disabled')}
|
|
126
|
+
<Box>
|
|
127
|
+
<Typography variant="h6" sx={{ color: 'var(--theme-text-primary)' }}>
|
|
128
|
+
Status:{' '}
|
|
129
|
+
<Chip
|
|
130
|
+
label={status?.state?.toUpperCase() || 'UNKNOWN'}
|
|
131
|
+
size="small"
|
|
132
|
+
sx={{
|
|
133
|
+
bgcolor: `${getStateColor(status?.state || 'disabled')}20`,
|
|
134
|
+
color: getStateColor(status?.state || 'disabled'),
|
|
135
|
+
fontWeight: 600,
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
</Typography>
|
|
139
|
+
{status?.adapter && (
|
|
140
|
+
<Typography variant="body2" sx={{ color: 'var(--theme-text-secondary)', mt: 0.5 }}>
|
|
141
|
+
Adapter: <strong>{status.adapter}</strong>
|
|
142
|
+
</Typography>
|
|
143
|
+
)}
|
|
144
|
+
</Box>
|
|
145
|
+
</Box>
|
|
146
|
+
|
|
147
|
+
{/* Error Message */}
|
|
148
|
+
{status?.state === 'error' && status.error && (
|
|
149
|
+
<Alert severity="error" sx={{ mb: 2 }}>
|
|
150
|
+
{status.error}
|
|
151
|
+
</Alert>
|
|
152
|
+
)}
|
|
153
|
+
|
|
154
|
+
{/* Missing Variables */}
|
|
155
|
+
{status?.missingVars && status.missingVars.length > 0 && (
|
|
156
|
+
<Alert severity="warning" sx={{ mb: 2 }}>
|
|
157
|
+
<Typography variant="body2" sx={{ fontWeight: 600, mb: 1 }}>
|
|
158
|
+
Missing environment variables:
|
|
159
|
+
</Typography>
|
|
160
|
+
<Box component="ul" sx={{ m: 0, pl: 2 }}>
|
|
161
|
+
{status.missingVars.map((v) => (
|
|
162
|
+
<li key={v}>
|
|
163
|
+
<code>{v}</code>
|
|
164
|
+
</li>
|
|
165
|
+
))}
|
|
166
|
+
</Box>
|
|
167
|
+
</Alert>
|
|
168
|
+
)}
|
|
169
|
+
|
|
170
|
+
{/* Disabled State Info */}
|
|
171
|
+
{status?.state === 'disabled' && (
|
|
172
|
+
<Alert severity="info">
|
|
173
|
+
<Typography variant="body2">
|
|
174
|
+
Authentication is disabled. Set the <code>AUTH_ADAPTER</code> environment variable to enable.
|
|
175
|
+
</Typography>
|
|
176
|
+
<Typography variant="body2" sx={{ mt: 1 }}>
|
|
177
|
+
Valid options: <code>supertokens</code>, <code>auth0</code>, <code>supabase</code>, <code>basic</code>
|
|
178
|
+
</Typography>
|
|
179
|
+
</Alert>
|
|
180
|
+
)}
|
|
181
|
+
</CardContent>
|
|
182
|
+
</Card>
|
|
183
|
+
|
|
184
|
+
{/* Configuration Table */}
|
|
185
|
+
{configEntries.length > 0 && (
|
|
186
|
+
<Card sx={{ bgcolor: 'var(--theme-surface)' }}>
|
|
187
|
+
<CardContent sx={{ pb: 0 }}>
|
|
188
|
+
<Typography variant="h6" sx={{ color: 'var(--theme-text-primary)', mb: 2 }}>
|
|
189
|
+
Current Configuration
|
|
190
|
+
</Typography>
|
|
191
|
+
</CardContent>
|
|
192
|
+
<TableContainer>
|
|
193
|
+
<Table size="small">
|
|
194
|
+
<TableHead>
|
|
195
|
+
<TableRow>
|
|
196
|
+
<TableCell sx={{ color: 'var(--theme-text-secondary)', borderColor: 'var(--theme-border)' }}>
|
|
197
|
+
Variable
|
|
198
|
+
</TableCell>
|
|
199
|
+
<TableCell sx={{ color: 'var(--theme-text-secondary)', borderColor: 'var(--theme-border)' }}>
|
|
200
|
+
Value
|
|
201
|
+
</TableCell>
|
|
202
|
+
<TableCell
|
|
203
|
+
sx={{ color: 'var(--theme-text-secondary)', borderColor: 'var(--theme-border)', width: 60 }}
|
|
204
|
+
>
|
|
205
|
+
Actions
|
|
206
|
+
</TableCell>
|
|
207
|
+
</TableRow>
|
|
208
|
+
</TableHead>
|
|
209
|
+
<TableBody>
|
|
210
|
+
{configEntries.map(([key, value]) => (
|
|
211
|
+
<TableRow key={key}>
|
|
212
|
+
<TableCell sx={{ borderColor: 'var(--theme-border)' }}>
|
|
213
|
+
<Typography sx={{ color: 'var(--theme-text-primary)', fontFamily: 'monospace', fontSize: 13 }}>
|
|
214
|
+
{key}
|
|
215
|
+
</Typography>
|
|
216
|
+
</TableCell>
|
|
217
|
+
<TableCell sx={{ borderColor: 'var(--theme-border)' }}>
|
|
218
|
+
<Typography
|
|
219
|
+
sx={{
|
|
220
|
+
color: value.includes('*') ? 'var(--theme-text-secondary)' : 'var(--theme-text-primary)',
|
|
221
|
+
fontFamily: 'monospace',
|
|
222
|
+
fontSize: 13,
|
|
223
|
+
}}
|
|
224
|
+
>
|
|
225
|
+
{value}
|
|
226
|
+
</Typography>
|
|
227
|
+
</TableCell>
|
|
228
|
+
<TableCell sx={{ borderColor: 'var(--theme-border)' }}>
|
|
229
|
+
<Tooltip title={copied === key ? 'Copied!' : 'Copy value'}>
|
|
230
|
+
<IconButton
|
|
231
|
+
size="small"
|
|
232
|
+
onClick={() => handleCopy(key, value)}
|
|
233
|
+
sx={{ color: copied === key ? 'var(--theme-success)' : 'var(--theme-text-secondary)' }}
|
|
234
|
+
>
|
|
235
|
+
<ContentCopyIcon fontSize="small" />
|
|
236
|
+
</IconButton>
|
|
237
|
+
</Tooltip>
|
|
238
|
+
</TableCell>
|
|
239
|
+
</TableRow>
|
|
240
|
+
))}
|
|
241
|
+
</TableBody>
|
|
242
|
+
</Table>
|
|
243
|
+
</TableContainer>
|
|
244
|
+
</Card>
|
|
245
|
+
)}
|
|
246
|
+
|
|
247
|
+
{/* No Configuration */}
|
|
248
|
+
{status?.state === 'enabled' && configEntries.length === 0 && (
|
|
249
|
+
<Card sx={{ bgcolor: 'var(--theme-surface)' }}>
|
|
250
|
+
<CardContent>
|
|
251
|
+
<Typography sx={{ color: 'var(--theme-text-secondary)', textAlign: 'center' }}>
|
|
252
|
+
No configuration details available
|
|
253
|
+
</Typography>
|
|
254
|
+
</CardContent>
|
|
255
|
+
</Card>
|
|
256
|
+
)}
|
|
257
|
+
</Box>
|
|
258
|
+
);
|
|
259
|
+
}
|
|
@@ -1,38 +1,19 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useNavigate } from 'react-router-dom';
|
|
2
3
|
import {
|
|
3
4
|
Box,
|
|
4
5
|
Card,
|
|
5
6
|
CardContent,
|
|
7
|
+
CardActionArea,
|
|
6
8
|
Typography,
|
|
7
|
-
Grid,
|
|
8
9
|
CircularProgress,
|
|
9
10
|
Chip,
|
|
10
11
|
} from '@mui/material';
|
|
11
12
|
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
|
|
12
13
|
import ErrorIcon from '@mui/icons-material/Error';
|
|
13
14
|
import WarningIcon from '@mui/icons-material/Warning';
|
|
14
|
-
import AccessTimeIcon from '@mui/icons-material/AccessTime';
|
|
15
|
-
import MemoryIcon from '@mui/icons-material/Memory';
|
|
16
|
-
import StorageIcon from '@mui/icons-material/Storage';
|
|
17
15
|
import { api, HealthResponse, InfoResponse } from '../api/controlPanelApi';
|
|
18
|
-
|
|
19
|
-
function formatUptime(ms: number): string {
|
|
20
|
-
const seconds = Math.floor(ms / 1000);
|
|
21
|
-
const minutes = Math.floor(seconds / 60);
|
|
22
|
-
const hours = Math.floor(minutes / 60);
|
|
23
|
-
const days = Math.floor(hours / 24);
|
|
24
|
-
|
|
25
|
-
if (days > 0) {
|
|
26
|
-
return `${days}d ${hours % 24}h ${minutes % 60}m`;
|
|
27
|
-
}
|
|
28
|
-
if (hours > 0) {
|
|
29
|
-
return `${hours}h ${minutes % 60}m`;
|
|
30
|
-
}
|
|
31
|
-
if (minutes > 0) {
|
|
32
|
-
return `${minutes}m ${seconds % 60}s`;
|
|
33
|
-
}
|
|
34
|
-
return `${seconds}s`;
|
|
35
|
-
}
|
|
16
|
+
import { DashboardWidgetRenderer, PluginWidgetRenderer } from '../dashboard';
|
|
36
17
|
|
|
37
18
|
function getStatusIcon(status: string) {
|
|
38
19
|
switch (status) {
|
|
@@ -61,6 +42,7 @@ function getStatusColor(status: string): string {
|
|
|
61
42
|
}
|
|
62
43
|
|
|
63
44
|
export function DashboardPage() {
|
|
45
|
+
const navigate = useNavigate();
|
|
64
46
|
const [health, setHealth] = useState<HealthResponse | null>(null);
|
|
65
47
|
const [info, setInfo] = useState<InfoResponse | null>(null);
|
|
66
48
|
const [loading, setLoading] = useState(true);
|
|
@@ -119,7 +101,7 @@ export function DashboardPage() {
|
|
|
119
101
|
Real-time overview of {info?.product || 'your service'}
|
|
120
102
|
</Typography>
|
|
121
103
|
|
|
122
|
-
{/* Status Banner */}
|
|
104
|
+
{/* Service Status Banner - clickable to navigate to Health page */}
|
|
123
105
|
<Card
|
|
124
106
|
sx={{
|
|
125
107
|
mb: 4,
|
|
@@ -127,138 +109,35 @@ export function DashboardPage() {
|
|
|
127
109
|
border: `2px solid ${getStatusColor(health?.status || 'unknown')}`,
|
|
128
110
|
}}
|
|
129
111
|
>
|
|
130
|
-
<
|
|
131
|
-
<
|
|
132
|
-
{
|
|
133
|
-
|
|
134
|
-
<
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
<Typography variant="body2" sx={{ color: 'var(--theme-text-secondary)' }}>
|
|
138
|
-
Last updated: {health?.timestamp ? new Date(health.timestamp).toLocaleString() : 'N/A'}
|
|
139
|
-
</Typography>
|
|
140
|
-
</Box>
|
|
141
|
-
</Box>
|
|
142
|
-
<Chip
|
|
143
|
-
label={`${healthyCount}/${totalCount} checks passing`}
|
|
144
|
-
sx={{
|
|
145
|
-
bgcolor: getStatusColor(health?.status || 'unknown') + '20',
|
|
146
|
-
color: getStatusColor(health?.status || 'unknown'),
|
|
147
|
-
}}
|
|
148
|
-
/>
|
|
149
|
-
</CardContent>
|
|
150
|
-
</Card>
|
|
151
|
-
|
|
152
|
-
{/* Stats Grid */}
|
|
153
|
-
<Grid container spacing={3} sx={{ mb: 4 }}>
|
|
154
|
-
<Grid size={{ xs: 12, sm: 6, md: 3 }}>
|
|
155
|
-
<Card sx={{ bgcolor: 'var(--theme-surface)', height: '100%' }}>
|
|
156
|
-
<CardContent>
|
|
157
|
-
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 2 }}>
|
|
158
|
-
<AccessTimeIcon sx={{ color: 'var(--theme-primary)' }} />
|
|
159
|
-
<Typography variant="body2" sx={{ color: 'var(--theme-text-secondary)' }}>
|
|
160
|
-
Uptime
|
|
112
|
+
<CardActionArea onClick={() => navigate('/health')}>
|
|
113
|
+
<CardContent sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
|
114
|
+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
|
|
115
|
+
{getStatusIcon(health?.status || 'unknown')}
|
|
116
|
+
<Box>
|
|
117
|
+
<Typography variant="h6" sx={{ color: 'var(--theme-text-primary)' }}>
|
|
118
|
+
Service Status: {health?.status?.charAt(0).toUpperCase()}{health?.status?.slice(1)}
|
|
161
119
|
</Typography>
|
|
162
|
-
</Box>
|
|
163
|
-
<Typography variant="h4" sx={{ color: 'var(--theme-primary)' }}>
|
|
164
|
-
{health ? formatUptime(health.uptime) : 'N/A'}
|
|
165
|
-
</Typography>
|
|
166
|
-
</CardContent>
|
|
167
|
-
</Card>
|
|
168
|
-
</Grid>
|
|
169
|
-
|
|
170
|
-
<Grid size={{ xs: 12, sm: 6, md: 3 }}>
|
|
171
|
-
<Card sx={{ bgcolor: 'var(--theme-surface)', height: '100%' }}>
|
|
172
|
-
<CardContent>
|
|
173
|
-
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 2 }}>
|
|
174
|
-
<CheckCircleIcon sx={{ color: 'var(--theme-success)' }} />
|
|
175
120
|
<Typography variant="body2" sx={{ color: 'var(--theme-text-secondary)' }}>
|
|
176
|
-
|
|
121
|
+
Click to view detailed health information
|
|
177
122
|
</Typography>
|
|
178
123
|
</Box>
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
<MemoryIcon sx={{ color: 'var(--theme-warning)' }} />
|
|
191
|
-
<Typography variant="body2" sx={{ color: 'var(--theme-text-secondary)' }}>
|
|
192
|
-
Version
|
|
193
|
-
</Typography>
|
|
194
|
-
</Box>
|
|
195
|
-
<Typography variant="h4" sx={{ color: 'var(--theme-text-primary)' }}>
|
|
196
|
-
{info?.version || 'N/A'}
|
|
197
|
-
</Typography>
|
|
198
|
-
</CardContent>
|
|
199
|
-
</Card>
|
|
200
|
-
</Grid>
|
|
124
|
+
</Box>
|
|
125
|
+
<Chip
|
|
126
|
+
label={`${healthyCount}/${totalCount} checks passing`}
|
|
127
|
+
sx={{
|
|
128
|
+
bgcolor: getStatusColor(health?.status || 'unknown') + '20',
|
|
129
|
+
color: getStatusColor(health?.status || 'unknown'),
|
|
130
|
+
}}
|
|
131
|
+
/>
|
|
132
|
+
</CardContent>
|
|
133
|
+
</CardActionArea>
|
|
134
|
+
</Card>
|
|
201
135
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
<CardContent>
|
|
205
|
-
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 2 }}>
|
|
206
|
-
<StorageIcon sx={{ color: 'var(--theme-info)' }} />
|
|
207
|
-
<Typography variant="body2" sx={{ color: 'var(--theme-text-secondary)' }}>
|
|
208
|
-
Product
|
|
209
|
-
</Typography>
|
|
210
|
-
</Box>
|
|
211
|
-
<Typography variant="h5" sx={{ color: 'var(--theme-text-primary)' }}>
|
|
212
|
-
{info?.product || 'N/A'}
|
|
213
|
-
</Typography>
|
|
214
|
-
</CardContent>
|
|
215
|
-
</Card>
|
|
216
|
-
</Grid>
|
|
217
|
-
</Grid>
|
|
136
|
+
{/* Plugin widgets (from server-side widget contributions) */}
|
|
137
|
+
<PluginWidgetRenderer />
|
|
218
138
|
|
|
219
|
-
{/*
|
|
220
|
-
<
|
|
221
|
-
<CardContent>
|
|
222
|
-
<Typography variant="h6" sx={{ mb: 3, color: 'var(--theme-text-primary)' }}>
|
|
223
|
-
Health Checks
|
|
224
|
-
</Typography>
|
|
225
|
-
<Grid container spacing={2}>
|
|
226
|
-
{healthChecks.map(([name, check]) => (
|
|
227
|
-
<Grid size={{ xs: 12, sm: 6, md: 4 }} key={name}>
|
|
228
|
-
<Box
|
|
229
|
-
sx={{
|
|
230
|
-
p: 2,
|
|
231
|
-
borderRadius: 1,
|
|
232
|
-
bgcolor: 'var(--theme-background)',
|
|
233
|
-
border: `1px solid ${getStatusColor(check.status)}40`,
|
|
234
|
-
}}
|
|
235
|
-
>
|
|
236
|
-
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', mb: 1 }}>
|
|
237
|
-
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
|
238
|
-
{getStatusIcon(check.status)}
|
|
239
|
-
<Typography sx={{ color: 'var(--theme-text-primary)', fontWeight: 500 }}>
|
|
240
|
-
{name}
|
|
241
|
-
</Typography>
|
|
242
|
-
</Box>
|
|
243
|
-
{check.latency !== undefined && (
|
|
244
|
-
<Chip
|
|
245
|
-
label={`${check.latency}ms`}
|
|
246
|
-
size="small"
|
|
247
|
-
sx={{ bgcolor: 'var(--theme-surface)', color: 'var(--theme-text-secondary)' }}
|
|
248
|
-
/>
|
|
249
|
-
)}
|
|
250
|
-
</Box>
|
|
251
|
-
{check.error && (
|
|
252
|
-
<Typography variant="caption" sx={{ color: 'var(--theme-error)' }}>
|
|
253
|
-
{check.error}
|
|
254
|
-
</Typography>
|
|
255
|
-
)}
|
|
256
|
-
</Box>
|
|
257
|
-
</Grid>
|
|
258
|
-
))}
|
|
259
|
-
</Grid>
|
|
260
|
-
</CardContent>
|
|
261
|
-
</Card>
|
|
139
|
+
{/* Legacy widgets from context (for backwards compatibility) */}
|
|
140
|
+
<DashboardWidgetRenderer />
|
|
262
141
|
</Box>
|
|
263
142
|
);
|
|
264
143
|
}
|