Browse Source

[frontend] Allow customization of app ordering in the nav bar

Added a MENU_INDEX property to the app settings py file for apps to specify
where they should appear in the top nav.
Ben Bishop 13 years ago
parent
commit
d281ef6965

+ 1 - 0
apps/about/src/about/settings.py

@@ -16,3 +16,4 @@
 DJANGO_APPS = [ "about" ]
 NICE_NAME = "About"
 REQUIRES_HADOOP = False
+MENU_INDEX = 80

+ 1 - 0
apps/beeswax/src/beeswax/settings.py

@@ -17,3 +17,4 @@ DJANGO_APPS = [ "beeswax" ]
 NICE_NAME = "Beeswax (Hive UI)"
 REQUIRES_HADOOP = True
 ICON = "/beeswax/static/art/beeswax-logo.png"
+MENU_INDEX = 10

+ 1 - 0
apps/filebrowser/src/filebrowser/settings.py

@@ -19,3 +19,4 @@ DJANGO_APPS = ['filebrowser']
 NICE_NAME = "File Browser"
 REQUIRES_HADOOP = False
 ICON = "/filebrowser/static/art/icon.png"
+MENU_INDEX = 20

+ 1 - 0
apps/help/src/help/settings.py

@@ -17,3 +17,4 @@ DJANGO_APPS = ['help']
 NICE_NAME = "Help"
 REQUIRES_HADOOP = False
 ICON = "/help/static/art/help.png"
+MENU_INDEX = 90

+ 1 - 0
apps/jobbrowser/src/jobbrowser/settings.py

@@ -22,3 +22,4 @@ DJANGO_APPS = ['jobbrowser']
 NICE_NAME = "Job Browser"
 REQUIRES_HADOOP = True
 ICON = "/jobbrowser/static/art/icon_large.png"
+MENU_INDEX = 30

+ 1 - 0
apps/jobsub/src/jobsub/settings.py

@@ -22,3 +22,4 @@ MIDDLEWARE_CLASSES=[
 ]
 
 ICON = "/jobsub/static/art/icon.png"
+MENU_INDEX = 40

+ 1 - 0
apps/shell/src/shell/settings.py

@@ -24,3 +24,4 @@ PERMISSION_ACTIONS = (
 )
 
 ICON = "/shell/static/art/shell.png"
+MENU_INDEX = 50

+ 1 - 0
apps/useradmin/src/useradmin/settings.py

@@ -16,3 +16,4 @@
 DJANGO_APPS = [ "useradmin" ]
 NICE_NAME = "User Admin"
 REQUIRES_HADOOP = False
+MENU_INDEX = 60

+ 1 - 0
desktop/core/src/desktop/app_template/src/app_name/settings.py

@@ -15,3 +15,4 @@
 # limitations under the License.
 DJANGO_APPS = [ "${app_name}" ]
 REQUIRES_HADOOP = False
+MENU_INDEX = 100

+ 5 - 0
desktop/core/src/desktop/appmanager.py

@@ -119,6 +119,11 @@ class DesktopModuleInfo(object):
     else:
         self.icon_path = ""
 
+    if hasattr(self.settings, "MENU_INDEX"):
+        self.menu_index = self.settings.MENU_INDEX
+    else:
+        self.menu_index = 999
+
     if self.config_key is not None:
       self.display_name = self.config_key
 

+ 3 - 1
desktop/core/src/desktop/views.py

@@ -264,8 +264,10 @@ def commonheader(title, section, padding="60px"):
   """
   Returns the rendered common header
   """
+  apps_list = sorted(appmanager.DESKTOP_APPS[:], key=lambda app: app.menu_index)
+
   return render_to_string("common_header.html", dict(
-    apps=appmanager.DESKTOP_APPS,
+    apps=apps_list,
     title=title,
     section=section,
     padding=padding