Dashboard Module (DashboardPage)

1. Overview

The Dashboard module provides a centralized real-time monitoring interface for BastionGuard. It aggregates runtime engine status, signature database metadata, Anti-Ransomware and Anti-Phishing service states, recent on-access scanning activity, and application update availability.

The page is implemented using GTKmm (GTK4) and integrates asynchronous networking (libsoup), systemd service inspection, backend data retrieval, periodic refresh timers, and semantic version comparison logic.

The module integrates the following components:

  • Backend – provides engine status, DB version, last update date, on-access events, app version/build
  • libsoup – asynchronous HTTP update check
  • systemd – service activity detection via systemctl
  • GLib main loop – idle dispatching and timed refresh
  • Resource subsystem – icon loading

2. Page Layout and Structure

The Dashboard UI is structured as a vertical container (Gtk::Box) containing:

  • Title label (markup-enabled)
  • Grid of status cards
  • On-access log card
  • Footer update status badge

2.1 Status Cards Grid

The top section uses a Gtk::Grid with homogeneous columns and spacing to render three primary cards:

  • Stato – Antivirus + Anti-Ransomware + Anti-Phishing runtime state
  • Versione Firme – ClamAV database version
  • Ultimo aggiornamento – last DB update timestamp

Each card is created via make_card(), which standardizes icon, title, and content layout.


3. Core Utilities

3.1 Semantic Version Comparison

The module defines compare_semver() to compare semantic versions in MAJOR.MINOR.PATCH format.

Behavior:

  • Splits string by “.”
  • Parses each segment to integer
  • Pads missing parts with zero
  • Returns -1, 0, or 1

This ensures accurate comparison between local and remote versions.


3.2 System Service State Detection

Service activity is checked using:

systemctl is-active --quiet <service>

Implemented via:

static bool check_service_active(const std::string& service_name)

This enables runtime validation of:

  • BastionGuard-ransomware-realtime.service
  • BastionGuard-phishing-scanner.service

4. Update Checking Subsystem

4.1 Asynchronous Version Check

The Dashboard performs periodic update checks against:

https://bastionguard.eu/version.php

Implementation:

  • SoupSession with 10-second timeout
  • soup_session_send_and_read_async()
  • Parsing of plain text response: version=X.Y.Z build=NN

Comparison logic:

  • Uses Backend::getAppVersion()
  • Uses Backend::getAppBuild()
  • Compares via compare_semver()

4.2 Update Badge States

Status label supports CSS-driven state classes:

  • update-ok → Aggiornato
  • update-warn → Aggiornamento disponibile
  • update-checking → Verifica aggiornamenti…
  • update-unk → Impossibile verificare

State transitions are marshaled onto GTK main loop using:

Glib::signal_idle().connect_once()

Update check runs:

  • At startup
  • Every 6 hours via timeout

5. Log Monitoring Section

5.1 On-Access Events

Recent on-access scan events are retrieved via:

Backend::getOnAccessEvents()

Behavior:

  • Displays last 2 events (reverse order)
  • Word-wrapped read-only text view
  • Fallback message if empty

6. Runtime Status Updates

6.1 Periodic Refresh

The Dashboard refreshes operational state every 5 seconds via:

Glib::signal_timeout()

Update routine:

update_from_logs()

6.2 Antivirus Engine Status

Status label displays:

  • Engine active (green markup)
  • Database version
  • Last update date

Data source:

  • Backend::getDbVersion()
  • Backend::getLastUpdateDate()
  • Backend::isClamonaccActive()

6.3 Anti-Ransomware State

Service:

BastionGuard-ransomware-realtime.service

Status rendered using markup:

  • Green → Attivo
  • Red → Disattivato

6.4 Anti-Phishing State

Service:

BastionGuard-phishing-scanner.service

Status rendering identical to ransomware subsystem.


7. UI Composition and Card Factory

7.1 Card Construction

All cards are created using:

Gtk::Frame* make_card(...)

Card structure:

  • Gtk::Frame with “card” CSS class
  • Horizontal layout
  • Left icon (scaled pixbuf → texture)
  • Right content block

7.2 Icon Handling

Icons are loaded via:

Gdk::Pixbuf::create_from_file()

Then scaled and converted to:

Gdk::Texture

Failure logs to stderr but does not crash UI.


8. Runtime and Security Considerations

  • Asynchronous networking: prevents UI blocking during update checks
  • Main loop marshaling: all UI updates dispatched safely
  • Graceful failure: network errors handled without crash
  • Service validation: systemctl checks ensure accurate runtime state
  • Timer-based refresh: guarantees near-real-time dashboard state
  • Non-blocking design: no synchronous network calls

9. Operational Summary

The Dashboard module acts as the real-time operational nerve center of BastionGuard. It consolidates antivirus engine state, signature intelligence metadata, subsystem activation states, live scanning telemetry, and secure update verification into a cohesive monitoring interface.

The implementation emphasizes asynchronous safety, periodic refresh consistency, semantic version correctness, and GTK main-loop compliance.