Skip to contentSkip to conversation

bug fixes patchset

PATCH New Alex DAMIAN 1 participant 7 messages Sep 4, 2014

lore
Share & tools
lore
#0 lore raw

cover bug fixes patchset

From: Alexandru DAMIAN <[email protected]>

This is a bugfix patchset that fixes two critical issues preventing normal operation of Toaster, and four bugs that break pieces of functionality or self-testing in the project.

Can you please merge them at your convenience ?

Cheers,
Alex

The following changes since commit 8f5c1cdae1ee6ce04ae0d04d0b95bd80efbf7534:

process: Ensure abnormal exits set an error level (2014-09-02 18:10:17 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib adamian/20140904-submission-bb
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=adamian/20140904-submission-bb

Alexandru DAMIAN (4):
toaster: rename bldviewer projecttags custom tagset
toaster: bitbake server listen on all interface
toaster: enable SSH-based remote build support
toaster: do not save objects in session

Marius Avram (2):
toaster: use cookies for count and sorting in templates tables
toaster: fix some code spacing issues

 bin/toaster                                        |   6 +-
 lib/toaster/bldcontrol/bbcontroller.py             | 170 ++----------------
 lib/toaster/bldcontrol/localhostbecontroller.py    | 191 ++++++++++++++++++++
 lib/toaster/bldcontrol/sshbecontroller.py          | 193 +++++++++++++++++++++
 lib/toaster/bldcontrol/tests.py                    | 116 ++++++++++---
 lib/toaster/bldviewer/templates/simple_build.html  |   2 +-
 lib/toaster/bldviewer/templates/simple_layer.html  |   2 +-
 lib/toaster/bldviewer/templates/simple_recipe.html |   2 +-
 .../{projecttags.py => simple_projecttags.py}      |   0
 .../toastergui/templates/basetable_bottom.html     |  52 +++---
 .../toastergui/templates/basetable_top.html        |  18 +-
 lib/toaster/toastergui/views.py                    | 140 +++++++++------
 12 files changed, 628 insertions(+), 264 deletions(-)
 create mode 100644 lib/toaster/bldcontrol/localhostbecontroller.py
 create mode 100644 lib/toaster/bldcontrol/sshbecontroller.py
 rename lib/toaster/bldviewer/templatetags/{projecttags.py => simple_projecttags.py} (100%)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/6 toaster: rename bldviewer projecttags custom tagset

From: Alexandru DAMIAN <[email protected]>

We rename the projecttags in bldviewer.templatetags to simple_projecttags in order to avoid conflict with the similarly named tagset in toastergui.

The conflict leads to an intermittent bug where proper tags are not read correctly since Django uses only the module name as global tag library identificator.

---
 lib/toaster/bldviewer/templates/simple_build.html                       | 2 +-
 lib/toaster/bldviewer/templates/simple_layer.html                       | 2 +-
 lib/toaster/bldviewer/templates/simple_recipe.html                      | 2 +-
 .../bldviewer/templatetags/{projecttags.py => simple_projecttags.py}    | 0
 4 files changed, 3 insertions(+), 3 deletions(-)
 rename lib/toaster/bldviewer/templatetags/{projecttags.py => simple_projecttags.py} (100%)
lib/toaster/bldviewer/templates/simple_build.html +1 -1
index a6983f5..230e7c2 100644
@@ -6,7 +6,7 @@
 
 {% block pagetable %}
 
-    {% load projecttags %}
+    {% load simple_projecttags %}
         <tr>
             <th>Outcome</th>
             <th>Started On</th>
lib/toaster/bldviewer/templates/simple_layer.html +1 -1
index ae7172d..25e7bf8 100644
@@ -5,7 +5,7 @@
 {% endblock %}
 
 {% block pagetable %}
-    {% load projecttags %}
+    {% load simple_projecttags %}
 
         <tr>
             <th>Name</th>
lib/toaster/bldviewer/templates/simple_recipe.html +1 -1
index 77b9de2..3bff3b9a 100644
@@ -8,7 +8,7 @@
 {% endblock %}
 
 {% block pagetable %}
-    {% load projecttags %}
+    {% load simple_projecttags %}
 
         <tr>
         </tr>
lib/toaster/bldviewer/templatetags/simple_projecttags.py renamed from lib/toaster/bldviewer/templatetags/projecttags.py +0 -0
similarity index 100%
rename from lib/toaster/bldviewer/templatetags/projecttags.py
rename to lib/toaster/bldviewer/templatetags/simple_projecttags.py
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/6 toaster: bitbake server listen on all interface

From: Alexandru DAMIAN <[email protected]>

We change the toaster starting script to make the bitbake server listen on all interfaces on the local machine.

This is needed to be able to receive a controlling client running on a remote machine.

---
 bin/toaster | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
bin/toaster +3 -3
index 2fabe5c..75c7a07 100755
@@ -99,7 +99,7 @@ function stop_system()
         kill $(< ${BUILDDIR}/.toasterui.pid ) 2>/dev/null
         rm ${BUILDDIR}/.toasterui.pid
     fi
-    BBSERVER=localhost:8200 bitbake -m
+    BBSERVER=0.0.0.0:8200 bitbake -m
     unset BBSERVER
     webserverKillAll
     # force stop any misbehaving bitbake server
@@ -234,12 +234,12 @@ case $CMD in
             return 4
         fi
         unset BBSERVER
-        bitbake --postread conf/toaster.conf --server-only -t xmlrpc -B localhost:8200
+        bitbake --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:8200
         if [ $? -ne 0 ]; then
             start_success=0
             echo "Bitbake server start failed"
         else
-            export BBSERVER=localhost:8200
+            export BBSERVER=0.0.0.0:8200
             if [ $NOTOASTERUI == 0 ]; then        # we start the TOASTERUI only if not inhibited
                 bitbake --observe-only -u toasterui >${BUILDDIR}/toaster_ui.log 2>&1 & echo $! >${BUILDDIR}/.toasterui.pid
             fi
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/6 toaster: enable SSH-based remote build support

In reply to Alex DAMIAN

From: Alexandru DAMIAN <[email protected]>

We enable support for starting builds on remote machines through SSH. The support is limited to poky-based distributions.

We refactor localhost build support and we update bldcontrol application tests to uniformely test the APIs of localhost and SSH build controllers.

[YOCTO #6240]

---
 lib/toaster/bldcontrol/bbcontroller.py          | 170 ++-------------------
 lib/toaster/bldcontrol/localhostbecontroller.py | 191 +++++++++++++++++++++++
 lib/toaster/bldcontrol/sshbecontroller.py       | 193 ++++++++++++++++++++++++
 lib/toaster/bldcontrol/tests.py                 | 116 +++++++++++---
 4 files changed, 488 insertions(+), 182 deletions(-)
 create mode 100644 lib/toaster/bldcontrol/localhostbecontroller.py
 create mode 100644 lib/toaster/bldcontrol/sshbecontroller.py
lib/toaster/bldcontrol/bbcontroller.py +12 -158
index bf9cdf9..6812ae3 100644
@@ -26,10 +26,6 @@ import re
 from django.db import transaction
 from django.db.models import Q
 from bldcontrol.models import BuildEnvironment, BRLayer, BRVariable, BRTarget, BRBitbake
-import subprocess
-
-from toastermain import settings
-
 
 # load Bitbake components
 path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
@@ -72,6 +68,10 @@ def getBuildEnvironmentController(**kwargs):
 
         The return object MUST always be a BuildEnvironmentController.
     """
+
+    from localhostbecontroller import LocalhostBEController
+    from sshbecontroller    import SSHBEController
+
     be = BuildEnvironment.objects.filter(Q(**kwargs))[0]
     if be.betype == BuildEnvironment.TYPE_LOCAL:
         return LocalhostBEController(be)
@@ -81,6 +81,13 @@ def getBuildEnvironmentController(**kwargs):
         raise Exception("FIXME: Implement BEC for type %s" % str(be.betype))
 
 
+def _getgitcheckoutdirectoryname(url):
+    """ Utility that returns the last component of a git path as directory
+    """
+    import re
+    components = re.split(r'[:\.\/]', url)
+    return components[-2] if components[-1] == "git" else components[-1]
+
 
 class BuildEnvironmentController(object):
     """ BuildEnvironmentController (BEC) is the abstract class that defines the operations that MUST
@@ -110,6 +117,7 @@ class BuildEnvironmentController(object):
         self.be = be
         self.connection = None
 
+
     def startBBServer(self):
         """ Starts a  BB server with Toaster toasterui set up to record the builds, an no controlling UI.
             After this method executes, self.be bbaddress/bbport MUST point to a running and free server,
@@ -173,157 +181,3 @@ class ShellCmdException(Exception):
 class BuildSetupException(Exception):
     pass
 
-class LocalhostBEController(BuildEnvironmentController):
-    """ Implementation of the BuildEnvironmentController for the localhost;
-        this controller manages the default build directory,
-        the server setup and system start and stop for the localhost-type build environment
-
-    """
-
-    def __init__(self, be):
-        super(LocalhostBEController, self).__init__(be)
-        self.dburl = settings.getDATABASE_URL()
-        self.pokydirname = None
-
-    def _shellcmd(self, command, cwd = None):
-        if cwd is None:
-            cwd = self.be.sourcedir
-
-        p = subprocess.Popen(command, cwd = cwd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-        (out,err) = p.communicate()
-        if p.returncode:
-            if len(err) == 0:
-                err = "command: %s \n%s" % (command, out)
-            else:
-                err = "command: %s \n%s" % (command, err)
-            raise ShellCmdException(err)
-        else:
-            return out
-
-    def _createdirpath(self, path):
-        from os.path import dirname as DN
-        if not os.path.exists(DN(path)):
-            self._createdirpath(DN(path))
-        if not os.path.exists(path):
-            os.mkdir(path, 0755)
-
-    def _startBE(self):
-        assert self.pokydirname and os.path.exists(self.pokydirname)
-        self._createdirpath(self.be.builddir)
-        self._shellcmd("bash -c \"source %s/oe-init-build-env %s\"" % (self.pokydirname, self.be.builddir))
-
-    def startBBServer(self):
-        assert self.pokydirname and os.path.exists(self.pokydirname)
-        print self._shellcmd("bash -c \"source %s/oe-init-build-env %s && DATABASE_URL=%s source toaster start noweb && sleep 1\"" % (self.pokydirname, self.be.builddir, self.dburl))
-        # FIXME unfortunate sleep 1 - we need to make sure that bbserver is started and the toaster ui is connected
-        # but since they start async without any return, we just wait a bit
-        print "Started server"
-        assert self.be.sourcedir and os.path.exists(self.be.builddir)
-        self.be.bbaddress = "localhost"
-        self.be.bbport = "8200"
-        self.be.bbstate = BuildEnvironment.SERVER_STARTED
-        self.be.save()
-
-    def stopBBServer(self):
-        assert self.be.sourcedir
-        print self._shellcmd("bash -c \"source %s/oe-init-build-env %s && %s source toaster stop\"" %
-            (self.be.sourcedir, self.be.builddir, (lambda: "" if self.be.bbtoken is None else "BBTOKEN=%s" % self.be.bbtoken)()))
-        self.be.bbstate = BuildEnvironment.SERVER_STOPPED
-        self.be.save()
-        print "Stopped server"
-
-    def setLayers(self, bitbakes, layers):
-        """ a word of attention: by convention, the first layer for any build will be poky! """
-
-        assert self.be.sourcedir is not None
-        assert len(bitbakes) == 1
-        # set layers in the layersource
-
-        # 1. get a list of repos, and map dirpaths for each layer
-        gitrepos = {}
-        gitrepos[bitbakes[0].giturl] = []
-        gitrepos[bitbakes[0].giturl].append( ("bitbake", bitbakes[0].dirpath, bitbakes[0].commit) )
-        
-        for layer in layers:
-            # we don't process local URLs
-            if layer.giturl.startswith("file://"):
-                continue
-            if not layer.giturl in gitrepos:
-                gitrepos[layer.giturl] = []
-            gitrepos[layer.giturl].append( (layer.name, layer.dirpath, layer.commit))
-        for giturl in gitrepos.keys():
-            commitid = gitrepos[giturl][0][2]
-            for e in gitrepos[giturl]:
-                if commitid != e[2]:
-                    raise BuildSetupException("More than one commit per git url, unsupported configuration")
-
-        def _getgitdirectoryname(url):
-            import re
-            components = re.split(r'[:\.\/]', url)
-            return components[-2] if components[-1] == "git" else components[-1]
-
-        layerlist = []
-
-        # 2. checkout the repositories
-        for giturl in gitrepos.keys():
-            localdirname = os.path.join(self.be.sourcedir, _getgitdirectoryname(giturl))
-            print "DEBUG: giturl ", giturl ,"checking out in current directory", localdirname
-
-            # make sure our directory is a git repository
-            if os.path.exists(localdirname):
-                if not giturl in self._shellcmd("git remote -v", localdirname):
-                    raise BuildSetupException("Existing git repository at %s, but with different remotes (not '%s'). Aborting." % (localdirname, giturl))
-            else:
-                self._shellcmd("git clone \"%s\" \"%s\"" % (giturl, localdirname))
-            # checkout the needed commit
-            commit = gitrepos[giturl][0][2]
-
-            # branch magic name "HEAD" will inhibit checkout
-            if commit != "HEAD":
-                print "DEBUG: checking out commit ", commit, "to", localdirname
-                self._shellcmd("git fetch --all && git checkout \"%s\"" % commit , localdirname)
-
-            # take the localdirname as poky dir if we can find the oe-init-build-env
-            if self.pokydirname is None and os.path.exists(os.path.join(localdirname, "oe-init-build-env")):
-                print "DEBUG: selected poky dir name", localdirname
-                self.pokydirname = localdirname
-
-            # verify our repositories
-            for name, dirpath, commit in gitrepos[giturl]:
-                localdirpath = os.path.join(localdirname, dirpath)
-                if not os.path.exists(localdirpath):
-                    raise BuildSetupException("Cannot find layer git path '%s' in checked out repository '%s:%s'. Aborting." % (localdirpath, giturl, commit))
-
-                if name != "bitbake":
-                    layerlist.append(localdirpath)
-
-        print "DEBUG: current layer list ", layerlist
-
-        # 3. configure the build environment, so we have a conf/bblayers.conf
-        assert self.pokydirname is not None
-        self._startBE()
-
-        # 4. update the bblayers.conf
-        bblayerconf = os.path.join(self.be.builddir, "conf/bblayers.conf")
-        if not os.path.exists(bblayerconf):
-            raise BuildSetupException("BE is not consistent: bblayers.conf file missing at %s" % bblayerconf)
-
-        conflines = open(bblayerconf, "r").readlines()
-
-        bblayerconffile = open(bblayerconf, "w")
-        for i in xrange(len(conflines)):
-            if conflines[i].startswith("# line added by toaster"):
-                i += 2
-            else:
-                bblayerconffile.write(conflines[i])
-
-        bblayerconffile.write("\n# line added by toaster build control\nBBLAYERS = \"" + " ".join(layerlist) + "\"")
-        bblayerconffile.close()
-
-        return True
-
-    def release(self):
-        assert self.be.sourcedir and os.path.exists(self.be.builddir)
-        import shutil
-        shutil.rmtree(os.path.join(self.be.sourcedir, "build"))
-        assert not os.path.exists(self.be.builddir)
lib/toaster/bldcontrol/localhostbecontroller.py new file +191 -0

191 lines not on this page · raw message

lib/toaster/bldcontrol/sshbecontroller.py new file +193 -0

193 lines not on this page · raw message

lib/toaster/bldcontrol/tests.py +92 -24

146 lines not on this page · raw message

Signature · 1 line
1.9.1
#4 lore raw

PATCH 4/6 toaster: do not save objects in session

In reply to Alex DAMIAN

From: Alexandru DAMIAN <[email protected]>

In order to avoid problems when using JSON serializer for saving sessions, we move from storing the objects themselves in the session to storing the object id and reloading the object when retrieved.

This allows, for example, to use cookie-storage sessions if the infrastructure owner so desires.

---
 lib/toaster/toastergui/views.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
lib/toaster/toastergui/views.py +9 -9
index 13788b0..22b26d0 100755
@@ -1774,8 +1774,8 @@ if toastermain.settings.MANAGED:
             "projects": Project.objects.all(),
             "MANAGED" : toastermain.settings.MANAGED
         }
-        if 'project' in request.session:
-            ret['project'] = request.session['project']
+        if 'project_id' in request.session:
+            ret['project'] = Project.objects.get(pk = request.session['project_id'])
         return ret
 
     # new project
@@ -1841,7 +1841,7 @@ if toastermain.settings.MANAGED:
             puser = None
 
         # we use implicit knowledge of the current user's project to filter layer information, e.g.
-        request.session['project'] = prj
+        request.session['project_id'] = prj.id
 
         context = {
             "project" : prj,
@@ -1937,8 +1937,8 @@ if toastermain.settings.MANAGED:
         (filter_string, search_term, ordering_string) = _search_tuple(request, Layer_Version)
 
         queryset_all = Layer_Version.objects.all()
-        if 'project' in request.session:
-            queryset_all = queryset_all.filter(up_branch__in = Branch.objects.filter(name = request.session['project'].release.name))
+        if 'project_id' in request.session:
+            queryset_all = queryset_all.filter(up_branch__in = Branch.objects.filter(name = Project.objects.get(pk = request.session['project_id']).release.name))
 
         queryset_with_search = _get_queryset(Layer_Version, queryset_all, None, search_term, ordering_string, '-layer__name')
         queryset = _get_queryset(Layer_Version, queryset_all, filter_string, search_term, ordering_string, '-layer__name')
@@ -2023,8 +2023,8 @@ if toastermain.settings.MANAGED:
         (filter_string, search_term, ordering_string) = _search_tuple(request, Recipe)
 
         queryset_all = Recipe.objects.all()
-        if 'project' in request.session:
-            queryset_all = queryset_all.filter(Q(layer_version__up_branch__in = Branch.objects.filter(name = request.session['project'].release.name)) | Q(layer_version__build__in = request.session['project'].build_set.all()))
+        if 'project_id' in request.session:
+            queryset_all = queryset_all.filter(Q(layer_version__up_branch__in = Branch.objects.filter(name = Project.objects.get(pk=request.session['project_id']).release.name)) | Q(layer_version__build__in = Project.objects.get(pk = request.session['project_id']).build_set.all()))
 
         queryset_with_search = _get_queryset(Recipe, queryset_all, None, search_term, ordering_string, '-name')
         queryset = _get_queryset(Recipe, queryset_all, filter_string, search_term, ordering_string, '-name')
@@ -2107,8 +2107,8 @@ if toastermain.settings.MANAGED:
         (filter_string, search_term, ordering_string) = _search_tuple(request, Machine)
 
         queryset_all = Machine.objects.all()
-#        if 'project' in request.session:
-#            queryset_all = queryset_all.filter(Q(layer_version__up_branch__in = Branch.objects.filter(name = request.session['project'].release.name)) | Q(layer_version__build__in = request.session['project'].build_set.all()))
+#        if 'project_id' in request.session:
+#            queryset_all = queryset_all.filter(Q(layer_version__up_branch__in = Branch.objects.filter(name = Project.objects.get(request.session['project_id']).release.name)) | Q(layer_version__build__in = Project.objects.get(request.session['project_id']).build_set.all()))
 
         queryset_with_search = _get_queryset(Machine, queryset_all, None, search_term, ordering_string, '-name')
         queryset = _get_queryset(Machine, queryset_all, filter_string, search_term, ordering_string, '-name')
Signature · 1 line
1.9.1
#5 lore raw

PATCH 5/6 toaster: use cookies for count and sorting in templates tables

In reply to Alex DAMIAN

From: Marius Avram <[email protected]>

Until now cookies were used to save which columns were shown and which were hidden in toaster tables. The tables from the templates also have functionalities like sorting the entries on a certain column and limiting the number of entries displayed on a page. The later however were not saved using cookies. This patch brings this new feature.

The cookies are not saved only in the front-end. They are saved both in the frontend in case the user uses the inputs/buttons to change a parameter and also in the backend in case the user specifies manually using GET variables the value of the parameters.

When no GET parameters are given the views will redirect the url to one containg the parameters saved as cookies. When no cookies exist, default values will be used.

[YOCTO #6126]

---
 .../toastergui/templates/basetable_bottom.html     |  15 ++-
 .../toastergui/templates/basetable_top.html        |  11 +-
 lib/toaster/toastergui/views.py                    | 122 ++++++++++++++-------
 3 files changed, 102 insertions(+), 46 deletions(-)
lib/toaster/toastergui/templates/basetable_bottom.html +12 -3
index ac14363..cbdc164 100644
@@ -26,7 +26,7 @@
                             <span class="help-inline" style="padding-top:5px;">Show rows:</span>
                             <select style="margin-top:5px;margin-bottom:0px;" class="pagesize">
   {% with "2 5 10 25 50 100" as list%}
-    {% for i in list.split %}<option{%if i == request.GET.count %} selected{%endif%}>{{i}}</option>
+    {% for i in list.split %}<option value="{{i}}">{{i}}</option>
     {% endfor %}
   {% endwith %}
                             </select>
@@ -56,6 +56,14 @@
     }
     }
 
+    // load cookie for number of entries to be displayed on page
+    pagesize = $.cookie('count');
+    if (!pagesize)
+        pagesize = 10;
+    $('.pagesize option').prop('selected', false)
+                         .filter('[value="' + pagesize + '"]')
+                         .attr('selected', true);
+
     $('.chbxtoggle').each(function () {
         showhideTableColumn($(this).attr('id'), $(this).is(':checked'))
     });
@@ -72,8 +80,9 @@
     $('.progress, .lead span').tooltip({container:'table', placement:'top'});
 
     $(".pagesize").change(function () {
-        console.log("page size change");
-        reload_params({"count":$(this).val()}); ;
+        reload_params({"count":$(this).val()});
+        // save cookie with pagesize
+        $.cookie("count", $(this).val(), { path : $(location).attr('pathname') });
     });
 });
 </script>
lib/toaster/toastergui/templates/basetable_top.html +9 -2
index 1231e1f..037554b 100644
@@ -156,6 +156,13 @@
         showhideImmediateTableAction( clname, sh, orderkey );
     }
 
+    //
+    // saves a cookie with selected order field
+    //
+    function saveOrderCookie( orderfield ) {
+        $.cookie("orderby", orderfield, { path: $(location).attr('pathname') });
+    }
+
     </script>
 
 <!-- control header -->
@@ -205,7 +212,7 @@
                 <span class="help-inline" style="padding-top:5px;">Show rows:</span>
                 <select style="margin-top:5px;margin-bottom:0px;" class="pagesize">
   {% with "2 5 10 25 50 100" as list%}
-{% for i in list.split %}                    <option{%if i == request.GET.count %} selected{%endif%}>{{i}}</option>
+{% for i in list.split %}                    <option value="{{i}}">{{i}}</option>
     {% endfor %}
   {% endwith %}
                 </select>
@@ -221,7 +228,7 @@
         <tr>
             {% for tc in tablecols %}<th class="{{tc.dclass}} {{tc.clclass}}">
                 {%if tc.qhelp%}<i class="icon-question-sign get-help" title="{{tc.qhelp}}"></i>{%endif%}
-                {%if tc.orderfield%}<a {%if tc.ordericon%} class="sorted" {%endif%}href="javascript:reload_params({'page': 1, 'orderby' : '{{tc.orderfield}}' })" >{{tc.name}}</a>{%else%}<span class="muted">{{tc.name}}</span>{%endif%}
+                {%if tc.orderfield%}<a {%if tc.ordericon%} class="sorted" {%endif%}href="javascript:reload_params({'page': 1, 'orderby' : '{{tc.orderfield}}' })" onclick="saveOrderCookie('{{tc.orderfield}}')">{{tc.name}}</a>{%else%}<span class="muted">{{tc.name}}</span>{%endif%}
                 {%if tc.ordericon%} <i class="icon-caret-{{tc.ordericon}}"></i>{%endif%}
                 {%if tc.filter%}<div class="btn-group pull-right">
                     <a href="#filter_{{tc.filter.class}}" role="button" class="btn btn-mini {%if request.GET.filter%}{{tc.filter.options|filtered_icon:request.GET.filter}} {%endif%}" {%if request.GET.filter and tc.filter.options|filtered_tooltip:request.GET.filter %} title="<p>{{tc.filter.options|filtered_tooltip:request.GET.filter}}</p><p><a class='btn btn-small btn-primary' href=javascript:reload_params({'filter':''})>Show all {% if filter_search_display %}{{filter_search_display}}{% else %}{{objectname}}{% endif %}</a></p>" {%endif%} data-toggle="modal"> <i class="icon-filter filtered"></i> </a>
lib/toaster/toastergui/views.py +81 -41

312 lines not on this page · raw message

Signature · 1 line
1.9.1
#6 lore raw

PATCH 6/6 toaster: fix some code spacing issues

In reply to Alex DAMIAN

From: Marius Avram <[email protected]>

Code is related to the basetable templates files.
It had mixed tabs and spaces and was miss aligned in various places, making it hard to read.

---
 .../toastergui/templates/basetable_bottom.html     | 39 +++++++++++-----------
 .../toastergui/templates/basetable_top.html        |  9 ++---
 2 files changed, 25 insertions(+), 23 deletions(-)
lib/toaster/toastergui/templates/basetable_bottom.html +20 -19
index cbdc164..e6b9506 100644
@@ -23,13 +23,14 @@
 {%endif%}
   </ul>
   <div class="pull-right">
-                            <span class="help-inline" style="padding-top:5px;">Show rows:</span>
-                            <select style="margin-top:5px;margin-bottom:0px;" class="pagesize">
-  {% with "2 5 10 25 50 100" as list%}
-    {% for i in list.split %}<option value="{{i}}">{{i}}</option>
-    {% endfor %}
-  {% endwith %}
-                            </select>
+    <span class="help-inline" style="padding-top:5px;">Show rows:</span>
+    <select style="margin-top:5px;margin-bottom:0px;" class="pagesize">
+      {% with "2 5 10 25 50 100" as list%}
+        {% for i in list.split %}
+            <option value="{{i}}">{{i}}</option>
+        {% endfor %}
+      {% endwith %}
+    </select>
    </div>
 </div>
 
@@ -40,21 +41,21 @@
 
     // we load cookies for the column display
     save = $.cookie('_displaycols_{{objectname}}');
-		if (save != undefined) {
-    setting = save.split(';');
-    for ( i = 0; i < setting.length; i++) {
-        if (setting[i].length > 0) {
-            splitlist = setting[i].split(':');
-            id = splitlist[0], v = splitlist[1];
-            if (v == 'true') {
-                $('.chbxtoggle#'+id).prop('checked', true);
-            }
-            else {
-                $('.chbxtoggle#'+id).prop('checked', false);
+    if (save != undefined) {
+        setting = save.split(';');
+        for ( i = 0; i < setting.length; i++) {
+            if (setting[i].length > 0) {
+                splitlist = setting[i].split(':');
+                id = splitlist[0], v = splitlist[1];
+                if (v == 'true') {
+                    $('.chbxtoggle#'+id).prop('checked', true);
+                }
+                else {
+                    $('.chbxtoggle#'+id).prop('checked', false);
+                }
             }
         }
     }
-    }
 
     // load cookie for number of entries to be displayed on page
     pagesize = $.cookie('count');
lib/toaster/toastergui/templates/basetable_top.html +5 -4
index 037554b..e43eb2c 100644
@@ -211,10 +211,11 @@
                 <span class="divider-vertical"></span>
                 <span class="help-inline" style="padding-top:5px;">Show rows:</span>
                 <select style="margin-top:5px;margin-bottom:0px;" class="pagesize">
-  {% with "2 5 10 25 50 100" as list%}
-{% for i in list.split %}                    <option value="{{i}}">{{i}}</option>
-    {% endfor %}
-  {% endwith %}
+                  {% with "2 5 10 25 50 100" as list%}
+                    {% for i in list.split %}
+                        <option value="{{i}}">{{i}}</option>
+                    {% endfor %}
+                  {% endwith %}
                 </select>
            </div>
         </div>
Signature · 1 line
1.9.1