Skip to main content

Overview

The dashboard models provide aggregated statistics and recent activity data for the admin dashboard view. These models consolidate information from multiple sources to present a comprehensive overview of the system.

DashboardStats

Aggregated statistics from all tenants in the system.
data class DashboardStats(
    val totalClients: Int,
    val activeClients: Int,
    val totalGreenhouses: Int,
    val activeGreenhouses: Int,
    val totalDevices: Int,
    val sensorCount: Int,
    val actuatorCount: Int,
    val activeAlerts: Int,
    val criticalAlerts: Int,
    val totalUsers: Int
)

Fields

totalClients
Int
Total number of clients (tenants) in the system
activeClients
Int
Number of clients with isActive=true
totalGreenhouses
Int
Total number of greenhouses across all clients
activeGreenhouses
Int
Number of greenhouses with isActive=true
totalDevices
Int
Total number of devices (sensors + actuators)
sensorCount
Int
Number of sensor devices (categoryId=1)
actuatorCount
Int
Number of actuator devices (categoryId=2)
activeAlerts
Int
Number of unresolved alerts
criticalAlerts
Int
Number of critical severity alerts
totalUsers
Int
Total number of users across all tenants

StatCard

Represents a single statistic card displayed on the dashboard.
data class StatCard(
    val id: String,
    val title: String,
    val value: String,
    val subtitle: String,
    val subtitleColor: StatCardSubtitleColor = StatCardSubtitleColor.DEFAULT,
    val icon: StatCardIcon
)

Fields

id
String
Unique identifier for the stat card
title
String
Title of the stat (e.g., “Clients”, “Greenhouses”)
value
String
Main value to display (e.g., “24”, “12 active”)
subtitle
String
Subtitle or additional context
subtitleColor
StatCardSubtitleColor
default:"DEFAULT"
Color variant for the subtitle (DEFAULT, SUCCESS, WARNING)
icon
StatCardIcon
Icon to display on the card (PEOPLE, GREENHOUSE, DEVICES, ALERT, USERS)
Represents a menu item in the sidebar navigation.
data class MenuItem(
    val id: String,
    val title: String,
    val icon: MenuIcon,
    val route: String
)

Fields

id
String
Unique identifier for the menu item
title
String
Display text for the menu item
icon
MenuIcon
Icon for the menu item (DASHBOARD, CLIENTS, SETTINGS)
route
String
Navigation route for the menu item

RecentAlert

Represents a recent alert for dashboard display.
data class RecentAlert(
    val id: Long,
    val code: String,
    val tenantId: Long,
    val tenantName: String,
    val sectorCode: String?,
    val message: String?,
    val description: String?,
    val severityName: String?,
    val severityLevel: Short?,
    val createdAt: String
) {
    val displayText: String
        get() = message ?: description ?: ""
}

Computed Properties

displayText
String
Returns the message if available, otherwise description, or empty string

RecentClient

Represents a recent client for dashboard display.
data class RecentClient(
    val id: Long,
    val code: String,
    val name: String,
    val province: String?,
    val isActive: Boolean
)

DeviceBreakdown

Breakdown of devices by category.
data class DeviceBreakdown(
    val sensors: Int = 0,
    val actuators: Int = 0
) {
    val total: Int get() = sensors + actuators
}

Computed Properties

total
Int
Total number of devices (sensors + actuators)

Enums

StatCardSubtitleColor

Color variants for stat card subtitles:
  • DEFAULT - Primary green for positive changes
  • SUCCESS - Green for good status indicators
  • WARNING - Orange/Yellow for alerts requiring attention

StatCardIcon

Icons available for stat cards:
  • PEOPLE - For client/tenant counts
  • GREENHOUSE - For greenhouse counts
  • DEVICES - For device counts
  • ALERT - For alert counts
  • USERS - For user counts
Icons available for menu items:
  • DASHBOARD - Dashboard view
  • CLIENTS - Client management
  • SETTINGS - Settings and configuration

DashboardRepository

Repository for fetching dashboard data

DashboardViewModel

Dashboard screen state management

Dashboard Feature

User guide for dashboard features

Alert Models

Full alert data models

Build docs developers (and LLMs) love