]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: display Toaster mode and version in debug mode
authorAlexandru DAMIAN <alexandru.damian@intel.com>
Fri, 6 Feb 2015 15:32:18 +0000 (15:32 +0000)
committerAlexandru DAMIAN <alexandru.damian@intel.com>
Mon, 9 Feb 2015 17:54:34 +0000 (17:54 +0000)
This patch displays the current running mode and checked-out git branch
as Toaster version when running in debug mode.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
lib/toaster/toastergui/static/css/default.css
lib/toaster/toastergui/templates/base.html
lib/toaster/toastergui/views.py
lib/toaster/toastermain/settings.py

index 10952547b4b23eb316a899fede2e2c4aa8849d60..a866773af6db2a459ab447539e5c5bded6f6efd8 100644 (file)
@@ -2,6 +2,25 @@
 .logo img { height: 30px; width: auto !important; }
 .logo { padding-top: 4px !important; padding-bottom:0px !important; }
 
+/* style the version text */
+.version-text {
+       color: #AAA;
+       font-size: 0.6em;
+       display: table-footer-group;
+       padding: 0px;
+       margin: 1px 1px 1px 1px;
+}
+
+.version-brand, .version-brand:hover, a.version-brand:focus  {
+    color: #777;
+    display: block;
+    float: left;
+    font-size: 20px;
+    font-weight: 200;
+    padding: 00px 0px;
+    text-shadow: 0 1px 0 #fff;
+}
+
 /* Style the breadcrumb */
 .breadcrumb { display: inline-block; background-color: transparent; }
 .section { margin: 20px 0; }
index e95b5e0cac841edbfd89da3c0e05950087622309..6f249bcf2d513fe7e9b02c702fe65d91c72045aa 100644 (file)
     <div class="navbar-inner">
             <a class="brand logo" href="#"><img src="{% static 'img/logo.png' %}" class="" alt="Yocto logo project"/></a>
             <a class="brand" href="/">Toaster</a>
+            {% if DEBUG %}
+            <div style="display: inline;" class="version-brand">
+              <p class="version-text">version {{TOASTER_VERSION}}</p>
+              <p class="version-text">{%if MANAGED%}managed{%else%}interactive{%endif%} mode</p>
+            </div>
+            {% endif %}
             <a class="pull-right manual" target="_blank" href="http://www.yoctoproject.org/documentation/toaster-manual">
                 <i class="icon-book"></i>
                 Toaster manual
index b67a6767b3ec2a247c0bee0c8686132ef2165de7..4b770ff5db3436d3fdd0ff8ba860ed5db9f7cc63 100755 (executable)
@@ -1709,10 +1709,12 @@ if toastermain.settings.MANAGED:
 
     # the context processor that supplies data used across all the pages
     def managedcontextprocessor(request):
+        import subprocess
         ret = {
             "projects": Project.objects.all(),
             "MANAGED" : toastermain.settings.MANAGED,
-            "DEBUG" : toastermain.settings.DEBUG
+            "DEBUG" : toastermain.settings.DEBUG,
+            "TOASTER_VERSION": toastermain.settings.TOASTER_VERSION,
         }
         if 'project_id' in request.session:
             try:
@@ -3057,7 +3059,9 @@ else:
         return {
             "projects": [],
             "MANAGED" : toastermain.settings.MANAGED,
-            "DEBUG" : toastermain.settings.DEBUG
+            "DEBUG" : toastermain.settings.DEBUG,
+            "TOASTER_VERSION": toastermain.settings.TOASTER_VERSION,
+
         }
 
 
index ea7c3534da5427fcfde8c65b1434e35530e7bd56..b6a42c062685a92e61f28611e3880bf75bbbcbe9 100644 (file)
@@ -211,8 +211,6 @@ MIDDLEWARE_CLASSES = (
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
-    'django.middleware.cache.UpdateCacheMiddleware',
-    'django.middleware.cache.FetchFromCacheMiddleware',
     # Uncomment the next line for simple clickjacking protection:
     # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 )
@@ -233,6 +231,9 @@ CACHES = {
 from os.path import dirname as DN
 SITE_ROOT=DN(DN(os.path.abspath(__file__)))
 
+import subprocess
+TOASTER_VERSION = subprocess.Popen('cd %s; git branch | grep "^* " | tr -d "* "' % SITE_ROOT, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]
+
 ROOT_URLCONF = 'toastermain.urls'
 
 # Python dotted path to the WSGI application used by Django's runserver.