Skip to main content

Overview

The Web module is a hybrid application combining an Angular-based frontend with a Go backend server. It serves the Dashboard UI and handles web-specific logic including settings management, localization, and configuration.
The Web module is responsible for presenting data fetched from the Kubernetes API through the API module in an intuitive, user-friendly interface.

Module Architecture

Dual-Layer Design

Entry Point

The Go server starts in modules/web/main.go:
Reference: modules/web/main.go:36-62

Frontend Architecture (Angular)

Technology Stack

Reference: modules/web/package.json

Project Structure

Core Modules

Provides singleton services shared across the application:

Key Features

Material Design UI

Built with Angular Material components:
Custom themes in src/_theming.scss:
  • Light theme (_light.scss)
  • Dark theme (_dark.scss)

Resource Management

Angular services communicate with API module:

Data Tables

Powered by Angular Material with sorting, filtering, and pagination:

Metrics Visualization

Charts using ngx-charts and D3:

Terminal Emulation

Integrated terminal using xterm.js:

Internationalization (i18n)

Multi-language support using Angular i18n:
Build commands:
Reference: modules/web/i18n/

Backend Server (Go)

Package Structure

API Endpoints

The Go server provides several web-specific APIs:

GET /config

Returns application configuration:
Reference: modules/web/pkg/config/

GET /api/v1/settings/global

Returns global settings:
Reference: modules/web/pkg/settings/

GET /api/v1/systembanner

Returns system banner configuration:
Reference: modules/web/pkg/systembanner/

GET /api/v1/locale

Returns available locales:
Reference: modules/web/pkg/locale/

Route Registration

Routes are registered via init() functions:
Reference: modules/web/main.go:29-33

Build Process

Development Build

Development server features:
  • Hot module replacement
  • Proxy to API module
  • Source maps for debugging

Production Build

Reference: modules/web/package.json:16-18

Docker Build

Multi-stage Dockerfile:
Reference: modules/web/Dockerfile

Configuration

Angular Configuration

angular.json defines build configurations:
Reference: modules/web/angular.json

Proxy Configuration

Development proxy to API module:
Reference: modules/web/proxy.conf.json

Styling and Theming

SCSS Architecture

Custom Material Theme

Testing

Unit Tests (Jest)

Test configuration in jest.config.js.

E2E Tests (Cypress)

Cypress configuration in cypress.config.ts. Reference:
  • modules/web/jest.config.js
  • modules/web/cypress.config.ts

Code Quality

Linting

Tools:
  • ESLint: TypeScript linting
  • Prettier: Code formatting
  • Stylelint: SCSS linting
Reference: modules/web/package.json:19-28

Code Conventions

Follows: Reference: DEVELOPMENT.md:20

Deployment

Helm chart configuration:
Reference: charts/kubernetes-dashboard/templates/deployments/web.yaml

Performance Optimizations

Resource modules are lazy-loaded to reduce initial bundle size:
Ahead-of-Time compilation for production:
  • Faster rendering
  • Smaller bundle size
  • Early error detection
OnPush strategy for better performance:
For large lists:

API Module

Backend API consumed by web module

Auth Module

Authentication flow integration

Angular Documentation

Official Angular documentation

Material Design

Angular Material components