ui aanpassing, debug scherm weg

This commit is contained in:
kodi
2026-03-08 09:18:20 +01:00
parent e10082e1bc
commit d7f97b2a77
7 changed files with 66 additions and 34 deletions
+5
View File
@@ -23,3 +23,8 @@ def health():
@app.get("/", response_class=HTMLResponse)
def index(request: Request):
return templates.TemplateResponse("index.html", {"request": request})
@app.get("/debug.html", response_class=HTMLResponse)
def debug_page(request: Request):
return templates.TemplateResponse("debug.html", {"request": request})
+6 -3
View File
@@ -39,7 +39,6 @@
fileDownBtn: document.getElementById("fileDownBtn"),
fileRemoveBtn: document.getElementById("fileRemoveBtn"),
selectedFilesList: document.getElementById("selectedFilesList"),
filenamePreviewBtn: document.getElementById("filenamePreviewBtn"),
renameExecuteBtn: document.getElementById("renameExecuteBtn"),
fileModal: document.getElementById("fileModal"),
fileModalTitle: document.getElementById("fileModalTitle"),
@@ -85,7 +84,12 @@
}
function out(label, payload) {
el.outputBox.textContent = `${label}\n${JSON.stringify(payload, null, 2)}`;
const text = `${label}\n${JSON.stringify(payload, null, 2)}`;
if (el.outputBox) {
el.outputBox.textContent = text;
return;
}
console.log(text);
}
function makeBtn(label, handler, secondary) {
@@ -478,7 +482,6 @@
el.fileDownBtn.addEventListener("click", () => withHandler(() => reorderSelectedFiles(1), el.fileDownBtn));
el.fileRemoveBtn.addEventListener("click", () => withHandler(removeSelectedFile, el.fileRemoveBtn));
el.filenamePreviewBtn.addEventListener("click", () => withHandler(async () => out("Filename preview", await api(q("/api/session/filename-preview"))), el.filenamePreviewBtn));
el.renameExecuteBtn.addEventListener("click", () => withHandler(executeRename, el.renameExecuteBtn));
el.closeFileModalBtn.addEventListener("click", closeFileModal);
+19 -15
View File
@@ -51,6 +51,18 @@ body {
font-size: 16px;
}
.panel-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
margin-bottom: 10px;
}
.panel-head h2 {
margin: 0;
}
.panel h3 {
margin: 10px 0 6px;
font-size: 14px;
@@ -139,9 +151,10 @@ button.secondary {
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
min-height: 38px;
}
.advanced-row {
.panel-actions {
margin-top: 8px;
justify-content: flex-end;
}
@@ -189,8 +202,10 @@ button.secondary {
}
#panelSelectedEpisodes .panel-footer button:first-child,
#panelSelectedEpisodes .panel-footer button:last-child,
#panelSelectedFiles .panel-footer button:first-child,
#panelSelectedFiles .panel-footer button:last-child,
#panelSelectedFiles .advanced-row button:last-child {
#panelSelectedFiles .panel-actions button:last-child {
border-color: #0b3a6e;
background: #0b3a6e;
color: #ffffff;
@@ -226,19 +241,8 @@ button.secondary {
font-size: 12px;
}
.debug-box {
margin: 0 12px 12px;
background: #ffffff;
border: 1px solid #d7dee9;
border-radius: 8px;
padding: 8px;
}
.debug-box > summary {
cursor: pointer;
user-select: none;
color: #334155;
font-size: 13px;
.debug-page {
margin: 12px;
}
@media (max-width: 1600px) {
+17
View File
@@ -0,0 +1,17 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Rename MVP Debug</title>
<link rel="stylesheet" href="/static/styles.css" />
</head>
<body>
<header class="topbar">
<h1>Rename MVP Debug</h1>
</header>
<main class="debug-page">
<pre id="outputBox">Debug output is available here when needed.</pre>
</main>
</body>
</html>
+6 -8
View File
@@ -47,31 +47,29 @@
</section>
<section class="panel" id="panelSelectedFiles">
<div class="panel-head">
<h2>4. Selected Files</h2>
<button id="selectFilesBtn" class="secondary">Select Files</button>
</div>
<div class="stack">
<div id="fileMeta" class="muted"></div>
<div class="linked-list-wrap">
<ul id="selectedFilesList" class="list linked-list"></ul>
</div>
<div class="panel-footer">
<button id="selectFilesBtn">Select Files</button>
<button id="refreshSelectedFilesBtn" class="secondary">Refresh</button>
<button id="refreshSelectedFilesBtn">Refresh</button>
<button id="fileUpBtn" class="secondary">Up</button>
<button id="fileDownBtn" class="secondary">Down</button>
<button id="fileRemoveBtn" class="secondary">Remove</button>
<button id="clearSelectedFilesBtn">Clear</button>
</div>
<div class="row panel-actions">
<button id="renameExecuteBtn">Rename Execute (confirm=true)</button>
<button id="filenamePreviewBtn" class="secondary">Filename Preview (Debug)</button>
</div>
</div>
</section>
</main>
<details class="debug-box">
<summary>Debug Output</summary>
<pre id="outputBox"></pre>
</details>
<div id="fileModal" class="modal hidden" aria-hidden="true">
<div class="modal-card">
<div class="row modal-head">
Binary file not shown.
+12 -7
View File
@@ -30,17 +30,21 @@ required = [
"2. Episodes",
"3. Selected Episodes",
"4. Selected Files",
"Debug Output",
"Filename Preview",
"Select Files",
"Rename Execute (confirm=true)",
]
for needle in required:
assert needle in html, f"missing UI text: {needle}"
for removed in ["Debug Output", "Filename Preview", "Mapping Preview"]:
assert removed not in html, f"unexpected legacy UI text present: {removed}"
print("UI panel/control validation passed")
PY
echo
echo "== Feature test 2: static assets are served =="
echo "== Feature test 2: debug page and static assets are served =="
curl --fail --silent --show-error \
"${BASE_URL}/debug.html" \
-o "${TMP_DIR}/debug.html"
curl --fail --silent --show-error \
"${BASE_URL}/static/styles.css" \
-o "${TMP_DIR}/styles.css"
@@ -48,12 +52,14 @@ curl --fail --silent --show-error \
"${BASE_URL}/static/app.js" \
-o "${TMP_DIR}/app.js"
python3 - "${TMP_DIR}/styles.css" "${TMP_DIR}/app.js" <<'PY'
python3 - "${TMP_DIR}/debug.html" "${TMP_DIR}/styles.css" "${TMP_DIR}/app.js" <<'PY'
import sys
from pathlib import Path
css = Path(sys.argv[1]).read_text(encoding="utf-8")
js = Path(sys.argv[2]).read_text(encoding="utf-8")
debug_html = Path(sys.argv[1]).read_text(encoding="utf-8")
css = Path(sys.argv[2]).read_text(encoding="utf-8")
js = Path(sys.argv[3]).read_text(encoding="utf-8")
assert "Rename MVP Debug" in debug_html, "debug.html missing expected title/text"
assert ".grid" in css, "styles.css missing expected grid styles"
assert "session_id" in js, "app.js missing session_id usage"
assert "/api/tvdb/search" in js, "app.js missing search endpoint usage"
@@ -77,7 +83,6 @@ required_endpoints = [
"/api/files/roots",
"/api/files/folders",
"/api/files/discover",
"/api/session/filename-preview",
"/api/session/rename-execute",
]
for endpoint in required_endpoints: