diff options
author | Milo Casagrande <milo.casagrande@linaro.org> | 2014-07-22 15:45:41 +0200 |
---|---|---|
committer | Milo Casagrande <milo.casagrande@linaro.org> | 2014-07-22 15:45:41 +0200 |
commit | cf67e7c16b97e284fad7da17498d824dd2eb34ec (patch) | |
tree | 74b3eb060f97a4a47d1947695de7bd68e74c764d | |
parent | e74886d4e563ad745c80e23f9187429b793296ba (diff) |
Add the boot details view.
Change-Id: I530d4ed3d09044038f2fab2ad9a3c96c71af6419
-rw-r--r-- | app/dashboard/__init__.py | 8 | ||||
-rw-r--r-- | app/dashboard/templates/boot.html | 2 | ||||
-rw-r--r-- | app/dashboard/views/boot.py | 67 |
3 files changed, 65 insertions, 12 deletions
diff --git a/app/dashboard/__init__.py b/app/dashboard/__init__.py index 44ebf00..353a6c4 100644 --- a/app/dashboard/__init__.py +++ b/app/dashboard/__init__.py @@ -37,6 +37,7 @@ from dashboard.views.build import ( ) from dashboard.views.boot import ( BootIdView, + BootJobKernelView, BootsView, ) from dashboard.views.index import IndexView @@ -124,7 +125,12 @@ app.add_url_rule( '/boot/<string:board>/job/<string:job>/kernel/<string:kernel>/' 'defconfig/<string:defconfig>/' ), - view_func=BootIdView.as_view('boot_id'), + view_func=BootIdView.as_view('boot-id'), + methods=['GET'], +) +app.add_url_rule( + '/boot/all/job/<string:job>/kernel/<string:kernel>/', + view_func=BootJobKernelView.as_view('boot-job-kernel'), methods=['GET'], ) diff --git a/app/dashboard/templates/boot.html b/app/dashboard/templates/boot.html index 69f6c04..ca51602 100644 --- a/app/dashboard/templates/boot.html +++ b/app/dashboard/templates/boot.html @@ -6,7 +6,7 @@ {%- block content %} <div class="row"> <div class="page-header"> - <h3>{{ boot_title|safe }}</h3> + <h3>{{ body_title|safe }}</h3> </div> <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6"> <dl class="dl-horizontal" id="dl-right"> diff --git a/app/dashboard/views/boot.py b/app/dashboard/views/boot.py index 83637ca..2817859 100644 --- a/app/dashboard/views/boot.py +++ b/app/dashboard/views/boot.py @@ -13,22 +13,31 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from flask import render_template +from flask import ( + abort, + render_template, +) + from flask.views import View -from dashboard.utils.backend import today_date +from dashboard.utils.backend import ( + extract_response_metadata, + get_job, + today_date, +) + +PAGE_TITLE = 'Kernel CI Dashboard — Boot Reports' class BootsView(View): def dispatch_request(self): - page_title = 'Kernel CI Dashboard — Boot Reports' results_title = 'Available Boot Reports' return render_template( 'boots.html', - page_title=page_title, + page_title=PAGE_TITLE, server_date=today_date(), results_title=results_title ) @@ -38,18 +47,56 @@ class BootIdView(View): def dispatch_request(self, **kwargs): - page_title = ( - 'Kernel CI Dashboard — Boot report ' - 'for %(board)s' % kwargs - ) - boot_title = 'Details for board %(board)s' % kwargs + page_title = PAGE_TITLE + ' ‐Board %(board)s' % kwargs + body_title = 'Details for board %(board)s' % kwargs return render_template( 'boot.html', page_title=page_title, - boot_title=boot_title, + body_title=body_title, board=kwargs['board'], job=kwargs['job'], kernel=kwargs['kernel'], defconfig=kwargs['defconfig'], ) + + +class BootJobKernelView(View): + + def dispatch_request(self, **kwargs): + + job = kwargs['job'] + kernel = kwargs['kernel'] + job_id = '%s-%s' % (job, kernel) + storage_id = 'boot-' + job_id + + body_title = body_title = 'Details for %s ‐ %s' % ( + job, kernel + ) + + params = {'id': job_id} + response = get_job(**params) + + metadata = {} + base_url = '' + commit_url = '' + + if response.status_code == 200: + metadata, base_url, commit_url, result = extract_response_metadata( + response + ) + + return render_template( + 'boots-job-kernel.html', + page_title=PAGE_TITLE, + body_title=body_title, + base_url=base_url, + commit_url=commit_url, + job_id=job_id, + job=job, + kernel=kernel, + metadata=metadata, + storage_id=storage_id, + ) + else: + abort(response.status_code) |