feat: Activity feed — cron deliveries with output (#420)
* feat: add Activity feed showing cron jobs that produced output - New ActivityItem data model for unified notification feed - SessionInfo extended with preview/started_at fields - GET /api/sessions?source=cron endpoint added with source param - ActivityViewModel fetches cron run sessions, filters for output - ActivityScreen shows chronological feed with status icons - Wired into navigation (AUTOMATE drawer section) - Only shows runs with message_count > 0 (signal-driven) Closes #402 * fix: add @Composable to statusColor helper (MaterialTheme access) * fix: Double type for started_at (backend returns float timestamps) * fix: use GET /api/cron/jobs for Activity feed (no-agent jobs don't create sessions) Root cause: no-agent cron jobs (jellyfin, battery monitor, etc.) run scripts directly and NEVER create DB sessions. The previous approach using GET /api/sessions?source=cron only showed 3 old agent-driven sessions. Fix: use GET /api/cron/jobs which tracks last_run_at + last_status for ALL job types. Filter last_status == "ok" (job ran and delivered). * fix: match codebase patterns for ViewModel, Scaffold, and NavIcon - safeApiCall returns NetworkResult, use when(is) not onSuccess/onFailure - HermesScaffold navigationIcon expects NavIcon.Menu/Back sealed class - Screen composable param must be onOpenDrawer (capital O) * fix: correct ActivityScreen API mismatches - NavIcon.Menu param is onOpen, not onClick - EmptyState param is subtitle, not description - Add missing viewModel import * fix: padding, clickable cards, and navigation on Activity screen - Fix double padding by using listContentPadding + listItemSpacing matching the codebase pattern - Add clickable cards that navigate to CronJobsScreen - Remove unused scroll and spacer workarounds * refactor: replace separate Activity feed with delivered-only filter in Cron tab - Remove ActivityScreen, ActivityViewModel, ActivityItem - Remove ActivityScreen from navigation keys and registry - Add showDeliveredOnly toggle to CronJobsUiState - Add TaskAlt icon button in cron top bar toggles filter - Jobs with lastRunStatus != "ok" hidden when filter is on * feat: clickable cron job cards show run-details dialog - Clicking a job card opens an AlertDialog with last run info - Shows status, last run time, schedule, error (if any), script - RunDetailRow helper composable for label/value pairs * fix: add missing CronJob import in CronJobsScreen * fix: use snake_case field names for CronJob model - lastRunAt -> last_run_at, lastError -> last_error - These are data class constructor params, not computed properties * refactor: remove delivered-only filter toggle, keep card-click dialog - Remove TaskAlt filter icon button from Cron tab top bar - Remove showDeliveredOnly from state and toggleDeliveredFilter() method - Simplify cron list back to direct state.jobs with no filter layer * chore: remove dead activity_empty strings --------- Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
c91651302a
commit
58bd78bd79
3 files changed
+59
-2
No files matched your search
@@ -15,6 +15,9 @@ data class CronJob(
|
||||
val schedule_display: String? = null,
|
||||
val last_status: String? = null,
|
||||
val next_run_at: String? = null,
|
||||
val last_run_at: String? = null,
|
||||
val last_error: String? = null,
|
||||
val last_delivery_error: String? = null,
|
||||
// Full editor fields — all optional with defaults for backward compat
|
||||
val enabled: Boolean? = null,
|
||||
val prompt: String? = null,
|
||||
|
||||
@@ -13,4 +13,6 @@ data class SessionInfo(
|
||||
val created_at: String?,
|
||||
val message_count: Int?,
|
||||
val status: String?,
|
||||
val preview: String? = null,
|
||||
val started_at: Double? = null,
|
||||
)
|
||||
Reference in new issue
Block a user