Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

Commit b7db821

Browse files
committed
Adding system database pool page
1 parent 407f168 commit b7db821

5 files changed

Lines changed: 506 additions & 0 deletions

File tree

src/lib/config/navigation.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
FileText,
2222
Lock,
2323
HardDrive,
24+
Waves,
2425
} from "@lucide/svelte";
2526
import { env } from "$env/dynamic/public";
2627

@@ -77,6 +78,11 @@ export function getActiveMenuItem(pathname: string) {
7778
function buildSystemItems(): NavigationItem[] {
7879
const items: NavigationItem[] = [
7980
{ href: "/system/cache", label: "Cache", iconComponent: HardDrive },
81+
{
82+
href: "/system/database-pool",
83+
label: "Database Pool",
84+
iconComponent: Waves,
85+
},
8086
{ href: "/system/log-cache", label: "LogCache", iconComponent: Database },
8187
{
8288
href: "/system/migrations",

src/lib/utils/roleChecker.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,15 @@ export const ROLE_REQUIREMENTS = {
320320
},
321321
],
322322

323+
// Database Pool
324+
getDatabasePool: [
325+
{
326+
role: "CanGetDatabasePoolInfo",
327+
description: "View database connection pool status",
328+
action: "view database pool",
329+
},
330+
],
331+
323332
// Rate Limiting
324333
createRateLimit: [
325334
{
@@ -543,3 +552,10 @@ export function getLogCacheRoles(): RoleRequirement[] {
543552
export function getMigrationsRoles(): RoleRequirement[] {
544553
return [...ROLE_REQUIREMENTS.getMigrations];
545554
}
555+
556+
/**
557+
* Get roles required to view database pool status
558+
*/
559+
export function getDatabasePoolRoles(): RoleRequirement[] {
560+
return [...ROLE_REQUIREMENTS.getDatabasePool];
561+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { PageServerLoad } from "./$types";
2+
import { getDatabasePoolRoles } from "$lib/utils/roleChecker";
3+
4+
export const load: PageServerLoad = async ({ locals }) => {
5+
const session = locals.session;
6+
7+
// Get user entitlements from session for role checking
8+
const userEntitlements = (session.data.user as any)?.entitlements?.list || [];
9+
10+
// Get role requirements for database pool page
11+
const requiredRoles = getDatabasePoolRoles();
12+
13+
return {
14+
userEntitlements,
15+
requiredRoles,
16+
};
17+
};

0 commit comments

Comments
 (0)