Support status.openstack.org header/footer

Add a openstack_status magic parameter in config.js which toggles the
use of openstack-specific CSS and JS files to better integrate in
status.openstack.org.
This commit is contained in:
Thierry Carrez 2013-03-29 17:18:29 +01:00
parent 0a2dfc1032
commit a878b43380
2 changed files with 21 additions and 2 deletions

View File

@ -29,7 +29,8 @@ def create_files(templatepath, outputpath, projects):
indexfile = os.path.join(outputpath, "index.html")
if not os.path.exists(indexfile):
template = env.get_template('index.html')
template.stream(projects=projects).dump(indexfile)
template.stream(projects=projects,
openstack_status=openstack_status).dump(indexfile)
# Create each project file
for project in projects:
@ -57,7 +58,6 @@ def update_stats(outputpath, project_name, rotation):
for record in json_data['records']:
if rotation:
if (now - record['date']) > (rotation * 24 * 60 * 60):
print "skip"
continue
records.append(record)
except IOError:
@ -162,6 +162,7 @@ if __name__ == '__main__':
config = json.load(configfile)
projects = config['projects']
rotation = config.get('rotation')
openstack_status = config.get('openstack_status')
# Create files in output directory, if needed
create_files(templatepath, outputpath, projects)

View File

@ -1,5 +1,20 @@
<HTML>
<TITLE>Bugsquashing day stats</TITLE>
{% if openstack_status %}
<link rel="stylesheet"
href="http://www.openstack.org/themes/openstack/css/blueprint/screen.css"
type="text/css" media="screen, projection"/>
<link rel="stylesheet"
href="http://www.openstack.org/themes/openstack/css/blueprint/print.css"
type="text/css" media="print"/>
<link href='http://fonts.googleapis.com/css?family=PT+Sans&amp;subset=latin'
rel='stylesheet' type='text/css'/>
<link rel="stylesheet" type="text/css"
href="http://www.openstack.org/themes/openstack/css/main.css" />
<script type="text/javascript"
src="http://status.openstack.org/common.js"></script>
<script type="text/javascript">header('Bugday');</script>
{% endif %}
<h1>Bugsquashing day stats</h1>
<TABLE BORDER=0>
{% for project in projects %}
@ -15,4 +30,7 @@
</IFRAME></TD></TR>
{% endfor %}
</TABLE>
{% if openstack_status %}
<script type="text/javascript">footer();</script>
{% endif %}
</HTML>