Ilya Shakhat 34f43995d2 Project type is back to UI to keep compatibility with 0.4
* To keep UI compatibility with version 0.4 project type is returned.
List of project types is configured in default data, every type is
a list of modules or module groups.
* Module groups now have tags to distinguish between different kinds.
Introduced:
  'group' - for user-configured groups,
  'program' - for official programs,
  'project_type' - for types of projects within official programs,
  'organization' - for module groups generated for github organization

Change-Id: I8d5e46e18c7327e8c9d114e0a5eec021305b843e
2014-02-14 19:11:53 +04:00

269 lines
9.0 KiB
HTML

{% extends "layout.html" %}
{% import '_macros/activity_log.html' as activity_log %}
{% set show_company_breakdown = (not company) and (not user_id) %}
{% set show_engineer_breakdown = (not user_id) %}
{% set show_bp_breakdown = (metric in ['bpd', 'bpc']) %}
{% set show_module_breakdown = (not module) %}
{% set show_user_activity = (user_id) %}
{% set show_module_activity = (module) and (not user_id) %}
{% set show_activity = (show_user_activity) or (show_module_activity) %}
{% set show_user_contribution = (user_id) or (company) %}
{% set show_module_contribution = (module) and (not user_id) %}
{% set show_contribution = (show_user_contribution) or (show_module_contribution) %}
{% set show_user_profile = (user_id) %}
{% set show_top_mentors_options = (metric == 'tm_marks') %}
{% set show_review_ratio = (metric in ['marks', 'tm_marks']) %}
{% block scripts %}
<script type="text/javascript">
renderTimeline();
{% if show_company_breakdown %}
renderTableAndChart("/api/1.0/stats/companies", "company_container", "company_table", "company_chart", "company");
{% endif %}
{% if show_engineer_breakdown %}
{% if show_review_ratio %}
renderTableAndChart("/api/1.0/stats/engineers", "engineer_container", "engineer_table", "engineer_chart", "user_id",
["index", "link", "mark_ratio", "metric"]);
{% else %}
renderTableAndChart("/api/1.0/stats/engineers", "engineer_container", "engineer_table", "engineer_chart", "user_id");
{% endif %}
{% endif %}
{% if show_bp_breakdown %}
renderTableAndChart("/api/1.0/stats/bp", "bp_container", "bp_table", "bp_chart", "name",
["index", "link", "status", "date", "metric"]);
{% endif %}
{% if show_module_breakdown %}
renderTableAndChart("/api/1.0/stats/modules", "module_container", "module_table", "module_chart", "module");
{% endif %}
{% if show_user_profile %}
$(document).ready(function () {
$.ajax({
url: make_uri("/api/1.0/users/{{ user_id }}"),
dataType: "json",
success: function (data) {
$("#user_profile_template").tmpl(data["user"]).appendTo("#user_profile_container");
}
});
});
{% endif %}
{% if show_contribution %}
$(document).ready(function () {
$.ajax({
url: make_uri("/api/1.0/contribution"),
dataType: "json",
success: function (data) {
$("#contribution_template").tmpl(data["contribution"]).appendTo("#contribution_container");
}
});
});
{% endif %}
</script>
{# Templates #}
<script id="user_profile_template" type="text/x-jquery-tmpl">
{% raw %}
<div>
<div style="float: left;"><img src="${gravatar}"></div>
<div style="margin-left: 90px;">
<h2>${user_name}</h2>
<div>Company: {%html company_link %}
[<span style="font-style: italic;"><a
href="https://wiki.openstack.org/wiki/Stackalytics#Company_affiliation" style="color: grey" target="_blank">how to change</a></span>]
</div>
{%if launchpad_id != '' %}
<div>Launchpad: <a href="https://launchpad.net/~${launchpad_id}">${launchpad_id}</a></div>
{%/if%}
</div>
</div>
{% endraw %}
</script>
<script id="contribution_template" type="text/x-jquery-tmpl">
{% raw %}
<h2>Contribution Summary</h2>
<div>Total commits: <b>${commit_count}</b></div>
<div>Total LOC: <b>${loc}</b></div>
<div>Review stat (-2, -1, +1, +2, A): <b>${marks["-2"]}, ${marks["-1"]}, ${marks["1"]}, ${marks["2"]}, ${marks["A"]}</b></div>
{% endraw %}
<div>Draft Blueprints: <b>${drafted_blueprint_count}</b></div>
<div>Completed Blueprints: <b>${completed_blueprint_count}</b></div>
<div>Emails: <b>${email_count}</b></div>
{% if module %}
<div><b><a href="/report/reviews/{{ module }}/open" target="_blank">Show open reviews for {{ module }}</a></b></div>
<div><b><a href="/report/contribution/{{ module }}/30" target="_blank">Contribution for the last 30 days in {{ module }}</a></b></div>
<div><b><a href="/report/contribution/{{ module }}/90" target="_blank">Contribution for the last 90 days in {{ module }}</a></b></div>
{% endif %}
{% if company %}
<div><b><a href="/report/companies/{{ company }}" target="_blank">Show activity report for {{ company_original }}</a></b></div>
{% endif %}
{% if user_id %}
<div><b><a href="/report/users/{{ user_id }}" target="_blank">Show activity report for {{ user_id }}</a></b></div>
{% endif %}
</script>
{% endblock %}
{% block report_options %}
{% if show_top_mentors_options %}
<script type='text/javascript'>
$(document).ready(function () {
$('#review_nth').val('{{ review_nth }}');
$("#review_nth").select2();
});
function make_options() {
var options = make_std_options();
options['review_nth'] = $('#review_nth').val();
return options;
}
function reload() {
window.location.search = $.map(make_options(),function (val, index) {
return index + "=" + val;
}).join("&")
}
$(document).on('change', '#review_nth', function (evt) {
reload();
});
</script>
<div class="drop" style="margin-top: 1em;">
<label for="review_nth">Aggregate stats for first # reviews</label>
<select id="review_nth" name="review_nth"
style="min-width: 140px;"
data-placeholder="Select review #">
<option></option>
{% set review_number_options = [1, 2, 3, 4, 5, 10, 15] %}
{% for option in review_number_options %}
<option value="{{ option }}">{{ option }}</option>
{% endfor %}
</select>
</div>
{% endif %}
{% endblock %}
{% block left_frame %}
{% if show_company_breakdown %}
<div id="company_container">
<h2>Contribution by companies</h2>
<div id="company_chart" style="width: 100%; height: 350px; margin-bottom: 1em;"></div>
<table id="company_table" class="display">
<thead>
<tr>
<th>#</th>
<th>Company</th>
<th>{{ metric_label }}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="spacer"></div>
</div>
{% endif %}
{% if show_engineer_breakdown %}
<div id="engineer_container">
<h2>Contribution by engineers</h2>
<div id="engineer_chart" style="width: 100%; height: 350px; margin-bottom: 1em;"></div>
<table id="engineer_table" class="display">
<thead>
<tr>
<th>#</th>
<th>Engineer</th>
{% if show_review_ratio %}
<th>-2|-1|+1|+2|A (+/- ratio)</th>
{% endif %}
<th>{{ metric_label }}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="spacer"></div>
</div>
{% endif %}
{% if show_user_profile %}
<div id="user_profile_container" style="margin-bottom: 2em;"></div>
{% endif %}
{% if show_user_activity %}
{{ activity_log.show_activity_log(gravatar_size=32, show_all=False) }}
{% endif %}
{% if show_module_contribution %}
<div id="contribution_container"></div>
{% endif %}
{% endblock %}
{% block right_frame %}
{% if show_module_breakdown %}
<div id="module_container">
<h2>Contribution by modules</h2>
<div id="module_chart" style="width: 100%; height: 350px; margin-bottom: 1em;"></div>
<table id="module_table" class="display">
<thead>
<tr>
<th>#</th>
<th>Module</th>
<th>{{ metric_label }}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="spacer"></div>
</div>
{% endif %}
{% if show_bp_breakdown %}
<div id="bp_container">
<h2>Blueprint popularity</h2>
<div style="font-style: italic;">
This metric shows how many times a blueprint was mentioned in emails and commit messages.
</div>
<div id="bp_chart" style="width: 100%; height: 350px; margin-bottom: 1em;"></div>
<table id="bp_table" class="display">
<thead>
<tr>
<th>#</th>
<th>Blueprint</th>
<th>Status</th>
<th>Date</th>
<th>Mentions</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="spacer"></div>
</div>
{% endif %}
{% if show_user_contribution %}
<div id="contribution_container"></div>
{% endif %}
{% if show_module_activity %}
{{ activity_log.show_activity_log(gravatar_size=32, show_all=False) }}
{% endif %}
{% endblock %}