# info5-groupe-9-dashboard-rust/app architecture

> Architecture diagram of the GitHub repository info5-groupe-9-dashboard-rust/app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/info5-groupe-9-dashboard-rust/app
- Repository: https://github.com/info5-groupe-9-dashboard-rust/app

## Overview

##### Main Components
- Application Bootstrap & Core – Represent the entry point (src/main.rs) and core state management (src/app.rs).
- Models – These contain the business logic and data structures (see src/models, which has subdirectories for data structures and utility functions). Components like application_context, job, cluster, cpu, and resource should be shown as part of the business logic layer.
- Views – The UI layer (under src/views) includes components for the dashboard, Gantt chart, job details, and menu. Note the separation into components (e.g., dashboard_components, main_page, menu) that manage layout and interactivity.
- Assets & Web Specific Files – The assets folder (containing manifest.json and service worker script sw.js), index.html, and build configurations imply that the application supports Progressive Web App (PWA) functionality and WebAssembly deployment.
- External Services & Dependencies – Include SSH-based communication with HPC clusters as a distinct external service. Also, note external tools like Eframe, Egui, Trunk (for web builds), and Rust’s Cargo system.

##### Establish Relationships and Interactions
- Controllers or handlers within the app (from src/app.rs) that mediate between Models and UI components.

##### Architectural Patterns and Design Principles
- Modular structure by grouping related components (e.g., grouping all dashboard-related views together).
- For the full-stack (or rather hybrid native/web) nature, delineate between the native runtime and web deployment paths (show separate paths for building with Cargo run and Trunk serve/build).

##### Technologies, Frameworks, and Libraries
- That the application is written in Rust and builds with Cargo.
- Eframe and Egui as key UI libraries in the Views section.
- Presence of WebAssembly toolchain (rustup target add wasm32-unknown-unknown) and Trunk for web bundling.
- SSH as an external dependency for retrieving data from HPC clusters.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Bootstrapping Layer
    subgraph "Bootstrapping"
        B1["src/main.rs: Application Entry"]:::bootstrap
        B2["src/app.rs: Core Controller"]:::bootstrap
    end

    %% Models (Business Logic)
    subgraph "Models (Business Logic)"
        M1["src/models: Business Logic"]:::business
        M2["application_context"]:::business
        M3["job"]:::business
        M4["cluster"]:::business
        M5["cpu"]:::business
        M6["resource"]:::business
    end

    %% Views (UI Components)
    subgraph "Views (UI Components)"
        V1["Dashboard & Interactive Components"]:::ui
        V5["Dashboard Components"]:::ui
        V2["Gantt Chart Visualization"]:::ui
        V6["Gantt Components"]:::ui
        V3["Job Details"]:::ui
        V4["Menu & Options"]:::ui
    end

    %% Assets & Web Files
    subgraph "Assets & Web Files"
        A1["Manifest.json"]:::asset
        A2["Service Worker"]:::asset
        A3["index.html"]:::asset
    end

    %% External Services
    subgraph "External Services"
        E1["SSH to HPC Clusters"]:::external
    end

    %% Connections within Bootstrapping
    B1 -->|"initializes"| B2
    B2 -->|"bootstraps"| M1
    B2 -->|"bootstraps"| V1

    %% Models internal structure
    M1 -->|"contains"| M2
    M1 -->|"contains"| M3
    M1 -->|"contains"| M4
    M1 -->|"contains"| M5
    M1 -->|"contains"| M6

    %% Models to Views data flow
    M1 -->|"provides_data"| V1
    M1 -->|"provides_data"| V2
    M1 -->|"provides_data"| V3
    M1 -->|"provides_data"| V4

    %% Views internal composition
    V1 -->|"contains"| V5
    V2 -->|"contains"| V6

    %% Models to External Service
    M1 -->|"SSH_retrieval"| E1

    %% Assets & Web to Views (PWA support)
    A1 -->|"PWA_support"| V1
    A2 -->|"PWA_support"| V1
    A3 -->|"PWA_support"| V1

    %% Styles
    classDef bootstrap fill:#f7c6c7,stroke:#b30000,stroke-width:2px,color:#000,font-weight:bold;
    classDef business fill:#c6f7d0,stroke:#2d8a39,stroke-width:2px,color:#000;
    classDef ui fill:#c6e2ff,stroke:#2a7ecb,stroke-width:2px,color:#000;
    classDef asset fill:#ffe0b3,stroke:#d95f02,stroke-width:2px,color:#000;
    classDef external fill:#ffd6cc,stroke:#d62728,stroke-width:2px,color:#000;

    %% Click Events
    click B1 "https://github.com/info5-groupe-9-dashboard-rust/app/blob/main/src/main.rs"
    click B2 "https://github.com/info5-groupe-9-dashboard-rust/app/blob/main/src/app.rs"
    click M1 "https://github.com/info5-groupe-9-dashboard-rust/app/tree/main/src/models"
    click M2 "https://github.com/info5-groupe-9-dashboard-rust/app/blob/main/src/models/data_structure/application_context.rs"
    click M3 "https://github.com/info5-groupe-9-dashboard-rust/app/blob/main/src/models/data_structure/job.rs"
    click M4 "https://github.com/info5-groupe-9-dashboard-rust/app/blob/main/src/models/data_structure/cluster.rs"
    click M5 "https://github.com/info5-groupe-9-dashboard-rust/app/blob/main/src/models/data_structure/cpu.rs"
    click M6 "https://github.com/info5-groupe-9-dashboard-rust/app/blob/main/src/models/data_structure/resource.rs"
    click V1 "https://github.com/info5-groupe-9-dashboard-rust/app/blob/main/src/views/main_page/dashboard.rs"
    click V5 "https://github.com/info5-groupe-9-dashboard-rust/app/tree/main/src/views/components/dashboard_components"
    click V2 "https://github.com/info5-groupe-9-dashboard-rust/app/blob/main/src/views/main_page/gantt.rs"
    click V6 "https://github.com/info5-groupe-9-dashboard-rust/app/blob/main/src/views/components/gantt_aggregate_by.rs"
    click V3 "https://github.com/info5-groupe-9-dashboard-rust/app/blob/main/src/views/components/job_details.rs"
    click V4 "https://github.com/info5-groupe-9-dashboard-rust/app/tree/main/src/views/menu"
    click A1 "https://github.com/info5-groupe-9-dashboard-rust/app/blob/main/assets/manifest.json"
    click A2 "https://github.com/info5-groupe-9-dashboard-rust/app/blob/main/assets/sw.js"
    click A3 "https://github.com/info5-groupe-9-dashboard-rust/app/blob/main/index.html"
```
