summary: don't load size on container expand, only on manual action.
- this is too heavy to open without explicit action - increase locking timeout to 15min - expose basic info on summary page without expand.
This commit is contained in:
parent
17d63e0042
commit
0faa3e93e1
4 changed files with 33 additions and 22 deletions
|
|
@ -96,7 +96,7 @@ class CustomLockFactory(FileLock):
|
|||
# set non-blocking, this will cause an exception if we cannot acquire a lock
|
||||
operation |= fcntl.LOCK_NB
|
||||
start_lock_time = time.time()
|
||||
timeout = 60 * 5 # 5min
|
||||
timeout = 60 * 15 # 15min
|
||||
while True:
|
||||
try:
|
||||
flock_org(fd, operation)
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ var showRepoSize = function(target, repo_name, commit_id, callback) {
|
|||
var url = pyroutes.url('repo_stats',
|
||||
{"repo_name": repo_name, "commit_id": commit_id});
|
||||
|
||||
container.show();
|
||||
if (!container.hasClass('loaded')) {
|
||||
$.ajax({url: url})
|
||||
.complete(function (data) {
|
||||
|
|
|
|||
|
|
@ -83,9 +83,9 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
|
||||
<div class="fieldset">
|
||||
<div class="left-label-summary">
|
||||
${_('Information')}:
|
||||
|
||||
</div>
|
||||
<div class="right-content">
|
||||
<div class="commit-info">
|
||||
|
|
@ -105,28 +105,42 @@
|
|||
## commits
|
||||
<span class="tag">
|
||||
% if commit_rev == -1:
|
||||
${_ungettext('%(num)s Commit', '%(num)s Commits', 0) % {'num': 0}},
|
||||
${_ungettext('%(num)s Commit', '%(num)s Commits', 0) % {'num': 0}}
|
||||
% else:
|
||||
<a href="${h.route_path('repo_changelog', repo_name=c.repo_name)}">
|
||||
${_ungettext('%(num)s Commit', '%(num)s Commits', commit_rev) % {'num': commit_rev}}</a>,
|
||||
${_ungettext('%(num)s Commit', '%(num)s Commits', commit_rev) % {'num': commit_rev}}</a>
|
||||
% endif
|
||||
</span>
|
||||
|
||||
## forks
|
||||
<span class="tag">
|
||||
<a title="${_('Number of Repository Forks')}" href="${h.route_path('repo_forks_show_all', repo_name=c.repo_name)}">
|
||||
${c.repository_forks} ${_ungettext('Fork', 'Forks', c.repository_forks)}</a>,
|
||||
${c.repository_forks} ${_ungettext('Fork', 'Forks', c.repository_forks)}</a>
|
||||
</span>
|
||||
|
||||
## repo size
|
||||
% if commit_rev == -1:
|
||||
<span class="stats-bullet">0 B</span>
|
||||
% else:
|
||||
<span class="stats-bullet" id="repo_size_container">
|
||||
${_('Calculating Repository Size...')}
|
||||
</span>
|
||||
% endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
|
||||
<div class="left-label-summary">
|
||||
${_('Repository size')}:
|
||||
</div>
|
||||
<div class="right-content">
|
||||
<div class="commit-info">
|
||||
<div class="tags">
|
||||
## repo size
|
||||
% if commit_rev == -1:
|
||||
<span class="stats-bullet">0 B</span>
|
||||
% else:
|
||||
<span>
|
||||
<a href="#showSize" onclick="calculateSize(); $(this).hide(); return false" id="show-repo-size">Show repository size</a>
|
||||
</span>
|
||||
<span class="stats-bullet" id="repo_size_container" style="display:none">
|
||||
${_('Calculating Repository Size...')}
|
||||
</span>
|
||||
% endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -106,8 +106,8 @@ $(document).ready(function(){
|
|||
});
|
||||
|
||||
|
||||
// load details on summary page expand
|
||||
$('#summary_details_expand').on('click', function() {
|
||||
// calculate size of repository
|
||||
calculateSize = function () {
|
||||
|
||||
var callback = function (data) {
|
||||
% if c.show_stats:
|
||||
|
|
@ -115,13 +115,9 @@ $(document).ready(function(){
|
|||
% endif
|
||||
};
|
||||
|
||||
showRepoSize(
|
||||
'repo_size_container',
|
||||
templateContext.repo_name,
|
||||
templateContext.repo_landing_commit,
|
||||
callback);
|
||||
showRepoSize('repo_size_container', templateContext.repo_name, templateContext.repo_landing_commit, callback);
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue