diff --git a/borgweb/borg/static/borg/js/index.js b/borgweb/borg/static/borg/js/index.js index 8c5c5db..2ab1218 100644 --- a/borgweb/borg/static/borg/js/index.js +++ b/borgweb/borg/static/borg/js/index.js @@ -1,10 +1,6 @@ function inflateRepo(repo_json, label, template_id, container_id) { 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"; @@ -22,25 +18,9 @@ window.addEventListener("DOMContentLoaded", function () { const template = $('#repo-template').html(); const container = $('#repo-container'); - $.getJSON(`/repo_list.json`, function (repo_list) { - repo_list.labels.forEach(function (repo_label) { - $.getJSON(`/repo/${repo_label}.json`, function (repo_json) { - inflateRepo(repo_json, repo_label, template, container); - }) - - $.getJSON(`/repo/${repo_label}/monthly-size.json`, function (repo_size_json) { - draw_time_series_graph(`repo-${repo_label}-size-graph`, repo_size_json.repo, - repo_size_json.dates, repo_size_json.units); - }) - - }); - }) - - - // $.getJSON("repo_daily.json", function (json) { - // draw_time_graph("daily_backup_size", json.repos, json.dates, json.units); - // }); - // $.getJSON("repo_monthly.json", function (json) { - // draw_time_graph("monthly_backup_size", json.repos, json.dates, json.units); - // }); + $('[data-json-string-request]').each(function (index, element) { + $.getJSON($(this).attr("data-json-string-request"), function (data) { + $(element).html(data['data']); + }) + }); }, false); diff --git a/borgweb/borg/templates/borg/index.html b/borgweb/borg/templates/borg/index.html index da4c751..cbab99b 100644 --- a/borgweb/borg/templates/borg/index.html +++ b/borgweb/borg/templates/borg/index.html @@ -36,21 +36,24 @@
Latest backup:
-
+
Size:
-
+
Recent errors:
-
+