Changeset View
Changeset View
Standalone View
Standalone View
swh/web/assets/src/bundles/webapp/webapp-utils.js
Show First 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
export function initHomePage() { | export function initHomePage() { | ||||
$(document).ready(() => { | $(document).ready(() => { | ||||
$('.swh-coverage-list').iFrameResize({heightCalculationMethod: 'taggedElement'}); | $('.swh-coverage-list').iFrameResize({heightCalculationMethod: 'taggedElement'}); | ||||
fetch(Urls.stat_counters()) | fetch(Urls.stat_counters()) | ||||
.then(response => response.json()) | .then(response => response.json()) | ||||
.then(data => { | .then(data => { | ||||
if (data.stat_counters) { | if (data.stat_counters.content) { | ||||
$('#swh-contents-count').html(data.stat_counters.content.toLocaleString()); | $('#swh-contents-count').html(data.stat_counters.content.toLocaleString()); | ||||
$('#swh-revisions-count').html(data.stat_counters.revision.toLocaleString()); | $('#swh-revisions-count').html(data.stat_counters.revision.toLocaleString()); | ||||
$('#swh-origins-count').html(data.stat_counters.origin.toLocaleString()); | $('#swh-origins-count').html(data.stat_counters.origin.toLocaleString()); | ||||
$('#swh-directories-count').html(data.stat_counters.directory.toLocaleString()); | $('#swh-directories-count').html(data.stat_counters.directory.toLocaleString()); | ||||
$('#swh-persons-count').html(data.stat_counters.person.toLocaleString()); | $('#swh-persons-count').html(data.stat_counters.person.toLocaleString()); | ||||
$('#swh-releases-count').html(data.stat_counters.release.toLocaleString()); | $('#swh-releases-count').html(data.stat_counters.release.toLocaleString()); | ||||
} | } | ||||
if (data.stat_counters_history) { | if (data.stat_counters_history.content) { | ||||
swh.webapp.drawHistoryCounterGraph('#swh-contents-count-history', data.stat_counters_history.content); | swh.webapp.drawHistoryCounterGraph('#swh-contents-count-history', data.stat_counters_history.content); | ||||
swh.webapp.drawHistoryCounterGraph('#swh-revisions-count-history', data.stat_counters_history.revision); | swh.webapp.drawHistoryCounterGraph('#swh-revisions-count-history', data.stat_counters_history.revision); | ||||
swh.webapp.drawHistoryCounterGraph('#swh-origins-count-history', data.stat_counters_history.origin); | swh.webapp.drawHistoryCounterGraph('#swh-origins-count-history', data.stat_counters_history.origin); | ||||
} else { | |||||
$('#swh-contents-count-history').hide(); | |||||
$('#swh-revisions-count-history').hide(); | |||||
$('#swh-origins-count-history').hide(); | |||||
} | } | ||||
}); | }); | ||||
}); | }); | ||||
initPage('home'); | initPage('home'); | ||||
} | } | ||||
export function showModalMessage(title, message) { | export function showModalMessage(title, message) { | ||||
$('#swh-web-modal-message .modal-title').text(title); | $('#swh-web-modal-message .modal-title').text(title); | ||||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |