Retrieve repo info with individual requests
This commit is contained in:
parent
7a12406e60
commit
4c3bafdcca
|
@ -1,10 +1,6 @@
|
||||||
function inflateRepo(repo_json, label, template_id, container_id) {
|
function inflateRepo(repo_json, label, template_id, container_id) {
|
||||||
const repoLabel = `#repo-${label}`
|
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");
|
$(container_id).find(repoLabel).removeClass("bg-primary");
|
||||||
|
|
||||||
let bg_class = "bg-primary";
|
let bg_class = "bg-primary";
|
||||||
|
@ -22,25 +18,9 @@ window.addEventListener("DOMContentLoaded", function () {
|
||||||
const template = $('#repo-template').html();
|
const template = $('#repo-template').html();
|
||||||
const container = $('#repo-container');
|
const container = $('#repo-container');
|
||||||
|
|
||||||
$.getJSON(`/repo_list.json`, function (repo_list) {
|
$('[data-json-string-request]').each(function (index, element) {
|
||||||
repo_list.labels.forEach(function (repo_label) {
|
$.getJSON($(this).attr("data-json-string-request"), function (data) {
|
||||||
$.getJSON(`/repo/${repo_label}.json`, function (repo_json) {
|
$(element).html(data['data']);
|
||||||
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);
|
|
||||||
// });
|
|
||||||
}, false);
|
}, false);
|
||||||
|
|
|
@ -36,21 +36,24 @@
|
||||||
</div>
|
</div>
|
||||||
<dl class="att-label row ps-3">
|
<dl class="att-label row ps-3">
|
||||||
<dt class="col-4">Latest backup:</dt>
|
<dt class="col-4">Latest backup:</dt>
|
||||||
<dd class="repo-latest-backup col-8">
|
<dd class="repo-latest-backup col-8"
|
||||||
|
data-json-string-request="/repo/{{ repo.label }}/latest-backup.json">
|
||||||
<div class="spinner-border" role="status">
|
<div class="spinner-border" role="status">
|
||||||
</div>
|
</div>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl class="att-label row ps-3">
|
<dl class="att-label row ps-3">
|
||||||
<dt class="col-4">Size:</dt>
|
<dt class="col-4">Size:</dt>
|
||||||
<dd class="repo-size col-8">
|
<dd class="repo-size col-8"
|
||||||
|
data-json-string-request="/repo/{{ repo.label }}/size.json">
|
||||||
<div class="spinner-border" role="status">
|
<div class="spinner-border" role="status">
|
||||||
</div>
|
</div>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl class="att-label row ps-3">
|
<dl class="att-label row ps-3">
|
||||||
<dt class="col-4">Recent errors:</dt>
|
<dt class="col-4">Recent errors:</dt>
|
||||||
<dd class="repo-recent-errors col-8">
|
<dd class="repo-recent-errors col-8"
|
||||||
|
data-json-string-request="/repo/{{ repo.label }}/recent-errors.json">
|
||||||
<div class="spinner-border" role="status">
|
<div class="spinner-border" role="status">
|
||||||
</div>
|
</div>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user