Move dashboard into stackalytics
Installing a global module called dashboard is bad form as it pollutes the global namespace. Change-Id: I4b7ff8a4bbcb34a24f751d874c5f1894e75ae10c Closes-Bug: #1320133
This commit is contained in:
committed by
Ilya Shakhat
parent
a77502ea10
commit
246df32c07
167
stackalytics/dashboard/templates/_macros/activity_log.html
Normal file
167
stackalytics/dashboard/templates/_macros/activity_log.html
Normal file
@@ -0,0 +1,167 @@
|
||||
{% macro show_activity_log(user_id=None, company=None, blueprint_id=None,
|
||||
show_record_type=True, show_user_gravatar=True, gravatar_size=32, show_all=True) -%}
|
||||
|
||||
<script type="text/javascript">
|
||||
var page_size = 10;
|
||||
var start_record = 0;
|
||||
var uri_options = {};
|
||||
{% if show_all %}
|
||||
uri_options = {project_type: "all", release: "all", metric: "all"};
|
||||
{% endif %}
|
||||
{% if user_id %}
|
||||
uri_options["user_id"] = "{{ user_id }}";
|
||||
{% endif %}
|
||||
{% if company %}
|
||||
uri_options["company"] = "{{ company|safe }}";
|
||||
{% endif %}
|
||||
{% if blueprint_id %}
|
||||
uri_options["blueprint_id"] = "{{ blueprint_id }}";
|
||||
{% endif %}
|
||||
|
||||
function load_activity(extra_options) {
|
||||
var options = {page_size: page_size, start_record: start_record};
|
||||
$.extend(options, extra_options);
|
||||
|
||||
$.ajax({
|
||||
url: makeURI("/api/1.0/activity", options),
|
||||
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();
|
||||
}
|
||||
$.each(data["activity"], function() {
|
||||
extendWithGravatar(this, {{ gravatar_size }});
|
||||
});
|
||||
$("#activity_template").tmpl(data["activity"]).appendTo("#activity_container");
|
||||
$('.ext_link').click(function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
window.open(this.href, '_blank');
|
||||
});
|
||||
$(".expand-button").click(function () {
|
||||
$("#content-" + this.id).slideToggle('fast');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).ready(function () {
|
||||
load_activity(uri_options);
|
||||
});
|
||||
$(document).ready(function () {
|
||||
$('#activity_more')
|
||||
.click(function () {
|
||||
start_record += page_size;
|
||||
load_activity(uri_options)
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script id="activity_template" type="text/x-jquery-tmpl">
|
||||
<div class="record">
|
||||
<div style='float: left; '>
|
||||
{% if show_user_gravatar %}
|
||||
<img src="${gravatar}">
|
||||
{% else %}
|
||||
<img src="http://www.gravatar.com/avatar/a${parseInt(record_type,36)}?s={{ gravatar_size }}&d=identicon" style="width: {{ gravatar_size }}px; height: {{ gravatar_size }}px;">
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div style="margin-left: {{ gravatar_size * 1.4 }}px;">
|
||||
|
||||
{% raw %}
|
||||
{%if coauthor %}
|
||||
<div class="header">
|
||||
{%each(index,value) coauthor %}{%if index>0 %}, {%/if%}{%html value.author_link %} ({%html value.company_link %}){%/each%}
|
||||
</div>
|
||||
{%else%}
|
||||
<div class="header">{%html author_link %} ({%html company_link %})</div>
|
||||
{%/if%}
|
||||
<div class="header">${date_str} in {%html module_link%}</div>
|
||||
|
||||
{%if record_type == "commit" %}
|
||||
<div class="header">Commit “${subject}”</div>
|
||||
<div class="message">{%html message %}</div>
|
||||
{%if commit_date_str != "" %}
|
||||
<div>Commit date: ${commit_date_str}</div>
|
||||
{%/if%}
|
||||
{%if correction_comment != "" %}
|
||||
<div style='font-weight: bold; color: red;'>Commit corrected:
|
||||
<span>${correction_comment}</span></div>
|
||||
{%/if%}
|
||||
<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 class="header">Review “${parent_subject}”</div>
|
||||
<div>Submitted by: {%html parent_author_link %} ({%html parent_company_link %}) (#${parent_review_number})</div>
|
||||
<div>Change Id: <a href="${parent_url}" target="_blank">${review_id}</a></div>
|
||||
<div style="color: {%if value > 0 %} green {%else%} blue {%/if%}">
|
||||
{%if (type == "Workflow" && value == 1) %}
|
||||
Approved
|
||||
{%elif (type == "Workflow" && value == -1) %}
|
||||
Work in progress
|
||||
{%else%}
|
||||
${type}: <span class="review_mark">${value}</span>
|
||||
{%/if%}
|
||||
</div>
|
||||
{%elif record_type == "review" %}
|
||||
<div class="header">New change request “${subject}”</div>
|
||||
<div>Current Status: ${status}</div>
|
||||
<div>Change Id: <a href="${url}" target="_blank">${id}</a></div>
|
||||
{%elif record_type == "patch" %}
|
||||
<div class="header">Patch #${number} “${parent_subject}”</div>
|
||||
<div>Change Id: <a href="${parent_url}" target="_blank">${review_id}</a></div>
|
||||
{%elif record_type == "email" %}
|
||||
<div class="header">
|
||||
{%if email_link != "" %}
|
||||
<a href='${email_link}'>
|
||||
{%/if%}
|
||||
Email “${subject}”
|
||||
{%if email_link != "" %}
|
||||
</a>
|
||||
{%/if%}
|
||||
</div>
|
||||
{%if blueprint_id_count %}
|
||||
<div>Mentions blueprints:
|
||||
{%each( index, value ) blueprint_links %}
|
||||
{%html value %}
|
||||
{%/each%}
|
||||
</div>
|
||||
{%/if%}
|
||||
{%if body %}
|
||||
<div>Email: <span class="expand-button" id="button-${record_id}">[+]</span></div>
|
||||
<div id="content-button-${record_id}" class="message" style="display:none;">${body}</div>
|
||||
{%/if%}
|
||||
{%elif ((record_type == "bpd") || (record_type == "bpc")) %}
|
||||
<div class="header">Blueprint “${title}” ({%html blueprint_link %})</div>
|
||||
<div class="message">${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%}
|
||||
{%elif ((record_type == "bugf") || (record_type == "bugr")) %}
|
||||
<div class="header">“${title}”</div>
|
||||
<div>Status: <span class="status${status}">${status}</span></div>
|
||||
<div>Importance: ${importance}</div>
|
||||
{%/if%}
|
||||
</div>
|
||||
</div>
|
||||
{% endraw %}
|
||||
</script>
|
||||
|
||||
<h2 id="activity_header">Activity Log</h2>
|
||||
<div id="activity_container"></div>
|
||||
|
||||
<div style="height: 44px;">
|
||||
<div class="paging_full_numbers" id="activity_paginate" style="margin-left: {{ gravatar_size * 1.4 }}px;">
|
||||
<a class="last paginate_button" tabindex="0" id="activity_more">More...</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{%- endmacro %}
|
||||
@@ -0,0 +1,46 @@
|
||||
{% macro show_contribution_summary(user_id=None, company=None, show_all=True) -%}
|
||||
|
||||
<script type="text/javascript">
|
||||
function load_contribution_summary(extra_options) {
|
||||
$.ajax({
|
||||
url: makeURI("/api/1.0/contribution", extra_options),
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
$("#contribution_template").tmpl(data["contribution"]).appendTo("#contribution_container");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
var uri_options = {};
|
||||
{% if show_all %}
|
||||
uri_options = {project_type: "all", release: "all", metric: "all"};
|
||||
{% endif %}
|
||||
{% if user_id %}
|
||||
uri_options["user_id"] = "{{ user_id }}";
|
||||
{% endif %}
|
||||
{% if company %}
|
||||
uri_options["company"] = "{{ company|safe }}";
|
||||
{% endif %}
|
||||
|
||||
load_contribution_summary(uri_options);
|
||||
});
|
||||
</script>
|
||||
|
||||
<script id="contribution_template" type="text/x-jquery-tmpl">
|
||||
{% raw %}
|
||||
<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>
|
||||
<div>Draft Blueprints: <b>${drafted_blueprint_count}</b></div>
|
||||
<div>Completed Blueprints: <b>${completed_blueprint_count}</b></div>
|
||||
<div>Filed Bugs: <b>${filed_bug_count}</b></div>
|
||||
<div>Resolved Bugs: <b>${resolved_bug_count}</b></div>
|
||||
<div>Emails: <b>${email_count}</b></div>
|
||||
{% endraw %}
|
||||
</script>
|
||||
|
||||
<h2>Contribution Summary</h2>
|
||||
<div id="contribution_container"></div>
|
||||
|
||||
{%- endmacro %}
|
||||
49
stackalytics/dashboard/templates/_macros/user_profile.html
Normal file
49
stackalytics/dashboard/templates/_macros/user_profile.html
Normal file
@@ -0,0 +1,49 @@
|
||||
{% macro show_user_profile(user_id) -%}
|
||||
|
||||
<script type="text/javascript">
|
||||
function load_user_profile(extra_options) {
|
||||
$.ajax({
|
||||
url: makeURI("/api/1.0/users/{{ user_id }}", extra_options),
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
var user = data["user"];
|
||||
extendWithGravatar(user, 64);
|
||||
$("#user_profile_template").tmpl(data["user"]).appendTo("#user_profile_container");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
var uri_options = {};
|
||||
load_user_profile(uri_options);
|
||||
});
|
||||
</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 %}
|
||||
[<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}" target="_blank">${launchpad_id}</a></div>
|
||||
{%/if%}
|
||||
{%if core != '' %}
|
||||
<div>Core in:
|
||||
{%each( index, value ) core %}
|
||||
${value[0]} (<small>${value[1]}</small>)
|
||||
{%/each%}
|
||||
</div>
|
||||
{%/if%}
|
||||
</div>
|
||||
</div>
|
||||
{% endraw %}
|
||||
</script>
|
||||
|
||||
<div id="user_profile_container" style="margin-bottom: 2em;"></div>
|
||||
|
||||
{%- endmacro %}
|
||||
Reference in New Issue
Block a user