@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.
Files changed (299) hide show
  1. package/README.md +392 -0
  2. package/dist/core/control-panel.d.ts +7 -2
  3. package/dist/core/control-panel.d.ts.map +1 -1
  4. package/dist/core/control-panel.js +120 -54
  5. package/dist/core/control-panel.js.map +1 -1
  6. package/dist/core/gateway.d.ts +159 -79
  7. package/dist/core/gateway.d.ts.map +1 -1
  8. package/dist/core/gateway.js +679 -319
  9. package/dist/core/gateway.js.map +1 -1
  10. package/dist/core/index.d.ts +3 -1
  11. package/dist/core/index.d.ts.map +1 -1
  12. package/dist/core/index.js +2 -0
  13. package/dist/core/index.js.map +1 -1
  14. package/dist/core/plugin-registry.d.ts +307 -0
  15. package/dist/core/plugin-registry.d.ts.map +1 -0
  16. package/dist/core/plugin-registry.js +352 -0
  17. package/dist/core/plugin-registry.js.map +1 -0
  18. package/dist/core/types.d.ts +16 -33
  19. package/dist/core/types.d.ts.map +1 -1
  20. package/dist/index.d.ts +8 -5
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +15 -7
  23. package/dist/index.js.map +1 -1
  24. package/dist/plugins/auth/adapters/auth0-adapter.d.ts +14 -0
  25. package/dist/plugins/auth/adapters/auth0-adapter.d.ts.map +1 -0
  26. package/dist/plugins/auth/adapters/auth0-adapter.js +179 -0
  27. package/dist/plugins/auth/adapters/auth0-adapter.js.map +1 -0
  28. package/dist/plugins/auth/adapters/basic-adapter.d.ts +13 -0
  29. package/dist/plugins/auth/adapters/basic-adapter.d.ts.map +1 -0
  30. package/dist/plugins/auth/adapters/basic-adapter.js +51 -0
  31. package/dist/plugins/auth/adapters/basic-adapter.js.map +1 -0
  32. package/dist/plugins/auth/adapters/index.d.ts +10 -0
  33. package/dist/plugins/auth/adapters/index.d.ts.map +1 -0
  34. package/dist/plugins/auth/adapters/index.js +10 -0
  35. package/dist/plugins/auth/adapters/index.js.map +1 -0
  36. package/dist/plugins/auth/adapters/supabase-adapter.d.ts +13 -0
  37. package/dist/plugins/auth/adapters/supabase-adapter.d.ts.map +1 -0
  38. package/dist/plugins/auth/adapters/supabase-adapter.js +109 -0
  39. package/dist/plugins/auth/adapters/supabase-adapter.js.map +1 -0
  40. package/dist/plugins/auth/adapters/supertokens-adapter.d.ts +18 -0
  41. package/dist/plugins/auth/adapters/supertokens-adapter.d.ts.map +1 -0
  42. package/dist/plugins/auth/adapters/supertokens-adapter.js +267 -0
  43. package/dist/plugins/auth/adapters/supertokens-adapter.js.map +1 -0
  44. package/dist/plugins/auth/auth-plugin.d.ts +40 -0
  45. package/dist/plugins/auth/auth-plugin.d.ts.map +1 -0
  46. package/dist/plugins/auth/auth-plugin.js +255 -0
  47. package/dist/plugins/auth/auth-plugin.js.map +1 -0
  48. package/dist/plugins/auth/auth-plugin.test.d.ts +9 -0
  49. package/dist/plugins/auth/auth-plugin.test.d.ts.map +1 -0
  50. package/dist/plugins/auth/auth-plugin.test.js +147 -0
  51. package/dist/plugins/auth/auth-plugin.test.js.map +1 -0
  52. package/dist/plugins/auth/env-config.d.ts +88 -0
  53. package/dist/plugins/auth/env-config.d.ts.map +1 -0
  54. package/dist/plugins/auth/env-config.js +489 -0
  55. package/dist/plugins/auth/env-config.js.map +1 -0
  56. package/dist/plugins/auth/index.d.ts +14 -0
  57. package/dist/plugins/auth/index.d.ts.map +1 -0
  58. package/dist/plugins/auth/index.js +16 -0
  59. package/dist/plugins/auth/index.js.map +1 -0
  60. package/dist/plugins/auth/supertokens-adapter.test.d.ts +10 -0
  61. package/dist/plugins/auth/supertokens-adapter.test.d.ts.map +1 -0
  62. package/dist/plugins/auth/supertokens-adapter.test.js +486 -0
  63. package/dist/plugins/auth/supertokens-adapter.test.js.map +1 -0
  64. package/dist/plugins/auth/types.d.ts +218 -0
  65. package/dist/plugins/auth/types.d.ts.map +1 -0
  66. package/dist/plugins/auth/types.js +14 -0
  67. package/dist/plugins/auth/types.js.map +1 -0
  68. package/dist/plugins/bans/bans-plugin.d.ts +59 -0
  69. package/dist/plugins/bans/bans-plugin.d.ts.map +1 -0
  70. package/dist/plugins/bans/bans-plugin.js +428 -0
  71. package/dist/plugins/bans/bans-plugin.js.map +1 -0
  72. package/dist/plugins/bans/index.d.ts +9 -0
  73. package/dist/plugins/bans/index.d.ts.map +1 -0
  74. package/dist/plugins/bans/index.js +10 -0
  75. package/dist/plugins/bans/index.js.map +1 -0
  76. package/dist/plugins/bans/stores/index.d.ts +7 -0
  77. package/dist/plugins/bans/stores/index.d.ts.map +1 -0
  78. package/dist/plugins/bans/stores/index.js +7 -0
  79. package/dist/plugins/bans/stores/index.js.map +1 -0
  80. package/dist/plugins/bans/stores/postgres-store.d.ts +29 -0
  81. package/dist/plugins/bans/stores/postgres-store.d.ts.map +1 -0
  82. package/dist/plugins/bans/stores/postgres-store.js +132 -0
  83. package/dist/plugins/bans/stores/postgres-store.js.map +1 -0
  84. package/dist/plugins/bans/types.d.ts +128 -0
  85. package/dist/plugins/bans/types.d.ts.map +1 -0
  86. package/dist/plugins/bans/types.js +11 -0
  87. package/dist/plugins/bans/types.js.map +1 -0
  88. package/dist/plugins/cache-plugin.d.ts +14 -3
  89. package/dist/plugins/cache-plugin.d.ts.map +1 -1
  90. package/dist/plugins/cache-plugin.js +27 -7
  91. package/dist/plugins/cache-plugin.js.map +1 -1
  92. package/dist/plugins/cache-plugin.test.js +99 -32
  93. package/dist/plugins/cache-plugin.test.js.map +1 -1
  94. package/dist/plugins/config-plugin.d.ts +3 -2
  95. package/dist/plugins/config-plugin.d.ts.map +1 -1
  96. package/dist/plugins/config-plugin.js +17 -10
  97. package/dist/plugins/config-plugin.js.map +1 -1
  98. package/dist/plugins/diagnostics-plugin.d.ts +2 -2
  99. package/dist/plugins/diagnostics-plugin.d.ts.map +1 -1
  100. package/dist/plugins/diagnostics-plugin.js +17 -10
  101. package/dist/plugins/diagnostics-plugin.js.map +1 -1
  102. package/dist/plugins/entitlements/entitlements-plugin.d.ts +95 -0
  103. package/dist/plugins/entitlements/entitlements-plugin.d.ts.map +1 -0
  104. package/dist/plugins/entitlements/entitlements-plugin.js +707 -0
  105. package/dist/plugins/entitlements/entitlements-plugin.js.map +1 -0
  106. package/dist/plugins/entitlements/index.d.ts +12 -0
  107. package/dist/plugins/entitlements/index.d.ts.map +1 -0
  108. package/dist/plugins/entitlements/index.js +16 -0
  109. package/dist/plugins/entitlements/index.js.map +1 -0
  110. package/dist/plugins/entitlements/sources/index.d.ts +9 -0
  111. package/dist/plugins/entitlements/sources/index.d.ts.map +1 -0
  112. package/dist/plugins/entitlements/sources/index.js +9 -0
  113. package/dist/plugins/entitlements/sources/index.js.map +1 -0
  114. package/dist/plugins/entitlements/sources/postgres-source.d.ts +29 -0
  115. package/dist/plugins/entitlements/sources/postgres-source.d.ts.map +1 -0
  116. package/dist/plugins/entitlements/sources/postgres-source.js +169 -0
  117. package/dist/plugins/entitlements/sources/postgres-source.js.map +1 -0
  118. package/dist/plugins/entitlements/types.d.ts +232 -0
  119. package/dist/plugins/entitlements/types.d.ts.map +1 -0
  120. package/dist/plugins/entitlements/types.js +11 -0
  121. package/dist/plugins/entitlements/types.js.map +1 -0
  122. package/dist/plugins/frontend-app-plugin.d.ts +9 -3
  123. package/dist/plugins/frontend-app-plugin.d.ts.map +1 -1
  124. package/dist/plugins/frontend-app-plugin.js +14 -9
  125. package/dist/plugins/frontend-app-plugin.js.map +1 -1
  126. package/dist/plugins/health-plugin.d.ts +5 -2
  127. package/dist/plugins/health-plugin.d.ts.map +1 -1
  128. package/dist/plugins/health-plugin.js +20 -5
  129. package/dist/plugins/health-plugin.js.map +1 -1
  130. package/dist/plugins/index.d.ts +10 -2
  131. package/dist/plugins/index.d.ts.map +1 -1
  132. package/dist/plugins/index.js +10 -2
  133. package/dist/plugins/index.js.map +1 -1
  134. package/dist/plugins/logs-plugin.d.ts +3 -2
  135. package/dist/plugins/logs-plugin.d.ts.map +1 -1
  136. package/dist/plugins/logs-plugin.js +21 -12
  137. package/dist/plugins/logs-plugin.js.map +1 -1
  138. package/dist/plugins/postgres-plugin.d.ts +3 -3
  139. package/dist/plugins/postgres-plugin.d.ts.map +1 -1
  140. package/dist/plugins/postgres-plugin.js +9 -7
  141. package/dist/plugins/postgres-plugin.js.map +1 -1
  142. package/dist/plugins/postgres-plugin.test.js +50 -29
  143. package/dist/plugins/postgres-plugin.test.js.map +1 -1
  144. package/dist/plugins/preferences/__tests__/deep-merge.test.d.ts +7 -0
  145. package/dist/plugins/preferences/__tests__/deep-merge.test.d.ts.map +1 -0
  146. package/dist/plugins/preferences/__tests__/deep-merge.test.js +215 -0
  147. package/dist/plugins/preferences/__tests__/deep-merge.test.js.map +1 -0
  148. package/dist/plugins/preferences/__tests__/preferences-plugin.test.d.ts +7 -0
  149. package/dist/plugins/preferences/__tests__/preferences-plugin.test.d.ts.map +1 -0
  150. package/dist/plugins/preferences/__tests__/preferences-plugin.test.js +265 -0
  151. package/dist/plugins/preferences/__tests__/preferences-plugin.test.js.map +1 -0
  152. package/dist/plugins/preferences/index.d.ts +12 -0
  153. package/dist/plugins/preferences/index.d.ts.map +1 -0
  154. package/dist/plugins/preferences/index.js +13 -0
  155. package/dist/plugins/preferences/index.js.map +1 -0
  156. package/dist/plugins/preferences/preferences-plugin.d.ts +39 -0
  157. package/dist/plugins/preferences/preferences-plugin.d.ts.map +1 -0
  158. package/dist/plugins/preferences/preferences-plugin.js +226 -0
  159. package/dist/plugins/preferences/preferences-plugin.js.map +1 -0
  160. package/dist/plugins/preferences/stores/index.d.ts +9 -0
  161. package/dist/plugins/preferences/stores/index.d.ts.map +1 -0
  162. package/dist/plugins/preferences/stores/index.js +9 -0
  163. package/dist/plugins/preferences/stores/index.js.map +1 -0
  164. package/dist/plugins/preferences/stores/postgres-store.d.ts +41 -0
  165. package/dist/plugins/preferences/stores/postgres-store.d.ts.map +1 -0
  166. package/dist/plugins/preferences/stores/postgres-store.js +181 -0
  167. package/dist/plugins/preferences/stores/postgres-store.js.map +1 -0
  168. package/dist/plugins/preferences/types.d.ts +91 -0
  169. package/dist/plugins/preferences/types.d.ts.map +1 -0
  170. package/dist/plugins/preferences/types.js +10 -0
  171. package/dist/plugins/preferences/types.js.map +1 -0
  172. package/dist/plugins/users/__tests__/users-plugin.test.d.ts +9 -0
  173. package/dist/plugins/users/__tests__/users-plugin.test.d.ts.map +1 -0
  174. package/dist/plugins/users/__tests__/users-plugin.test.js +546 -0
  175. package/dist/plugins/users/__tests__/users-plugin.test.js.map +1 -0
  176. package/dist/plugins/users/index.d.ts +12 -0
  177. package/dist/plugins/users/index.d.ts.map +1 -0
  178. package/dist/plugins/users/index.js +13 -0
  179. package/dist/plugins/users/index.js.map +1 -0
  180. package/dist/plugins/users/stores/index.d.ts +7 -0
  181. package/dist/plugins/users/stores/index.d.ts.map +1 -0
  182. package/dist/plugins/users/stores/index.js +7 -0
  183. package/dist/plugins/users/stores/index.js.map +1 -0
  184. package/dist/plugins/users/stores/postgres-store.d.ts +28 -0
  185. package/dist/plugins/users/stores/postgres-store.d.ts.map +1 -0
  186. package/dist/plugins/users/stores/postgres-store.js +157 -0
  187. package/dist/plugins/users/stores/postgres-store.js.map +1 -0
  188. package/dist/plugins/users/types.d.ts +225 -0
  189. package/dist/plugins/users/types.d.ts.map +1 -0
  190. package/dist/plugins/users/types.js +12 -0
  191. package/dist/plugins/users/types.js.map +1 -0
  192. package/dist/plugins/users/users-plugin.d.ts +45 -0
  193. package/dist/plugins/users/users-plugin.d.ts.map +1 -0
  194. package/dist/plugins/users/users-plugin.js +359 -0
  195. package/dist/plugins/users/users-plugin.js.map +1 -0
  196. package/dist-ui/assets/index-BY8OxNgO.js +465 -0
  197. package/dist-ui/assets/index-BY8OxNgO.js.map +1 -0
  198. package/dist-ui/index.html +1 -1
  199. package/dist-ui-lib/api/controlPanelApi.d.ts +278 -0
  200. package/dist-ui-lib/components/ControlPanelApp.d.ts +61 -0
  201. package/dist-ui-lib/components/index.d.ts +18 -0
  202. package/dist-ui-lib/config/AppConfig.d.ts +7 -0
  203. package/dist-ui-lib/dashboard/DashboardWidgetRegistry.d.ts +62 -0
  204. package/dist-ui-lib/dashboard/DashboardWidgetRenderer.d.ts +8 -0
  205. package/dist-ui-lib/dashboard/PluginWidgetRenderer.d.ts +19 -0
  206. package/dist-ui-lib/dashboard/WidgetComponentRegistry.d.ts +48 -0
  207. package/dist-ui-lib/dashboard/builtInWidgets.d.ts +25 -0
  208. package/dist-ui-lib/dashboard/index.d.ts +13 -0
  209. package/dist-ui-lib/dashboard/widgets/ServiceHealthWidget.d.ts +12 -0
  210. package/dist-ui-lib/dashboard/widgets/index.d.ts +6 -0
  211. package/dist-ui-lib/index.js +5172 -0
  212. package/dist-ui-lib/index.js.map +1 -0
  213. package/dist-ui-lib/pages/AuthPage.d.ts +1 -0
  214. package/dist-ui-lib/pages/ConfigPage.d.ts +1 -0
  215. package/dist-ui-lib/pages/DashboardPage.d.ts +1 -0
  216. package/dist-ui-lib/pages/DiagnosticsPage.d.ts +1 -0
  217. package/dist-ui-lib/pages/EntitlementsPage.d.ts +17 -0
  218. package/dist-ui-lib/pages/LogsPage.d.ts +1 -0
  219. package/dist-ui-lib/pages/NotFoundPage.d.ts +1 -0
  220. package/dist-ui-lib/pages/PluginPage.d.ts +15 -0
  221. package/dist-ui-lib/pages/PluginsPage.d.ts +1 -0
  222. package/dist-ui-lib/pages/SystemPage.d.ts +1 -0
  223. package/dist-ui-lib/pages/UsersPage.d.ts +22 -0
  224. package/package.json +24 -7
  225. package/src/core/control-panel.ts +145 -61
  226. package/src/core/gateway.ts +863 -403
  227. package/src/core/index.ts +21 -2
  228. package/src/core/plugin-registry.ts +716 -0
  229. package/src/core/types.ts +31 -37
  230. package/src/index.ts +125 -19
  231. package/src/plugins/auth/adapters/auth0-adapter.ts +214 -0
  232. package/src/plugins/auth/adapters/basic-adapter.ts +61 -0
  233. package/src/plugins/auth/adapters/index.ts +10 -0
  234. package/src/plugins/auth/adapters/supabase-adapter.ts +149 -0
  235. package/src/plugins/auth/adapters/supertokens-adapter.ts +326 -0
  236. package/src/plugins/auth/auth-plugin.test.ts +176 -0
  237. package/src/plugins/auth/auth-plugin.ts +303 -0
  238. package/src/plugins/auth/env-config.ts +572 -0
  239. package/src/plugins/auth/index.ts +42 -0
  240. package/src/plugins/auth/supertokens-adapter.test.ts +621 -0
  241. package/src/plugins/auth/types.ts +245 -0
  242. package/src/plugins/bans/bans-plugin.ts +485 -0
  243. package/src/plugins/bans/index.ts +31 -0
  244. package/src/plugins/bans/stores/index.ts +7 -0
  245. package/src/plugins/bans/stores/postgres-store.ts +195 -0
  246. package/src/plugins/bans/types.ts +141 -0
  247. package/src/plugins/cache-plugin.test.ts +108 -32
  248. package/src/plugins/cache-plugin.ts +40 -9
  249. package/src/plugins/config-plugin.ts +23 -12
  250. package/src/plugins/diagnostics-plugin.ts +22 -12
  251. package/src/plugins/entitlements/entitlements-plugin.ts +820 -0
  252. package/src/plugins/entitlements/index.ts +51 -0
  253. package/src/plugins/entitlements/sources/index.ts +9 -0
  254. package/src/plugins/entitlements/sources/postgres-source.ts +253 -0
  255. package/src/plugins/entitlements/types.ts +256 -0
  256. package/src/plugins/frontend-app-plugin.ts +24 -12
  257. package/src/plugins/health-plugin.ts +27 -7
  258. package/src/plugins/index.ts +132 -4
  259. package/src/plugins/logs-plugin.ts +28 -14
  260. package/src/plugins/postgres-plugin.test.ts +52 -29
  261. package/src/plugins/postgres-plugin.ts +11 -9
  262. package/src/plugins/preferences/__tests__/deep-merge.test.ts +242 -0
  263. package/src/plugins/preferences/__tests__/preferences-plugin.test.ts +350 -0
  264. package/src/plugins/preferences/index.ts +30 -0
  265. package/src/plugins/preferences/preferences-plugin.ts +270 -0
  266. package/src/plugins/preferences/stores/index.ts +9 -0
  267. package/src/plugins/preferences/stores/postgres-store.ts +252 -0
  268. package/src/plugins/preferences/types.ts +100 -0
  269. package/src/plugins/users/__tests__/users-plugin.test.ts +690 -0
  270. package/src/plugins/users/index.ts +38 -0
  271. package/src/plugins/users/stores/index.ts +7 -0
  272. package/src/plugins/users/stores/postgres-store.ts +225 -0
  273. package/src/plugins/users/types.ts +247 -0
  274. package/src/plugins/users/users-plugin.ts +418 -0
  275. package/ui/src/App.tsx +188 -31
  276. package/ui/src/api/controlPanelApi.ts +453 -1
  277. package/ui/src/components/ControlPanelApp.tsx +212 -0
  278. package/ui/src/components/index.ts +62 -0
  279. package/ui/src/dashboard/DashboardWidgetRegistry.tsx +129 -0
  280. package/ui/src/dashboard/DashboardWidgetRenderer.tsx +34 -0
  281. package/ui/src/dashboard/PluginWidgetRenderer.tsx +118 -0
  282. package/ui/src/dashboard/WidgetComponentRegistry.tsx +120 -0
  283. package/ui/src/dashboard/builtInWidgets.tsx +35 -0
  284. package/ui/src/dashboard/index.ts +35 -0
  285. package/ui/src/dashboard/widgets/ServiceHealthWidget.tsx +140 -0
  286. package/ui/src/dashboard/widgets/index.ts +7 -0
  287. package/ui/src/pages/AuthPage.tsx +259 -0
  288. package/ui/src/pages/DashboardPage.tsx +28 -149
  289. package/ui/src/pages/EntitlementsPage.tsx +557 -0
  290. package/ui/src/pages/LogsPage.tsx +174 -8
  291. package/ui/src/pages/PluginPage.tsx +148 -0
  292. package/ui/src/pages/PluginsPage.tsx +394 -0
  293. package/ui/src/pages/SystemPage.tsx +445 -0
  294. package/ui/src/pages/UsersPage.tsx +837 -0
  295. package/ui/tsconfig.lib.json +11 -0
  296. package/ui/vite.lib.config.ts +56 -0
  297. package/dist-ui/assets/index-CW1BviRn.js +0 -465
  298. package/dist-ui/assets/index-CW1BviRn.js.map +0 -1
  299. 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
- <CardContent sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
131
- <Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
132
- {getStatusIcon(health?.status || 'unknown')}
133
- <Box>
134
- <Typography variant="h6" sx={{ color: 'var(--theme-text-primary)' }}>
135
- Service Status: {health?.status?.charAt(0).toUpperCase()}{health?.status?.slice(1)}
136
- </Typography>
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
- Health Checks
121
+ Click to view detailed health information
177
122
  </Typography>
178
123
  </Box>
179
- <Typography variant="h4" sx={{ color: 'var(--theme-success)' }}>
180
- {healthyCount}/{totalCount}
181
- </Typography>
182
- </CardContent>
183
- </Card>
184
- </Grid>
185
-
186
- <Grid size={{ xs: 12, sm: 6, md: 3 }}>
187
- <Card sx={{ bgcolor: 'var(--theme-surface)', height: '100%' }}>
188
- <CardContent>
189
- <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 2 }}>
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
- <Grid size={{ xs: 12, sm: 6, md: 3 }}>
203
- <Card sx={{ bgcolor: 'var(--theme-surface)', height: '100%' }}>
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
- {/* Health Checks Detail */}
220
- <Card sx={{ bgcolor: 'var(--theme-surface)' }}>
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
  }