Grotti 3.5.2: Zu wenig Rest blockiert den Start nicht mehr, und ein anlaufender Druck wird nicht als Neustart neu eingereiht.

This commit is contained in:
Dominic Gundel committed 2026-10-21 21:04:28 +02:00
1 parent 5166ed6530
commit d1eb87ba25
13 files changed
+98 -77

No files matched your search

+36 -9
View File
@@ -322,6 +322,14 @@ function actionsHtml(state, printer) {
function flowHtml(printer) {
const job = printer.queue_running;
const bits = [];
const pending = startingJob(printer);
if (pending) {
const name = jobName(pending.filename || "") || "Datei";
bits.push(`<div class="strip flow">
<div class="flow-head">${icon("play")}<span class="grow">Startet ${escapeHtml(name)}</span></div>
<div class="flow-msg">Die Datei ist auf dem Drucker. Bis der Druck läuft, kann es etwa eine Minute dauern — der Auftrag bleibt hier.</div>
</div>`);
}
// Nur Ablauf braucht den Strip (Schritte). Einfacher Queue-Druck: Karte zeigt schon DRUCKT.
if (job && job.is_ablauf) {
const rep = repeatText(job);
@@ -511,6 +519,16 @@ function steerPanelHtml(printer) {
</div>`;
}
function startingJob(printer) {
const job = printer && printer.queue_running;
if (!job || job.is_ablauf) return null;
const phase = String(job.phase || "").toLowerCase();
if (phase !== "starting" && phase !== "await_print") return null;
const state = shownState(printer);
if (state === "printing" || state === "paused" || state === "heating") return null;
return job;
}
function heroHtml(printer, state) {
const remain = hours(printer.remain);
const eta = finishClock(printer.remain);
@@ -532,6 +550,11 @@ function heroHtml(printer, state) {
if (state === "offline") {
return `<div class="hero idle"><span class="hero-main">nicht erreichbar</span></div>`;
}
const pending = startingJob(printer);
if (pending) {
const name = jobName(pending.filename || "") || "Datei";
return `<div class="hero"><span class="hero-main"><small>startet</small>${escapeHtml(name)}</span><span class="hero-side">kann eine Minute dauern</span></div>`;
}
if (state === "complete") {
const took = hours(printer.elapsed);
const last = jobLabel(printer.filename || "");
@@ -541,7 +564,7 @@ function heroHtml(printer, state) {
if (state === "cancelled") {
return `<div class="hero idle"><span class="hero-main">abgebrochen</span></div>`;
}
const busyQueue = printer.queue_running ? "Ablauf läuft" : "";
const busyQueue = printer.queue_running && printer.queue_running.is_ablauf ? "Ablauf läuft" : "";
return `<div class="hero idle"><span class="hero-main">${needsClear(printer) ? "Platte belegt" : "bereit"}</span>${busyQueue ? `<span class="hero-side">${busyQueue}</span>` : ""}</div>`;
}
@@ -809,13 +832,15 @@ function patchCard(article, printer) {
else runningJobs.delete(printer.host);
const role = (name) => article.querySelector(`[data-role=${name}]`);
setHtml(role("chip"), chipHtml(state, labels[state]));
const pendingStart = startingJob(printer);
setHtml(role("chip"), chipHtml(pendingStart ? "heating" : state, pendingStart ? "startet" : labels[state]));
setHtml(role("hero"), heroHtml(printer, state));
patchBar(role("bar"), printer, state);
setHtml(role("stats"), statsHtml(printer, state));
setHtml(role("temps"), tempbarsHtml(printer, state));
const jobline = role("jobline");
const jobVisible = jobLineVisible(printer, state, shownFile);
const startName = pendingStart ? (pendingStart.filename || "") : "";
const jobVisible = jobLineVisible(printer, state, shownFile || startName) || !!pendingStart;
const hasThumb = !!(jobVisible && printer.preview);
if (jobline) {
jobline.hidden = !jobVisible;
@@ -847,8 +872,8 @@ function patchCard(article, printer) {
}
const job = role("job");
if (job) {
setText(job, jobName(shownFile) || "");
job.title = shownFile || "";
setText(job, jobName(shownFile || startName) || "");
job.title = shownFile || startName || "";
}
setHtml(role("swatches"), swatchesHtml(printer));
setHtml(role("flow"), flowHtml(printer));
@@ -976,7 +1001,8 @@ function patchDesk(printer) {
const nameEl = role("name");
if (nameEl) nameEl.textContent = printer.name || printer.host;
setHtml(role("badge"), printer.family_label ? `<span class="badge">${escapeHtml(printer.family_label)}</span>` : "");
setHtml(role("chip"), chipHtml(state, labels[state]));
const pendingStart = startingJob(printer);
setHtml(role("chip"), chipHtml(pendingStart ? "heating" : state, pendingStart ? "startet" : labels[state]));
setHtml(role("pills"), pillsHtml(printer.host));
const mainsail = role("mainsail");
if (mainsail) {
@@ -989,12 +1015,13 @@ function patchDesk(printer) {
setHtml(role("temps"), tempbarsHtml(printer, state));
const jobline = role("jobline");
const jobVisible = jobLineVisible(printer, state, shownFile);
const startName = pendingStart ? (pendingStart.filename || "") : "";
const jobVisible = jobLineVisible(printer, state, shownFile || startName) || !!pendingStart;
if (jobline) jobline.hidden = !jobVisible && !printer.preview;
const job = role("job");
if (job) {
setText(job, jobName(shownFile) || (jobVisible ? "" : "Kein Auftrag"));
job.title = shownFile || "";
setText(job, jobName(shownFile || startName) || (jobVisible ? "" : "Kein Auftrag"));
job.title = shownFile || startName || "";
}
const preview = role("preview");
if (preview) {