Skip to content

Add progress indication to Operations page for running tasks #246

@JayVDZ

Description

@JayVDZ

Summary

The Operations page (/admin/operations) currently shows running tasks but provides no indication of progress. Users have no way to know if a long-running task is progressing or stuck.

Current Behaviour

  • Operations page shows: Type, Name, Status, Created, Initiated By
  • No progress information displayed
  • Status only shows state (e.g., "Executing"), not progress

Desired Behaviour

Show real-time progress for running tasks:

  • Progress bar showing percentage complete
  • Current status message (e.g., "Imported 2450 objects (page 3)", "Reconciling pending exports")
  • Objects processed / Objects to process count

Technical Context

Existing Infrastructure

The Activity model already tracks progress:

  • ObjectsToProcess - total count of objects
  • ObjectsProcessed - current count processed
  • CurrentMessage - status message updated during execution

These fields are already being updated during sync operations in SyncImportTaskProcessor:

// Line 106-107 in SyncImportTaskProcessor.cs
_activity.ObjectsProcessed = totalObjectsImported;
await _jim.Activities.UpdateActivityMessageAsync(_activity, $"Imported {totalObjectsImported} objects (page {pageNumber})");

The Operations page already polls every 2 seconds for updates (line 164 in Operations.razor).

Implementation Steps

  1. Update WorkerTaskHeader DTO (JIM.Models/Tasking/DTOs/WorkerTaskHeader.cs):

    public int? ObjectsToProcess { get; set; }
    public int? ObjectsProcessed { get; set; }
    public string? ProgressMessage { get; set; }
  2. Update GetWorkerTaskHeadersAsync in TaskingServer.cs:

    • Join with Activity table to get progress fields
    • Populate the new WorkerTaskHeader fields
  3. Update Operations.razor:

    • Add a "Progress" column or expand Status display
    • Show MudProgressLinear when ObjectsToProcess > 0:
      @if (context.ObjectsToProcess > 0)
      {
          <MudProgressLinear Value="@((double)context.ObjectsProcessed / context.ObjectsToProcess * 100)" 
                            Color="Color.Primary" Rounded="true" Size="Size.Small" />
          <MudText Typo="Typo.caption">@context.ObjectsProcessed / @context.ObjectsToProcess</MudText>
      }
    • Show ProgressMessage below status or in tooltip
  4. Ensure progress updates propagate:

    • The existing polling mechanism should pick up changes automatically
    • Verify UpdateActivityMessageAsync commits changes so polling sees them

Files to Modify

  • JIM.Models/Tasking/DTOs/WorkerTaskHeader.cs - Add progress fields
  • JIM.Application/Servers/TaskingServer.cs - Update query to include progress
  • JIM.Web/Pages/Admin/Operations.razor - Display progress UI

UI Mock-up

| Type | Name              | Status     | Progress                    | Created | Initiated By |
|------|-------------------|------------|-----------------------------|---------|--------------|
| Sync | AD - Full Import  | Executing  | [========>    ] 75%         | 2 min   | admin        |
|      |                   |            | Reconciling pending exports |         |              |

Acceptance Criteria

  • Progress bar visible for tasks with known total (ObjectsToProcess > 0)
  • Indeterminate progress for tasks without known total
  • Current status message displayed
  • Progress updates in real-time (within 2-second polling interval)
  • No progress shown for queued/completed tasks (only Executing)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions