Port the HLCRF application frame from lthn-desktop into core/gui/ui/ as a reusable Angular framework. Adds: - ApplicationFrameComponent: header, collapsible sidebar, content area, footer - SystemTrayFrameComponent: 380x480 frameless panel with provider status cards - ProviderDiscoveryService: fetches GET /api/v1/providers, loads custom elements - ProviderHostComponent: renders any custom element by tag via Renderer2 - ProviderNavComponent: dynamic sidebar navigation from provider discovery - StatusBarComponent: footer with time, version, provider count, WS status - WebSocketService: persistent connection with auto-reconnect - ApiConfigService: configurable API base URL - TranslationService: key-value i18n with API fallback Navigation is dynamic (populated from providers), sidebar shows icons-only in collapsed mode with expand on click, dark mode supported throughout. Co-Authored-By: Virgil <virgil@lethean.io>
29 lines
815 B
TypeScript
29 lines
815 B
TypeScript
// SPDX-Licence-Identifier: EUPL-1.2
|
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
/**
|
|
* ApiConfigService provides a configurable base URL for all API calls.
|
|
* Defaults to the current origin (Wails embedded) but can be overridden
|
|
* for development or remote connections.
|
|
*/
|
|
@Injectable({ providedIn: 'root' })
|
|
export class ApiConfigService {
|
|
private _baseUrl = '';
|
|
|
|
/** The API base URL without a trailing slash. */
|
|
get baseUrl(): string {
|
|
return this._baseUrl;
|
|
}
|
|
|
|
/** Override the base URL. Strips trailing slash if present. */
|
|
set baseUrl(url: string) {
|
|
this._baseUrl = url.replace(/\/+$/, '');
|
|
}
|
|
|
|
/** Build a full URL for the given path. */
|
|
url(path: string): string {
|
|
const cleanPath = path.startsWith('/') ? path : `/${path}`;
|
|
return `${this._baseUrl}${cleanPath}`;
|
|
}
|
|
}
|