basex-lsp/webapp/lsp-manager/api-jobs.xqm
2025-10-13 23:07:01 +01:00

37 lines
No EOL
1.1 KiB
Text

module namespace joba = 'app/jobs';
declare variable $joba:names:=("id","type","state","user","duration","time","start");
(:
id: job ID
type: type of the job (command, query, REST, RESTXQ, etc.)
state: current state of the job: scheduled, queued, running, cached
user: user who started the job
duration: evaluation time (included if a job is running or if the result was cached)
start: next start of job (included if a job will be executed repeatedly)
time: time when job was registered
:)
declare function joba:jobs()
as element(job)*
{
job:list()[. ne job:current()] ! job:list-details(.)
};
declare function joba:table($jobs as element(job)*,$names as xs:string+)
as element(table)
{
<table class="table">
<thead>
<tr>{$names!<th>{ . }</th>}</tr>
</thead>
<tbody>
{for $j in $jobs
return <tr>
{for $n in $names
let $val:= $j/@*[name() eq $n]
return <td>{$val/string()}</td>
}
</tr>}
</tbody>
</table>
};