
* Update blueprints with number of mentions (emails, commits, reviews) * Improved understandability of record processor tests (significantly refactored) * Extracted LP specific functions into launchpad_utils * Refactored activity template in UI Implements bp metric-by-bugs-blueprints Change-Id: I9008a84ef1960e54be6e61f0ef3d69cd2cc1d9e4
279 lines
9.5 KiB
HTML
279 lines
9.5 KiB
HTML
{% extends "layout.html" %}
|
|
|
|
{% set show_company_breakdown = (not company) and (not user_id) %}
|
|
{% set show_engineer_breakdown = ((company) or (module)) and (not user_id) %}
|
|
{% 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) %}
|
|
|
|
{% 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 %}
|
|
renderTableAndChart("/api/1.0/stats/engineers", "engineer_container", "engineer_table", "engineer_chart", "user_id", {company: "{{ company|encode }}" });
|
|
{% endif %}
|
|
{% if show_module_breakdown %}
|
|
renderTableAndChart("/api/1.0/stats/modules", "module_container", "module_table", "module_chart", "module");
|
|
{% endif %}
|
|
|
|
{% if show_activity %}
|
|
|
|
var page_size = 10;
|
|
var start_record = 0;
|
|
|
|
function load_activity() {
|
|
$.ajax({
|
|
url: make_uri("/api/1.0/activity", {page_size: page_size, start_record: start_record}),
|
|
dataType: "json",
|
|
success: function (data) {
|
|
if (data["activity"].length < page_size) {
|
|
$('#activity_more').hide();
|
|
}
|
|
if ((start_record == 0) && (data["activity"].length == 0)) {
|
|
$('#activity_header').hide();
|
|
}
|
|
$("#activity_template").tmpl(data["activity"]).appendTo("#activity_container");
|
|
}
|
|
});
|
|
}
|
|
$(document).ready(function () {
|
|
load_activity();
|
|
});
|
|
$(document).ready(function () {
|
|
$('#activity_more')
|
|
.click(function() {
|
|
start_record += page_size;
|
|
load_activity() });
|
|
});
|
|
|
|
{% 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="activity_template" type="text/x-jquery-tmpl">
|
|
{% raw %}
|
|
<div style="margin-bottom: 1em;">
|
|
<div style='float: left; '><img src="${gravatar}" style="width: 32px; height: 32px;"></div>
|
|
<div style="margin-left: 40px;">
|
|
<div style="font-weight: bold;">{%html author_link %} ({%html company_link %})</div>
|
|
<div style="font-weight: bold;">${date_str} to <a href="https://launchpad.net/${module}">${module}</a></div>
|
|
</div>
|
|
<div style="margin-left: 40px;">
|
|
{%if record_type == "commit" %}
|
|
{%if correction_comment != "" %}
|
|
<div style='font-weight: bold; color: red;'>Commit corrected:
|
|
<span>${correction_comment}</span></div>
|
|
{%/if%}
|
|
<div style='font-weight: bold;'>${subject}</div>
|
|
<div style='white-space: pre-wrap; '>{%html message %}</div>
|
|
<div><span style="color: green">+<span>${lines_added}</span></span>
|
|
<span style="color: blue">- <span>${lines_deleted}</span></span></div>
|
|
{%elif record_type == "mark" %}
|
|
<div>Patch submitted by {%html parent_author_link %}</div>
|
|
<div style='font-weight: bold;'>${subject}</div>
|
|
<div>Change Id: <a href="${url}">${review_id}</a></div>
|
|
<div style="color: {%if value > 0 %} green {%else%} blue {%/if%}">${description}: <span class="review_mark">${value}</span></div>
|
|
{%elif record_type == "email" %}
|
|
<div style='font-weight: bold;'>
|
|
{%if email_link != "" %}
|
|
<a href='${email_link}'>
|
|
{%/if%}
|
|
${subject}
|
|
{%if email_link != "" %}
|
|
</a>
|
|
{%/if%}
|
|
</div>
|
|
{%if blueprint_id_count %}
|
|
<div>Mentions blueprints:
|
|
{%each( index, value ) blueprint_id %}
|
|
${value}
|
|
{%/each%}
|
|
</div>
|
|
{%/if%}
|
|
{%elif ((record_type == "bpd") || (record_type == "bpc")) %}
|
|
<div style='font-weight: bold;'>${title} (<a href='${web_link}'>${name}</a>)</div>
|
|
<div style='white-space: pre-wrap;'>${summary}</div>
|
|
|
|
<div>Priority: <span class="specpriority${priority}">${priority}</span></div>
|
|
<div>Status: <span class="status${lifecycle_status}">${lifecycle_status}</span>
|
|
(<span class="specstatus${definition_status}">${definition_status}</span>,
|
|
<span class="specdelivery${implementation_status}">${implementation_status}</span>)</div>
|
|
{%if mention_count %}
|
|
<div><b>Mention count: ${mention_count}, last mention on ${mention_date_str}</b></div>
|
|
{%/if%}
|
|
{%/if%}
|
|
</div>
|
|
</div>
|
|
{% endraw %}
|
|
</script>
|
|
|
|
<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 %}</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): <b>${marks["-2"]}, ${marks["-1"]}, ${marks["1"]}, ${marks["2"]}</b></div>
|
|
{% endraw %}
|
|
<div>Draft Blueprints: <b>${new_blueprint_count}</b></div>
|
|
<div>Completed Blueprints: <b>${competed_blueprint_count}</b></div>
|
|
<div>Emails: <b>${email_count}</b></div>
|
|
</script>
|
|
|
|
{% 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;"></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;"></div>
|
|
|
|
<table id="engineer_table" class="display">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Engineer</th>
|
|
<th>{{ metric_label }}</th>
|
|
{% if metric == 'marks' %}
|
|
<th>-2|-1|+1|+2 (+/- ratio)</th>
|
|
{% endif %}
|
|
</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 %}
|
|
<h2 id="activity_header">Activity log</h2>
|
|
<div id="activity_container"></div>
|
|
|
|
<div style="height: 44px;">
|
|
<div class="dataTables_paginate paging_full_numbers" id="activity_paginate">
|
|
<a class="last paginate_button" tabindex="0" id="activity_more">More...</a>
|
|
</div>
|
|
</div>
|
|
{% 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;"></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_user_contribution %}
|
|
<div id="contribution_container"></div>
|
|
{% endif %}
|
|
|
|
{% if show_module_activity %}
|
|
<h2 id="activity_header">Activity log</h2>
|
|
<div id="activity_container"></div>
|
|
|
|
<div style="height: 44px;">
|
|
<div class="dataTables_paginate paging_full_numbers" id="activity_paginate">
|
|
<a class="last paginate_button" tabindex="0" id="activity_more">More...</a>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% endblock %}
|