diff --git a/borgweb/borg/static/borg/js/index.js b/borgweb/borg/static/borg/js/index.js index 1892d35..e9543e4 100644 --- a/borgweb/borg/static/borg/js/index.js +++ b/borgweb/borg/static/borg/js/index.js @@ -1,11 +1,11 @@ function inflateRepo(repo_json, label, template_id, container_id) { - const template_copy = $(template_id).clone(); - $(template_copy).find(".repo-label").html(label); - $(template_copy).find(".repo-location").html(repo_json.location); - $(template_copy).find(".repo-latest-backup").html(repo_json.latest_backup); - $(template_copy).find(".repo-size").html(repo_json.size); - $(template_copy).find(".repo-recent-errors").html(repo_json.recent_errors); - $(template_copy).find(".repo-size-graph").prop("id", `repo-${label}-size-graph`); + const repoLabel = `#repo-${label}` + + $(container_id).find(repoLabel).find(".repo-latest-backup").html(repo_json.latest_backup); + $(container_id).find(repoLabel).find(".repo-size").html(repo_json.size); + $(container_id).find(repoLabel).find(".repo-recent-errors").html(repo_json.recent_errors); + + $(container_id).find(repoLabel).removeClass("bg-primary"); let bg_class = "bg-primary"; if (repo_json.error) { @@ -13,9 +13,7 @@ function inflateRepo(repo_json, label, template_id, container_id) { } else if (repo_json.warning) { bg_class = "bg-warning"; } - $(template_copy).addClass(bg_class); - - $(container_id).append(template_copy); + $(container_id).find(repoLabel).addClass(bg_class); } diff --git a/borgweb/borg/templates/borg/index.html b/borgweb/borg/templates/borg/index.html index e1b4e16..e0b936a 100644 --- a/borgweb/borg/templates/borg/index.html +++ b/borgweb/borg/templates/borg/index.html @@ -15,29 +15,68 @@ {% block style %} {{ block.super }} .repo-container { - padding: 8px; - margin: 8px; + padding: 8px; + margin: 8px; } .att-label { - margin-top: 4px; - margin-bottom: 4px; + margin-top: 4px; + margin-bottom: 4px; } {% endblock %} {% block body %} -