Skip to content

Comments

feat: Phase 5 - Alert Configuration & Log Management#421

Merged
hossain-khan merged 1 commit intomainfrom
feature/dev-portal-phase5-alert-log-management
Dec 11, 2025
Merged

feat: Phase 5 - Alert Configuration & Log Management#421
hossain-khan merged 1 commit intomainfrom
feature/dev-portal-phase5-alert-log-management

Conversation

@hossain-khan
Copy link
Owner

Overview

Phase 5 of the Developer Portal implementation adds Alert Configuration & Log Management - a comprehensive overview of configured alerts and health check history with statistics and management actions.

Changes

New Features

Alert Configuration Overview:

  • 🔔 Active Alerts count display
  • Real-time monitoring of configured alert rules
  • Visual indicator of monitoring coverage

Log Statistics Dashboard:

  • 📊 Total Checks counter - shows all health check executions
  • 🚨 Triggered Alerts counter - highlights when alerts fired (red if > 0)
  • Provides quick insight into alert activity

Navigation & Management:

  • "View All Logs" button - navigates to AlertsListScreen for detailed history
  • "Clear Logs" button with confirmation dialog
    • Disabled when no logs exist
    • Styled with error colors for destructive action
    • Shows confirmation dialog before deletion
    • Permanent deletion warning

User Feedback:

  • ℹ️ Info message when no logs exist yet
  • Success/error snackbar messages
  • Loading states during operations

Technical Implementation

State Management:

  • configuredAlertsCount: Int - live count via Flow
  • totalChecks: Int - aggregated from all logs
  • triggeredAlerts: Int - filtered count of sent alerts
  • showClearLogsDialog: Boolean - dialog visibility control

Events:

  • NavigateToAlertsList - routes to logs screen
  • ShowClearLogsDialog / DismissClearLogsDialog - dialog management
  • ConfirmClearLogs - executes deletion with logging

Data Collection:

// Real-time statistics with produceState
val logStats by produceState(Triple(0, 0, 0)) {
    repository.getAllAlertCheckLogs().collect { logs ->
        value = Triple(
            logs.size,                      // total
            logs.count { it.isAlertSent },  // triggered
            0                               // reserved
        )
    }
}

val configuredAlertsCount by produceState(0) {
    repository.getAllRemoteAlertFlow().collect { alerts ->
        value = alerts.size
    }
}

UI Components:

  • AlertLogManagementCard composable with statistics grid
  • AlertDialog for clear logs confirmation
  • Color-coded statistics (error color for triggered alerts)
  • Responsive button layout with equal spacing

Testing

  • ./gradlew compileDebugKotlin - Compilation successful
  • ./gradlew lintKotlin - No lint errors (auto-formatted)
  • ./gradlew test - All tests passing (89 tasks)
  • ./gradlew assembleDebug - Debug APK builds successfully

Screenshots

Alert Configuration & Logs Section:

[📋 Alert Configuration & Logs]
Overview of configured alerts and check history

🔔 Configured Alerts
Active Alerts:              3

📊 Log Statistics
Total Checks:              45
Alerts Triggered:           8  ← (red if > 0)

[View All Logs]  [Clear Logs]

ℹ️ No check logs yet (when empty)

Clear Logs Dialog:

┌─────────────────────────────┐
│ Clear All Logs?             │
│                             │
│ This will permanently       │
│ delete all alert check      │
│ logs. This action cannot    │
│ be undone.                  │
│                             │
│        [Cancel]  [Clear]    │
└─────────────────────────────┘

Benefits

  1. At-a-Glance Monitoring - Quick overview of alert system health
  2. Historical Insights - Access to all check logs for debugging
  3. Log Management - Clean up old logs to manage storage
  4. Navigation Hub - Quick access to detailed logs screen

User Flow

  1. User opens Developer Portal
  2. Scrolls to Alert Configuration & Logs section
  3. Sees statistics (e.g., "3 active alerts, 45 checks, 8 triggered")
  4. Options:
    • Click "View All Logs" → Navigate to full logs screen
    • Click "Clear Logs" → Confirmation dialog → Logs deleted

Related

Next Steps

  • Phase 6: Battery Optimization Testing
  • Phase 7: Polish & Documentation

Notes

  • Uses produceState for reactive statistics
  • Confirmation dialog prevents accidental log deletion
  • Pre-commit hooks auto-formatted code
  • All existing functionality remains intact
  • No breaking changes

- Add Alert Configuration & Logs card with statistics
  * Display configured alerts count
  * Show total checks performed
  * Display triggered alerts count (highlighted in red if > 0)
- Navigation to Alerts List screen with 'View All Logs' button
- Clear all logs functionality with confirmation dialog
- Real-time statistics using Flow collection with produceState
- Log info message when no logs exist
- Update Coming Soon list (removed Alert/Log items)
@github-actions
Copy link

Code Coverage Report

View Coverage Report

@github-actions
Copy link

📊 APK Size Analysis

Comparing mainfeature/dev-portal-phase5-alert-log-management (this PR)

OLD: base.apk (signature: V2)
NEW: app-release.apk (signature: V2)

          │            compressed             │           uncompressed            
          ├───────────┬───────────┬───────────┼───────────┬───────────┬───────────
 APK      │ old       │ new       │ diff      │ old       │ new       │ diff      
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
      dex │   6.4 MiB │   6.4 MiB │ +16.8 KiB │   6.4 MiB │   6.4 MiB │ +16.8 KiB 
     arsc │ 429.8 KiB │ 429.8 KiB │       0 B │ 429.7 KiB │ 429.7 KiB │       0 B 
 manifest │   3.6 KiB │   3.6 KiB │       0 B │  16.4 KiB │  16.4 KiB │       0 B 
      res │ 160.8 KiB │ 160.8 KiB │       0 B │ 198.5 KiB │ 198.5 KiB │       0 B 
   native │  60.1 KiB │  60.1 KiB │       0 B │  58.9 KiB │  58.9 KiB │       0 B 
    asset │   6.7 KiB │   6.7 KiB │     +17 B │   6.4 KiB │   6.4 KiB │     +17 B 
    other │   106 KiB │   106 KiB │       0 B │ 172.4 KiB │ 172.4 KiB │       0 B 
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
    total │   7.2 MiB │   7.2 MiB │ +16.8 KiB │   7.3 MiB │   7.3 MiB │ +16.8 KiB 

 DEX     │ old   │ new   │ diff           
─────────┼───────┼───────┼────────────────
   files │     1 │     1 │   0            
 strings │ 33885 │ 33968 │ +83 (+101 -18) 
   types │  8949 │  8960 │ +11 (+12 -1)   
 classes │  7651 │  7662 │ +11 (+12 -1)   
 methods │ 41228 │ 41325 │ +97 (+164 -67) 
  fields │ 24573 │ 24612 │ +39 (+62 -23)  

 ARSC    │ old │ new │ diff 
─────────┼─────┼─────┼──────
 configs │ 109 │ 109 │  0   
 entries │ 392 │ 392 │  0
APK
     compressed      │    uncompressed     │                                
─────────┬───────────┼─────────┬───────────┤                                
 size    │ diff      │ size    │ diff      │ path                           
─────────┼───────────┼─────────┼───────────┼────────────────────────────────
 6.4 MiB │ +16.8 KiB │ 6.4 MiB │ +16.8 KiB │ ∆ classes.dex                  
 5.8 KiB │     +15 B │ 5.7 KiB │     +15 B │ ∆ assets/dexopt/baseline.prof  
   870 B │      +2 B │   738 B │      +2 B │ ∆ assets/dexopt/baseline.profm 
─────────┼───────────┼─────────┼───────────┼────────────────────────────────
 6.4 MiB │ +16.8 KiB │ 6.4 MiB │ +16.8 KiB │ (total)
DEX
STRINGS:

   old   │ new   │ diff           
  ───────┼───────┼────────────────
   33885 │ 33968 │ +83 (+101 -18) 
  
  +

@hossain-khan hossain-khan merged commit a7e8383 into main Dec 11, 2025
5 checks passed
@hossain-khan hossain-khan deleted the feature/dev-portal-phase5-alert-log-management branch December 11, 2025 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Dev Portal] Phase 5: Alert Configuration Overview & Log Management

1 participant