build(ui): expand application shell and implement administrative dashboard pages

This commit significantly expands the application's routing, navigation, and administrative capabilities. It introduces several new functional modules and refines the core layout for a more professional, dashboard-oriented experience.

- **Routing & Navigation**:
  - Added routes for `wallboard`, `call-center`, `call-center/calls`, and `chat-questions`.
  - Updated `SidebarComponent` to include all new navigation items.
  - Enhanced `LayoutComponent` with dynamic navigation based on user roles (admin vs. user).
- **New Administrative Pages**:
  - `WallboardPage`: Implements a real-time KPI dashboard with call activity trends and outcome distributions.
  - `CallCenterPage`: Provides a symbolic interface for managing call center connectivity and synchronization.
  - `CallCenterCallsPage`: Implements a call history retrieval interface with filtering capabilities.
  - `ChatQuestionsPage`: Adds a module for reviewing user questions from web and mobile channels.
- **Core Infrastructure & Refinement**:
  - Updated `AppConfig` to include an `APP_INITIALIZER` for validating user identity via `AuthService` on startup.
  - Refined `HomeComponent` layout to a "Claude-style" continuous chat column.
  - Implemented global themed scrollbars and integrated the 'Lahze' font family.
  - Added `proxy.conf.json` and updated `angular.json` to support local backend development.
- **Documentation**:
  - Added comprehensive API handoff guides for frontend-backend connection and MVP API catalog.
This commit is contained in:
Peyman Honarjoo
2026-10-10 00:20:00 +03:30
parent 0b5a882ecb
commit ff7fcbc4bb
71 changed files with 9148 additions and 780 deletions
+72 -12
View File
@@ -1,7 +1,13 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
import {
HttpClient,
HttpErrorResponse,
HttpHeaders,
HttpEvent,
HttpEventType,
} from '@angular/common/http';
import { Router } from '@angular/router';
import { catchError, Observable, throwError, map } from 'rxjs';
import { catchError, Observable, throwError, map, race } from 'rxjs';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrService } from 'ngx-toastr';
@@ -25,6 +31,8 @@ export interface HttpOptions {
cooldownMs?: number;
skipHasErrorCheck?: boolean;
headers?: Record<string, string>;
/** Optional AbortSignal forwarded to the underlying XMLHttpRequest. */
signal?: AbortSignal;
}
export const EVENT_STREAM_HEADERS = {
@@ -37,15 +45,16 @@ export const EVENT_STREAM_HEADERS = {
providedIn: 'root',
})
export class HttpService {
// private readonly baseUrl = `${window.location.protocol}//${window.location.hostname}/api`;
// public readonly backendUrl = `${window.location.protocol}//${window.location.hostname}/api`;
// public readonly apiUrl = `${window.location.protocol}//${window.location.hostname}/api`;
// public readonly imagesUrl = `${window.location.protocol}//${window.location.hostname}`;
private readonly baseUrl = `http://192.168.180.151:1321`;
public readonly backendUrl = `http://192.168.180.151:1321`;
public readonly apiUrl = `http://192.168.180.151:1321`;
public readonly imagesUrl = `http://192.168.180.151:1321`;
/**
* Same-origin deployment: the browser talks to `/api/v1/...` on the UI origin and
* the dev-server proxy (proxy.conf.json) forwards `/api` — including WebSocket
* upgrades — to the backend. The `rag_session` cookie therefore stays same-origin
* and is sent automatically; no bearer token is used for the MVP endpoints.
*/
private readonly baseUrl = 'http://10.0.8.51:1321';
public readonly backendUrl = 'http://10.0.8.51:1321';
public readonly apiUrl = 'http://10.0.8.51:1321';
public readonly imagesUrl = 'http://10.0.8.51:1321';
constructor(
private readonly http: HttpClient,
@@ -197,7 +206,7 @@ export class HttpService {
...headers,
},
signal: controller.signal,
credentials: 'omit',
credentials: 'same-origin',
})
.then((response) => {
if (!response.ok || !response.body) {
@@ -275,6 +284,57 @@ export class HttpService {
});
}
/**
* Raw PATCH (no envelope processing, no bearer token): used by MVP endpoints
* such as `PATCH /knowledge-selection` whose auth is the `rag_session` cookie.
*/
patchRaw<T>(endpoint: string, data: any, options: HttpOptions = {}): Observable<T> {
const url = `${this.baseUrl}/${endpoint}`;
const headers = options.headers ? new HttpHeaders(options.headers) : new HttpHeaders();
return this.http
.patch<T>(url, data, { headers, params: options.params })
.pipe(catchError((err) => this.handleError(err, options.skipToast)));
}
/**
* Multipart upload that reports byte-level progress as `HttpEvent`s.
* Auth is the session cookie (same origin), so — like `postRaw`/`getRaw` — the
* bearer token is not injected; pass `X-CSRF-Token` / `Idempotency-Key` via `options.headers`.
* Cancellation is driven by racing the request against an `AbortSignal`-derived error;
* the race's teardown unsubscribes and aborts the in-flight XHR.
*/
uploadWithProgress<T>(
endpoint: string,
data: FormData,
options: HttpOptions = {},
): Observable<HttpEvent<T>> {
const url = `${this.baseUrl}/${endpoint}`;
const headers = options.headers ? new HttpHeaders(options.headers) : new HttpHeaders();
const http$ = this.http.post<T>(url, data, {
headers,
params: options.params,
reportProgress: true,
observe: 'events',
});
if (!options.signal) {
return http$.pipe(catchError((err) => this.handleError(err, options.skipToast)));
}
const abort$ = new Observable<never>((subscriber) => {
if (options.signal!.aborted) {
subscriber.error(new HttpErrorResponse({ status: 0, statusText: 'Aborted', url }));
return;
}
const onAbort = () =>
subscriber.error(new HttpErrorResponse({ status: 0, statusText: 'Aborted', url }));
options.signal!.addEventListener('abort', onAbort);
return () => options.signal!.removeEventListener('abort', onAbort);
});
return race(http$, abort$).pipe(catchError((err) => this.handleError(err, options.skipToast)));
}
getRaw<T>(endpoint: string, options: HttpOptions = {}): Observable<T> {
const url = `${this.baseUrl}/${endpoint}`;
const headers = options.headers ? new HttpHeaders(options.headers) : new HttpHeaders();