Activity log code is polished
+ Removed activity log macro (unused) + Added Icehouse tags for glance into test data Change-Id: I56de44684e234e9b212da4a69ab47b53511ca5ca
This commit is contained in:
parent
a53ed51a6f
commit
ad271d4d29
@ -58,23 +58,28 @@ def extend_record(record):
|
||||
if not parent:
|
||||
return None
|
||||
|
||||
parent = parent.copy()
|
||||
_extend_record_common_fields(parent)
|
||||
for k, v in parent.iteritems():
|
||||
record['parent_%s' % k] = v
|
||||
|
||||
record['review_number'] = parent.get('review_number')
|
||||
record['subject'] = parent['subject']
|
||||
record['url'] = parent['url']
|
||||
record['parent_author_link'] = make_link(
|
||||
parent['author_name'], '/',
|
||||
{'user_id': parent['user_id'], 'company': ''})
|
||||
elif record['record_type'] == 'email':
|
||||
record['email_link'] = record.get('email_link') or ''
|
||||
record['blueprint_links'] = []
|
||||
for bp_id in record.get('blueprint_id', []):
|
||||
bp_module, bp_name = bp_id.split(':')
|
||||
record['blueprint_links'].append(
|
||||
make_blueprint_link(bp_module, bp_name))
|
||||
elif record['record_type'] in ['bpd', 'bpc']:
|
||||
record['summary'] = utils.format_text(record['summary'])
|
||||
if record.get('mention_count'):
|
||||
record['mention_date_str'] = format_datetime(
|
||||
record['mention_date'])
|
||||
record['blueprint_link'] = make_blueprint_link(
|
||||
record['name'], record['module'])
|
||||
record['blueprint_link'] = make_blueprint_link(record['module'],
|
||||
record['name'])
|
||||
|
||||
return record
|
||||
|
||||
@ -179,7 +184,7 @@ def make_link(title, uri=None, options=None):
|
||||
return '<a href="%(uri)s">%(title)s</a>' % {'uri': uri, 'title': title}
|
||||
|
||||
|
||||
def make_blueprint_link(name, module):
|
||||
def make_blueprint_link(module, name):
|
||||
uri = '/report/blueprint/' + module + '/' + name
|
||||
return '<a href="%(uri)s">%(title)s</a>' % {'uri': uri, 'title': name}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% macro show_activity_log(user_id=None, company=None, blueprint_id=None, show_gravatar=True, gravatar_size=32) -%}
|
||||
{% macro show_activity_log(user_id=None, company=None, blueprint_id=None, show_record_type=True, show_user_gravatar=True, gravatar_size=32) -%}
|
||||
|
||||
<script type="text/javascript">
|
||||
var page_size = 10;
|
||||
@ -55,7 +55,11 @@
|
||||
<script id="activity_template" type="text/x-jquery-tmpl">
|
||||
<div style="margin-bottom: 1em;">
|
||||
<div style='float: left; '>
|
||||
{% if show_user_gravatar %}
|
||||
<img src="${gravatar}" style="width: {{ gravatar_size }}px; height: {{ gravatar_size }}px;">
|
||||
{% 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;">
|
||||
@ -65,36 +69,37 @@
|
||||
<div style="font-weight: bold;">${date_str} in {%html module_link%}</div>
|
||||
|
||||
{%if record_type == "commit" %}
|
||||
<div style='font-weight: bold;'>Commit “${subject}”</div>
|
||||
<div style='white-space: pre-wrap; '>{%html message %}</div>
|
||||
{%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>Review #${review_number} submitted by {%html parent_author_link %}</div>
|
||||
<div style='font-weight: bold;'>${subject}</div>
|
||||
<div style='font-weight: bold;'>Review “${subject}”</div>
|
||||
<div>${review_number} review submitted by {%html parent_author_link %} ({%html parent_company_link %})</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 == "review" %}
|
||||
<div style='font-weight: bold;'>${subject}</div>
|
||||
<div style='font-weight: bold;'>Patch “${subject}”</div>
|
||||
<div>Current Status: ${status}</div>
|
||||
<div>Change Id: <a href="${url}">${id}</a></div>
|
||||
{%elif record_type == "email" %}
|
||||
<div style='font-weight: bold;'>
|
||||
{%if email_link != "" %}
|
||||
<a href='${email_link}'>
|
||||
{%/if%}
|
||||
${subject}
|
||||
Email “${subject}”
|
||||
{%if email_link != "" %}
|
||||
</a>
|
||||
{%/if%}
|
||||
</div>
|
||||
{%if blueprint_id_count %}
|
||||
<div>Mentions blueprints:
|
||||
{%each( index, value ) blueprint_id %}
|
||||
${value}
|
||||
{%each( index, value ) blueprint_links %}
|
||||
{%html value %}
|
||||
{%/each%}
|
||||
</div>
|
||||
{%/if%}
|
||||
@ -103,7 +108,7 @@
|
||||
<div id="content-button-${record_id}" class="message" style="display:none;">${body}</div>
|
||||
{%/if%}
|
||||
{%elif ((record_type == "bpd") || (record_type == "bpc")) %}
|
||||
<div style='font-weight: bold;'>${title} ({%html blueprint_link %})</div>
|
||||
<div style='font-weight: bold;'>Blueprint “${title}” ({%html blueprint_link %})</div>
|
||||
<div style='white-space: pre-wrap;'>${summary}</div>
|
||||
|
||||
<div>Priority: <span class="specpriority${priority}">${priority}</span></div>
|
||||
|
@ -40,95 +40,6 @@
|
||||
{% block scripts %}{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% macro show_activity_log(activity, show_gravatar) -%}
|
||||
|
||||
<h2>Activity Log</h2>
|
||||
|
||||
{% if not activity %}
|
||||
<div>No activity.</div>
|
||||
{% else %}
|
||||
|
||||
{% for item in activity %}
|
||||
<div class="activity">
|
||||
<div style='float: left; '>
|
||||
{% if show_gravatar %}
|
||||
<img src="{{ item.gravatar }}">
|
||||
{% else %}
|
||||
<img src="{{ item.record_type | gravatar(default='retro') }}">
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div style="margin-left: 86px;">
|
||||
|
||||
{% if item.record_type == "commit" %}
|
||||
|
||||
<h3>{{ item.date_str}} — commit “{{item.subject}}” to {{ item.module }}</h3>
|
||||
|
||||
<div>Author: <a href="/report/users/{{ item.user_id }}">{{ item.author_name }}</a>
|
||||
(<a href="/report/companies/{{ item.company_name }}">{{ item.company_name }}</a>)</div>
|
||||
|
||||
<div class="message">{{ item.message | safe }}</div>
|
||||
<div><span style="color: green">+<span>{{ item.lines_added }}</span></span>
|
||||
<span style="color: blue">- <span>{{ item.lines_deleted }}</span></span>
|
||||
</div>
|
||||
{% if item.correction_comment %}
|
||||
<div style='font-weight: bold; color: red;'>Commit corrected:
|
||||
<span>{{ item.correction_comment }}</span></div>
|
||||
{% endif %}
|
||||
|
||||
{% elif item.record_type == "mark" %}
|
||||
|
||||
<h3>{{ item.date_str}} — review “{{item.subject}}” in {{ item.module }}</h3>
|
||||
|
||||
<div>Reviewer: <a href="/report/users/{{ item.user_id }}">{{ item.author_name }}</a>
|
||||
(<a href="/report/companies/{{ item.company_name }}">{{ item.company_name }}</a>)</div>
|
||||
<div>Submitter: <a href="/report/users/{{ item.parent_user_id }}">{{ item.parent_author_name }}</a>
|
||||
(<a href="/report/companies/{{ item.company_name }}">{{ item.parent_company_name }}</a>)</div>
|
||||
<div>Change Id: <a href="{{item.url}}">{{item.review_id}}</a></div>
|
||||
<div style="color: {% if item.value > 0 %} green {% else %} blue {% endif %}">
|
||||
{{item.description}}: <span class="review_mark">{{item.value}}</span></div>
|
||||
|
||||
{% elif item.record_type == "review" %}
|
||||
|
||||
<h3>{{ item.date_str}} — patch “{{item.subject}}” posted into {{ item.module }}</h3>
|
||||
|
||||
<div>Author: <a href="/report/users/{{ item.user_id }}">{{ item.author_name }}</a>
|
||||
(<a href="/report/companies/{{ item.company_name }}">{{ item.company_name }}</a>)</div>
|
||||
<div>Current Status: {{ item.status }}</div>
|
||||
<div>URL: <a href="{{item.url}}">{{item.url}}</a></div>
|
||||
<div>Change Id: <a href="{{item.url}}">{{item.id}}</a></div>
|
||||
|
||||
{% elif item.record_type == "email" %}
|
||||
|
||||
<h3>{{ item.date_str}} — email “{{item.subject}}”</h3>
|
||||
|
||||
<div>Author: <a href="/report/users/{{ item.user_id }}">{{ item.author_name }}</a>
|
||||
(<a href="/report/companies/{{ item.company_name }}">{{ item.company_name }}</a>)</div>
|
||||
{% if item.body %}
|
||||
<div class="message">{{ item.body|safe }}</div>
|
||||
{% endif %}
|
||||
|
||||
{% elif item.record_type in ["bpd", "bpc"] %}
|
||||
|
||||
<h3>{{ item.date_str}} — blueprint “{{item.title}}” in {{ item.module }}</h3>
|
||||
|
||||
<div>Author: <a href="/report/users/{{ item.user_id }}">{{ item.author_name }}</a>
|
||||
(<a href="/report/companies/{{ item.parent_company_name }}">{{ item.parent_company_name }}</a>)</div>
|
||||
<div>Launchpad: <a href="https://blueprints.launchpad.net/{{ item.module }}/+spec/{{ item.name }}">https://blueprints.launchpad.net/{{ item.module }}/+spec/{{ item.name }}</a></div>
|
||||
<div>Report: {{ item.blueprint_link | safe}}</div>
|
||||
{% if item.summary %}
|
||||
<div class="message">{{ item.summary|safe }}</div>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro show_contribution_summary(contribution) -%}
|
||||
|
||||
<h2>Contribution summary</h2>
|
||||
|
@ -32,6 +32,6 @@ Blueprint “{{ blueprint.title }}” report
|
||||
<div class="message">{{ blueprint.whiteboard }}</div>
|
||||
{% endif %}
|
||||
|
||||
{{ activity_log.show_activity_log(blueprint_id=blueprint.id, show_gravatar=false, gravatar_size=64) }}
|
||||
{{ activity_log.show_activity_log(blueprint_id=blueprint.id, gravatar_size=64) }}
|
||||
|
||||
{% endblock %}
|
||||
|
@ -20,6 +20,6 @@
|
||||
|
||||
<div id="punch_card" style="width: 100%; height: 350px;"></div>
|
||||
|
||||
{{ activity_log.show_activity_log(company=company_name, show_gravatar=false, gravatar_size=64) }}
|
||||
{{ activity_log.show_activity_log(company=company_name, gravatar_size=64) }}
|
||||
|
||||
{% endblock %}
|
||||
|
@ -20,6 +20,6 @@
|
||||
|
||||
<div id="punch_card" style="width: 100%; height: 350px;"></div>
|
||||
|
||||
{{ activity_log.show_activity_log(user_id=user.user_id, show_gravatar=false, gravatar_size=64) }}
|
||||
{{ activity_log.show_activity_log(user_id=user.user_id, show_user_gravatar=false, gravatar_size=64) }}
|
||||
|
||||
{% endblock %}
|
||||
|
@ -254,8 +254,8 @@ def get_bpd(records):
|
||||
'metric': record.get('mention_count') or 0,
|
||||
'id': record['name'],
|
||||
'name': record['name'],
|
||||
'link': helpers.make_blueprint_link(
|
||||
record['name'], record['module'])
|
||||
'link': helpers.make_blueprint_link(record['module'],
|
||||
record['name'])
|
||||
})
|
||||
|
||||
result.sort(key=lambda x: x['metric'], reverse=True)
|
||||
|
@ -75,9 +75,15 @@
|
||||
"tag_from": "2012.2"
|
||||
},
|
||||
{
|
||||
"branch": "stable/havana",
|
||||
"tag_to": "HEAD",
|
||||
"release_name": "Havana",
|
||||
"tag_from": "2013.1"
|
||||
},
|
||||
{
|
||||
"tag_to": "HEAD",
|
||||
"release_name": "Icehouse",
|
||||
"tag_from": "2013.2"
|
||||
}
|
||||
],
|
||||
"uri": "git://github.com/openstack/glance.git",
|
||||
|
Loading…
x
Reference in New Issue
Block a user