diff options
-rw-r--r-- | bitbake/lib/toaster/toastergui/tables.py | 42 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/minibuilds.html | 19 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastergui/urls.py | 4 |
3 files changed, 65 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index 67a659222f8..7c849304412 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py @@ -1535,3 +1535,45 @@ class ProjectBuildsTable(BuildsTable): context['project'] = project return context + +# TODO example for wiki +# import any models you need for the table +from orm.models import Build + +class MiniBuildsTable(ToasterTable): + def __init__(self, *args, **kwargs): + super(MiniBuildsTable, self).__init__(*args, **kwargs) + self.default_orderby = '-completed_on' + self.title = 'Mini Builds Table' + + def setup_queryset(self, *args, **kwargs): + self.queryset = Build.objects.all() + + def setup_columns(self, *args, **kwargs): + outcome_template = ''' + {% if data.outcome == 0 %} + succeeded + {% else %} + failed + {% endif %} + ''' + + self.add_column(title='Completed on', + help_text='The date and time when the build finished', + hideable=False, + orderable=True, + static_data_name='completed_on', + static_data_template='{{data.completed_on | date:"d/m/y H:i"}}') + + self.add_column(title='Project', + help_text='The project associated with this build', + hideable=True, + orderable=True, + field_name='project__name') + + self.add_column(title='Outcome', + help_text='The outcome of the build', + hideable=True, + orderable=True, + static_data_name='outcome', + static_data_template=outcome_template) diff --git a/bitbake/lib/toaster/toastergui/templates/minibuilds.html b/bitbake/lib/toaster/toastergui/templates/minibuilds.html new file mode 100644 index 00000000000..5e4e481090a --- /dev/null +++ b/bitbake/lib/toaster/toastergui/templates/minibuilds.html @@ -0,0 +1,19 @@ +{% extends 'base.html' %} +{% load static %} + +{% block extraheadcontent %} + <link rel="stylesheet" href="{% static 'css/jquery-ui.min.css' %}" type='text/css'> + <link rel="stylesheet" href="{% static 'css/jquery-ui.structure.min.css' %}" type='text/css'> + <link rel="stylesheet" href="{% static 'css/jquery-ui.theme.min.css' %}" type='text/css'> + <script src="{% static 'js/jquery-ui.min.js' %}"></script> +{% endblock %} + +{% block title %}{{title}}{% endblock %} + +{% block pagecontent %} + <!--div class="row-fluid"--> + <h1 class="page-header top-air">{{title}}</h1> + {% url 'minibuilds' as xhr_table_url %} + {% include 'toastertable.html' %} + <!--/div--> +{% endblock %} diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py index 400580a2359..ea1e5354e28 100644 --- a/bitbake/lib/toaster/toastergui/urls.py +++ b/bitbake/lib/toaster/toastergui/urls.py @@ -31,6 +31,10 @@ urlpatterns = patterns('toastergui.views', tables.AllBuildsTable.as_view(template_name="builds-toastertable.html"), name='all-builds'), + url(r'^minibuilds/$', + tables.MiniBuildsTable.as_view(template_name='minibuilds.html'), + name='minibuilds'), + # build info navigation url(r'^build/(?P<build_id>\d+)$', 'builddashboard', name="builddashboard"), |