aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2016-06-13 17:01:24 -0500
committerMichael Wood <michael.g.wood@intel.com>2016-06-23 12:24:17 +0100
commite63e5bd6bec69c0d58de6ddbdf7889a53dd4d256 (patch)
treecd3e4519d090a392ff3250b5557b464302dcb9d7
parenta03225118e4b554bbe77327b8639bb03a9b7f6d6 (diff)
downloaderror-report-web-e63e5bd6bec69c0d58de6ddbdf7889a53dd4d256.tar.gz
error-report-web-e63e5bd6bec69c0d58de6ddbdf7889a53dd4d256.tar.bz2
error-report-web-e63e5bd6bec69c0d58de6ddbdf7889a53dd4d256.zip
views/templates: Add support for display different type of errors
Now we have a set of different type of errors not only Recipe ones this change enables support for display these. Based on design done by Belen Barros [1]. [YOCTO #7583] [1] https://bugzilla.yoctoproject.org/attachment.cgi?id=3214 Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Michael Wood <michael.g.wood@intel.com>
-rw-r--r--Post/views.py53
-rw-r--r--templates/error-details.html13
-rw-r--r--templates/latest-errors.html27
3 files changed, 64 insertions, 29 deletions
diff --git a/Post/views.py b/Post/views.py
index 0455baa..7f2cffb 100644
--- a/Post/views.py
+++ b/Post/views.py
@@ -12,7 +12,7 @@ from django.shortcuts import get_object_or_404
from django.shortcuts import HttpResponse, render
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import redirect
-from Post.models import BuildFailure
+from Post.models import BuildFailure, Build, ErrorType
from parser import Parser
from django.conf import settings
from createStatistics import Statistics
@@ -83,16 +83,32 @@ def addData(request, return_json=False):
def apply_filter(context, items, name, value):
# Look up the field name for filtering
# e.g. filter_pair = (RECIPE, value)
- filter_pair = None
-
- for col in context['tablecols']:
- if col['clclass'] == name:
- filter_pair = (col['field'], value)
+ filters = []
+
+ if name == 'error_type':
+ filters.append(('BUILD__ERROR_TYPE', value))
+ elif name == 'failure':
+ # failure column when is recipe error_type
+ # is build "recipe: task" otherwise only
+ # "task"
+ if ':' in value:
+ recipe = value.split(':')[0].strip()
+ task = value.split(':')[1].strip()
+ filters.append(('TASK', task))
+ filters.append(('RECIPE', recipe))
+ else:
+ filters.append(('TASK', value))
+ else:
+ for col in context['tablecols']:
+ if col['clclass'] == name:
+ filters.append((col['field'], value))
- if not filter_pair:
+ if not filters:
return items
- items = items.filter(filter_pair)
+ for filter_pair in filters:
+ items = items.filter(filter_pair)
+
return items
def default(request):
@@ -128,24 +144,21 @@ def search(request, mode=results_mode.LATEST, **kwargs):
'results_mode' : results_mode,
'mode' : mode,
'args' : kwargs,
+ 'error_types': ErrorType,
'tablecols' : [
{'name': 'Submitted on',
'clclass' : 'submitted_on',
'field' : 'BUILD__DATE',
'disable_toggle' : True,
},
- {'name': 'Recipe',
- 'clclass' : 'recipe',
- 'field' : 'RECIPE',
+ {'name': 'Error type',
+ 'clclass' : 'error_type',
+ 'field' : 'BUILD__ERROR_TYPE',
'disable_toggle' : True,
},
- {'name': 'Recipe version',
- 'clclass': 'recipe_version',
- 'field' : 'RECIPE_VERSION',
- },
- {'name': 'Task',
- 'clclass': 'task',
- 'field' : 'TASK',
+ {'name': 'Failure',
+ 'clclass': 'failure',
+ 'field': 'TASK',
'disable_toggle' : True,
},
{'name': 'Machine',
@@ -156,7 +169,6 @@ def search(request, mode=results_mode.LATEST, **kwargs):
{'name': 'Distro',
'clclass': 'distro',
'field': 'BUILD__DISTRO',
- 'disable_toggle' : True,
},
{'name': 'Build system',
'clclass': 'build_sys',
@@ -190,7 +202,6 @@ def search(request, mode=results_mode.LATEST, **kwargs):
if request.GET.has_key("filter") and request.GET.has_key("type"):
items = apply_filter(context, items, request.GET['type'], request.GET['filter'])
-
if mode == results_mode.SPECIAL_SUBMITTER and hasattr(settings,"SPECIAL_SUBMITTER"):
#Special submitter mode see settings.py to enable
name = settings.SPECIAL_SUBMITTER['name']
@@ -249,7 +260,7 @@ def details(request, fail_id):
except ObjectDoesNotExist:
build_failure = None
- context = {'detail' : build_failure }
+ context = {'detail' : build_failure, 'error_types' : ErrorType }
return render(request, "error-details.html", context)
diff --git a/templates/error-details.html b/templates/error-details.html
index 62ec75f..c30160d 100644
--- a/templates/error-details.html
+++ b/templates/error-details.html
@@ -9,7 +9,11 @@
<a class="btn pull-left back-btn" style="margin-top:7px;" href="#">
<i class="icon-arrow-left"></i>
</a>
- <h1 style="margin-left:60px;">{{detail.RECIPE}}-{{detail.RECIPE_VERSION}} {{detail.TASK}} </h1>
+ <h1 style="margin-left:60px;">
+ {% if detail.BUILD.ERROR_TYPE == error_types.RECIPE %}
+ {{detail.RECIPE}}-{{detail.RECIPE_VERSION}}
+ {% endif %}
+ {{detail.TASK}} </h1>
</div>
<div class="row span8">
<pre>{{detail.ERROR_DETAILS}}</pre>
@@ -20,12 +24,19 @@
<dl class="dl-vertical">
<dt>Submitted on:</dt>
<dd>{{ detail.BUILD.DATE|date:"d/m/y H:i"}}</dd>
+ <dt>Error type:</dt>
+ <dd>{{ detail.BUILD.get_ERROR_TYPE_display }}</dd>
+ {% if detail.BUILD.ERROR_TYPE == error_types.RECIPE %}
<dt>Task:</dt>
<dd>{{ detail.TASK }}</dd>
<dt>Recipe:</dt>
<dd>{{detail.RECIPE }} </dd>
<dt>Recipe version:</dt>
<dd>{{ detail.RECIPE_VERSION }}</dd>
+ {% else %}
+ <dt>Command:</dt>
+ <dd>{{ detail.TASK }}</dd>
+ {% endif %}
<dt>Machine:</dt>
<dd>{{ detail.BUILD.MACHINE }}</dd>
<dt>Distro:</dt>
diff --git a/templates/latest-errors.html b/templates/latest-errors.html
index 56f612a..87e30d8 100644
--- a/templates/latest-errors.html
+++ b/templates/latest-errors.html
@@ -107,6 +107,8 @@
<a href="#" class="sort-col sorted" data-order-by="-{{col.field}}" >{{col.name}}</a>
<span class="sorting-arrows" style="visibility: visible">&#9660</span>
+ {% elif col.clclass == "failure" %}
+ {{col.name}}
{% else %}
<a href="#" class="sort-col" data-order-by="{{col.field}}" >{{col.name}}</a>
@@ -127,18 +129,29 @@
{% url "details" build_fail.id as details_url %}
<tr class="data">
<td class="submitted_on"> <a href="{{details_url}}">{{ build_fail.BUILD.DATE|date:"d/m/y H:i"}}</a></td>
- <td class="recipe"><a href="{{details_url}}">{{ build_fail.RECIPE }}</a>
- <a class="filter" href="#" data-filter="{{build_fail.RECIPE}}" data-type="recipe">
- <i class="icon-filter hover" title="Filter by {{build_fail.RECIPE}}"></i>
+
+ <td class="error_type"><a href="{{details_url}}">{{ build_fail.BUILD.get_ERROR_TYPE_display }}</a>
+ <a class="filter" href="#" data-filter="{{build_fail.BUILD.get_ERROR_TYPE_display}}" data-type="error_type">
+ <i class="icon-filter hover" title="Filter by {{build_fail.BUILD.get_ERROR_TYPE_display}}"></i>
</a>
</td>
- <td class="recipe_version"><a href="{{details_url}}" {% if build_fail.RECIPE_VERSION|length > 13 %}class="tooltip-me" data-toggle="tooltip" title="{{ build_fail.RECIPE_VERSION }}"{%endif%}>{{ build_fail.RECIPE_VERSION|truncatechars:13 }}</a></td>
- <td class="task"><a href="{{details_url}}">{{ build_fail.TASK }}</a>
- <a class="filter" href="#" data-filter="{{build_fail.TASK}}" data-type="task">
+
+ <td class="failure">
+ {% if build_fail.BUILD.ERROR_TYPE == error_types.RECIPE %}
+ <a href="{{details_url}}">
+ {{ build_fail.RECIPE }}:
+ {{ build_fail.TASK }}</a>
+ <a class="filter" href="#" data-filter=" {{ build_fail.RECIPE }}: {{build_fail.TASK}}" data-type="failure">
+ <i class="icon-filter hover" title="Filter by {{ build_fail.RECIPE }}: {{build_fail.TASK}}"></i>
+ </a>
+ {% else %}
+ <a href="{{details_url}}">{{ build_fail.TASK }}</a>
+ <a class="filter" href="#" data-filter="{{build_fail.TASK}}" data-type="failure">
<i class="icon-filter hover" title="Filter by {{build_fail.TASK}}"></i>
</a>
-
+ {% endif %}
</td>
+
<td class="machine"><a href="{{details_url}}">{{ build_fail.BUILD.MACHINE }}</a>
<a class="filter" href="#" data-filter="{{build_fail.BUILD.MACHINE}}" data-type="machine">
<i class="icon-filter hover" title="Filter by {{build_fail.BUILD.MACHINE}}"></i>