Unify and polish page titles
Change-Id: I67dbb0dfaaac0ba506920f07013fbd3b66da786d
This commit is contained in:
parent
dc4a2bfcb5
commit
e4c626d706
@ -295,8 +295,11 @@ def make_commit_message(record):
|
||||
|
||||
def make_page_title(project_type_inst, release, module_inst, company,
|
||||
user_inst):
|
||||
is_openstack = (project_type_inst['id'] in
|
||||
['openstack', 'stackforge', 'all', 'integrated', 'other'])
|
||||
pt_class = project_type_inst['id']
|
||||
if project_type_inst.get('parent'):
|
||||
pt_class = project_type_inst['parent']['id']
|
||||
is_openstack = pt_class == 'all' or pt_class[:9] == 'openstack'
|
||||
|
||||
if company or user_inst:
|
||||
if user_inst:
|
||||
s = user_inst['user_name']
|
||||
@ -313,10 +316,13 @@ def make_page_title(project_type_inst, release, module_inst, company,
|
||||
if module_inst:
|
||||
s += ' to %s' % module_inst['module_group_name']
|
||||
if is_openstack:
|
||||
s += ' in'
|
||||
if release != 'all':
|
||||
s += ' in %s release' % release.capitalize()
|
||||
if company or user_inst:
|
||||
s += ' OpenStack'
|
||||
s += ' %s release' % release.capitalize()
|
||||
else:
|
||||
s += ' in all releases'
|
||||
s += ' all releases'
|
||||
else:
|
||||
if release != 'all':
|
||||
s += ' during OpenStack %s release' % release.capitalize()
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
|
||||
<title>{% block title %}{% endblock %}</title>
|
||||
<title>Stackalytics {% if page_title %}| {{ page_title }} {% endif %}</title>
|
||||
|
||||
{% if not page_title %}
|
||||
<meta name="description" content="OpenStack contribution dashboard collects and processes development activity data such as commits, lines of code changed, code reviews, statistics on bugs, blueprints and emails"/>
|
||||
|
@ -1,8 +1,6 @@
|
||||
{% extends "kpi/base_kpi.html" %}
|
||||
|
||||
{% block title %}
|
||||
Example of KPI report
|
||||
{% endblock %}
|
||||
{% set page_title = 'Example of KPI report' %}
|
||||
|
||||
{% block scripts %}
|
||||
<script type="text/javascript">
|
||||
|
@ -1,8 +1,6 @@
|
||||
{% extends "kpi/base_kpi.html" %}
|
||||
|
||||
{% block title %}
|
||||
Example of scripted KPI report
|
||||
{% endblock %}
|
||||
{% set page_title = 'Example of scripted KPI report' %}
|
||||
|
||||
{% block scripts %}
|
||||
<script type="text/javascript">
|
||||
|
@ -1,9 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}
|
||||
Stackalytics {% if page_title %}| {{ page_title }} {% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -1,10 +1,6 @@
|
||||
{% 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 %}
|
||||
|
@ -1,8 +1,6 @@
|
||||
{% extends "reports/base_report.html" %}
|
||||
|
||||
{% block title %}
|
||||
Company Affiliation Changes
|
||||
{% endblock %}
|
||||
{% set page_title = 'Company Affiliation Changes' %}
|
||||
|
||||
{% block scripts %}
|
||||
<script type="text/javascript">
|
||||
|
@ -1,9 +1,7 @@
|
||||
{% extends "reports/base_report.html" %}
|
||||
{% import '_macros/activity_log.html' as activity_log %}
|
||||
|
||||
{% block title %}
|
||||
Blueprint “{{ blueprint.title }}” report
|
||||
{% endblock %}
|
||||
{% set page_title = 'The activity log for blueprint "' + blueprint.title + '"' %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Blueprint “{{ blueprint.title }}”</h1>
|
||||
|
@ -2,9 +2,7 @@
|
||||
{% import '_macros/activity_log.html' as activity_log %}
|
||||
{% import '_macros/contribution_summary.html' as contribution_summary %}
|
||||
|
||||
{% block title %}
|
||||
{{ company_name }} activity in OpenStack
|
||||
{% endblock %}
|
||||
{% set page_title = company_name + " | OpenStack activity report" %}
|
||||
|
||||
{% block scripts %}
|
||||
<script type="text/javascript">
|
||||
|
@ -1,8 +1,6 @@
|
||||
{% extends "reports/base_report.html" %}
|
||||
|
||||
{% block title %}
|
||||
Contribution into {{ module }} for the last {{ days }} days
|
||||
{% endblock %}
|
||||
{% set page_title = "Contribution into " + module + " during the recent " + days + " days" %}
|
||||
|
||||
{% block scripts %}
|
||||
<script type="text/javascript">
|
||||
|
@ -1,8 +1,6 @@
|
||||
{% extends "reports/base_report.html" %}
|
||||
|
||||
{% block title %}
|
||||
Cores
|
||||
{% endblock %}
|
||||
{% set page_title = 'Cores' %}
|
||||
|
||||
{% block scripts %}
|
||||
<script type="text/javascript">
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% set active_tab = 'driverlog' %}
|
||||
{% block title %}Vendor Drivers{% endblock %}
|
||||
{% set page_title = "Vendor Drivers" %}
|
||||
|
||||
{% block head %}
|
||||
<script type="text/javascript">
|
||||
|
@ -1,8 +1,6 @@
|
||||
{% extends "reports/base_report.html" %}
|
||||
|
||||
{% block title %}
|
||||
External CI status for {{ module }} for the last {{ days }} days
|
||||
{% endblock %}
|
||||
{% set page_title = "Status of drivers testing in " + module.title() + " during recent " + days + " days" %}
|
||||
|
||||
{% block scripts %}
|
||||
<script type="text/javascript">
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% set active_tab = 'members' %}
|
||||
{% block title %}Members of OpenStack Foundation{% endblock %}
|
||||
{% set page_title = 'OpenStack Foundation members' %}
|
||||
|
||||
{% block head %}
|
||||
<script type="text/javascript">
|
||||
|
@ -1,8 +1,6 @@
|
||||
{% extends "reports/base_report.html" %}
|
||||
|
||||
{% block title %}
|
||||
Open change requests report for {{ module }}
|
||||
{% endblock %}
|
||||
{% set page_title = "Open change requests in " + module %}
|
||||
|
||||
{% block scripts %}
|
||||
<script type="text/javascript">
|
||||
@ -24,7 +22,7 @@ Open change requests report for {{ module }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Open change requests for {{ module }}</h1>
|
||||
<h1>Open change requests in {{ module }}</h1>
|
||||
|
||||
<h3>Summary</h3>
|
||||
<ul>
|
||||
|
@ -3,9 +3,7 @@
|
||||
{% import '_macros/contribution_summary.html' as contribution_summary %}
|
||||
{% import '_macros/user_profile.html' as user_profile %}
|
||||
|
||||
{% block title %}
|
||||
{{ user.user_name }} activity in OpenStack
|
||||
{% endblock %}
|
||||
{% set page_title = user.user_name + " | OpenStack activity report" %}
|
||||
|
||||
{% block scripts %}
|
||||
<script type="text/javascript">
|
||||
|
@ -154,6 +154,14 @@ def _init_project_types(vault):
|
||||
runtime_storage_inst = vault['runtime_storage']
|
||||
project_types = runtime_storage_inst.get_by_key('project_types') or {}
|
||||
|
||||
# add ref from child to parent
|
||||
parent_pt = None
|
||||
for pt in project_types:
|
||||
if pt.get('child'):
|
||||
pt['parent'] = parent_pt
|
||||
else:
|
||||
parent_pt = pt
|
||||
|
||||
vault['project_types'] = project_types
|
||||
vault['project_types_index'] = dict((pt['id'], pt) for pt in project_types)
|
||||
|
||||
|
@ -87,8 +87,9 @@ Implements Blueprint ''' + (
|
||||
@mock.patch('stackalytics.dashboard.vault.get_vault')
|
||||
@mock.patch('stackalytics.dashboard.vault.get_user_from_runtime_storage')
|
||||
def test_make_page_title(self, user_patch, vault_patch):
|
||||
def _pt(id, title=None):
|
||||
return dict(id=id.lower(), title=title or id)
|
||||
def _pt(id, title=None, is_openstack=True):
|
||||
return dict(id=id.lower(), title=title or id,
|
||||
parent=dict(id='openstack') if is_openstack else None)
|
||||
|
||||
user_inst = {'user_name': 'John Doe'}
|
||||
module_inst = {'module_group_name': 'neutron'}
|
||||
@ -99,24 +100,27 @@ Implements Blueprint ''' + (
|
||||
self.assertEqual('OpenStack community contribution in Havana release',
|
||||
helpers.make_page_title(
|
||||
_pt('OpenStack'), 'Havana', None, None, None))
|
||||
self.assertEqual('Mirantis contribution in Havana release',
|
||||
self.assertEqual('Mirantis contribution in OpenStack Havana release',
|
||||
helpers.make_page_title(
|
||||
_pt('Stackforge'), 'Havana', None, 'Mirantis',
|
||||
None))
|
||||
self.assertEqual('John Doe contribution in Havana release',
|
||||
self.assertEqual('John Doe contribution in OpenStack Havana release',
|
||||
helpers.make_page_title(
|
||||
_pt('all'), 'Havana', None, None, user_inst))
|
||||
self.assertEqual(
|
||||
'John Doe (Mirantis) contribution to neutron in Havana release',
|
||||
'John Doe (Mirantis) contribution to neutron in OpenStack Havana '
|
||||
'release',
|
||||
helpers.make_page_title(
|
||||
_pt('all'), 'Havana', module_inst, 'Mirantis', user_inst))
|
||||
self.assertEqual('Ansible community contribution during OpenStack '
|
||||
'Havana release',
|
||||
helpers.make_page_title(
|
||||
_pt('Ansible'), 'Havana', None, None, None))
|
||||
_pt('Ansible', is_openstack=False),
|
||||
'Havana', None, None, None))
|
||||
self.assertEqual('Docker community contribution',
|
||||
helpers.make_page_title(
|
||||
_pt('Docker'), 'all', None, None, None))
|
||||
_pt('Docker', is_openstack=False),
|
||||
'all', None, None, None))
|
||||
|
||||
@mock.patch('flask.request')
|
||||
@mock.patch('stackalytics.dashboard.parameters.get_default')
|
||||
|
Loading…
x
Reference in New Issue
Block a user