Skip to content

Commit 74da3f3

Browse files
committed
fix: ename normalization logic
1 parent d24c4cf commit 74da3f3

File tree

3 files changed

+44
-12
lines changed

3 files changed

+44
-12
lines changed

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,7 @@ PUBLIC_EID_WALLET_TOKEN=obtained-from-post-registry-service-/platforms/certifica
7777
LOKI_URL=http://localhost:3100
7878
LOKI_USERNAME=admin
7979
LOKI_PASSWORD=admin
80+
81+
LOKI_URL=http://146.190.29.56:3100
82+
LOKI_USERNAME=admin
83+
LOKI_PASSWORD=admin

asd

Whitespace-only changes.

infrastructure/control-panel/src/routes/monitoring/+page.svelte

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<script lang="ts">
2-
import { SvelteFlow, Background, Controls } from '@xyflow/svelte';
32
import { goto } from '$app/navigation';
4-
import { onMount, onDestroy } from 'svelte';
3+
import { Background, Controls, SvelteFlow } from '@xyflow/svelte';
4+
import { onDestroy, onMount } from 'svelte';
55
import '@xyflow/svelte/dist/style.css';
6-
import type { Node, Edge, NodeTypes } from '@xyflow/svelte';
76
import { Logs, VaultNode } from '$lib/fragments';
8-
import { HugeiconsIcon } from '@hugeicons/svelte';
9-
import { Database01FreeIcons, PauseFreeIcons, PlayFreeIcons } from '@hugeicons/core-free-icons';
107
import type { LogEvent } from '$lib/types';
8+
import { Database01FreeIcons, PauseFreeIcons, PlayFreeIcons } from '@hugeicons/core-free-icons';
9+
import { HugeiconsIcon } from '@hugeicons/svelte';
10+
import type { Edge, Node, NodeTypes } from '@xyflow/svelte';
1111
1212
let SvelteFlowComponent: typeof import('@xyflow/svelte').SvelteFlow | null = $state(null);
1313
@@ -507,18 +507,46 @@
507507
console.log('Cleaned w3id:', cleanW3id);
508508
509509
// Match against ename (w3id), evault, or id fields
510-
const index = selectedEVaults.findIndex((e) => {
510+
// Helper to normalize IDs by removing @ symbol for comparison
511+
const normalize = (id: string | undefined) => id?.replace('@', '') || '';
512+
513+
const index = selectedEVaults.findIndex((e, idx) => {
511514
// Check if ename (w3id) matches (with or without @)
512-
const enameMatch = e.ename && (e.ename === cleanW3id || e.ename === w3id || e.ename.replace('@', '') === cleanW3id);
513-
// Check if evault field matches
514-
const evaultMatch = e.evault && e.evault === cleanW3id;
515-
// Check if id field matches
516-
const idMatch = e.id && e.id === cleanW3id;
515+
// The event's w3id should match the eVault's ename
516+
const normalizedEname = normalize(e.ename);
517+
const enameMatch =
518+
e.ename &&
519+
(e.ename === w3id || e.ename === cleanW3id || normalizedEname === cleanW3id);
520+
521+
// Check if evault field matches (normalize both sides)
522+
const normalizedEvault = normalize(e.evault);
523+
const evaultMatch = e.evault && (e.evault === w3id || normalizedEvault === cleanW3id);
524+
525+
// Check if id field matches (normalize both sides)
526+
const normalizedId = normalize(e.id);
527+
const idMatch = e.id && (e.id === w3id || normalizedId === cleanW3id);
517528
518529
const matches = enameMatch || evaultMatch || idMatch;
519530
520531
if (matches) {
521-
console.log('Found matching eVault:', e);
532+
console.log(`Found matching eVault at index ${idx}:`, {
533+
ename: e.ename,
534+
evault: e.evault,
535+
id: e.id,
536+
matchedBy: enameMatch ? 'ename' : evaultMatch ? 'evault' : 'id'
537+
});
538+
} else {
539+
// Log why it didn't match for debugging
540+
console.log(`eVault ${idx} didn't match:`, {
541+
eventW3id: w3id,
542+
eventCleanW3id: cleanW3id,
543+
evaultEname: e.ename,
544+
evaultEnameNormalized: normalizedEname,
545+
evaultEvault: e.evault,
546+
evaultEvaultNormalized: normalizedEvault,
547+
evaultId: e.id,
548+
evaultIdNormalized: normalizedId
549+
});
522550
}
523551
524552
return matches;

0 commit comments

Comments
 (0)