Fix MAC address encoding in client logs Grafana URL

MAC addresses contain colons which are special characters in Lucene
query syntax. URL-encoding the MAC with encodeURIComponent ensures
Grafana receives the value correctly decoded (52:54:00:e7:c7:cf)
and can substitute it into the host.mac filter without parse errors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
pull/71/head
Nicolas Arenas 2026-04-21 20:01:42 +02:00
parent 3cb148e5ef
commit 7d4be64b60
1 changed files with 1 additions and 1 deletions

View File

@ -18,7 +18,7 @@ export class ClientLogsModalComponent {
private configService: ConfigService,
private sanitizer: DomSanitizer
) {
const mac = this.data.client.mac || '';
const mac = encodeURIComponent(this.data.client.mac || '');
const iframeUrlString = `${this.configService.logUrl}/d-solo/opengnsys-clients/filebeat-clients?orgId=1&timezone=browser&var-hostname=$__all&var-mac=${mac}&refresh=5s&panelId=1&__feature.dashboardSceneSolo`;
this.iframeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(iframeUrlString);
this.grafanaUrl = `${this.configService.logUrl}/d/opengnsys-clients/filebeat-clients?orgId=1&from=now-5m&to=now&timezone=browser&var-hostname=$__all&var-mac=${mac}&refresh=5s&viewPanel=panel-1`;