{% extends "repo_master.html" %}
{% block title %}{{ select.capitalize() }} - {{
g.repo.namespace + '/' if g.repo.namespace }}{{ g.repo.name }}{% endblock %}
{% set tag = "home" %}
{% block repo %}
<div class="row">
<div class="col-md-2">
<div class="list-group">
<a class="list-group-item stats_btn" name="commits" href="#commits"
title="Evolution of the commits over time">
Commits
</a>
</div>
<div class="list-group">
<a class="list-group-item stats_btn" name="authors" href="#authors"
title="Number of commits per person having contributed to the project">
Authors
</a>
</div>
<div class="list-group">
<a class="list-group-item stats_btn" name="issues" href="#issues"
title="Evolution of the number of issues opened over a year">
Issues
</a>
</div>
</div>
<div class="col-md-8">
<section id="stats">
<span id="data_stats_spinner" style="display:none;"></span>
<span id="data_stats" style="display:none;"></span>
</section>
</div>
</div>
{% endblock %}
{% block jscripts %}
{{ super() }}
<script type="text/javascript" src="{{
url_for('static', filename='vendor/d3/d3.v4.min.js') }}"></script>
<script type="text/javascript" src="{{
url_for('static', filename='issues_stats.js') }}"></script>
<script type="text/javascript">
var view_commits_url = "{{ url_for('view_commits',
repo=repo.name,
username=username,
namespace=repo.namespace,
author='---') }}";
issues_history_stats_plot_call = function(){
var _stats_url = "{{ url_for(
'api_ns.api_view_issues_history_stats',
repo=g.repo.name,
username=username,
namespace=g.repo.namespace,) }}";
var _b = $("#data_stats");
var _s = $("#data_stats_spinner");
_s.html(
"<img id='spinnergif' src='{{ url_for('static', filename='images/spinner.gif') }}'>"
)
_s.show();
_b.html(
"<p>Number of issues open on 7 days windows</p>"
+ "<svg width=\"100%\" height=\"250\"></svg>"
);
issues_history_stats_plot(_stats_url, _b, _s);
};
commits_authors_call = function(){
var _stats_url = "{{ url_for('internal_ns.get_stats_commits') }}";
var _b = $("#data_stats");
var _s = $("#data_stats_spinner");
_s.html(
"<img id='spinnergif' src='{{ url_for('static', filename='images/spinner.gif') }}'>"
)
_s.show();
var data = {
csrf_token: "{{ form.csrf_token.current_token }}",
repo: "{{ g.repo.name }}",
username: "{{ username or '' }}",
namespace: "{{ g.repo.namespace or '' }}",
}
commits_authors(_stats_url, data);
};
commits_history_call = function(){
var _stats_url = "{{ url_for('internal_ns.get_stats_commits_trend') }}";
var _b = $("#data_stats");
var _s = $("#data_stats_spinner");
_s.html(
"<img id='spinnergif' src='{{ url_for('static', filename='images/spinner.gif') }}'>"
)
_s.show();
_b.html(
"<p>Evolution of the number of commits over the last year</p>"
+ "<svg width=\"100%\" height=\"250\"></svg>"
);
var data = {
csrf_token: "{{ form.csrf_token.current_token }}",
repo: "{{ g.repo.name }}",
username: "{{ username or '' }}",
namespace: "{{ g.repo.namespace or '' }}",
}
commits_history(_stats_url, data);
};
$(document).ready(function() {
$('.stats_btn').click(function(ev){
var _b = $("#data_stats");
_b.hide();
if ($(this).attr('name') == 'issues') {
issues_history_stats_plot_call();
} else if ($(this).attr('name') == 'authors') {
commits_authors_call();
} else if ($(this).attr('name') == 'commits') {
commits_history_call();
}
});
commits_history_call();
});
</script>
{% endblock %}