All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Toaster fixes
@ 2015-08-06 16:01 Ed Bartosh
  2015-08-06 16:01 ` [PATCH 1/3] bitbake: toastergui: Fix toastertable table header reference Ed Bartosh
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ed Bartosh @ 2015-08-06 16:01 UTC (permalink / raw)
  To: bitbake-devel

Hi,

This patchset contains 3 Toaster fixes reviewed by me.

The following changes since commit a8b723498c9a7106210db140452886894494b4d6:

  bitbake: cooker: Resolve file monitoring race issues when using memres bitbake (2015-08-03 07:36:25 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib ed/toaster/submit/michaelw/toaster/misc_fixes
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/submit/michaelw/toaster/misc_fixes

Michael Wood (3):
  bitbake: toastergui: Fix toastertable table header reference
  bitbake: toastergui: Move layerdetails view definition to the views.py
  bitbake: toastermain: Add a longer default database timeout

 bitbake/lib/toaster/toastergui/static/js/table.js  |  2 +-
 bitbake/lib/toaster/toastergui/tables.py           | 24 +-------------------
 .../toaster/toastergui/templates/toastertable.html |  2 +-
 bitbake/lib/toaster/toastergui/urls.py             |  3 +--
 bitbake/lib/toaster/toastergui/views.py            | 15 +++++++++++++
 bitbake/lib/toaster/toastergui/widgets.py          | 26 ----------------------
 bitbake/lib/toaster/toastermain/settings.py        |  6 +++++
 7 files changed, 25 insertions(+), 53 deletions(-)

--
Ed



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] bitbake: toastergui: Fix toastertable table header reference
  2015-08-06 16:01 [PATCH 0/3] Toaster fixes Ed Bartosh
@ 2015-08-06 16:01 ` Ed Bartosh
  2015-08-06 16:01 ` [PATCH 2/3] bitbake: toastergui: Move layerdetails view definition to the views.py Ed Bartosh
  2015-08-06 16:01 ` [PATCH 3/3] bitbake: toastermain: Add a longer default database timeout Ed Bartosh
  2 siblings, 0 replies; 5+ messages in thread
From: Ed Bartosh @ 2015-08-06 16:01 UTC (permalink / raw)
  To: bitbake-devel

From: Michael Wood <michael.g.wood@intel.com>

A header id was mistakenly added to the table template which was not
also added to the simple version of the toaster template. We don't need
this id so remove it.

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/toaster/toastergui/static/js/table.js          | 2 +-
 bitbake/lib/toaster/toastergui/templates/toastertable.html | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/toaster/toastergui/static/js/table.js b/bitbake/lib/toaster/toastergui/static/js/table.js
index d06a3f5..f18034d 100644
--- a/bitbake/lib/toaster/toastergui/static/js/table.js
+++ b/bitbake/lib/toaster/toastergui/static/js/table.js
@@ -198,7 +198,7 @@ function tableInit(ctx){
     if (tableChromeDone === true)
       return;
 
-    var tableHeadRow = table.find("thead#tableheader");
+    var tableHeadRow = table.find("thead");
     var editColMenu = $("#table-chrome-"+ctx.tableName).find(".editcol");
 
     tableHeadRow.html("");
diff --git a/bitbake/lib/toaster/toastergui/templates/toastertable.html b/bitbake/lib/toaster/toastergui/templates/toastertable.html
index 0473116..9ef4c6f 100644
--- a/bitbake/lib/toaster/toastergui/templates/toastertable.html
+++ b/bitbake/lib/toaster/toastergui/templates/toastertable.html
@@ -78,7 +78,7 @@
 
   <!-- The actual table -->
   <table class="table table-bordered table-hover tablesorter" id="{{table_name}}">
-    <thead id="tableheader">
+    <thead>
       <tr><th></th></tr>
     </thead>
     <tbody></tbody>
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] bitbake: toastergui: Move layerdetails view definition to the views.py
  2015-08-06 16:01 [PATCH 0/3] Toaster fixes Ed Bartosh
  2015-08-06 16:01 ` [PATCH 1/3] bitbake: toastergui: Fix toastertable table header reference Ed Bartosh
@ 2015-08-06 16:01 ` Ed Bartosh
  2015-08-06 21:07   ` Richard Purdie
  2015-08-06 16:01 ` [PATCH 3/3] bitbake: toastermain: Add a longer default database timeout Ed Bartosh
  2 siblings, 1 reply; 5+ messages in thread
From: Ed Bartosh @ 2015-08-06 16:01 UTC (permalink / raw)
  To: bitbake-devel

From: Michael Wood <michael.g.wood@intel.com>

The layerdetails view definition was moved to tables though it isn't
a table. We have a mechanism for the JSON response for this page so use
this instead of a custom class.

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/toaster/toastergui/tables.py  | 24 +-----------------------
 bitbake/lib/toaster/toastergui/urls.py    |  3 +--
 bitbake/lib/toaster/toastergui/views.py   | 15 +++++++++++++++
 bitbake/lib/toaster/toastergui/widgets.py | 26 --------------------------
 4 files changed, 17 insertions(+), 51 deletions(-)

diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py
index 8d5166be..8770df5 100644
--- a/bitbake/lib/toaster/toastergui/tables.py
+++ b/bitbake/lib/toaster/toastergui/tables.py
@@ -19,7 +19,7 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-from toastergui.widgets import ToasterTable, ToasterTemplateView
+from toastergui.widgets import ToasterTable
 from orm.models import Recipe, ProjectLayer, Layer_Version, Machine, Project
 from django.db.models import Q, Max
 from django.conf.urls import url
@@ -202,28 +202,6 @@ class LayersTable(ToasterTable):
                         computation = lambda x: x.layer.name)
 
 
-
-
-class LayerDetails(ToasterTemplateView):
-    def get_context_data(self, **kwargs):
-        context = super(LayerDetails, self).get_context_data(**kwargs)
-        from toastergui.views import _lv_to_dict
-
-        context['project'] = Project.objects.get(pk=kwargs['pid'])
-        context['layerversion'] = Layer_Version.objects.get(pk=kwargs['layerid'])
-        context['layerdict'] = _lv_to_dict(context['project'], context['layerversion'])
-        context['layerdeps'] = {"list": [
-            [ {"id": y.id,
-               "name": y.layer.name,
-               "layerdetailurl": reverse('layerdetails', args=(kwargs['pid'], y.id)),
-              } for y in x.depends_on.get_equivalents_wpriority(context['project'])][0] for x in context['layerversion'].dependencies.all()]}
-        context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project']))
-
-        self.context_entries = ['project', 'layerversion', 'projectlayers', 'layerdict', 'layerdeps']
-
-        return context
-
-
 class MachinesTable(ToasterTable, ProjectFiltersMixin):
     """Table of Machines in Toaster"""
 
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py
index beb4303..6a2c586 100644
--- a/bitbake/lib/toaster/toastergui/urls.py
+++ b/bitbake/lib/toaster/toastergui/urls.py
@@ -109,8 +109,7 @@ urlpatterns = patterns('toastergui.views',
             name="projectlayers"),
 
         url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)$',
-            tables.LayerDetails.as_view(template_name='layerdetails.html'),
-            name='layerdetails'),
+            'layerdetails', name='layerdetails'),
 
         url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)/recipes/$',
             tables.LayerRecipesTable.as_view(template_name="generic-toastertable-page.html"),
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index b43a01e..21997d6 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2528,6 +2528,21 @@ if True:
         }
         return render(request, template, context)
 
+    @_template_renderer('layerdetails.html')
+    def layerdetails(request, pid, layerid):
+        project = Project.objects.get(pk=pid)
+        layer_version = Layer_Version.objects.get(pk=layerid)
+
+        context = { 'project' : project,
+                   'layerversion' : layer_version,
+                   'layerdeps' : { "list": [
+                     [{"id": y.id, "name": y.layer.name} for y in x.depends_on.get_equivalents_wpriority(project)][0] for x in layer_version.dependencies.all()]},
+                   'projectlayers': map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=project))
+                  }
+
+        return context
+
+
     def get_project_configvars_context():
         # Vars managed outside of this view
         vars_managed = {
diff --git a/bitbake/lib/toaster/toastergui/widgets.py b/bitbake/lib/toaster/toastergui/widgets.py
index 0885402..1f81297 100644
--- a/bitbake/lib/toaster/toastergui/widgets.py
+++ b/bitbake/lib/toaster/toastergui/widgets.py
@@ -328,29 +328,3 @@ class ToasterTable(TemplateView):
         cache.set(cache_name, data, 60*30)
 
         return data
-
-
-class ToasterTemplateView(TemplateView):
-    # renders a instance in a template, or returns the context as json
-    # the class-equivalent of the _template_renderer decorator for views
-
-
-    def get(self, *args, **kwargs):
-        if self.request.GET.get('format', None) == 'json':
-            from django.core.urlresolvers import reverse
-            from django.shortcuts import HttpResponse
-            from views import objtojson
-            from toastergui.templatetags.projecttags import json as jsonfilter
-
-            context = self.get_context_data(**kwargs)
-
-            for x in context.keys():
-                if x not in self.context_entries:
-                    del context[x]
-
-            context["error"] = "ok"
-
-            return HttpResponse(jsonfilter(context,  default=objtojson ),
-                            content_type = "application/json; charset=utf-8")
-
-        return super(ToasterTemplateView, self).get(*args, **kwargs)
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] bitbake: toastermain: Add a longer default database timeout
  2015-08-06 16:01 [PATCH 0/3] Toaster fixes Ed Bartosh
  2015-08-06 16:01 ` [PATCH 1/3] bitbake: toastergui: Fix toastertable table header reference Ed Bartosh
  2015-08-06 16:01 ` [PATCH 2/3] bitbake: toastergui: Move layerdetails view definition to the views.py Ed Bartosh
@ 2015-08-06 16:01 ` Ed Bartosh
  2 siblings, 0 replies; 5+ messages in thread
From: Ed Bartosh @ 2015-08-06 16:01 UTC (permalink / raw)
  To: bitbake-devel

From: Michael Wood <michael.g.wood@intel.com>

When using sqlite we sometimes see Database Locked exceptions when we
fire off database calls asynchronously from the UI. We need sqlite to
wait a bit longer for the lock to be released.
n.b In production setup we hopefully wouldn't be using sqlite.

docs.djangoproject.com/en/1.6/ref/databases/#database-is-locked-errors

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/toaster/toastermain/settings.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py
index c72a904..b149a5e 100644
--- a/bitbake/lib/toaster/toastermain/settings.py
+++ b/bitbake/lib/toaster/toastermain/settings.py
@@ -49,6 +49,12 @@ DATABASES = {
     }
 }
 
+# Needed when Using sqlite especially to add a longer timeout for waiting
+# for the database lock to be  released
+# https://docs.djangoproject.com/en/1.6/ref/databases/#database-is-locked-errors
+if 'sqlite' in DATABASES['default']['ENGINE']:
+    DATABASES['default']['OPTIONS'] = { 'timeout': 20 }
+
 # Reinterpret database settings if we have DATABASE_URL environment variable defined
 
 if 'DATABASE_URL' in os.environ:
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/3] bitbake: toastergui: Move layerdetails view definition to the views.py
  2015-08-06 16:01 ` [PATCH 2/3] bitbake: toastergui: Move layerdetails view definition to the views.py Ed Bartosh
@ 2015-08-06 21:07   ` Richard Purdie
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Purdie @ 2015-08-06 21:07 UTC (permalink / raw)
  To: Ed Bartosh, Michael Wood; +Cc: bitbake-devel

On Thu, 2015-08-06 at 19:01 +0300, Ed Bartosh wrote:
> From: Michael Wood <michael.g.wood@intel.com>
> 
> The layerdetails view definition was moved to tables though it isn't
> a table. We have a mechanism for the JSON response for this page so use
> this instead of a custom class.
> 
> Signed-off-by: Michael Wood <michael.g.wood@intel.com>
> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>

Could someone rebase and resend this patch please as it doesn't apply
with the other changes.

Cheers,

Richard



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-06 21:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-06 16:01 [PATCH 0/3] Toaster fixes Ed Bartosh
2015-08-06 16:01 ` [PATCH 1/3] bitbake: toastergui: Fix toastertable table header reference Ed Bartosh
2015-08-06 16:01 ` [PATCH 2/3] bitbake: toastergui: Move layerdetails view definition to the views.py Ed Bartosh
2015-08-06 21:07   ` Richard Purdie
2015-08-06 16:01 ` [PATCH 3/3] bitbake: toastermain: Add a longer default database timeout Ed Bartosh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.