Limit changes list in review report on server side
Also adds an option 'report-default-limit' that allows to configure default amount of changes to present in open changes report, in case if limit query parameter is not provided. Change-Id: I916d40c934a1dc2977ac76c4b0ceed3c80385926
This commit is contained in:
parent
048b924b78
commit
627edcf745
@ -191,3 +191,6 @@
|
|||||||
|
|
||||||
# Password for github access (string value)
|
# Password for github access (string value)
|
||||||
#github_password = password
|
#github_password = password
|
||||||
|
|
||||||
|
# Default number of open reviews to present in open changes report
|
||||||
|
#report_default_limit = 5
|
||||||
|
@ -36,6 +36,9 @@ DASHBOARD_OPTS = [
|
|||||||
help='Name of file to store python profiler data'),
|
help='Name of file to store python profiler data'),
|
||||||
cfg.IntOpt('age-warn', default=2 * 24 * 60 * 60,
|
cfg.IntOpt('age-warn', default=2 * 24 * 60 * 60,
|
||||||
help='Warn if the age of data is more than this value, sec'),
|
help='Warn if the age of data is more than this value, sec'),
|
||||||
|
cfg.IntOpt('report-default-limit', default=5,
|
||||||
|
help='Number of open reviews to present in open changes '
|
||||||
|
'report'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ import operator
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
import flask
|
import flask
|
||||||
|
from oslo_config import cfg
|
||||||
|
|
||||||
from stackalytics.dashboard import decorators
|
from stackalytics.dashboard import decorators
|
||||||
from stackalytics.dashboard import helpers
|
from stackalytics.dashboard import helpers
|
||||||
@ -28,6 +29,8 @@ from stackalytics.dashboard import vault
|
|||||||
from stackalytics.processor import utils
|
from stackalytics.processor import utils
|
||||||
|
|
||||||
|
|
||||||
|
CONF = cfg.CONF
|
||||||
|
|
||||||
DEFAULT_DAYS_COUNT = 7
|
DEFAULT_DAYS_COUNT = 7
|
||||||
FIRST_MEMBER_DATE = "2012-Jul-18"
|
FIRST_MEMBER_DATE = "2012-Jul-18"
|
||||||
|
|
||||||
@ -59,7 +62,7 @@ def _get_day(timestamp, time_now):
|
|||||||
return int((time_now - timestamp) / 60 / 60 / 24)
|
return int((time_now - timestamp) / 60 / 60 / 24)
|
||||||
|
|
||||||
|
|
||||||
def _process_stat(data, key, time_now):
|
def _process_stat(data, key, time_now, limit=None):
|
||||||
if not data:
|
if not data:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -75,7 +78,7 @@ def _process_stat(data, key, time_now):
|
|||||||
chart_data[_get_day(review[key], time_now)] += 1
|
chart_data[_get_day(review[key], time_now)] += 1
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'reviews': data,
|
'reviews': data[:limit],
|
||||||
'average': utils.make_age_string(sum_ages / len(data)),
|
'average': utils.make_age_string(sum_ages / len(data)),
|
||||||
'max': data[0][key + '_age'],
|
'max': data[0][key + '_age'],
|
||||||
'chart_data': json.dumps(chart_data),
|
'chart_data': json.dumps(chart_data),
|
||||||
@ -119,6 +122,10 @@ def open_reviews(module):
|
|||||||
# new requests without votes, waiting for CI
|
# new requests without votes, waiting for CI
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
limit = int(flask.request.args.get('limit') or CONF.report_default_limit)
|
||||||
|
if limit < 0:
|
||||||
|
limit = None
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'module': module,
|
'module': module,
|
||||||
'total_open': total_open,
|
'total_open': total_open,
|
||||||
@ -127,13 +134,13 @@ def open_reviews(module):
|
|||||||
'waiting_on_ci': (total_open - len(waiting_on_reviewer) -
|
'waiting_on_ci': (total_open - len(waiting_on_reviewer) -
|
||||||
len(waiting_on_submitter)),
|
len(waiting_on_submitter)),
|
||||||
'reviewer_latest_revision': _process_stat(
|
'reviewer_latest_revision': _process_stat(
|
||||||
waiting_on_reviewer, 'updated_on', time_now),
|
waiting_on_reviewer, 'updated_on', time_now, limit),
|
||||||
'reviewer_first_revision': _process_stat(
|
'reviewer_first_revision': _process_stat(
|
||||||
waiting_on_reviewer, 'date', time_now),
|
waiting_on_reviewer, 'date', time_now, limit),
|
||||||
'submitter_latest_revision': _process_stat(
|
'submitter_latest_revision': _process_stat(
|
||||||
waiting_on_submitter, 'updated_on', time_now),
|
waiting_on_submitter, 'updated_on', time_now, limit),
|
||||||
'submitter_first_revision': _process_stat(
|
'submitter_first_revision': _process_stat(
|
||||||
waiting_on_submitter, 'date', time_now),
|
waiting_on_submitter, 'date', time_now, limit),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
<div id="reviewer_latest_revision_chart" style="width: 100%; height: 350px;"></div>
|
<div id="reviewer_latest_revision_chart" style="width: 100%; height: 350px;"></div>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
{% for item in reviewer_latest_revision.reviews[:5] %}
|
{% for item in reviewer_latest_revision.reviews %}
|
||||||
<li>{{ item.updated_on_age }} <a href="{{ item.url }}">{{ item.url }}</a> {{ item.subject }} by {{ item.author_link|safe }} ({{ item.company_link|safe }})</li>
|
<li>{{ item.updated_on_age }} <a href="{{ item.url }}">{{ item.url }}</a> {{ item.subject }} by {{ item.author_link|safe }} ({{ item.company_link|safe }})</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ol>
|
</ol>
|
||||||
@ -58,7 +58,7 @@
|
|||||||
<div id="reviewer_first_revision_chart" style="width: 100%; height: 350px;"></div>
|
<div id="reviewer_first_revision_chart" style="width: 100%; height: 350px;"></div>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
{% for item in reviewer_first_revision.reviews[:5] %}
|
{% for item in reviewer_first_revision.reviews %}
|
||||||
<li>{{ item.date_age }} <a href="{{ item.url }}">{{ item.url }}</a> {{ item.subject }} by {{ item.author_link|safe }} ({{ item.company_link|safe }})</li>
|
<li>{{ item.date_age }} <a href="{{ item.url }}">{{ item.url }}</a> {{ item.subject }} by {{ item.author_link|safe }} ({{ item.company_link|safe }})</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ol>
|
</ol>
|
||||||
@ -79,7 +79,7 @@
|
|||||||
<div id="submitter_latest_revision_chart" style="width: 100%; height: 350px;"></div>
|
<div id="submitter_latest_revision_chart" style="width: 100%; height: 350px;"></div>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
{% for item in submitter_latest_revision.reviews[:5] %}
|
{% for item in submitter_latest_revision.reviews %}
|
||||||
<li>{{ item.updated_on_age }} <a href="{{ item.url }}">{{ item.url }}</a> {{ item.subject }} by {{ item.author_link|safe }} ({{ item.company_link|safe }})</li>
|
<li>{{ item.updated_on_age }} <a href="{{ item.url }}">{{ item.url }}</a> {{ item.subject }} by {{ item.author_link|safe }} ({{ item.company_link|safe }})</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ol>
|
</ol>
|
||||||
@ -94,7 +94,7 @@
|
|||||||
<div id="submitter_first_revision_chart" style="width: 100%; height: 350px;"></div>
|
<div id="submitter_first_revision_chart" style="width: 100%; height: 350px;"></div>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
{% for item in submitter_first_revision.reviews[:5] %}
|
{% for item in submitter_first_revision.reviews %}
|
||||||
<li>{{ item.date_age }} <a href="{{ item.url }}">{{ item.url }}</a> {{ item.subject }} by {{ item.author_link|safe }} ({{ item.company_link|safe }})</li>
|
<li>{{ item.date_age }} <a href="{{ item.url }}">{{ item.url }}</a> {{ item.subject }} by {{ item.author_link|safe }} ({{ item.company_link|safe }})</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ol>
|
</ol>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user