2012-02-01 11:59:23 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#-*- coding: utf-8 -*-
|
|
|
|
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
|
|
|
#
|
|
|
|
# Use of this source code is governed by a BSD-style license
|
|
|
|
# that can be found in the LICENSE file in the root of the source
|
|
|
|
# tree. An additional intellectual property rights grant can be found
|
|
|
|
# in the file PATENTS. All contributing project authors may
|
|
|
|
# be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
|
|
|
"""Implements the quality tracker dashboard and reporting facilities."""
|
|
|
|
|
|
|
|
__author__ = 'phoglund@webrtc.org (Patrik Höglund)'
|
|
|
|
|
2012-02-06 11:55:12 +01:00
|
|
|
from google.appengine.ext.webapp import template
|
2012-02-01 11:59:23 +01:00
|
|
|
import webapp2
|
|
|
|
|
|
|
|
import add_build_status_data
|
|
|
|
import add_coverage_data
|
2012-02-06 11:55:12 +01:00
|
|
|
import load_build_status
|
|
|
|
import load_coverage
|
2012-02-01 11:59:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
class ShowDashboard(webapp2.RequestHandler):
|
|
|
|
"""Shows the dashboard page.
|
|
|
|
|
|
|
|
The page is shown by grabbing data we have stored previously
|
|
|
|
in the App Engine database using the AddCoverageData handler.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def get(self):
|
2012-02-06 11:55:12 +01:00
|
|
|
build_status_loader = load_build_status.BuildStatusLoader()
|
|
|
|
build_status_data = build_status_loader.load_build_status_data()
|
|
|
|
last_updated_at = build_status_loader.load_last_modified_at()
|
|
|
|
last_updated_at = last_updated_at.strftime("%Y-%m-%d %H:%M")
|
|
|
|
lkgr = build_status_loader.compute_lkgr()
|
2012-02-01 11:59:23 +01:00
|
|
|
|
2012-02-06 11:55:12 +01:00
|
|
|
coverage_loader = load_coverage.CoverageDataLoader()
|
|
|
|
coverage_json_data = coverage_loader.load_coverage_json_data()
|
2012-02-01 11:59:23 +01:00
|
|
|
|
|
|
|
# Fill in the template with the data and respond:
|
2012-02-06 11:55:12 +01:00
|
|
|
page_template_filename = 'templates/dashboard_template.html'
|
|
|
|
self.response.write(template.render(page_template_filename, vars()))
|
2012-02-01 11:59:23 +01:00
|
|
|
|
|
|
|
def _show_error_page(self, error_message):
|
|
|
|
self.response.write('<html><body>%s</body></html>' % error_message)
|
|
|
|
|
|
|
|
|
|
|
|
app = webapp2.WSGIApplication([('/', ShowDashboard),
|
|
|
|
('/add_coverage_data',
|
|
|
|
add_coverage_data.AddCoverageData),
|
|
|
|
('/add_build_status_data',
|
|
|
|
add_build_status_data.AddBuildStatusData)],
|
|
|
|
debug=True)
|