JobProgress Component — sgcHTML | eSeGeCe

JobProgress

TsgcHTMLComponent_JobProgress — render a live list of background job progress bars with status badges, cancel buttons and out-of-band fragment updates, in Delphi, C++ Builder and .NET.

TsgcHTMLComponent_JobProgress

Register jobs with AddJob, move them along with UpdateJob, then read HTML for the initial render or push a single row with GetJobFragmentHTML.

Component class

TsgcHTMLComponent_JobProgress

Renders

Bootstrap 5 progress-bar list + scoped CSS

Languages

Delphi, C++ Builder, .NET

Add a job, update it, push the change

Call AddJob to register a job, render the initial HTML, then on each progress tick call UpdateJob and broadcast GetJobFragmentHTML to refresh just that row.

uses
  sgcHTML_Enums, sgcHTML_Component_JobProgress;

var
  oJobs: TsgcHTMLComponent_JobProgress;
begin
  oJobs := TsgcHTMLComponent_JobProgress.Create(nil);
  try
    oJobs.JobsID := 'exports';
    oJobs.Title := 'Background Exports';
    oJobs.ShowCompleted := False;

    oJobs.AddJob('exp-42', 'Export customers.csv', 'Generating CSV export');

    WebModule.Response := oJobs.HTML;   // card + progress rows + cancel-form script
  finally
    oJobs.Free;
  end;
end;

// On a later progress tick, push just that row over the WebSocket:
oJobs.UpdateJob('exp-42', 65, jsRunning);
Engine.BroadcastFragment(oJobs.GetJobFragmentHTML('exp-42'));
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_JobProgress.hpp

TsgcHTMLComponent_JobProgress *oJobs = new TsgcHTMLComponent_JobProgress(NULL);
try
{
  oJobs->JobsID = "exports";
  oJobs->Title = "Background Exports";
  oJobs->ShowCompleted = false;

  oJobs->AddJob("exp-42", "Export customers.csv", "Generating CSV export");

  String html = oJobs->HTML;   // card + progress rows + cancel-form script
}
__finally
{
  delete oJobs;
}

// On a later progress tick, push just that row over the WebSocket:
oJobs->UpdateJob("exp-42", 65, jsRunning, "");
Engine->BroadcastFragment(oJobs->GetJobFragmentHTML("exp-42"));
using esegece.sgcWebSockets;

var jobs = new TsgcHTMLComponent_JobProgress();
jobs.JobsID = "exports";
jobs.Title = "Background Exports";
jobs.ShowCompleted = false;

jobs.AddJob("exp-42", "Export customers.csv", "Generating CSV export");

string html = jobs.HTML;   // card + progress rows + cancel-form script

// On a later progress tick, push just that row over the WebSocket:
jobs.UpdateJob("exp-42", 65, TsgcHTMLJobStatus.jsRunning, "");
engine.BroadcastFragment(jobs.GetJobFragmentHTML("exp-42"));

Key properties & methods

The members you reach for most often.

AddJob

AddJob(aId, aName, aDescription) registers a job and returns its TsgcHTMLJobItem (Id, Name, Description, Percent, Status, StatusText, StartedAt).

UpdateJob

UpdateJob(aId, aPercent, aStatus, aStatusText) updates a job by id, clamping Percent to 0–100.

Status

TsgcHTMLJobStatus (jsQueued, jsRunning, jsCompleted, jsFailed, jsCancelled) drives the badge and progress-bar color, striped and animated while running.

Live fragments

GetJobFragmentHTML/GetJobAppendFragmentHTML return out-of-band swap fragments for PushFragment/BroadcastFragment, so a tick updates one row instead of the whole page.

Visibility

ShowCompleted hides finished jobs from the list; AutoRemoveCompleted drops them from Jobs entirely once completed.

Cancel button

ShowCancelButton, CancelCaption and CancelAction control the per-row Cancel form, posted through the same mechanism as Grid and Chat.

Keep exploring

Online HelpFull API reference and usage guide for this component.
All sgcHTML ComponentsBrowse the full feature matrix of 80+ components.
Download Free TrialThe 30-day trial ships the 60.HTML demo projects.
PricingSingle, Team and Site licenses with full source code.

Ready to Get Started?

Download the free trial and start building web UIs in Delphi, C++ Builder and .NET.