Added report that shows full and parametrized activity log
Examples of reports: * /report/activity - all commits (default metric) in default project_type and default release * /report/activity?metric=marks&module=glance - all marks in Glance * /report/activity?metric=commits&module=glance&user_id=vsergeyev&release=icehouse - all commits into Glance from specified user during Icehouse * /report/activity?metric=commits&project_type=all&release=all&query_message=docimpact - all commits into all projects and all releases that have 'docimpact' in message Change-Id: I51a3981429a3eafa320199244e4c06796cea4b19
This commit is contained in:
@@ -293,7 +293,7 @@ def templated(template=None, return_code=200):
|
|||||||
|
|
||||||
module = parameters.get_single_parameter(kwargs, 'module')
|
module = parameters.get_single_parameter(kwargs, 'module')
|
||||||
ctx['module'] = module
|
ctx['module'] = module
|
||||||
if module:
|
if module and module in vault_inst['module_id_index']:
|
||||||
ctx['module_inst'] = vault_inst['module_id_index'][module]
|
ctx['module_inst'] = vault_inst['module_id_index'][module]
|
||||||
|
|
||||||
ctx['user_id'] = parameters.get_single_parameter(kwargs, 'user_id')
|
ctx['user_id'] = parameters.get_single_parameter(kwargs, 'user_id')
|
||||||
|
|||||||
@@ -114,7 +114,11 @@ def extend_user(user):
|
|||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
||||||
def get_activity(records, start_record, page_size):
|
def get_activity(records, start_record, page_size, query_message=None):
|
||||||
|
if query_message:
|
||||||
|
records = [r for r in records
|
||||||
|
if (r.get('message') and
|
||||||
|
r.get('message').find(query_message) > 0)]
|
||||||
records_sorted = sorted(records, key=lambda x: x['date'], reverse=True)
|
records_sorted = sorted(records, key=lambda x: x['date'], reverse=True)
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
|
|||||||
@@ -192,6 +192,13 @@ def company_activity(company):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@blueprint.route('/activity')
|
||||||
|
@decorators.templated()
|
||||||
|
@decorators.exception_handler()
|
||||||
|
def activity():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route('/large_commits')
|
@blueprint.route('/large_commits')
|
||||||
@decorators.jsonify('commits')
|
@decorators.jsonify('commits')
|
||||||
@decorators.exception_handler()
|
@decorators.exception_handler()
|
||||||
|
|||||||
10
dashboard/templates/reports/activity.html
Normal file
10
dashboard/templates/reports/activity.html
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{% extends "reports/base_report.html" %}
|
||||||
|
{% import '_macros/activity_log.html' as activity_log %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
Activity Log
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{{ activity_log.show_activity_log(gravatar_size=64, show_all=False) }}
|
||||||
|
{% endblock %}
|
||||||
@@ -218,7 +218,9 @@ def get_activity_json(records):
|
|||||||
start_record = int(flask.request.args.get('start_record') or 0)
|
start_record = int(flask.request.args.get('start_record') or 0)
|
||||||
page_size = int(flask.request.args.get('page_size') or
|
page_size = int(flask.request.args.get('page_size') or
|
||||||
parameters.DEFAULT_RECORDS_LIMIT)
|
parameters.DEFAULT_RECORDS_LIMIT)
|
||||||
return helpers.get_activity(records, start_record, page_size)
|
query_message = flask.request.args.get('query_message')
|
||||||
|
return helpers.get_activity(records, start_record, page_size,
|
||||||
|
query_message)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/api/1.0/contribution')
|
@app.route('/api/1.0/contribution')
|
||||||
|
|||||||
Reference in New Issue
Block a user