JobProgress Component — sgcHTML | eSeGeCe

JobProgress

TsgcHTMLComponent_JobProgress — renderizza un elenco live di barre di avanzamento per job in background, con badge di stato, pulsanti di annullamento e aggiornamenti a frammenti out-of-band, in Delphi, C++ Builder e .NET.

TsgcHTMLComponent_JobProgress

Registra i job con AddJob, falli avanzare con UpdateJob, quindi leggi HTML per il rendering iniziale oppure invia una singola riga con GetJobFragmentHTML.

Classe del componente

TsgcHTMLComponent_JobProgress

Renderizza

Bootstrap 5 progress-bar list + scoped CSS

Linguaggi

Delphi, C++ Builder, .NET

Aggiungi un job, aggiornalo, invia la modifica

Chiama AddJob per registrare un job, renderizza l’HTML iniziale, quindi a ogni avanzamento chiama UpdateJob e trasmetti GetJobFragmentHTML per aggiornare solo quella riga.

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"));

Proprietà e metodi principali

I membri che utilizzerai più spesso.

AddJob

AddJob(aId, aName, aDescription) registra un job e restituisce il suo TsgcHTMLJobItem (Id, Name, Description, Percent, Status, StatusText, StartedAt).

UpdateJob

UpdateJob(aId, aPercent, aStatus, aStatusText) aggiorna un job in base al suo id, limitando Percent tra 0 e 100.

Status

TsgcHTMLJobStatus (jsQueued, jsRunning, jsCompleted, jsFailed, jsCancelled) determina il colore del badge e della barra di avanzamento, a righe e animata durante l’esecuzione.

Frammenti live

GetJobFragmentHTML/GetJobAppendFragmentHTML restituiscono frammenti di swap out-of-band per PushFragment/BroadcastFragment, così un tick aggiorna una riga invece dell’intera pagina.

Visibilità

ShowCompleted nasconde dall’elenco i job completati; AutoRemoveCompleted li rimuove del tutto da Jobs una volta completati.

Pulsante Annulla

ShowCancelButton, CancelCaption e CancelAction controllano il modulo Annulla per riga, inviato con lo stesso meccanismo di Grid e Chat.

Continua a esplorare

Guida in lineaRiferimento API completo e guida all’uso per questo componente.
Tutti i componenti sgcHTMLEsplora la matrice completa delle funzionalità di oltre 80 componenti.
Scarica la Prova GratuitaLa prova di 30 giorni include i progetti demo 60.HTML.
PrezziLicenze Single, Team e Site con codice sorgente completo.

Pronto a Iniziare?

Scarica la versione di prova gratuita e inizia a creare interfacce web in Delphi, C++ Builder e .NET.