ui aanpassing, debug scherm weg
This commit is contained in:
@@ -23,3 +23,8 @@ def health():
|
|||||||
@app.get("/", response_class=HTMLResponse)
|
@app.get("/", response_class=HTMLResponse)
|
||||||
def index(request: Request):
|
def index(request: Request):
|
||||||
return templates.TemplateResponse("index.html", {"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
@@ -39,7 +39,6 @@
|
|||||||
fileDownBtn: document.getElementById("fileDownBtn"),
|
fileDownBtn: document.getElementById("fileDownBtn"),
|
||||||
fileRemoveBtn: document.getElementById("fileRemoveBtn"),
|
fileRemoveBtn: document.getElementById("fileRemoveBtn"),
|
||||||
selectedFilesList: document.getElementById("selectedFilesList"),
|
selectedFilesList: document.getElementById("selectedFilesList"),
|
||||||
filenamePreviewBtn: document.getElementById("filenamePreviewBtn"),
|
|
||||||
renameExecuteBtn: document.getElementById("renameExecuteBtn"),
|
renameExecuteBtn: document.getElementById("renameExecuteBtn"),
|
||||||
fileModal: document.getElementById("fileModal"),
|
fileModal: document.getElementById("fileModal"),
|
||||||
fileModalTitle: document.getElementById("fileModalTitle"),
|
fileModalTitle: document.getElementById("fileModalTitle"),
|
||||||
@@ -85,7 +84,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function out(label, payload) {
|
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) {
|
function makeBtn(label, handler, secondary) {
|
||||||
@@ -478,7 +482,6 @@
|
|||||||
el.fileDownBtn.addEventListener("click", () => withHandler(() => reorderSelectedFiles(1), el.fileDownBtn));
|
el.fileDownBtn.addEventListener("click", () => withHandler(() => reorderSelectedFiles(1), el.fileDownBtn));
|
||||||
el.fileRemoveBtn.addEventListener("click", () => withHandler(removeSelectedFile, el.fileRemoveBtn));
|
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.renameExecuteBtn.addEventListener("click", () => withHandler(executeRename, el.renameExecuteBtn));
|
||||||
|
|
||||||
el.closeFileModalBtn.addEventListener("click", closeFileModal);
|
el.closeFileModalBtn.addEventListener("click", closeFileModal);
|
||||||
|
|||||||
+19
-15
@@ -51,6 +51,18 @@ body {
|
|||||||
font-size: 16px;
|
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 {
|
.panel h3 {
|
||||||
margin: 10px 0 6px;
|
margin: 10px 0 6px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
@@ -139,9 +151,10 @@ button.secondary {
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
|
min-height: 38px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.advanced-row {
|
.panel-actions {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
@@ -189,8 +202,10 @@ button.secondary {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#panelSelectedEpisodes .panel-footer button:first-child,
|
#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 .panel-footer button:last-child,
|
||||||
#panelSelectedFiles .advanced-row button:last-child {
|
#panelSelectedFiles .panel-actions button:last-child {
|
||||||
border-color: #0b3a6e;
|
border-color: #0b3a6e;
|
||||||
background: #0b3a6e;
|
background: #0b3a6e;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
@@ -226,19 +241,8 @@ button.secondary {
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.debug-box {
|
.debug-page {
|
||||||
margin: 0 12px 12px;
|
margin: 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1600px) {
|
@media (max-width: 1600px) {
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -47,31 +47,29 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="panel" id="panelSelectedFiles">
|
<section class="panel" id="panelSelectedFiles">
|
||||||
|
<div class="panel-head">
|
||||||
<h2>4. Selected Files</h2>
|
<h2>4. Selected Files</h2>
|
||||||
|
<button id="selectFilesBtn" class="secondary">Select Files</button>
|
||||||
|
</div>
|
||||||
<div class="stack">
|
<div class="stack">
|
||||||
<div id="fileMeta" class="muted"></div>
|
<div id="fileMeta" class="muted"></div>
|
||||||
<div class="linked-list-wrap">
|
<div class="linked-list-wrap">
|
||||||
<ul id="selectedFilesList" class="list linked-list"></ul>
|
<ul id="selectedFilesList" class="list linked-list"></ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-footer">
|
<div class="panel-footer">
|
||||||
<button id="selectFilesBtn">Select Files</button>
|
<button id="refreshSelectedFilesBtn">Refresh</button>
|
||||||
<button id="refreshSelectedFilesBtn" class="secondary">Refresh</button>
|
|
||||||
<button id="fileUpBtn" class="secondary">Up</button>
|
<button id="fileUpBtn" class="secondary">Up</button>
|
||||||
<button id="fileDownBtn" class="secondary">Down</button>
|
<button id="fileDownBtn" class="secondary">Down</button>
|
||||||
<button id="fileRemoveBtn" class="secondary">Remove</button>
|
<button id="fileRemoveBtn" class="secondary">Remove</button>
|
||||||
<button id="clearSelectedFilesBtn">Clear</button>
|
<button id="clearSelectedFilesBtn">Clear</button>
|
||||||
|
</div>
|
||||||
|
<div class="row panel-actions">
|
||||||
<button id="renameExecuteBtn">Rename Execute (confirm=true)</button>
|
<button id="renameExecuteBtn">Rename Execute (confirm=true)</button>
|
||||||
<button id="filenamePreviewBtn" class="secondary">Filename Preview (Debug)</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<details class="debug-box">
|
|
||||||
<summary>Debug Output</summary>
|
|
||||||
<pre id="outputBox"></pre>
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<div id="fileModal" class="modal hidden" aria-hidden="true">
|
<div id="fileModal" class="modal hidden" aria-hidden="true">
|
||||||
<div class="modal-card">
|
<div class="modal-card">
|
||||||
<div class="row modal-head">
|
<div class="row modal-head">
|
||||||
|
|||||||
Binary file not shown.
+12
-7
@@ -30,17 +30,21 @@ required = [
|
|||||||
"2. Episodes",
|
"2. Episodes",
|
||||||
"3. Selected Episodes",
|
"3. Selected Episodes",
|
||||||
"4. Selected Files",
|
"4. Selected Files",
|
||||||
"Debug Output",
|
"Select Files",
|
||||||
"Filename Preview",
|
|
||||||
"Rename Execute (confirm=true)",
|
"Rename Execute (confirm=true)",
|
||||||
]
|
]
|
||||||
for needle in required:
|
for needle in required:
|
||||||
assert needle in html, f"missing UI text: {needle}"
|
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")
|
print("UI panel/control validation passed")
|
||||||
PY
|
PY
|
||||||
|
|
||||||
echo
|
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 \
|
curl --fail --silent --show-error \
|
||||||
"${BASE_URL}/static/styles.css" \
|
"${BASE_URL}/static/styles.css" \
|
||||||
-o "${TMP_DIR}/styles.css"
|
-o "${TMP_DIR}/styles.css"
|
||||||
@@ -48,12 +52,14 @@ curl --fail --silent --show-error \
|
|||||||
"${BASE_URL}/static/app.js" \
|
"${BASE_URL}/static/app.js" \
|
||||||
-o "${TMP_DIR}/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
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
css = Path(sys.argv[1]).read_text(encoding="utf-8")
|
debug_html = Path(sys.argv[1]).read_text(encoding="utf-8")
|
||||||
js = Path(sys.argv[2]).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 ".grid" in css, "styles.css missing expected grid styles"
|
||||||
assert "session_id" in js, "app.js missing session_id usage"
|
assert "session_id" in js, "app.js missing session_id usage"
|
||||||
assert "/api/tvdb/search" in js, "app.js missing search endpoint usage"
|
assert "/api/tvdb/search" in js, "app.js missing search endpoint usage"
|
||||||
@@ -77,7 +83,6 @@ required_endpoints = [
|
|||||||
"/api/files/roots",
|
"/api/files/roots",
|
||||||
"/api/files/folders",
|
"/api/files/folders",
|
||||||
"/api/files/discover",
|
"/api/files/discover",
|
||||||
"/api/session/filename-preview",
|
|
||||||
"/api/session/rename-execute",
|
"/api/session/rename-execute",
|
||||||
]
|
]
|
||||||
for endpoint in required_endpoints:
|
for endpoint in required_endpoints:
|
||||||
|
|||||||
Reference in New Issue
Block a user