@alepha/ui 0.17.1 → 0.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/{AdminParameters-iQE8o7a7.js → AdminParameters-DCGbpt2c.js} +1 -1
- package/dist/admin/{AdminParameters-iQE8o7a7.js.map → AdminParameters-DCGbpt2c.js.map} +1 -1
- package/dist/admin/{AdminSessions-oKJCbd7w.js → AdminSessions-DyhW6RZv.js} +1 -1
- package/dist/admin/{AdminSessions-oKJCbd7w.js.map → AdminSessions-DyhW6RZv.js.map} +1 -1
- package/dist/admin/{AdminUserAudits-BNCEle_E.js → AdminUserAudits-D1GcREEE.js} +1 -1
- package/dist/admin/{AdminUserAudits-BNCEle_E.js.map → AdminUserAudits-D1GcREEE.js.map} +1 -1
- package/dist/admin/{AdminUserCreate-CgqeFwCt.js → AdminUserCreate-DR8LA0tv.js} +1 -1
- package/dist/admin/{AdminUserCreate-CgqeFwCt.js.map → AdminUserCreate-DR8LA0tv.js.map} +1 -1
- package/dist/admin/{AdminUserDetails-DDe1A1GP.js → AdminUserDetails-CDkZNHQD.js} +1 -1
- package/dist/admin/{AdminUserDetails-DDe1A1GP.js.map → AdminUserDetails-CDkZNHQD.js.map} +1 -1
- package/dist/admin/{AdminUserLayout-HAlobhWf.js → AdminUserLayout-CrBj4UuI.js} +1 -1
- package/dist/admin/{AdminUserLayout-HAlobhWf.js.map → AdminUserLayout-CrBj4UuI.js.map} +1 -1
- package/dist/admin/{AdminUserSessions-Bq1LnVLf.js → AdminUserSessions-srgFHrqy.js} +1 -1
- package/dist/admin/{AdminUserSessions-Bq1LnVLf.js.map → AdminUserSessions-srgFHrqy.js.map} +1 -1
- package/dist/admin/{AdminUserSettings-BRsBZoxV.js → AdminUserSettings-BFuxl-xT.js} +1 -1
- package/dist/admin/{AdminUserSettings-BRsBZoxV.js.map → AdminUserSettings-BFuxl-xT.js.map} +1 -1
- package/dist/admin/{AdminUsers-D71kIOSn.js → AdminUsers-D1pDpiwK.js} +1 -1
- package/dist/admin/{AdminUsers-D71kIOSn.js.map → AdminUsers-D1pDpiwK.js.map} +1 -1
- package/dist/admin/index.d.ts +1 -4
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +11 -26
- package/dist/admin/index.js.map +1 -1
- package/package.json +3 -3
- package/src/admin/AdminRouter.ts +2 -22
- package/src/admin/index.ts +1 -1
- package/dist/admin/AdminNotifications-DeHJFf6W.js +0 -153
- package/dist/admin/AdminNotifications-DeHJFf6W.js.map +0 -1
- package/src/admin/components/notifications/AdminNotifications.tsx +0 -204
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminUserSessions-
|
|
1
|
+
{"version":3,"file":"AdminUserSessions-srgFHrqy.js","names":[],"sources":["../../src/admin/components/users/AdminUserSessions.tsx"],"sourcesContent":["import { ActionButton, DataTable, Flex, Text } from \"@alepha/ui\";\nimport { Badge } from \"@mantine/core\";\nimport {\n IconDeviceDesktop,\n IconDeviceMobile,\n IconDeviceTablet,\n IconTrash,\n} from \"@tabler/icons-react\";\nimport { type Page, t } from \"alepha\";\nimport type { AdminSessionController, SessionEntity } from \"alepha/api/users\";\nimport { useClient } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useRouterState } from \"alepha/react/router\";\nimport { useState } from \"react\";\n\nexport interface AdminUserSessionsProps {\n userRealmName?: string;\n}\n\nconst AdminUserSessions = (props: AdminUserSessionsProps) => {\n const state = useRouterState();\n const client = useClient<AdminSessionController>();\n const { l } = useI18n();\n const userId = state.params.userId as string;\n const [refreshKey, setRefreshKey] = useState(0);\n\n const getDeviceIcon = (device?: string) => {\n switch (device) {\n case \"MOBILE\":\n return <IconDeviceMobile size={14} />;\n case \"TABLET\":\n return <IconDeviceTablet size={14} />;\n default:\n return <IconDeviceDesktop size={14} />;\n }\n };\n\n const isExpired = (expiresAt: Date | string) => {\n return new Date(expiresAt) < new Date();\n };\n\n const handleDelete = async (sessionId: string) => {\n await client.deleteSession({\n params: { id: sessionId },\n query: { userRealmName: props.userRealmName },\n });\n setRefreshKey((k) => k + 1);\n };\n\n const filters = t.object({});\n\n return (\n <Flex flex={1} direction=\"column\">\n <DataTable<SessionEntity, typeof filters>\n key={refreshKey}\n submitOnInit\n defaultSize={10}\n filters={filters}\n tableProps={{\n horizontalSpacing: \"xs\",\n verticalSpacing: \"xs\",\n }}\n tableTrProps={(item) => {\n if (isExpired(item.expiresAt)) {\n return {\n opacity: 0.5,\n };\n }\n return {};\n }}\n items={async (filters) => {\n const response = await client.findSessions({\n query: {\n ...filters,\n userId,\n userRealmName: props.userRealmName,\n },\n });\n\n return response as Page<SessionEntity>;\n }}\n columns={{\n userAgent: {\n label: \"Device\",\n value: (item) => (\n <Flex gap={4}>\n {item.userAgent ? (\n <>\n <Badge\n size=\"xs\"\n variant=\"light\"\n leftSection={getDeviceIcon(item.userAgent.device)}\n >\n {item.userAgent.device}\n </Badge>\n <Text size=\"xs\" c=\"dimmed\">\n {item.userAgent.browser} / {item.userAgent.os}\n </Text>\n </>\n ) : (\n <Text size=\"xs\" c=\"dimmed\">\n -\n </Text>\n )}\n </Flex>\n ),\n },\n ip: {\n label: \"IP Address\",\n fit: true,\n value: (item) => (\n <Text size=\"xs\" ff=\"monospace\" c=\"dimmed\">\n {item.ip || \"-\"}\n </Text>\n ),\n },\n expiresAt: {\n label: \"Status\",\n fit: true,\n value: (item) => (\n <Badge\n size=\"sm\"\n variant=\"light\"\n color={isExpired(item.expiresAt) ? \"red\" : \"green\"}\n >\n {isExpired(item.expiresAt) ? \"Expired\" : \"Active\"}\n </Badge>\n ),\n },\n createdAt: {\n label: \"Created\",\n fit: true,\n value: (item) => (\n <Text size=\"xs\" c=\"dimmed\">\n {l(item.createdAt, { date: \"fromNow\" })}\n </Text>\n ),\n },\n actions: {\n label: \"\",\n fit: true,\n value: (item) => (\n <ActionButton\n size=\"xs\"\n variant=\"subtle\"\n color=\"red\"\n onClick={() => handleDelete(item.id)}\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AAa,cAAc,KAAK,UAAU,OAAO;iBAEhD,KAAK,UAAU;QACV,EACR,qBAAC;OAAK,MAAK;OAAK,GAAE;;QACf,KAAK,UAAU;QAAQ;QAAI,KAAK,UAAU;;QACtC,IACN,GAEH,oBAAC;OAAK,MAAK;OAAK,GAAE;iBAAS;QAEpB;OAEJ;KAEV;IACD,IAAI;KACF,OAAO;KACP,KAAK;KACL,QAAQ,SACN,oBAAC;MAAK,MAAK;MAAK,IAAG;MAAY,GAAE;gBAC9B,KAAK,MAAM;OACP;KAEV;IACD,WAAW;KACT,OAAO;KACP,KAAK;KACL,QAAQ,SACN,oBAAC;MACC,MAAK;MACL,SAAQ;MACR,OAAO,UAAU,KAAK,UAAU,GAAG,QAAQ;gBAE1C,UAAU,KAAK,UAAU,GAAG,YAAY;OACnC;KAEX;IACD,WAAW;KACT,OAAO;KACP,KAAK;KACL,QAAQ,SACN,oBAAC;MAAK,MAAK;MAAK,GAAE;gBACf,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;OAClC;KAEV;IACD,SAAS;KACP,OAAO;KACP,KAAK;KACL,QAAQ,SACN,oBAAC;MACC,MAAK;MACL,SAAQ;MACR,OAAM;MACN,eAAe,aAAa,KAAK,GAAG;gBAEpC,oBAAC,aAAU,MAAM,KAAM;OACV;KAElB;IACF;KAlGI,WAmGL;GACG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminUserSettings-
|
|
1
|
+
{"version":3,"file":"AdminUserSettings-BFuxl-xT.js","names":[],"sources":["../../src/admin/components/users/AdminUserSettings.tsx"],"sourcesContent":["import { ActionButton, Flex, Text } from \"@alepha/ui\";\nimport { Alert, Card, Loader } from \"@mantine/core\";\nimport {\n IconAlertCircle,\n IconCheck,\n IconMail,\n IconTrash,\n} from \"@tabler/icons-react\";\nimport type {\n AdminUserController,\n UserController,\n UserEntity,\n} from \"alepha/api/users\";\nimport { useClient } from \"alepha/react\";\nimport { useRouter, useRouterState } from \"alepha/react/router\";\nimport { useEffect, useState } from \"react\";\nimport type { AdminRouter } from \"../../AdminRouter.ts\";\n\nexport interface AdminUserSettingsProps {\n userRealmName?: string;\n}\n\nconst AdminUserSettings = (props: AdminUserSettingsProps) => {\n const router = useRouter<AdminRouter>();\n const state = useRouterState();\n const adminClient = useClient<AdminUserController>();\n const userClient = useClient<UserController>();\n const userId = state.params.userId as string;\n\n const [user, setUser] = useState<UserEntity | null>(null);\n const [loading, setLoading] = useState(true);\n const [deleteLoading, setDeleteLoading] = useState(false);\n const [verifyLoading, setVerifyLoading] = useState(false);\n const [verifySuccess, setVerifySuccess] = useState(false);\n\n useEffect(() => {\n const loadUser = async () => {\n try {\n const data = await adminClient.getUser({\n params: { id: userId },\n query: { userRealmName: props.userRealmName },\n });\n setUser(data);\n } finally {\n setLoading(false);\n }\n };\n\n loadUser();\n }, [userId]);\n\n const handleDelete = async () => {\n if (!confirm(\"Are you sure you want to delete this user?\")) {\n return;\n }\n\n setDeleteLoading(true);\n try {\n await adminClient.deleteUser({\n params: { id: userId },\n query: { userRealmName: props.userRealmName },\n });\n await router.push(\"adminUsers\");\n } finally {\n setDeleteLoading(false);\n }\n };\n\n const handleTriggerEmailVerification = async () => {\n if (!user?.email) return;\n\n setVerifyLoading(true);\n setVerifySuccess(false);\n try {\n await userClient.requestEmailVerification({\n query: {\n userRealmName: props.userRealmName,\n method: \"link\",\n verifyUrl: `${window.location.origin}/auth/verify-email`,\n },\n body: { email: user.email },\n });\n setVerifySuccess(true);\n } finally {\n setVerifyLoading(false);\n }\n };\n\n if (loading) {\n return (\n <Flex flex={1} justify=\"center\" align=\"center\">\n <Loader />\n </Flex>\n );\n }\n\n if (!user) {\n return (\n <Flex flex={1} justify=\"center\" align=\"center\">\n <Text c=\"dimmed\">User not found</Text>\n </Flex>\n );\n }\n\n return (\n <Flex flex={1} direction=\"column\" gap=\"md\">\n {user.email && !user.emailVerified && (\n <Card withBorder p=\"lg\">\n <Flex direction=\"column\" gap=\"md\">\n <Text size=\"lg\" fw={500}>\n Email Verification\n </Text>\n\n <Alert variant=\"light\" color=\"yellow\" icon={<IconMail />}>\n <Text size=\"sm\">\n This user's email ({user.email}) is not verified. You can send a\n verification link to the user.\n </Text>\n </Alert>\n\n {verifySuccess && (\n <Alert variant=\"light\" color=\"green\" icon={<IconCheck />}>\n <Text size=\"sm\">\n Verification link sent successfully to {user.email}.\n </Text>\n </Alert>\n )}\n\n <Flex>\n <ActionButton\n leftSection={<IconMail size={16} />}\n loading={verifyLoading}\n onClick={handleTriggerEmailVerification}\n >\n Send Verification Link\n </ActionButton>\n </Flex>\n </Flex>\n </Card>\n )}\n\n <Card withBorder p=\"lg\">\n <Flex direction=\"column\" gap=\"md\">\n <Text size=\"lg\" fw={500} c=\"red\">\n Danger Zone\n </Text>\n\n <Alert variant=\"light\" color=\"red\" icon={<IconAlertCircle />}>\n <Text size=\"sm\">\n Deleting this user will permanently remove their account and all\n associated data. This action cannot be undone.\n </Text>\n </Alert>\n\n <Flex>\n <ActionButton\n color=\"red\"\n leftSection={<IconTrash size={16} />}\n loading={deleteLoading}\n onClick={handleDelete}\n >\n Delete User\n </ActionButton>\n </Flex>\n </Flex>\n </Card>\n </Flex>\n );\n};\n\nexport default AdminUserSettings;\n"],"mappings":";;;;;;;;;AAsBA,MAAM,qBAAqB,UAAkC;CAC3D,MAAM,SAAS,WAAwB;CACvC,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,cAAc,WAAgC;CACpD,MAAM,aAAa,WAA2B;CAC9C,MAAM,SAAS,MAAM,OAAO;CAE5B,MAAM,CAAC,MAAM,WAAW,SAA4B,KAAK;CACzD,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,CAAC,eAAe,oBAAoB,SAAS,MAAM;CACzD,MAAM,CAAC,eAAe,oBAAoB,SAAS,MAAM;CACzD,MAAM,CAAC,eAAe,oBAAoB,SAAS,MAAM;AAEzD,iBAAgB;EACd,MAAM,WAAW,YAAY;AAC3B,OAAI;AAKF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D,qBAAC;OAAK,MAAK;;QAAK;QACM,KAAK;QAAM;;QAE1B;OACD;KAEP,iBACC,oBAAC;MAAM,SAAQ;MAAQ,OAAM;MAAQ,MAAM,oBAAC,cAAY;gBACtD,qBAAC;OAAK,MAAK;;QAAK;QAC0B,KAAK;QAAM;;QAC9C;OACD;KAGV,oBAAC,kBACC,oBAAC;MACC,aAAa,oBAAC,YAAS,MAAM,KAAM;MACnC,SAAS;MACT,SAAS;gBACV;OAEc,GACV;;KACF;IACF,EAGT,oBAAC;GAAK;GAAW,GAAE;aACjB,qBAAC;IAAK,WAAU;IAAS,KAAI;;KAC3B,oBAAC;MAAK,MAAK;MAAK,IAAI;MAAK,GAAE;gBAAM;OAE1B;KAEP,oBAAC;MAAM,SAAQ;MAAQ,OAAM;MAAM,MAAM,oBAAC,oBAAkB;gBAC1D,oBAAC;OAAK,MAAK;iBAAK;QAGT;OACD;KAER,oBAAC,kBACC,oBAAC;MACC,OAAM;MACN,aAAa,oBAAC,aAAU,MAAM,KAAM;MACpC,SAAS;MACT,SAAS;gBACV;OAEc,GACV;;KACF;IACF;GACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminUsers-
|
|
1
|
+
{"version":3,"file":"AdminUsers-D1pDpiwK.js","names":["Flex"],"sources":["../../src/admin/components/users/AdminUsers.tsx"],"sourcesContent":["import { DataTable, Text } from \"@alepha/ui\";\nimport { Badge, Flex } from \"@mantine/core\";\nimport { IconCheck, IconUsersPlus, IconX } from \"@tabler/icons-react\";\nimport { type Page, t } from \"alepha\";\nimport {\n type AdminUserController,\n type UserEntity,\n users,\n} from \"alepha/api/users\";\nimport { useClient } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useRouter } from \"alepha/react/router\";\nimport type { AdminRouter } from \"../../AdminRouter.ts\";\n\nexport interface AdminUsersProps {\n userRealmName?: string;\n}\n\nconst AdminUsers = (props: AdminUsersProps) => {\n const client = useClient<AdminUserController>();\n const router = useRouter<AdminRouter>();\n const { l } = useI18n();\n\n const filters = t.object({\n query: t.optional(\n t.string({\n $control: {\n query: t.omit(users.schema, [\"id\", \"version\"]),\n },\n }),\n ),\n });\n\n return (\n <Flex flex={1} direction=\"column\">\n <DataTable<UserEntity, typeof filters>\n submitOnInit\n actions={[\n {\n icon: IconUsersPlus,\n href: router.path(\"adminUserCreate\"),\n label: \"Create User\",\n },\n ]}\n defaultSize={10}\n typeFormProps={{\n skipSubmitButton: true,\n columns: 3,\n }}\n tableProps={{\n horizontalSpacing: \"xs\",\n verticalSpacing: \"xs\",\n striped: false,\n highlightOnHover: true,\n }}\n onFilterChange={(key, value, form) => {\n if (key === \"query\") {\n return form.submit();\n }\n }}\n filters={filters}\n tableTrProps={(item) => {\n const baseProps: Record<string, any> = {\n style: { cursor: \"pointer\" },\n onClick: () =>\n router.push(\"adminUserDetails\", {\n params: { userId: item.id },\n }),\n };\n\n if (!item.enabled) {\n baseProps.opacity = 0.5;\n }\n\n return baseProps;\n }}\n items={async (filters) => {\n const response = await client.findUsers({\n query: {\n ...filters,\n userRealmName: props.userRealmName,\n },\n });\n\n return response as Page<UserEntity>;\n }}\n columns={{\n username: {\n label: \"Username\",\n value: (item) => (\n <Text size=\"sm\" fw={500}>\n {item.username || \"-\"}\n </Text>\n ),\n },\n email: {\n label: \"Email\",\n value: (item) => (\n <Flex gap=\"xs\">\n <Text size=\"sm\">{item.email || \"-\"}</Text>\n {item.email && (\n <Badge\n size=\"xs\"\n variant=\"light\"\n color={item.emailVerified ? \"green\" : \"gray\"}\n leftSection={\n item.emailVerified ? (\n <IconCheck size={10} />\n ) : (\n <IconX size={10} />\n )\n }\n >\n {item.emailVerified ? \"Verified\" : \"Unverified\"}\n </Badge>\n )}\n </Flex>\n ),\n },\n roles: {\n label: \"Roles\",\n value: (item) => (\n <Flex gap={4}>\n {item.roles.map((role: string) => (\n <Badge key={role} size=\"xs\" variant=\"outline\">\n {role}\n </Badge>\n ))}\n </Flex>\n ),\n },\n enabled: {\n label: \"Status\",\n fit: true,\n value: (item) => (\n <Badge\n size=\"sm\"\n variant=\"light\"\n color={item.enabled ? \"green\" : \"red\"}\n >\n {item.enabled ? \"Active\" : \"Disabled\"}\n </Badge>\n ),\n },\n createdAt: {\n label: \"Created\",\n fit: true,\n value: (item) => (\n <Text size=\"xs\" c=\"dimmed\">\n {l(item.createdAt, { date: \"fromNow\" })}\n </Text>\n ),\n },\n }}\n />\n </Flex>\n );\n};\n\nexport default AdminUsers;\n"],"mappings":";;;;;;;;;;;AAkBA,MAAM,cAAc,UAA2B;CAC7C,MAAM,SAAS,WAAgC;CAC/C,MAAM,SAAS,WAAwB;CACvC,MAAM,EAAE,MAAM,SAAS;CAEvB,MAAM,UAAU,EAAE,OAAO,EACvB,OAAO,EAAE,SACP,EAAE,OAAO,EACP,UAAU,EACR,OAAO,EAAE,KAAK,MAAM,QAAQ,CAAC,MAAM,UAAU,CAAC,EAC/C,EACF,CAAC,CACH,EACF,CAAC;AAEF,QACE,oBAACA;EAAK,MAAM;EAAG,WAAU;YACvB,oBAAC;GACC;GACA,SAAS,CACP;IACE,MAAM;IACN,MAAM,OAAO,KAAK,kBAAkB;IACpC,OAAO;IACR,CACF;GACD,aAAa;GACb,eAAe;IACb,kBAAkB;IAClB,SAAS;IACV;GACD,YAAY;IACV,mBAAmB;IACnB,iBAAiB;IACjB,SAAS;IACT,kBAAkB;IACnB;GACD,iBAAiB,KAAK,OAAO,SAAS;AACpC,QAAI,QAAQ,QACV,QAAO,KAAK,QAAQ;;GAGf;GACT,eAAe,SAAS;IACtB,MAAM,YAAiC;KACrC,OAAO,EAAE,QAAQ,WAAW;KAC5B,eACE,OAAO,KAAK,oBAAoB,EAC9B,QAAQ,EAAE,QAAQ,KAAK,IAAI,EAC5B,CAAC;KACL;AAED,QAAI,CAAC,KAAK,QACR,WAAU,UAAU;AAGtB,WAAO;;GAET,OAAO,OAAO,YAAY;AAQxB,WAPiB,MAAM,OAAO,UAAU,EACtC,OAAO;KACL,GAAG;KACH,eAAe,MAAM;KACtB,EACF,CAAC;;GAIJ,SAAS;IACP,UAAU;KACR,OAAO;KACP,QAAQ,SACN,oBAAC;MAAK,MAAK;MAAK,IAAI;gBACjB,KAAK,YAAY;OACb;KAEV;IACD,OAAO;KACL,OAAO;KACP,QAAQ,SACN,qBAACA;MAAK,KAAI;iBACR,oBAAC;OAAK,MAAK;iBAAM,KAAK,SAAS;QAAW,EACzC,KAAK,SACJ,oBAAC;OACC,MAAK;OACL,SAAQ;OACR,OAAO,KAAK,gBAAgB,UAAU;OACtC,aACE,KAAK,gBACH,oBAAC,aAAU,MAAM,KAAM,GAEvB,oBAAC,SAAM,MAAM,KAAM;iBAItB,KAAK,gBAAgB,aAAa;QAC7B;OAEL;KAEV;IACD,OAAO;KACL,OAAO;KACP,QAAQ,SACN,oBAACA;MAAK,KAAK;gBACR,KAAK,MAAM,KAAK,SACf,oBAAC;OAAiB,MAAK;OAAK,SAAQ;iBACjC;SADS,KAEJ,CACR;OACG;KAEV;IACD,SAAS;KACP,OAAO;KACP,KAAK;KACL,QAAQ,SACN,oBAAC;MACC,MAAK;MACL,SAAQ;MACR,OAAO,KAAK,UAAU,UAAU;gBAE/B,KAAK,UAAU,WAAW;OACrB;KAEX;IACD,WAAW;KACT,OAAO;KACP,KAAK;KACL,QAAQ,SACN,oBAAC;MAAK,MAAK;MAAK,GAAE;gBACf,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;OAClC;KAEV;IACF;IACD;GACG"}
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ import { AdminSessionController, AdminUserController } from "alepha/api/users";
|
|
|
10
10
|
import { AdminAuditController } from "alepha/api/audits";
|
|
11
11
|
import { AdminJobController } from "alepha/api/jobs";
|
|
12
12
|
import { AdminApiKeyController } from "alepha/api/keys";
|
|
13
|
-
import { AdminNotificationController } from "alepha/api/notifications";
|
|
14
13
|
import { AdminParameterController } from "alepha/api/parameters";
|
|
15
14
|
|
|
16
15
|
//#region ../../src/admin/AdminRouter.d.ts
|
|
@@ -20,7 +19,6 @@ declare class AdminRouter {
|
|
|
20
19
|
protected readonly auth: ReactAuth;
|
|
21
20
|
protected readonly userCtrl: alepha_server_links0.HttpVirtualClient<AdminUserController>;
|
|
22
21
|
protected readonly sessionCtrl: alepha_server_links0.HttpVirtualClient<AdminSessionController>;
|
|
23
|
-
protected readonly notificationCtrl: alepha_server_links0.HttpVirtualClient<AdminNotificationController>;
|
|
24
22
|
protected readonly fileCtrl: alepha_server_links0.HttpVirtualClient<FileController>;
|
|
25
23
|
protected readonly paramCtrl: alepha_server_links0.HttpVirtualClient<AdminParameterController>;
|
|
26
24
|
protected readonly auditCtrl: alepha_server_links0.HttpVirtualClient<AdminAuditController>;
|
|
@@ -40,7 +38,6 @@ declare class AdminRouter {
|
|
|
40
38
|
readonly adminUserAudits: alepha_react_router0.PagePrimitive<alepha_react_router0.PageConfigSchema, any, any>;
|
|
41
39
|
readonly adminAudits: alepha_react_router0.PagePrimitive<alepha_react_router0.PageConfigSchema, any, {}>;
|
|
42
40
|
readonly adminSessions: alepha_react_router0.PagePrimitive<alepha_react_router0.PageConfigSchema, any, {}>;
|
|
43
|
-
readonly adminNotifications: alepha_react_router0.PagePrimitive<alepha_react_router0.PageConfigSchema, any, {}>;
|
|
44
41
|
readonly adminFiles: alepha_react_router0.PagePrimitive<alepha_react_router0.PageConfigSchema, any, {}>;
|
|
45
42
|
readonly adminParameters: alepha_react_router0.PagePrimitive<alepha_react_router0.PageConfigSchema, {
|
|
46
43
|
treeData: {
|
|
@@ -75,7 +72,7 @@ declare const $uiAdmin: (optsFn?: (a: AdminRouter) => DashboardShellProps) => Ad
|
|
|
75
72
|
* - AdminUsers with user list, create, details, settings, sessions, audits
|
|
76
73
|
* - AdminFiles for file management
|
|
77
74
|
* - AdminJobs for job monitoring
|
|
78
|
-
|
|
75
|
+
|
|
79
76
|
* - AdminParameters for configuration management
|
|
80
77
|
* - AdminSessions for session management
|
|
81
78
|
* - AdminAudits for audit log viewing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/admin/AdminRouter.ts","../../src/admin/primitives/$uiAdmin.ts","../../src/admin/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/admin/AdminRouter.ts","../../src/admin/primitives/$uiAdmin.ts","../../src/admin/index.ts"],"mappings":";;;;;;;;;;;;;;;cA8Ba,WAAA;EAAA,mBACQ,MAAA,EAAM,WAAA,CAAA,WAAA;EAAA,mBACN,UAAA,EAAU,UAAA;EAAA,mBACV,IAAA,EAAI,SAAA;EAAA,mBACJ,QAAA,EAAQ,oBAAA,CAAA,iBAAA,CAAA,mBAAA;EAAA,mBACR,WAAA,EAAW,oBAAA,CAAA,iBAAA,CAAA,sBAAA;EAAA,mBAEX,QAAA,EAAQ,oBAAA,CAAA,iBAAA,CAAA,cAAA;EAAA,mBACR,SAAA,EAAS,oBAAA,CAAA,iBAAA,CAAA,wBAAA;EAAA,mBACT,SAAA,EAAS,oBAAA,CAAA,iBAAA,CAAA,oBAAA;EAAA,mBACT,OAAA,EAAO,oBAAA,CAAA,iBAAA,CAAA,kBAAA;EAAA,mBACP,UAAA,EAAU,oBAAA,CAAA,iBAAA,CAAA,qBAAA;EAEtB,QAAA,IAAY,WAAA,EAAa,WAAA,KAAgB,mBAAA;EASzC,sBAAA,CAAA,GAA0B,WAAA;EAAA,UAuDvB,eAAA,CAAA,GAAmB,mBAAA;EAAA,UAOnB,eAAA,CAAgB,GAAA,EAAK,GAAA,GAAG,WAAA;EAAA,SAclB,WAAA,EAAW,oBAAA,CAAA,aAAA,CAdO,oBAAA,CAcP,gBAAA,MAAA,oBAAA,CAAA,mBAAA;EAAA,SAmBX,UAAA,EAAU,oBAAA,CAAA,aAAA,CAnBC,oBAAA,CAmBD,gBAAA;EAAA,SAUV,eAAA,EAAe,oBAAA,CAAA,aAAA,CAVL,oBAAA,CAUK,gBAAA;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thRouter } from "@alepha/ui/auth";
|
|
3
3
|
import { $context, $inject, $module } from "alepha";
|
|
4
|
-
import {
|
|
4
|
+
import { IconClock, IconDevices, IconFile, IconHistory, IconKey, IconListDetails, IconPlus, IconSettings, IconTerminal2, IconUser, IconUsers } from "@tabler/icons-react";
|
|
5
5
|
import { ReactAuth } from "alepha/react/auth";
|
|
6
6
|
import { $page, ReactRouter, Redirection } from "alepha/react/router";
|
|
7
7
|
import { $client } from "alepha/server/links";
|
|
@@ -13,7 +13,6 @@ var AdminRouter = class {
|
|
|
13
13
|
auth = $inject(ReactAuth);
|
|
14
14
|
userCtrl = $client();
|
|
15
15
|
sessionCtrl = $client();
|
|
16
|
-
notificationCtrl = $client();
|
|
17
16
|
fileCtrl = $client();
|
|
18
17
|
paramCtrl = $client();
|
|
19
18
|
auditCtrl = $client();
|
|
@@ -53,10 +52,6 @@ var AdminRouter = class {
|
|
|
53
52
|
...this.router.node(this.adminFiles.name),
|
|
54
53
|
can: () => this.fileCtrl.findFiles.can()
|
|
55
54
|
},
|
|
56
|
-
{
|
|
57
|
-
...this.router.node(this.adminNotifications.name),
|
|
58
|
-
can: () => this.notificationCtrl.findNotifications.can()
|
|
59
|
-
},
|
|
60
55
|
{
|
|
61
56
|
...this.router.node(this.adminJobDashboard.name),
|
|
62
57
|
href: void 0,
|
|
@@ -96,7 +91,6 @@ var AdminRouter = class {
|
|
|
96
91
|
adminLayout = $page({
|
|
97
92
|
path: "/admin",
|
|
98
93
|
label: "Admin",
|
|
99
|
-
can: () => this.auth.can("admin:*"),
|
|
100
94
|
lazy: () => import("./AdminLayout-e-ZP5nWw.js"),
|
|
101
95
|
props: () => ({ adminShellProps: this.adminShellProps() }),
|
|
102
96
|
loader: ({ user, url }) => {
|
|
@@ -110,7 +104,7 @@ var AdminRouter = class {
|
|
|
110
104
|
path: "/users",
|
|
111
105
|
label: "Users",
|
|
112
106
|
description: "Manage application users and their roles.",
|
|
113
|
-
lazy: () => import("./AdminUsers-
|
|
107
|
+
lazy: () => import("./AdminUsers-D1pDpiwK.js"),
|
|
114
108
|
can: () => this.userCtrl.findUsers.can()
|
|
115
109
|
});
|
|
116
110
|
adminUserCreate = $page({
|
|
@@ -119,7 +113,7 @@ var AdminRouter = class {
|
|
|
119
113
|
path: "/users/create",
|
|
120
114
|
label: "Create User",
|
|
121
115
|
description: "Create a new user account",
|
|
122
|
-
lazy: () => import("./AdminUserCreate-
|
|
116
|
+
lazy: () => import("./AdminUserCreate-DR8LA0tv.js"),
|
|
123
117
|
can: () => this.userCtrl.createUser.can()
|
|
124
118
|
});
|
|
125
119
|
adminUserLayout = $page({
|
|
@@ -127,32 +121,32 @@ var AdminRouter = class {
|
|
|
127
121
|
parent: this.adminLayout,
|
|
128
122
|
path: "/users/:userId",
|
|
129
123
|
label: "User",
|
|
130
|
-
lazy: () => import("./AdminUserLayout-
|
|
124
|
+
lazy: () => import("./AdminUserLayout-CrBj4UuI.js"),
|
|
131
125
|
can: () => this.userCtrl.getUser.can()
|
|
132
126
|
});
|
|
133
127
|
adminUserDetails = $page({
|
|
134
128
|
parent: this.adminUserLayout,
|
|
135
129
|
path: "/details",
|
|
136
130
|
label: "Details",
|
|
137
|
-
lazy: () => import("./AdminUserDetails-
|
|
131
|
+
lazy: () => import("./AdminUserDetails-CDkZNHQD.js")
|
|
138
132
|
});
|
|
139
133
|
adminUserSessions = $page({
|
|
140
134
|
parent: this.adminUserLayout,
|
|
141
135
|
path: "/sessions",
|
|
142
136
|
label: "Sessions",
|
|
143
|
-
lazy: () => import("./AdminUserSessions-
|
|
137
|
+
lazy: () => import("./AdminUserSessions-srgFHrqy.js")
|
|
144
138
|
});
|
|
145
139
|
adminUserSettings = $page({
|
|
146
140
|
parent: this.adminUserLayout,
|
|
147
141
|
path: "/settings",
|
|
148
142
|
label: "Settings",
|
|
149
|
-
lazy: () => import("./AdminUserSettings-
|
|
143
|
+
lazy: () => import("./AdminUserSettings-BFuxl-xT.js")
|
|
150
144
|
});
|
|
151
145
|
adminUserAudits = $page({
|
|
152
146
|
parent: this.adminUserLayout,
|
|
153
147
|
path: "/audits",
|
|
154
148
|
label: "Audit Log",
|
|
155
|
-
lazy: () => import("./AdminUserAudits-
|
|
149
|
+
lazy: () => import("./AdminUserAudits-D1GcREEE.js"),
|
|
156
150
|
can: () => this.auditCtrl.findByUser.can()
|
|
157
151
|
});
|
|
158
152
|
adminAudits = $page({
|
|
@@ -170,18 +164,9 @@ var AdminRouter = class {
|
|
|
170
164
|
path: "/sessions",
|
|
171
165
|
label: "Sessions",
|
|
172
166
|
description: "View and manage all active sessions.",
|
|
173
|
-
lazy: () => import("./AdminSessions-
|
|
167
|
+
lazy: () => import("./AdminSessions-DyhW6RZv.js"),
|
|
174
168
|
can: () => this.sessionCtrl.findSessions.can()
|
|
175
169
|
});
|
|
176
|
-
adminNotifications = $page({
|
|
177
|
-
icon: IconBell,
|
|
178
|
-
parent: this.adminLayout,
|
|
179
|
-
path: "/notifications",
|
|
180
|
-
label: "Notifications",
|
|
181
|
-
description: "View notification history and status.",
|
|
182
|
-
lazy: () => import("./AdminNotifications-DeHJFf6W.js"),
|
|
183
|
-
can: () => this.notificationCtrl.findNotifications.can()
|
|
184
|
-
});
|
|
185
170
|
adminFiles = $page({
|
|
186
171
|
icon: IconFile,
|
|
187
172
|
parent: this.adminLayout,
|
|
@@ -197,7 +182,7 @@ var AdminRouter = class {
|
|
|
197
182
|
path: "/parameters",
|
|
198
183
|
label: "Parameters",
|
|
199
184
|
description: "View and manage application parameters.",
|
|
200
|
-
lazy: () => import("./AdminParameters-
|
|
185
|
+
lazy: () => import("./AdminParameters-DCGbpt2c.js"),
|
|
201
186
|
can: () => this.paramCtrl.getParameterTree.can(),
|
|
202
187
|
loader: async () => {
|
|
203
188
|
return { treeData: await this.paramCtrl.getParameterTree({}) };
|
|
@@ -267,7 +252,7 @@ const $uiAdmin = (optsFn) => {
|
|
|
267
252
|
* - AdminUsers with user list, create, details, settings, sessions, audits
|
|
268
253
|
* - AdminFiles for file management
|
|
269
254
|
* - AdminJobs for job monitoring
|
|
270
|
-
|
|
255
|
+
|
|
271
256
|
* - AdminParameters for configuration management
|
|
272
257
|
* - AdminSessions for session management
|
|
273
258
|
* - AdminAudits for audit log viewing
|
package/dist/admin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/admin/AdminRouter.ts","../../src/admin/primitives/$uiAdmin.ts","../../src/admin/index.ts"],"sourcesContent":["import type { DashboardShellProps, SidebarNode } from \"@alepha/ui\";\nimport { AuthRouter } from \"@alepha/ui/auth\";\nimport {\n IconBell,\n IconClock,\n IconDevices,\n IconFile,\n IconHistory,\n IconKey,\n IconListDetails,\n IconPlus,\n IconSettings,\n IconTerminal2,\n IconUser,\n IconUsers,\n} from \"@tabler/icons-react\";\nimport { $inject } from \"alepha\";\nimport type { AdminAuditController } from \"alepha/api/audits\";\nimport type { FileController } from \"alepha/api/files\";\nimport type { AdminJobController } from \"alepha/api/jobs\";\nimport type { AdminApiKeyController } from \"alepha/api/keys\";\nimport type { AdminNotificationController } from \"alepha/api/notifications\";\nimport type { AdminParameterController } from \"alepha/api/parameters\";\nimport type {\n AdminSessionController,\n AdminUserController,\n} from \"alepha/api/users\";\nimport { ReactAuth } from \"alepha/react/auth\";\nimport { $page, ReactRouter, Redirection } from \"alepha/react/router\";\nimport { $client } from \"alepha/server/links\";\n\nexport class AdminRouter {\n protected readonly router = $inject(ReactRouter<AdminRouter>);\n protected readonly authRouter = $inject(AuthRouter);\n protected readonly auth = $inject(ReactAuth);\n protected readonly userCtrl = $client<AdminUserController>();\n protected readonly sessionCtrl = $client<AdminSessionController>();\n protected readonly notificationCtrl = $client<AdminNotificationController>();\n protected readonly fileCtrl = $client<FileController>();\n protected readonly paramCtrl = $client<AdminParameterController>();\n protected readonly auditCtrl = $client<AdminAuditController>();\n protected readonly jobCtrl = $client<AdminJobController>();\n protected readonly apiKeyCtrl = $client<AdminApiKeyController>();\n\n public configFn?: (adminRouter: AdminRouter) => DashboardShellProps = () => {\n return {\n sidebarResizable: true,\n sidebarProps: {\n items: this.getDefaultSidebarItems(),\n },\n };\n };\n\n public getDefaultSidebarItems(): SidebarNode[] {\n return [\n {\n type: \"section\",\n label: \"Identity\",\n children: [\n {\n ...this.router.node(this.adminUsers.name),\n can: () => this.userCtrl.findUsers.can(),\n },\n {\n ...this.router.node(this.adminSessions.name),\n can: () => this.sessionCtrl.findSessions.can(),\n },\n {\n ...this.router.node(this.adminApiKeys.name),\n can: () => this.apiKeyCtrl.findApiKeys.can(),\n },\n ],\n },\n {\n type: \"section\",\n label: \"System\",\n children: [\n {\n ...this.router.node(this.adminFiles.name),\n can: () => this.fileCtrl.findFiles.can(),\n },\n {\n ...this.router.node(this.adminNotifications.name),\n can: () => this.notificationCtrl.findNotifications.can(),\n },\n {\n ...this.router.node(this.adminJobDashboard.name),\n href: undefined,\n can: () => this.jobCtrl.getRegistry.can(),\n children: [\n {\n ...this.router.node(this.adminJobDashboard.name),\n label: \"Dashboard\",\n },\n { ...this.router.node(this.adminJobRegistry.name) },\n { ...this.router.node(this.adminJobExecutions.name) },\n ],\n },\n {\n ...this.router.node(this.adminAudits.name),\n can: () => this.auditCtrl.findAudits.can(),\n },\n {\n ...this.router.node(this.adminParameters.name),\n can: () => this.paramCtrl.getParameterTree.can(),\n },\n ],\n },\n { type: \"toggle\", position: \"bottom\" },\n ];\n }\n\n protected adminShellProps(): DashboardShellProps {\n if (this.configFn) {\n return this.configFn(this);\n }\n return {};\n }\n\n protected onNotAuthorized(url: URL) {\n return new Redirection(\n this.router.path(this.authRouter.login.name, {\n query: {\n r: url.pathname,\n },\n }),\n );\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Layout\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminLayout = $page({\n path: \"/admin\",\n label: \"Admin\",\n can: () => this.auth.can(\"admin:*\"),\n lazy: () => import(\"./components/AdminLayout.tsx\"),\n props: () => ({\n adminShellProps: this.adminShellProps(),\n }),\n loader: ({ user, url }) => {\n if (!user) {\n throw this.onNotAuthorized(url);\n }\n return {};\n },\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Users\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminUsers = $page({\n icon: IconUsers,\n parent: this.adminLayout,\n path: \"/users\",\n label: \"Users\",\n description: \"Manage application users and their roles.\",\n lazy: () => import(\"./components/users/AdminUsers.tsx\"),\n can: () => this.userCtrl.findUsers.can(),\n });\n\n public readonly adminUserCreate = $page({\n icon: IconPlus,\n parent: this.adminLayout,\n path: \"/users/create\",\n label: \"Create User\",\n description: \"Create a new user account\",\n lazy: () => import(\"./components/users/AdminUserCreate.tsx\"),\n can: () => this.userCtrl.createUser.can(),\n });\n\n public readonly adminUserLayout = $page({\n icon: IconUser,\n parent: this.adminLayout,\n path: \"/users/:userId\",\n label: \"User\",\n lazy: () => import(\"./components/users/AdminUserLayout.tsx\"),\n can: () => this.userCtrl.getUser.can(),\n });\n\n public readonly adminUserDetails = $page({\n parent: this.adminUserLayout,\n path: \"/details\",\n label: \"Details\",\n lazy: () => import(\"./components/users/AdminUserDetails.tsx\"),\n });\n\n public readonly adminUserSessions = $page({\n parent: this.adminUserLayout,\n path: \"/sessions\",\n label: \"Sessions\",\n lazy: () => import(\"./components/users/AdminUserSessions.tsx\"),\n });\n\n public readonly adminUserSettings = $page({\n parent: this.adminUserLayout,\n path: \"/settings\",\n label: \"Settings\",\n lazy: () => import(\"./components/users/AdminUserSettings.tsx\"),\n });\n\n public readonly adminUserAudits = $page({\n parent: this.adminUserLayout,\n path: \"/audits\",\n label: \"Audit Log\",\n lazy: () => import(\"./components/users/AdminUserAudits.tsx\"),\n can: () => this.auditCtrl.findByUser.can(),\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Audits (Global)\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminAudits = $page({\n icon: IconHistory,\n parent: this.adminLayout,\n path: \"/audits\",\n label: \"Audit Log\",\n description: \"View system-wide audit trail and activity logs.\",\n lazy: () => import(\"./components/audits/AdminAudits.tsx\"),\n can: () => this.auditCtrl.findAudits.can(),\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Sessions\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminSessions = $page({\n icon: IconDevices,\n parent: this.adminLayout,\n path: \"/sessions\",\n label: \"Sessions\",\n description: \"View and manage all active sessions.\",\n lazy: () => import(\"./components/sessions/AdminSessions.tsx\"),\n can: () => this.sessionCtrl.findSessions.can(),\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Notifications\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminNotifications = $page({\n icon: IconBell,\n parent: this.adminLayout,\n path: \"/notifications\",\n label: \"Notifications\",\n description: \"View notification history and status.\",\n lazy: () => import(\"./components/notifications/AdminNotifications.tsx\"),\n can: () => this.notificationCtrl.findNotifications.can(),\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Files\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminFiles = $page({\n icon: IconFile,\n parent: this.adminLayout,\n path: \"/files\",\n label: \"Files\",\n description: \"Manage uploaded files and storage.\",\n lazy: () => import(\"./components/files/AdminFiles.tsx\"),\n can: () => this.fileCtrl.findFiles.can(),\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Parameters\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminParameters = $page({\n icon: IconSettings,\n parent: this.adminLayout,\n path: \"/parameters\",\n label: \"Parameters\",\n description: \"View and manage application parameters.\",\n lazy: () => import(\"./components/parameters/AdminParameters.tsx\"),\n can: () => this.paramCtrl.getParameterTree.can(),\n loader: async () => {\n const treeData = await this.paramCtrl.getParameterTree({});\n return { treeData };\n },\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Jobs\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminJobDashboard = $page({\n icon: IconTerminal2,\n parent: this.adminLayout,\n path: \"/jobs\",\n label: \"Jobs\",\n description: \"Monitor and manage background jobs and scheduled tasks.\",\n lazy: () => import(\"./components/jobs/AdminJobDashboard.tsx\"),\n can: () => this.jobCtrl.getRegistry.can(),\n });\n\n public readonly adminJobRegistry = $page({\n icon: IconListDetails,\n parent: this.adminLayout,\n path: \"/jobs/registry\",\n label: \"Registry\",\n description: \"View all registered job definitions.\",\n lazy: () => import(\"./components/jobs/AdminJobRegistry.tsx\"),\n can: () => this.jobCtrl.getRegistry.can(),\n });\n\n public readonly adminJobExecutions = $page({\n icon: IconClock,\n parent: this.adminLayout,\n path: \"/jobs/executions\",\n label: \"Executions\",\n description: \"Browse and filter job execution history.\",\n lazy: () => import(\"./components/jobs/AdminJobExecutions.tsx\"),\n can: () => this.jobCtrl.findExecutions.can(),\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // API Keys\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminApiKeys = $page({\n icon: IconKey,\n parent: this.adminLayout,\n path: \"/api-keys\",\n label: \"API Keys\",\n description: \"View and manage API keys for programmatic access.\",\n lazy: () => import(\"./components/keys/AdminApiKeys.tsx\"),\n can: () => this.apiKeyCtrl.findApiKeys.can(),\n });\n}\n","import type { DashboardShellProps } from \"@alepha/ui\";\nimport { $context } from \"alepha\";\nimport { AdminRouter } from \"../AdminRouter.ts\";\n\n/**\n * Register Admin UI components and get the AdminRouter instance.\n */\nexport const $uiAdmin = (optsFn?: (a: AdminRouter) => DashboardShellProps) => {\n const { alepha } = $context();\n const adminRouter = alepha.inject(AdminRouter);\n\n if (optsFn) {\n adminRouter.configFn = optsFn;\n }\n\n return adminRouter;\n};\n","import { AlephaUI } from \"@alepha/ui\";\nimport { AlephaUIAuth } from \"@alepha/ui/auth\";\nimport { $module } from \"alepha\";\nimport { AdminRouter } from \"./AdminRouter.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport { AdminRouter } from \"./AdminRouter.ts\";\nexport * from \"./primitives/$uiAdmin.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * | Stability | Since | Runtime |\n * |-----------|-------|---------|\n * | 2 - beta | 0.12.0 | node, bun, workerd, browser|\n *\n * Admin panel UI components.\n *\n * **Features:**\n * - AdminLayout for admin pages\n * - AdminUsers with user list, create, details, settings, sessions, audits\n * - AdminFiles for file management\n * - AdminJobs for job monitoring\n * - AdminNotifications for notification management\n * - AdminParameters for configuration management\n * - AdminSessions for session management\n * - AdminAudits for audit log viewing\n * - AdminVerifications for verification management\n *\n * @module alepha.ui.admin\n */\nexport const AlephaUIAdmin = $module({\n name: \"alepha.ui.admin\",\n services: [AlephaUI, AlephaUIAuth, AdminRouter],\n register: (alepha) => {\n alepha.with(AdminRouter);\n },\n});\n\n// ---------------------------------------------------------------------------------------------------------------------\n"],"mappings":";;;;;;;;;AA+BA,IAAa,cAAb,MAAyB;CACvB,AAAmB,SAAS,QAAQ,YAAyB;CAC7D,AAAmB,aAAa,QAAQ,WAAW;CACnD,AAAmB,OAAO,QAAQ,UAAU;CAC5C,AAAmB,WAAW,SAA8B;CAC5D,AAAmB,cAAc,SAAiC;CAClE,AAAmB,mBAAmB,SAAsC;CAC5E,AAAmB,WAAW,SAAyB;CACvD,AAAmB,YAAY,SAAmC;CAClE,AAAmB,YAAY,SAA+B;CAC9D,AAAmB,UAAU,SAA6B;CAC1D,AAAmB,aAAa,SAAgC;CAEhE,AAAO,iBAAqE;AAC1E,SAAO;GACL,kBAAkB;GAClB,cAAc,EACZ,OAAO,KAAK,wBAAwB,EACrC;GACF;;CAGH,AAAO,yBAAwC;AAC7C,SAAO;GACL;IACE,MAAM;IACN,OAAO;IACP,UAAU;KACR;MACE,GAAG,KAAK,OAAO,KAAK,KAAK,WAAW,KAAK;MACzC,WAAW,KAAK,SAAS,UAAU,KAAK;MACzC;KACD;MACE,GAAG,KAAK,OAAO,KAAK,KAAK,cAAc,KAAK;MAC5C,WAAW,KAAK,YAAY,aAAa,KAAK;MAC/C;KACD;MACE,GAAG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;EACb,YAAY,OAAO;EACnB,WAAW,KAAK,WAAW,YAAY,KAAK;EAC7C,CAAC;;;;;;;;ACpUJ,MAAa,YAAY,WAAqD;CAC5E,MAAM,EAAE,WAAW,UAAU;CAC7B,MAAM,cAAc,OAAO,OAAO,YAAY;AAE9C,KAAI,OACF,aAAY,WAAW;AAGzB,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;ACiBT,MAAa,gBAAgB,QAAQ;CACnC,MAAM;CACN,UAAU;EAAC;EAAU;EAAc;EAAY;CAC/C,WAAW,WAAW;AACpB,SAAO,KAAK,YAAY;;CAE3B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/admin/AdminRouter.ts","../../src/admin/primitives/$uiAdmin.ts","../../src/admin/index.ts"],"sourcesContent":["import type { DashboardShellProps, SidebarNode } from \"@alepha/ui\";\nimport { AuthRouter } from \"@alepha/ui/auth\";\nimport {\n IconClock,\n IconDevices,\n IconFile,\n IconHistory,\n IconKey,\n IconListDetails,\n IconPlus,\n IconSettings,\n IconTerminal2,\n IconUser,\n IconUsers,\n} from \"@tabler/icons-react\";\nimport { $inject } from \"alepha\";\nimport type { AdminAuditController } from \"alepha/api/audits\";\nimport type { FileController } from \"alepha/api/files\";\nimport type { AdminJobController } from \"alepha/api/jobs\";\nimport type { AdminApiKeyController } from \"alepha/api/keys\";\n\nimport type { AdminParameterController } from \"alepha/api/parameters\";\nimport type {\n AdminSessionController,\n AdminUserController,\n} from \"alepha/api/users\";\nimport { ReactAuth } from \"alepha/react/auth\";\nimport { $page, ReactRouter, Redirection } from \"alepha/react/router\";\nimport { $client } from \"alepha/server/links\";\n\nexport class AdminRouter {\n protected readonly router = $inject(ReactRouter<AdminRouter>);\n protected readonly authRouter = $inject(AuthRouter);\n protected readonly auth = $inject(ReactAuth);\n protected readonly userCtrl = $client<AdminUserController>();\n protected readonly sessionCtrl = $client<AdminSessionController>();\n\n protected readonly fileCtrl = $client<FileController>();\n protected readonly paramCtrl = $client<AdminParameterController>();\n protected readonly auditCtrl = $client<AdminAuditController>();\n protected readonly jobCtrl = $client<AdminJobController>();\n protected readonly apiKeyCtrl = $client<AdminApiKeyController>();\n\n public configFn?: (adminRouter: AdminRouter) => DashboardShellProps = () => {\n return {\n sidebarResizable: true,\n sidebarProps: {\n items: this.getDefaultSidebarItems(),\n },\n };\n };\n\n public getDefaultSidebarItems(): SidebarNode[] {\n return [\n {\n type: \"section\",\n label: \"Identity\",\n children: [\n {\n ...this.router.node(this.adminUsers.name),\n can: () => this.userCtrl.findUsers.can(),\n },\n {\n ...this.router.node(this.adminSessions.name),\n can: () => this.sessionCtrl.findSessions.can(),\n },\n {\n ...this.router.node(this.adminApiKeys.name),\n can: () => this.apiKeyCtrl.findApiKeys.can(),\n },\n ],\n },\n {\n type: \"section\",\n label: \"System\",\n children: [\n {\n ...this.router.node(this.adminFiles.name),\n can: () => this.fileCtrl.findFiles.can(),\n },\n {\n ...this.router.node(this.adminJobDashboard.name),\n href: undefined,\n can: () => this.jobCtrl.getRegistry.can(),\n children: [\n {\n ...this.router.node(this.adminJobDashboard.name),\n label: \"Dashboard\",\n },\n { ...this.router.node(this.adminJobRegistry.name) },\n { ...this.router.node(this.adminJobExecutions.name) },\n ],\n },\n {\n ...this.router.node(this.adminAudits.name),\n can: () => this.auditCtrl.findAudits.can(),\n },\n {\n ...this.router.node(this.adminParameters.name),\n can: () => this.paramCtrl.getParameterTree.can(),\n },\n ],\n },\n { type: \"toggle\", position: \"bottom\" },\n ];\n }\n\n protected adminShellProps(): DashboardShellProps {\n if (this.configFn) {\n return this.configFn(this);\n }\n return {};\n }\n\n protected onNotAuthorized(url: URL) {\n return new Redirection(\n this.router.path(this.authRouter.login.name, {\n query: {\n r: url.pathname,\n },\n }),\n );\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Layout\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminLayout = $page({\n path: \"/admin\",\n label: \"Admin\",\n lazy: () => import(\"./components/AdminLayout.tsx\"),\n props: () => ({\n adminShellProps: this.adminShellProps(),\n }),\n loader: ({ user, url }) => {\n if (!user) {\n throw this.onNotAuthorized(url);\n }\n return {};\n },\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Users\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminUsers = $page({\n icon: IconUsers,\n parent: this.adminLayout,\n path: \"/users\",\n label: \"Users\",\n description: \"Manage application users and their roles.\",\n lazy: () => import(\"./components/users/AdminUsers.tsx\"),\n can: () => this.userCtrl.findUsers.can(),\n });\n\n public readonly adminUserCreate = $page({\n icon: IconPlus,\n parent: this.adminLayout,\n path: \"/users/create\",\n label: \"Create User\",\n description: \"Create a new user account\",\n lazy: () => import(\"./components/users/AdminUserCreate.tsx\"),\n can: () => this.userCtrl.createUser.can(),\n });\n\n public readonly adminUserLayout = $page({\n icon: IconUser,\n parent: this.adminLayout,\n path: \"/users/:userId\",\n label: \"User\",\n lazy: () => import(\"./components/users/AdminUserLayout.tsx\"),\n can: () => this.userCtrl.getUser.can(),\n });\n\n public readonly adminUserDetails = $page({\n parent: this.adminUserLayout,\n path: \"/details\",\n label: \"Details\",\n lazy: () => import(\"./components/users/AdminUserDetails.tsx\"),\n });\n\n public readonly adminUserSessions = $page({\n parent: this.adminUserLayout,\n path: \"/sessions\",\n label: \"Sessions\",\n lazy: () => import(\"./components/users/AdminUserSessions.tsx\"),\n });\n\n public readonly adminUserSettings = $page({\n parent: this.adminUserLayout,\n path: \"/settings\",\n label: \"Settings\",\n lazy: () => import(\"./components/users/AdminUserSettings.tsx\"),\n });\n\n public readonly adminUserAudits = $page({\n parent: this.adminUserLayout,\n path: \"/audits\",\n label: \"Audit Log\",\n lazy: () => import(\"./components/users/AdminUserAudits.tsx\"),\n can: () => this.auditCtrl.findByUser.can(),\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Audits (Global)\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminAudits = $page({\n icon: IconHistory,\n parent: this.adminLayout,\n path: \"/audits\",\n label: \"Audit Log\",\n description: \"View system-wide audit trail and activity logs.\",\n lazy: () => import(\"./components/audits/AdminAudits.tsx\"),\n can: () => this.auditCtrl.findAudits.can(),\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Sessions\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminSessions = $page({\n icon: IconDevices,\n parent: this.adminLayout,\n path: \"/sessions\",\n label: \"Sessions\",\n description: \"View and manage all active sessions.\",\n lazy: () => import(\"./components/sessions/AdminSessions.tsx\"),\n can: () => this.sessionCtrl.findSessions.can(),\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Files\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminFiles = $page({\n icon: IconFile,\n parent: this.adminLayout,\n path: \"/files\",\n label: \"Files\",\n description: \"Manage uploaded files and storage.\",\n lazy: () => import(\"./components/files/AdminFiles.tsx\"),\n can: () => this.fileCtrl.findFiles.can(),\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Parameters\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminParameters = $page({\n icon: IconSettings,\n parent: this.adminLayout,\n path: \"/parameters\",\n label: \"Parameters\",\n description: \"View and manage application parameters.\",\n lazy: () => import(\"./components/parameters/AdminParameters.tsx\"),\n can: () => this.paramCtrl.getParameterTree.can(),\n loader: async () => {\n const treeData = await this.paramCtrl.getParameterTree({});\n return { treeData };\n },\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Jobs\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminJobDashboard = $page({\n icon: IconTerminal2,\n parent: this.adminLayout,\n path: \"/jobs\",\n label: \"Jobs\",\n description: \"Monitor and manage background jobs and scheduled tasks.\",\n lazy: () => import(\"./components/jobs/AdminJobDashboard.tsx\"),\n can: () => this.jobCtrl.getRegistry.can(),\n });\n\n public readonly adminJobRegistry = $page({\n icon: IconListDetails,\n parent: this.adminLayout,\n path: \"/jobs/registry\",\n label: \"Registry\",\n description: \"View all registered job definitions.\",\n lazy: () => import(\"./components/jobs/AdminJobRegistry.tsx\"),\n can: () => this.jobCtrl.getRegistry.can(),\n });\n\n public readonly adminJobExecutions = $page({\n icon: IconClock,\n parent: this.adminLayout,\n path: \"/jobs/executions\",\n label: \"Executions\",\n description: \"Browse and filter job execution history.\",\n lazy: () => import(\"./components/jobs/AdminJobExecutions.tsx\"),\n can: () => this.jobCtrl.findExecutions.can(),\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // API Keys\n // ─────────────────────────────────────────────────────────────────────────────\n\n public readonly adminApiKeys = $page({\n icon: IconKey,\n parent: this.adminLayout,\n path: \"/api-keys\",\n label: \"API Keys\",\n description: \"View and manage API keys for programmatic access.\",\n lazy: () => import(\"./components/keys/AdminApiKeys.tsx\"),\n can: () => this.apiKeyCtrl.findApiKeys.can(),\n });\n}\n","import type { DashboardShellProps } from \"@alepha/ui\";\nimport { $context } from \"alepha\";\nimport { AdminRouter } from \"../AdminRouter.ts\";\n\n/**\n * Register Admin UI components and get the AdminRouter instance.\n */\nexport const $uiAdmin = (optsFn?: (a: AdminRouter) => DashboardShellProps) => {\n const { alepha } = $context();\n const adminRouter = alepha.inject(AdminRouter);\n\n if (optsFn) {\n adminRouter.configFn = optsFn;\n }\n\n return adminRouter;\n};\n","import { AlephaUI } from \"@alepha/ui\";\nimport { AlephaUIAuth } from \"@alepha/ui/auth\";\nimport { $module } from \"alepha\";\nimport { AdminRouter } from \"./AdminRouter.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport { AdminRouter } from \"./AdminRouter.ts\";\nexport * from \"./primitives/$uiAdmin.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * | Stability | Since | Runtime |\n * |-----------|-------|---------|\n * | 2 - beta | 0.12.0 | node, bun, workerd, browser|\n *\n * Admin panel UI components.\n *\n * **Features:**\n * - AdminLayout for admin pages\n * - AdminUsers with user list, create, details, settings, sessions, audits\n * - AdminFiles for file management\n * - AdminJobs for job monitoring\n\n * - AdminParameters for configuration management\n * - AdminSessions for session management\n * - AdminAudits for audit log viewing\n * - AdminVerifications for verification management\n *\n * @module alepha.ui.admin\n */\nexport const AlephaUIAdmin = $module({\n name: \"alepha.ui.admin\",\n services: [AlephaUI, AlephaUIAuth, AdminRouter],\n register: (alepha) => {\n alepha.with(AdminRouter);\n },\n});\n\n// ---------------------------------------------------------------------------------------------------------------------\n"],"mappings":";;;;;;;;;AA8BA,IAAa,cAAb,MAAyB;CACvB,AAAmB,SAAS,QAAQ,YAAyB;CAC7D,AAAmB,aAAa,QAAQ,WAAW;CACnD,AAAmB,OAAO,QAAQ,UAAU;CAC5C,AAAmB,WAAW,SAA8B;CAC5D,AAAmB,cAAc,SAAiC;CAElE,AAAmB,WAAW,SAAyB;CACvD,AAAmB,YAAY,SAAmC;CAClE,AAAmB,YAAY,SAA+B;CAC9D,AAAmB,UAAU,SAA6B;CAC1D,AAAmB,aAAa,SAAgC;CAEhE,AAAO,iBAAqE;AAC1E,SAAO;GACL,kBAAkB;GAClB,cAAc,EACZ,OAAO,KAAK,wBAAwB,EACrC;GACF;;CAGH,AAAO,yBAAwC;AAC7C,SAAO;GACL;IACE,MAAM;IACN,OAAO;IACP,UAAU;KACR;MACE,GAAG,KAAK,OAAO,KAAK,KAAK,WAAW,KAAK;MACzC,WAAW,KAAK,SAAS,UAAU,KAAK;MACzC;KACD;MACE,GAAG,KAAK,OAAO,KAAK,KAAK,cAAc,KAAK;MAC5C,WAAW,KAAK,YAAY,aAAa,KAAK;MAC/C;KACD;MACE,GAAG,KAAK,OAAO,KAAK,KAAK,aAAa,KAAK;MAC3C,WAAW,KAAK,WAAW,YAAY,KAAK;MAC7C;KACF;IACF;GACD;IACE,MAAM;IACN,OAAO;IACP,UAAU;KACR;MACE,GAAG,KAAK,OAAO,KAAK,KAAK,WAAW,KAAK;MACzC,WAAW,KAAK,SAAS,UAAU,KAAK;MACzC;KACD;MACE,GAAG,KAAK,OAAO,KA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
|
|
12
12
|
"engines": {
|
|
13
13
|
"node": ">=22.0.0"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@testing-library/dom": "^10.4.1",
|
|
41
41
|
"@testing-library/react": "^16.3.2",
|
|
42
42
|
"@types/react-is": "^19.2.0",
|
|
43
|
-
"alepha": "0.17.
|
|
43
|
+
"alepha": "0.17.2",
|
|
44
44
|
"react": "^19.2.4",
|
|
45
45
|
"react-dom": "^19.2.4",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"vitest": "^4.0.18"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"alepha": "0.17.
|
|
51
|
+
"alepha": "0.17.2",
|
|
52
52
|
"react": "*",
|
|
53
53
|
"react-dom": "*"
|
|
54
54
|
},
|
package/src/admin/AdminRouter.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { DashboardShellProps, SidebarNode } from "@alepha/ui";
|
|
2
2
|
import { AuthRouter } from "@alepha/ui/auth";
|
|
3
3
|
import {
|
|
4
|
-
IconBell,
|
|
5
4
|
IconClock,
|
|
6
5
|
IconDevices,
|
|
7
6
|
IconFile,
|
|
@@ -19,7 +18,7 @@ import type { AdminAuditController } from "alepha/api/audits";
|
|
|
19
18
|
import type { FileController } from "alepha/api/files";
|
|
20
19
|
import type { AdminJobController } from "alepha/api/jobs";
|
|
21
20
|
import type { AdminApiKeyController } from "alepha/api/keys";
|
|
22
|
-
|
|
21
|
+
|
|
23
22
|
import type { AdminParameterController } from "alepha/api/parameters";
|
|
24
23
|
import type {
|
|
25
24
|
AdminSessionController,
|
|
@@ -35,7 +34,7 @@ export class AdminRouter {
|
|
|
35
34
|
protected readonly auth = $inject(ReactAuth);
|
|
36
35
|
protected readonly userCtrl = $client<AdminUserController>();
|
|
37
36
|
protected readonly sessionCtrl = $client<AdminSessionController>();
|
|
38
|
-
|
|
37
|
+
|
|
39
38
|
protected readonly fileCtrl = $client<FileController>();
|
|
40
39
|
protected readonly paramCtrl = $client<AdminParameterController>();
|
|
41
40
|
protected readonly auditCtrl = $client<AdminAuditController>();
|
|
@@ -79,10 +78,6 @@ export class AdminRouter {
|
|
|
79
78
|
...this.router.node(this.adminFiles.name),
|
|
80
79
|
can: () => this.fileCtrl.findFiles.can(),
|
|
81
80
|
},
|
|
82
|
-
{
|
|
83
|
-
...this.router.node(this.adminNotifications.name),
|
|
84
|
-
can: () => this.notificationCtrl.findNotifications.can(),
|
|
85
|
-
},
|
|
86
81
|
{
|
|
87
82
|
...this.router.node(this.adminJobDashboard.name),
|
|
88
83
|
href: undefined,
|
|
@@ -134,7 +129,6 @@ export class AdminRouter {
|
|
|
134
129
|
public readonly adminLayout = $page({
|
|
135
130
|
path: "/admin",
|
|
136
131
|
label: "Admin",
|
|
137
|
-
can: () => this.auth.can("admin:*"),
|
|
138
132
|
lazy: () => import("./components/AdminLayout.tsx"),
|
|
139
133
|
props: () => ({
|
|
140
134
|
adminShellProps: this.adminShellProps(),
|
|
@@ -237,20 +231,6 @@ export class AdminRouter {
|
|
|
237
231
|
can: () => this.sessionCtrl.findSessions.can(),
|
|
238
232
|
});
|
|
239
233
|
|
|
240
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
241
|
-
// Notifications
|
|
242
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
243
|
-
|
|
244
|
-
public readonly adminNotifications = $page({
|
|
245
|
-
icon: IconBell,
|
|
246
|
-
parent: this.adminLayout,
|
|
247
|
-
path: "/notifications",
|
|
248
|
-
label: "Notifications",
|
|
249
|
-
description: "View notification history and status.",
|
|
250
|
-
lazy: () => import("./components/notifications/AdminNotifications.tsx"),
|
|
251
|
-
can: () => this.notificationCtrl.findNotifications.can(),
|
|
252
|
-
});
|
|
253
|
-
|
|
254
234
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
255
235
|
// Files
|
|
256
236
|
// ─────────────────────────────────────────────────────────────────────────────
|
package/src/admin/index.ts
CHANGED
|
@@ -22,7 +22,7 @@ export * from "./primitives/$uiAdmin.ts";
|
|
|
22
22
|
* - AdminUsers with user list, create, details, settings, sessions, audits
|
|
23
23
|
* - AdminFiles for file management
|
|
24
24
|
* - AdminJobs for job monitoring
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
* - AdminParameters for configuration management
|
|
27
27
|
* - AdminSessions for session management
|
|
28
28
|
* - AdminAudits for audit log viewing
|