From 775d618315a540da0e54d38621fcf15500a25180 Mon Sep 17 00:00:00 2001 From: boyska Date: Tue, 24 Aug 2021 23:48:56 +0200 Subject: [PATCH] clearly shows files not ready --- techrec/db.py | 1 + techrec/static/js/archive.js | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/techrec/db.py b/techrec/db.py index 5e431d2..c38e2fe 100644 --- a/techrec/db.py +++ b/techrec/db.py @@ -44,6 +44,7 @@ class Rec(Base): "starttime": self.starttime, "endtime": self.endtime, "filename": self.filename, + "ready": self.ready, } def __repr__(self): diff --git a/techrec/static/js/archive.js b/techrec/static/js/archive.js index 3ce9d19..6e7dabe 100644 --- a/techrec/static/js/archive.js +++ b/techrec/static/js/archive.js @@ -37,11 +37,17 @@ $(function() { ); var duration = $('').text(delta(rec.endtime, rec.starttime)); var dl_text = $('').text(" Scarica").addClass('pure-hidden-phone'); - var fn = $("").append($("").prop("href", "/output/" + - rec.filename).addClass("pure-button pure-button-small") - .html( $("").addClass("fa fa-download").css("color", "green")) - .append(dl_text)); + var fn = $("") + if(rec.ready) { + fn.append($("").prop("href", "/output/" + rec.filename) + .addClass("pure-button pure-button-small") + .html( $("").addClass("fa fa-download").css("color", "green")) + .append(dl_text)); + } else { + fn.html("File not found") + } var row = $('').append(name).append(start).append(duration).append(fn); + row.data('id', rec.id) $('#ongoing-recs-table tbody').append(row); } });