@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,394 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Card,
|
|
5
|
+
CardContent,
|
|
6
|
+
Typography,
|
|
7
|
+
CircularProgress,
|
|
8
|
+
Chip,
|
|
9
|
+
Table,
|
|
10
|
+
TableBody,
|
|
11
|
+
TableCell,
|
|
12
|
+
TableContainer,
|
|
13
|
+
TableHead,
|
|
14
|
+
TableRow,
|
|
15
|
+
Collapse,
|
|
16
|
+
IconButton,
|
|
17
|
+
Alert,
|
|
18
|
+
} from '@mui/material';
|
|
19
|
+
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
20
|
+
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
|
|
21
|
+
import ExtensionIcon from '@mui/icons-material/Extension';
|
|
22
|
+
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
|
|
23
|
+
import ErrorIcon from '@mui/icons-material/Error';
|
|
24
|
+
import HourglassEmptyIcon from '@mui/icons-material/HourglassEmpty';
|
|
25
|
+
import StopCircleIcon from '@mui/icons-material/StopCircle';
|
|
26
|
+
import { api, PluginInfo, PluginContributions } from '../api/controlPanelApi';
|
|
27
|
+
|
|
28
|
+
function getStatusIcon(status: PluginInfo['status']) {
|
|
29
|
+
switch (status) {
|
|
30
|
+
case 'active':
|
|
31
|
+
return <CheckCircleIcon sx={{ color: 'var(--theme-success)', fontSize: 20 }} />;
|
|
32
|
+
case 'error':
|
|
33
|
+
return <ErrorIcon sx={{ color: 'var(--theme-error)', fontSize: 20 }} />;
|
|
34
|
+
case 'starting':
|
|
35
|
+
return <HourglassEmptyIcon sx={{ color: 'var(--theme-warning)', fontSize: 20 }} />;
|
|
36
|
+
case 'stopped':
|
|
37
|
+
return <StopCircleIcon sx={{ color: 'var(--theme-text-secondary)', fontSize: 20 }} />;
|
|
38
|
+
default:
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function getStatusColor(status: PluginInfo['status']): string {
|
|
44
|
+
switch (status) {
|
|
45
|
+
case 'active':
|
|
46
|
+
return 'var(--theme-success)';
|
|
47
|
+
case 'error':
|
|
48
|
+
return 'var(--theme-error)';
|
|
49
|
+
case 'starting':
|
|
50
|
+
return 'var(--theme-warning)';
|
|
51
|
+
case 'stopped':
|
|
52
|
+
return 'var(--theme-text-secondary)';
|
|
53
|
+
default:
|
|
54
|
+
return 'var(--theme-text-secondary)';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function ContributionsSummary({ counts }: { counts: PluginInfo['contributionCounts'] }) {
|
|
59
|
+
const parts: string[] = [];
|
|
60
|
+
if (counts.routes > 0) parts.push(`${counts.routes} route${counts.routes > 1 ? 's' : ''}`);
|
|
61
|
+
if (counts.menuItems > 0) parts.push(`${counts.menuItems} menu item${counts.menuItems > 1 ? 's' : ''}`);
|
|
62
|
+
if (counts.pages > 0) parts.push(`${counts.pages} page${counts.pages > 1 ? 's' : ''}`);
|
|
63
|
+
if (counts.widgets > 0) parts.push(`${counts.widgets} widget${counts.widgets > 1 ? 's' : ''}`);
|
|
64
|
+
|
|
65
|
+
if (parts.length === 0) {
|
|
66
|
+
return <Typography sx={{ color: 'var(--theme-text-secondary)', fontSize: '0.875rem' }}>No contributions</Typography>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<Typography sx={{ color: 'var(--theme-text-secondary)', fontSize: '0.875rem' }}>
|
|
71
|
+
{parts.join(', ')}
|
|
72
|
+
</Typography>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface PluginRowProps {
|
|
77
|
+
plugin: PluginInfo;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function PluginRow({ plugin }: PluginRowProps) {
|
|
81
|
+
const [open, setOpen] = useState(false);
|
|
82
|
+
const [contributions, setContributions] = useState<PluginContributions | null>(null);
|
|
83
|
+
const [loading, setLoading] = useState(false);
|
|
84
|
+
const [detailError, setDetailError] = useState<string | null>(null);
|
|
85
|
+
|
|
86
|
+
const handleToggle = async () => {
|
|
87
|
+
if (!open && !contributions && !detailError) {
|
|
88
|
+
setLoading(true);
|
|
89
|
+
setDetailError(null);
|
|
90
|
+
try {
|
|
91
|
+
const detail = await api.getPluginDetail(plugin.id);
|
|
92
|
+
setContributions(detail.contributions);
|
|
93
|
+
} catch (err) {
|
|
94
|
+
console.error('Failed to load plugin details:', err);
|
|
95
|
+
setDetailError(err instanceof Error ? err.message : 'Failed to load details');
|
|
96
|
+
} finally {
|
|
97
|
+
setLoading(false);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
setOpen(!open);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const hasContributions =
|
|
104
|
+
plugin.contributionCounts.routes > 0 ||
|
|
105
|
+
plugin.contributionCounts.menuItems > 0 ||
|
|
106
|
+
plugin.contributionCounts.pages > 0 ||
|
|
107
|
+
plugin.contributionCounts.widgets > 0;
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<>
|
|
111
|
+
<TableRow
|
|
112
|
+
sx={{
|
|
113
|
+
'& > *': { borderBottom: open ? 'none' : undefined },
|
|
114
|
+
cursor: hasContributions ? 'pointer' : 'default',
|
|
115
|
+
'&:hover': { bgcolor: hasContributions ? 'var(--theme-background)' : undefined },
|
|
116
|
+
}}
|
|
117
|
+
onClick={hasContributions ? handleToggle : undefined}
|
|
118
|
+
>
|
|
119
|
+
<TableCell sx={{ width: 50, borderColor: 'var(--theme-border)' }}>
|
|
120
|
+
{hasContributions && (
|
|
121
|
+
<IconButton size="small" sx={{ color: 'var(--theme-text-secondary)' }}>
|
|
122
|
+
{open ? <KeyboardArrowUpIcon /> : <KeyboardArrowDownIcon />}
|
|
123
|
+
</IconButton>
|
|
124
|
+
)}
|
|
125
|
+
</TableCell>
|
|
126
|
+
<TableCell sx={{ borderColor: 'var(--theme-border)' }}>
|
|
127
|
+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
|
128
|
+
{getStatusIcon(plugin.status)}
|
|
129
|
+
<Typography sx={{ color: 'var(--theme-text-primary)', fontWeight: 500 }}>
|
|
130
|
+
{plugin.name}
|
|
131
|
+
</Typography>
|
|
132
|
+
</Box>
|
|
133
|
+
</TableCell>
|
|
134
|
+
<TableCell sx={{ borderColor: 'var(--theme-border)' }}>
|
|
135
|
+
<Typography sx={{ color: 'var(--theme-text-secondary)', fontFamily: 'monospace', fontSize: '0.875rem' }}>
|
|
136
|
+
{plugin.id}
|
|
137
|
+
</Typography>
|
|
138
|
+
</TableCell>
|
|
139
|
+
<TableCell sx={{ borderColor: 'var(--theme-border)' }}>
|
|
140
|
+
{plugin.version ? (
|
|
141
|
+
<Chip
|
|
142
|
+
label={`v${plugin.version}`}
|
|
143
|
+
size="small"
|
|
144
|
+
sx={{ bgcolor: 'var(--theme-background)', color: 'var(--theme-text-primary)' }}
|
|
145
|
+
/>
|
|
146
|
+
) : (
|
|
147
|
+
<Typography sx={{ color: 'var(--theme-text-secondary)' }}>-</Typography>
|
|
148
|
+
)}
|
|
149
|
+
</TableCell>
|
|
150
|
+
<TableCell sx={{ borderColor: 'var(--theme-border)' }}>
|
|
151
|
+
<Chip
|
|
152
|
+
label={plugin.status}
|
|
153
|
+
size="small"
|
|
154
|
+
sx={{
|
|
155
|
+
bgcolor: getStatusColor(plugin.status) + '20',
|
|
156
|
+
color: getStatusColor(plugin.status),
|
|
157
|
+
textTransform: 'capitalize',
|
|
158
|
+
}}
|
|
159
|
+
/>
|
|
160
|
+
</TableCell>
|
|
161
|
+
<TableCell sx={{ borderColor: 'var(--theme-border)' }}>
|
|
162
|
+
<ContributionsSummary counts={plugin.contributionCounts} />
|
|
163
|
+
</TableCell>
|
|
164
|
+
</TableRow>
|
|
165
|
+
|
|
166
|
+
{/* Expanded details row */}
|
|
167
|
+
<TableRow>
|
|
168
|
+
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={6} sx={{ borderColor: 'var(--theme-border)' }}>
|
|
169
|
+
<Collapse in={open} timeout="auto" unmountOnExit>
|
|
170
|
+
<Box sx={{ py: 2, px: 4 }}>
|
|
171
|
+
{loading ? (
|
|
172
|
+
<Box sx={{ display: 'flex', justifyContent: 'center', py: 2 }}>
|
|
173
|
+
<CircularProgress size={24} />
|
|
174
|
+
</Box>
|
|
175
|
+
) : detailError ? (
|
|
176
|
+
<Alert severity="error" sx={{ mb: 1 }}>
|
|
177
|
+
{detailError}
|
|
178
|
+
</Alert>
|
|
179
|
+
) : contributions ? (
|
|
180
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
|
|
181
|
+
{/* Error message if plugin failed */}
|
|
182
|
+
{plugin.status === 'error' && plugin.error && (
|
|
183
|
+
<Alert severity="error" sx={{ mb: 1 }}>
|
|
184
|
+
{plugin.error}
|
|
185
|
+
</Alert>
|
|
186
|
+
)}
|
|
187
|
+
|
|
188
|
+
{/* Routes */}
|
|
189
|
+
{contributions.routes.length > 0 && (
|
|
190
|
+
<Box>
|
|
191
|
+
<Typography variant="subtitle2" sx={{ color: 'var(--theme-text-primary)', mb: 1 }}>
|
|
192
|
+
Routes ({contributions.routes.length})
|
|
193
|
+
</Typography>
|
|
194
|
+
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
|
|
195
|
+
{contributions.routes.map((route, i) => (
|
|
196
|
+
<Chip
|
|
197
|
+
key={i}
|
|
198
|
+
label={`${route.method.toUpperCase()} ${route.path}`}
|
|
199
|
+
size="small"
|
|
200
|
+
sx={{
|
|
201
|
+
bgcolor: 'var(--theme-background)',
|
|
202
|
+
color: 'var(--theme-text-primary)',
|
|
203
|
+
fontFamily: 'monospace',
|
|
204
|
+
fontSize: '0.75rem',
|
|
205
|
+
}}
|
|
206
|
+
/>
|
|
207
|
+
))}
|
|
208
|
+
</Box>
|
|
209
|
+
</Box>
|
|
210
|
+
)}
|
|
211
|
+
|
|
212
|
+
{/* Menu Items */}
|
|
213
|
+
{contributions.menuItems.length > 0 && (
|
|
214
|
+
<Box>
|
|
215
|
+
<Typography variant="subtitle2" sx={{ color: 'var(--theme-text-primary)', mb: 1 }}>
|
|
216
|
+
Menu Items ({contributions.menuItems.length})
|
|
217
|
+
</Typography>
|
|
218
|
+
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
|
|
219
|
+
{contributions.menuItems.map((item) => (
|
|
220
|
+
<Chip
|
|
221
|
+
key={item.id}
|
|
222
|
+
label={`${item.label} (${item.route})`}
|
|
223
|
+
size="small"
|
|
224
|
+
sx={{ bgcolor: 'var(--theme-background)', color: 'var(--theme-text-primary)' }}
|
|
225
|
+
/>
|
|
226
|
+
))}
|
|
227
|
+
</Box>
|
|
228
|
+
</Box>
|
|
229
|
+
)}
|
|
230
|
+
|
|
231
|
+
{/* Pages */}
|
|
232
|
+
{contributions.pages.length > 0 && (
|
|
233
|
+
<Box>
|
|
234
|
+
<Typography variant="subtitle2" sx={{ color: 'var(--theme-text-primary)', mb: 1 }}>
|
|
235
|
+
Pages ({contributions.pages.length})
|
|
236
|
+
</Typography>
|
|
237
|
+
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
|
|
238
|
+
{contributions.pages.map((page) => (
|
|
239
|
+
<Chip
|
|
240
|
+
key={page.id}
|
|
241
|
+
label={`${page.title || page.id} (${page.route})`}
|
|
242
|
+
size="small"
|
|
243
|
+
sx={{ bgcolor: 'var(--theme-background)', color: 'var(--theme-text-primary)' }}
|
|
244
|
+
/>
|
|
245
|
+
))}
|
|
246
|
+
</Box>
|
|
247
|
+
</Box>
|
|
248
|
+
)}
|
|
249
|
+
|
|
250
|
+
{/* Widgets */}
|
|
251
|
+
{contributions.widgets.length > 0 && (
|
|
252
|
+
<Box>
|
|
253
|
+
<Typography variant="subtitle2" sx={{ color: 'var(--theme-text-primary)', mb: 1 }}>
|
|
254
|
+
Widgets ({contributions.widgets.length})
|
|
255
|
+
</Typography>
|
|
256
|
+
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
|
|
257
|
+
{contributions.widgets.map((widget) => (
|
|
258
|
+
<Chip
|
|
259
|
+
key={widget.id}
|
|
260
|
+
label={widget.title}
|
|
261
|
+
size="small"
|
|
262
|
+
sx={{ bgcolor: 'var(--theme-background)', color: 'var(--theme-text-primary)' }}
|
|
263
|
+
/>
|
|
264
|
+
))}
|
|
265
|
+
</Box>
|
|
266
|
+
</Box>
|
|
267
|
+
)}
|
|
268
|
+
</Box>
|
|
269
|
+
) : null}
|
|
270
|
+
</Box>
|
|
271
|
+
</Collapse>
|
|
272
|
+
</TableCell>
|
|
273
|
+
</TableRow>
|
|
274
|
+
</>
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export function PluginsPage() {
|
|
279
|
+
const [plugins, setPlugins] = useState<PluginInfo[]>([]);
|
|
280
|
+
const [loading, setLoading] = useState(true);
|
|
281
|
+
const [error, setError] = useState<string | null>(null);
|
|
282
|
+
|
|
283
|
+
useEffect(() => {
|
|
284
|
+
const fetchPlugins = async () => {
|
|
285
|
+
try {
|
|
286
|
+
const data = await api.getPlugins();
|
|
287
|
+
setPlugins(data.plugins);
|
|
288
|
+
setError(null);
|
|
289
|
+
} catch (err) {
|
|
290
|
+
setError(err instanceof Error ? err.message : 'Failed to fetch plugins');
|
|
291
|
+
} finally {
|
|
292
|
+
setLoading(false);
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
fetchPlugins();
|
|
297
|
+
}, []);
|
|
298
|
+
|
|
299
|
+
if (loading) {
|
|
300
|
+
return (
|
|
301
|
+
<Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', minHeight: '50vh' }}>
|
|
302
|
+
<CircularProgress />
|
|
303
|
+
</Box>
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if (error) {
|
|
308
|
+
return (
|
|
309
|
+
<Card sx={{ bgcolor: 'var(--theme-surface)', border: '1px solid var(--theme-error)' }}>
|
|
310
|
+
<CardContent>
|
|
311
|
+
<Typography color="error">{error}</Typography>
|
|
312
|
+
</CardContent>
|
|
313
|
+
</Card>
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// Count plugins by status
|
|
318
|
+
const activeCount = plugins.filter((p) => p.status === 'active').length;
|
|
319
|
+
const errorCount = plugins.filter((p) => p.status === 'error').length;
|
|
320
|
+
|
|
321
|
+
return (
|
|
322
|
+
<Box>
|
|
323
|
+
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 1 }}>
|
|
324
|
+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
|
|
325
|
+
<Typography variant="h4" sx={{ color: 'var(--theme-text-primary)' }}>
|
|
326
|
+
Plugins
|
|
327
|
+
</Typography>
|
|
328
|
+
<Chip
|
|
329
|
+
icon={<ExtensionIcon sx={{ fontSize: 16 }} />}
|
|
330
|
+
label={`${activeCount}/${plugins.length} active`}
|
|
331
|
+
size="small"
|
|
332
|
+
sx={{
|
|
333
|
+
bgcolor: activeCount === plugins.length ? 'var(--theme-success)20' : 'var(--theme-warning)20',
|
|
334
|
+
color: activeCount === plugins.length ? 'var(--theme-success)' : 'var(--theme-warning)',
|
|
335
|
+
}}
|
|
336
|
+
/>
|
|
337
|
+
{errorCount > 0 && (
|
|
338
|
+
<Chip
|
|
339
|
+
icon={<ErrorIcon sx={{ fontSize: 16 }} />}
|
|
340
|
+
label={`${errorCount} error${errorCount > 1 ? 's' : ''}`}
|
|
341
|
+
size="small"
|
|
342
|
+
sx={{ bgcolor: 'var(--theme-error)20', color: 'var(--theme-error)' }}
|
|
343
|
+
/>
|
|
344
|
+
)}
|
|
345
|
+
</Box>
|
|
346
|
+
</Box>
|
|
347
|
+
<Typography variant="body2" sx={{ mb: 4, color: 'var(--theme-text-secondary)' }}>
|
|
348
|
+
View registered plugins and their contributions to the control panel
|
|
349
|
+
</Typography>
|
|
350
|
+
|
|
351
|
+
{plugins.length === 0 ? (
|
|
352
|
+
<Card sx={{ bgcolor: 'var(--theme-surface)' }}>
|
|
353
|
+
<CardContent>
|
|
354
|
+
<Typography sx={{ color: 'var(--theme-text-secondary)', textAlign: 'center', py: 4 }}>
|
|
355
|
+
No plugins registered
|
|
356
|
+
</Typography>
|
|
357
|
+
</CardContent>
|
|
358
|
+
</Card>
|
|
359
|
+
) : (
|
|
360
|
+
<Card sx={{ bgcolor: 'var(--theme-surface)' }}>
|
|
361
|
+
<TableContainer>
|
|
362
|
+
<Table>
|
|
363
|
+
<TableHead>
|
|
364
|
+
<TableRow>
|
|
365
|
+
<TableCell sx={{ color: 'var(--theme-text-secondary)', borderColor: 'var(--theme-border)', width: 50 }} />
|
|
366
|
+
<TableCell sx={{ color: 'var(--theme-text-secondary)', borderColor: 'var(--theme-border)' }}>
|
|
367
|
+
Name
|
|
368
|
+
</TableCell>
|
|
369
|
+
<TableCell sx={{ color: 'var(--theme-text-secondary)', borderColor: 'var(--theme-border)' }}>
|
|
370
|
+
ID
|
|
371
|
+
</TableCell>
|
|
372
|
+
<TableCell sx={{ color: 'var(--theme-text-secondary)', borderColor: 'var(--theme-border)' }}>
|
|
373
|
+
Version
|
|
374
|
+
</TableCell>
|
|
375
|
+
<TableCell sx={{ color: 'var(--theme-text-secondary)', borderColor: 'var(--theme-border)' }}>
|
|
376
|
+
Status
|
|
377
|
+
</TableCell>
|
|
378
|
+
<TableCell sx={{ color: 'var(--theme-text-secondary)', borderColor: 'var(--theme-border)' }}>
|
|
379
|
+
Contributions
|
|
380
|
+
</TableCell>
|
|
381
|
+
</TableRow>
|
|
382
|
+
</TableHead>
|
|
383
|
+
<TableBody>
|
|
384
|
+
{plugins.map((plugin) => (
|
|
385
|
+
<PluginRow key={plugin.id} plugin={plugin} />
|
|
386
|
+
))}
|
|
387
|
+
</TableBody>
|
|
388
|
+
</Table>
|
|
389
|
+
</TableContainer>
|
|
390
|
+
</Card>
|
|
391
|
+
)}
|
|
392
|
+
</Box>
|
|
393
|
+
);
|
|
394
|
+
}
|