From 7a7c3e8e0debaa7b7869a77c513f22ff2eef358e Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Tue, 11 Mar 2025 11:10:37 +0100 Subject: [PATCH] Added Mercure_URL var env --- ogWebconsole/.env | 1 + .../commands/commands-task/task-logs/task-logs.component.ts | 3 ++- ogWebconsole/src/app/components/groups/groups.component.ts | 3 ++- ogWebconsole/src/env.d.ts | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ogWebconsole/.env b/ogWebconsole/.env index c601c93..45a28b7 100644 --- a/ogWebconsole/.env +++ b/ogWebconsole/.env @@ -1 +1,2 @@ NG_APP_BASE_API_URL=https://127.0.0.1:8443 +NG_APP_OGCORE_MERCURE_BASE_URL=http://localhost:3000/.well-known/mercure diff --git a/ogWebconsole/src/app/components/commands/commands-task/task-logs/task-logs.component.ts b/ogWebconsole/src/app/components/commands/commands-task/task-logs/task-logs.component.ts index 8637c6c..e2ef21b 100644 --- a/ogWebconsole/src/app/components/commands/commands-task/task-logs/task-logs.component.ts +++ b/ogWebconsole/src/app/components/commands/commands-task/task-logs/task-logs.component.ts @@ -18,6 +18,7 @@ import {ToastrService} from "ngx-toastr"; }) export class TaskLogsComponent implements OnInit { baseUrl: string = import.meta.env.NG_APP_BASE_API_URL; + mercureUrl: string = import.meta.env.NG_APP_OGCORE_MERCURE_BASE_URL; traces: any[] = []; groupedTraces: any[] = []; commands: any[] = []; @@ -109,7 +110,7 @@ export class TaskLogsComponent implements OnInit { map(name => (name ? this._filterClients(name) : this.clients.slice())) ); - const eventSource = new EventSource('http://localhost:3000/.well-known/mercure?topic=' + const eventSource = new EventSource(`${this.mercureUrl}?topic=` + encodeURIComponent(`traces`)); eventSource.onmessage = (event) => { diff --git a/ogWebconsole/src/app/components/groups/groups.component.ts b/ogWebconsole/src/app/components/groups/groups.component.ts index 133e2bc..43edcc4 100644 --- a/ogWebconsole/src/app/components/groups/groups.component.ts +++ b/ogWebconsole/src/app/components/groups/groups.component.ts @@ -39,6 +39,7 @@ enum NodeType { }) export class GroupsComponent implements OnInit, OnDestroy { baseUrl: string = import.meta.env.NG_APP_BASE_API_URL; + mercureUrl: string = import.meta.env.NG_APP_OGCORE_MERCURE_BASE_URL; organizationalUnits: UnidadOrganizativa[] = []; selectedUnidad: UnidadOrganizativa | null = null; selectedDetail: UnidadOrganizativa | null = null; @@ -138,7 +139,7 @@ export class GroupsComponent implements OnInit, OnDestroy { this.arrayClients = this.selectedClients.data; - const eventSource = new EventSource('http://localhost:3000/.well-known/mercure?topic=' + const eventSource = new EventSource(`${this.mercureUrl}?topic=` + encodeURIComponent(`clients`)); eventSource.onmessage = (event) => { diff --git a/ogWebconsole/src/env.d.ts b/ogWebconsole/src/env.d.ts index 0da6176..bf03f02 100644 --- a/ogWebconsole/src/env.d.ts +++ b/ogWebconsole/src/env.d.ts @@ -1,5 +1,6 @@ interface ImportMetaEnv { - readonly NG_APP_BASE_API_URL: string; // Define aquĆ­ todas las variables que necesitas + readonly NG_APP_BASE_API_URL: string; + readonly NG_APP_OGCORE_MERCURE_BASE_URL: string; } interface ImportMeta {