diff mbox

[Branch,~linaro-validation/lava-server/trunk] Rev 419: Add instance name information on the top panel next to the user indicator. Reviewed by terceiro.

Message ID 20130807121536.26383.61890.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Stevan Radakovic Aug. 7, 2013, 12:15 p.m. UTC
Merge authors:
  Stevan Radaković (stevanr)
Related merge proposals:
  https://code.launchpad.net/~stevanr/lava-server/instance-name/+merge/178939
  proposed by: Stevan Radaković (stevanr)
  review: Approve - Antonio Terceiro (terceiro)
------------------------------------------------------------
revno: 419 [merge]
committer: Stevan Radakovic <stevan.radakovic@linaro.org>
branch nick: trunk
timestamp: Wed 2013-08-07 14:15:10 +0200
message:
  Add instance name information on the top panel next to the user indicator. Reviewed by terceiro.
modified:
  lava_server/context_processors.py
  lava_server/htdocs/css/default.css
  lava_server/templates/layouts/content.html


--
lp:lava-server
https://code.launchpad.net/~linaro-validation/lava-server/trunk

You are subscribed to branch lp:lava-server.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-server/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_server/context_processors.py'
--- lava_server/context_processors.py	2013-07-30 15:28:17 +0000
+++ lava_server/context_processors.py	2013-08-07 11:35:41 +0000
@@ -16,6 +16,7 @@ 
 # You should have received a copy of the GNU Affero General Public License
 # along with LAVA Server.  If not, see <http://www.gnu.org/licenses/>.
 
+import os
 import versiontools
 
 import lava_server
@@ -39,10 +40,20 @@ 
         ]),
         Menu("Documentation", "http://lava.rtfd.org/"),
     ])
+
+    try:
+        instance_name = os.environ["LAVA_INSTANCE"]
+    except KeyError:
+        try:
+            instance_name = os.path.basename(os.environ["VIRTUAL_ENV"])
+        except KeyError:
+            instance_name = None
+
     return {
         'lava': {
             'menu_list': menu_list, 
             'extension_list': loader.extensions,
+            'instance_name': instance_name,
             'version': versiontools.format_version(
                 lava_server.__version__, hint=lava_server)}}
 

=== modified file 'lava_server/htdocs/css/default.css'
--- lava_server/htdocs/css/default.css	2012-06-04 05:10:13 +0000
+++ lava_server/htdocs/css/default.css	2013-08-07 11:35:41 +0000
@@ -219,6 +219,14 @@ 
   vertical-align: middle;
 }
 
+/* Instance name indicator */
+
+#lava-instance-name-indicator {
+  text-align: center;
+  padding-right: 20px;
+  vertical-align: middle;
+}
+
 /* Logo */
 
 #lava-logo {

=== modified file 'lava_server/templates/layouts/content.html'
--- lava_server/templates/layouts/content.html	2012-11-09 22:40:16 +0000
+++ lava_server/templates/layouts/content.html	2013-08-07 12:06:55 +0000
@@ -58,6 +58,13 @@ 
     </script>
     <!-- !ajax indicator -->
 
+
+    <!-- instance name indicator -->
+    {% if lava.instance_name %}
+    <div class="lava-indicator lava-panel-element" id="lava-instance-name-indicator">Instance: {{ lava.instance_name }}</div>
+    {% endif %}
+    <!-- !instance name indicator -->
+
     <!-- user indicator -->
     <div class="lava-indicator lava-panel-element {% if user.is_authenticated %}has-menu{% endif %}" id="lava-user-indicator">
       <div class="lava-panel-menu-text">