Grotti 3.1.0: Bedarf-UI, Zeitfenster, HT/NT, Theme, Chrome-Fixes.
Bedarf in Sidebar/Material, Drucker-Zeitfenster und Tarif in Einstellungen, helles Theme; Legacy-Token und /api/drucker entfernt; SSE/SW-Fixes gegen hängende Navigation in Chrome.
This commit is contained in:
1 parent
8e88efc094
commit
6e59df22e5
23 files changed
+741
-171
No files matched your search
+23
-7
@@ -28,13 +28,29 @@ async function api(path, options = {}) {
|
||||
headers.set("Content-Type", "application/json");
|
||||
body = JSON.stringify(options.json);
|
||||
}
|
||||
const response = await fetch("/api/v1" + path, {
|
||||
method,
|
||||
headers,
|
||||
body,
|
||||
cache: "no-store",
|
||||
credentials: "same-origin",
|
||||
});
|
||||
const timeoutMs = options.timeoutMs != null ? Number(options.timeoutMs) : 20000;
|
||||
const ctrl = options.signal ? null : new AbortController();
|
||||
const timer = ctrl && timeoutMs > 0
|
||||
? setTimeout(() => ctrl.abort(), timeoutMs)
|
||||
: 0;
|
||||
let response;
|
||||
try {
|
||||
response = await fetch("/api/v1" + path, {
|
||||
method,
|
||||
headers,
|
||||
body,
|
||||
cache: "no-store",
|
||||
credentials: "same-origin",
|
||||
signal: options.signal || (ctrl && ctrl.signal),
|
||||
});
|
||||
} catch (error) {
|
||||
if (error && error.name === "AbortError") {
|
||||
throw new Error("Zeitüberschreitung — Server antwortet nicht.");
|
||||
}
|
||||
throw error;
|
||||
} finally {
|
||||
if (timer) clearTimeout(timer);
|
||||
}
|
||||
if (response.status === 401) {
|
||||
const here = location.pathname + location.search;
|
||||
if (!here.startsWith("/login") && !here.startsWith("/setup")) {
|
||||
|
||||
+95
-2
@@ -2398,7 +2398,7 @@ label.button:hover { background: rgba(255, 255, 255, 0.04); }
|
||||
.nav-main { display: none; }
|
||||
html.shelf .mobile-nav,
|
||||
body.shelf .mobile-nav {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
}
|
||||
.nav-secondary { margin-top: 0; border-top: 0; padding-top: 0; flex: 1; justify-content: flex-end; }
|
||||
.side-foot { display: none; }
|
||||
@@ -2421,7 +2421,7 @@ label.button:hover { background: rgba(255, 255, 255, 0.04); }
|
||||
.desk:not(.no-cam) .desk-cam { max-height: 18rem; }
|
||||
.mobile-nav {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
@@ -2631,6 +2631,99 @@ ul.plain li:last-child { border-bottom: 0; }
|
||||
}
|
||||
}
|
||||
|
||||
html[data-theme="light"] {
|
||||
color-scheme: light;
|
||||
--bg: #f4f4f6;
|
||||
--ink: #16161a;
|
||||
--muted: #5c5c66;
|
||||
--faint: #6e6e78;
|
||||
--line: rgba(0, 0, 0, 0.08);
|
||||
--line-strong: rgba(0, 0, 0, 0.14);
|
||||
--card: #ffffff;
|
||||
--card-2: #f0f0f3;
|
||||
--accent: #ea580c;
|
||||
--accent-ink: #fff7ed;
|
||||
--accent-soft: rgba(234, 88, 12, 0.12);
|
||||
--warn: #dc2626;
|
||||
--pause: #d97706;
|
||||
--track: #e4e4ea;
|
||||
--shadow: 0 10px 28px rgba(20, 20, 30, 0.08);
|
||||
--live: #16a34a;
|
||||
--live-soft: rgba(22, 163, 74, 0.12);
|
||||
--st-printing: #16a34a;
|
||||
--st-printing-soft: rgba(22, 163, 74, 0.1);
|
||||
--st-heating: #d97706;
|
||||
--st-heating-soft: rgba(217, 119, 6, 0.1);
|
||||
--st-done: #4f46e5;
|
||||
--st-done-soft: rgba(79, 70, 229, 0.1);
|
||||
--st-error: #dc2626;
|
||||
--st-error-soft: rgba(220, 38, 38, 0.1);
|
||||
--st-offline: #73737c;
|
||||
--st-offline-soft: rgba(0, 0, 0, 0.04);
|
||||
--st-waiting: #ea580c;
|
||||
--st-waiting-soft: rgba(234, 88, 12, 0.1);
|
||||
--st-idle: #5c5c66;
|
||||
--st-idle-soft: rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
html[data-theme="light"] body {
|
||||
background:
|
||||
radial-gradient(800px 400px at 0% 0%, rgba(234, 88, 12, 0.06), transparent 55%),
|
||||
var(--bg);
|
||||
}
|
||||
html[data-theme="light"] a:hover { color: #c2410c; }
|
||||
html[data-theme="light"] {
|
||||
scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
|
||||
}
|
||||
html[data-theme="light"]::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.18); }
|
||||
html[data-theme="light"]::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.28); }
|
||||
|
||||
.narrow-fields { max-width: 36rem; }
|
||||
.printer-edit-list { display: grid; gap: 0.85rem; }
|
||||
.printer-edit {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 0.85rem 1rem;
|
||||
background: var(--card-2);
|
||||
}
|
||||
.printer-edit .actions { margin-top: 0.65rem; gap: 0.5rem; }
|
||||
.bedarf-card { margin-bottom: 1rem; }
|
||||
.bedarf-card tr.warn td { color: var(--warn); }
|
||||
.wartung-card .lib-head { align-items: center; }
|
||||
|
||||
.bar-chart { display: grid; gap: 0.45rem; margin-top: 0.35rem; }
|
||||
.bar-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(5rem, 8rem) 1fr auto;
|
||||
gap: 0.55rem;
|
||||
align-items: center;
|
||||
}
|
||||
.bar-label {
|
||||
font-size: var(--t-sm);
|
||||
color: var(--muted);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.bar-track {
|
||||
height: 0.55rem;
|
||||
border-radius: 99px;
|
||||
background: var(--track);
|
||||
overflow: hidden;
|
||||
}
|
||||
.bar-fill {
|
||||
display: block;
|
||||
height: 100%;
|
||||
border-radius: inherit;
|
||||
background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fbbf24));
|
||||
}
|
||||
.bar-val {
|
||||
font-size: var(--t-xs);
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: var(--faint);
|
||||
min-width: 3.5rem;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
@media print {
|
||||
.sidebar, .mobile-nav, .conn-banner, .toast-host, .nav-toggle { display: none !important; }
|
||||
.app-shell { display: block; }
|
||||
|
||||
+26
-7
@@ -1,27 +1,46 @@
|
||||
/* Minimaler Service-Worker: App-Shell-Cache für Offline-Hinweis. */
|
||||
const CACHE = "grotti-shell-v1";
|
||||
const SHELL = ["/", "/static/grotti.css?v=54", "/static/api.js?v=28", "/static/ui.js?v=2"];
|
||||
/* Nur Static-Assets cachen — nie HTML-Navigation abfangen (sonst falsche Seite in Chrome). */
|
||||
const CACHE = "grotti-shell-v2";
|
||||
|
||||
self.addEventListener("install", (event) => {
|
||||
event.waitUntil(caches.open(CACHE).then((c) => c.addAll(SHELL).catch(() => undefined)));
|
||||
self.skipWaiting();
|
||||
event.waitUntil(
|
||||
caches.open(CACHE).then((cache) =>
|
||||
cache.addAll([
|
||||
"/static/grotti.css?v=56",
|
||||
"/static/api.js?v=29",
|
||||
"/static/ui.js?v=3",
|
||||
]).catch(() => undefined)
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener("activate", (event) => {
|
||||
event.waitUntil(
|
||||
caches.keys().then((keys) =>
|
||||
Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k)))
|
||||
)
|
||||
).then(() => self.clients.claim())
|
||||
);
|
||||
self.clients.claim();
|
||||
});
|
||||
|
||||
self.addEventListener("fetch", (event) => {
|
||||
const req = event.request;
|
||||
if (req.method !== "GET") return;
|
||||
// Dokument-Navigation immer ans Netz — kein Fallback auf „/“.
|
||||
if (req.mode === "navigate") return;
|
||||
const url = new URL(req.url);
|
||||
if (url.origin !== self.location.origin) return;
|
||||
if (url.pathname.startsWith("/api/")) return;
|
||||
if (!url.pathname.startsWith("/static/")) return;
|
||||
|
||||
event.respondWith(
|
||||
fetch(req).catch(() => caches.match(req).then((hit) => hit || caches.match("/")))
|
||||
fetch(req)
|
||||
.then((res) => {
|
||||
if (res.ok) {
|
||||
const copy = res.clone();
|
||||
caches.open(CACHE).then((c) => c.put(req, copy)).catch(() => {});
|
||||
}
|
||||
return res;
|
||||
})
|
||||
.catch(() => caches.match(req))
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user