Only log job list clears that removed something
This commit is contained in:
1 parent
71730bc6a7
commit
68df7cfb3c
2 files changed
+12
-6
No files matched your search
@@ -1733,10 +1733,13 @@ async def api_pull_model(request: Request):
|
|||||||
def api_clear_history():
|
def api_clear_history():
|
||||||
with state_lock:
|
with state_lock:
|
||||||
st = load_state()
|
st = load_state()
|
||||||
st["history"] = []
|
count = len(st["history"])
|
||||||
save_state(st)
|
if count:
|
||||||
logger.info("Cleared the job history")
|
st["history"] = []
|
||||||
return {"ok": True}
|
save_state(st)
|
||||||
|
if count:
|
||||||
|
logger.info("Cleared %d jobs from the list", count)
|
||||||
|
return {"ok": True, "cleared": count}
|
||||||
|
|
||||||
|
|
||||||
@app.get("/api/trending")
|
@app.get("/api/trending")
|
||||||
|
|||||||
+5
-2
@@ -290,8 +290,11 @@ try{document.execCommand("copy");$("#copy-msg").textContent="Copied"}catch(err){
|
|||||||
ta.remove()}
|
ta.remove()}
|
||||||
setTimeout(()=>{$("#copy-msg").textContent=""},3000)};
|
setTimeout(()=>{$("#copy-msg").textContent=""},3000)};
|
||||||
$("#clear-jobs").onclick=async()=>{
|
$("#clear-jobs").onclick=async()=>{
|
||||||
if(!confirm("Clear the job list? Videos on disk and on YouTube are not touched."))return;
|
const b=$("#clear-jobs");
|
||||||
try{await api("/api/history/clear",{method:"POST"});refresh()}catch(e){alert(e.message)}};
|
if(b.disabled)return;
|
||||||
|
b.disabled=true;
|
||||||
|
try{await api("/api/history/clear",{method:"POST"});await refresh()}catch(e){alert(e.message)}
|
||||||
|
b.disabled=false};
|
||||||
$("#preview").onclick=async()=>{
|
$("#preview").onclick=async()=>{
|
||||||
$("#preview-msg").textContent="Loading...";
|
$("#preview-msg").textContent="Loading...";
|
||||||
try{
|
try{
|
||||||
|
|||||||
Reference in new issue
Block a user