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

Commit 94bc623

Browse files
committed
Connector counts
1 parent f2408ec commit 94bc623

6 files changed

Lines changed: 638 additions & 47 deletions

File tree

‎src/lib/components/OpeyChat.svelte‎

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<script lang="ts">
22
import { onMount, onDestroy } from 'svelte';
3-
import { ShieldUserIcon } from '@lucide/svelte';
43
import { Tooltip, Dialog, Portal } from '@skeletonlabs/skeleton-svelte';
54
import { createLogger } from '$lib/utils/logger';
65
@@ -256,11 +255,6 @@
256255
}
257256
});
258257
259-
let authPipOpenState = $state(false);
260-
261-
// async function formatAuthStatusPip(session: SessionSnapshot, consentInfo?: OBPConsentInfo): {
262-
// const
263-
// }
264258
265259
async function sendMessage(text: string) {
266260
if (!text.trim()) return;
@@ -539,47 +533,53 @@
539533

540534
{#snippet statusPips(session: SessionSnapshot, consentInfo?: OBPConsentInfo)}
541535
{#if options.displayConnectionPips}
542-
<div class="flex flex-col items-center">
536+
<div class="flex flex-row items-center gap-1.5">
543537
<!-- Connection Pip with Tooltip -->
544-
<Tooltip positioning={{ placement: 'top' }}>
538+
<Tooltip>
545539
<Tooltip.Trigger>
546-
<div class="badge-icon {connectionPipColor} h-3 w-3">
547-
<ShieldUserIcon size={12} />
548-
</div>
540+
<div class="h-2 w-2 rounded-full {connectionPipColor} cursor-pointer transition-all hover:scale-125"></div>
549541
</Tooltip.Trigger>
550-
<Tooltip.Content>Opey Connection Status: {connectionStatusString}</Tooltip.Content>
542+
<Portal>
543+
<Tooltip.Positioner class="z-10">
544+
<Tooltip.Content class="card bg-primary-200-800 text-xs p-2">
545+
Opey Connection Status: {connectionStatusString}
546+
<Tooltip.Arrow class="[--arrow-size:--spacing(2)] [--arrow-background:var(--color-primary-200-800)]">
547+
<Tooltip.ArrowTip />
548+
</Tooltip.Arrow>
549+
</Tooltip.Content>
550+
</Tooltip.Positioner>
551+
</Portal>
551552
</Tooltip>
552-
<!-- Authentication Pip with Tooltip -->
553-
<Tooltip open={authPipOpenState}>
553+
<!-- Authentication/Consent Pip with Tooltip -->
554+
<Tooltip>
554555
<Tooltip.Trigger>
555-
<div class="badge-icon {authPipColor} h-3 w-3">
556-
<ShieldUserIcon size={12} />
557-
</div>
556+
<a
557+
href="/user#opey-consent"
558+
class="h-2 w-2 rounded-full {authPipColor} cursor-pointer transition-all hover:scale-125 block"
559+
aria-label="View Opey consent"
560+
></a>
558561
</Tooltip.Trigger>
559-
<Tooltip.Content>
560-
{#if session.status === 'loading'}
561-
Authenticating...
562-
{:else if session.status === 'error'}
563-
Error during authentication: {session.error}
564-
{:else if session.isAuthenticated}
565-
<h1 class="font-bold text-success-500">Authenticated</h1>
566-
{#if consentInfo}
567-
<br />
568-
Consent ID:
569-
<a href="/user#opey-consent" aria-label="view opey consent"
570-
>{consentInfo.consent_id}</a
571-
>
572-
{/if}
573-
{:else}
574-
Not Authenticated
575-
{/if}
576-
</Tooltip.Content>
562+
<Portal>
563+
<Tooltip.Positioner class="z-10">
564+
<Tooltip.Content class="card bg-primary-200-800 text-xs p-2">
565+
{#if session.status === 'loading'}
566+
Authenticating...
567+
{:else if session.status === 'error'}
568+
Error: {session.error}
569+
{:else if session.isAuthenticated && consentInfo}
570+
Click to view consent
571+
{:else if session.isAuthenticated}
572+
Authenticated (no consent info)
573+
{:else}
574+
Not Authenticated
575+
{/if}
576+
<Tooltip.Arrow class="[--arrow-size:--spacing(2)] [--arrow-background:var(--color-primary-200-800)]">
577+
<Tooltip.ArrowTip />
578+
</Tooltip.Arrow>
579+
</Tooltip.Content>
580+
</Tooltip.Positioner>
581+
</Portal>
577582
</Tooltip>
578-
<!-- {#if !session.isAuthenticated}
579-
<button class="btn btn-sm btn-primary" onclick={upgradeSession} disabled={session.status === 'loading'}>
580-
Log in to connect banking data
581-
</button>
582-
{/if} -->
583583
</div>
584584
{/if}
585585
{/snippet}

‎src/lib/config/navigation.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
CircleHelp,
3030
Rocket,
3131
Banknote,
32+
Hash,
3233
} from "@lucide/svelte";
3334
import { env } from "$env/dynamic/public";
3435

@@ -179,6 +180,11 @@ function buildMetricsItems(): NavigationItem[] {
179180
label: "Connector Metrics",
180181
iconComponent: Plug,
181182
},
183+
{
184+
href: "/connector-counts",
185+
label: "Connector Counts",
186+
iconComponent: Hash,
187+
},
182188
];
183189

184190
return items;
@@ -430,7 +436,7 @@ export const navSections: NavigationSection[] = [
430436
{ id: "my-account", label: "My Account", iconComponent: User, items: myAccountItems, basePaths: ["/user"] },
431437
{ id: "system", label: "System", iconComponent: Server, items: systemItems, basePaths: ["/system"] },
432438
{ id: "integration", label: "Integration", iconComponent: Plug, items: integrationItems, basePaths: ["/integration"] },
433-
{ id: "metrics", label: "Metrics", iconComponent: BarChart3, items: metricsItems, basePaths: ["/metrics", "/aggregate-metrics", "/connector-metrics"] },
439+
{ id: "metrics", label: "Metrics", iconComponent: BarChart3, items: metricsItems, basePaths: ["/metrics", "/aggregate-metrics", "/connector-metrics", "/connector-counts"] },
434440
{ id: "abac", label: "ABAC", iconComponent: Lock, items: abacItems, basePaths: ["/abac"] },
435441
{ id: "products", label: "Products", iconComponent: Package, items: productsItems, basePaths: ["/products"] },
436442
{ id: "rbac", label: "RBAC", iconComponent: Shield, items: rbacItems, basePaths: ["/rbac"] },
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { createLogger } from "$lib/utils/logger";
2+
import { error } from "@sveltejs/kit";
3+
import type { PageServerLoad } from "./$types";
4+
5+
const logger = createLogger("ConnectorCountsPageServer");
6+
7+
export const load: PageServerLoad = async ({ locals }) => {
8+
const session = locals.session;
9+
10+
if (!session?.data?.user) {
11+
throw error(401, "Unauthorized");
12+
}
13+
14+
const userEntitlements = (session.data.user as any)?.entitlements?.list || [];
15+
const requiredRoles = [
16+
{
17+
role: "CanGetConnectorMetrics",
18+
description: "View connector call counts",
19+
action: "view connector call counts",
20+
},
21+
];
22+
23+
return {
24+
userEntitlements,
25+
requiredRoles,
26+
};
27+
};

0 commit comments

Comments
 (0)