implement scrapy + pygea job runner
This commit is contained in:
parent
916968c579
commit
8af28c2f68
8 changed files with 888 additions and 163 deletions
|
|
@ -144,6 +144,20 @@ def _upcoming_row(job: Mapping[str, object]) -> tuple[Node, ...]:
|
|||
|
||||
|
||||
def _completed_row(execution: Mapping[str, object]) -> tuple[Node, ...]:
|
||||
ended_at = _maybe_text(execution, "ended_at_iso")
|
||||
ended_at_label: Node = h.p(class_="font-medium text-slate-900")[
|
||||
_text(execution, "ended_at")
|
||||
]
|
||||
if ended_at is not None:
|
||||
ended_at_label = h.time(
|
||||
{
|
||||
"data-ended-at": ended_at,
|
||||
"title": ended_at,
|
||||
},
|
||||
datetime=ended_at,
|
||||
class_="font-medium text-slate-900",
|
||||
)[_text(execution, "ended_at")]
|
||||
|
||||
return (
|
||||
h.div[
|
||||
h.div(class_="font-semibold text-slate-950")[_text(execution, "source")],
|
||||
|
|
@ -157,7 +171,7 @@ def _completed_row(execution: Mapping[str, object]) -> tuple[Node, ...]:
|
|||
],
|
||||
],
|
||||
h.div[
|
||||
h.p(class_="font-medium text-slate-900")[_text(execution, "ended_at")],
|
||||
ended_at_label,
|
||||
h.p(class_="mt-1 text-xs text-slate-500")[_text(execution, "summary")],
|
||||
],
|
||||
status_badge(
|
||||
|
|
@ -262,10 +276,12 @@ window.repubFormatNextRuns = window.repubFormatNextRuns || (() => {
|
|||
return relativeFormatter.format(0, 'second');
|
||||
};
|
||||
const format = () => {
|
||||
document.querySelectorAll('time[data-next-run-at]').forEach((element) => {
|
||||
const nextRunAt = element.getAttribute('data-next-run-at');
|
||||
if (!nextRunAt) return;
|
||||
const targetDate = new Date(nextRunAt);
|
||||
document.querySelectorAll('time[data-next-run-at], time[data-ended-at]').forEach((element) => {
|
||||
const relativeAt =
|
||||
element.getAttribute('data-next-run-at') ??
|
||||
element.getAttribute('data-ended-at');
|
||||
if (!relativeAt) return;
|
||||
const targetDate = new Date(relativeAt);
|
||||
if (Number.isNaN(targetDate.getTime())) return;
|
||||
element.textContent = formatRelative(targetDate);
|
||||
element.title = absoluteFormatter.format(targetDate);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue