def process_request(self, request): global coreui_inited, urlpatterns if not coreui_inited: try: AppLoader.registerAllApps() coreui_inited = True except Exception, e: print "**** panic! AppLoader.registerAllApps() threw this Exception:" print e for index, app in enumerate(AppLoader.apps): # Redirect / to the first app in the list if (index == 0): urlpatterns += patterns( '', (r'^$', 'django.views.generic.simple.redirect_to', { 'url': '/' + app.name }), ) urlpatterns += patterns( '', (r'^' + app.name + '/?$', 'sdncon.coreui.views.show_application_tabs', { 'app': app.name })) urlpatterns += patterns( '', (r'^' + app.name + '/', include(app.name + '.urls')), ) for t in app.tabs: urlpatterns += patterns( app.name + '.views', (r'^' + app.name + '/' + t["id"] + '/?$', t["view"]))
def bsc_app_init(): if not docs_enabled: return APP_NAME = os.path.dirname(__file__).split("/")[-1] app = AppLister(APP_NAME, "Documentation", 9, "User Guide") app.addTab("docs", "User Guide", user_guide) AppLoader.addApp(app)
def process_request(self, request): global coreui_inited, urlpatterns if not coreui_inited: try: AppLoader.registerAllApps() coreui_inited = True except Exception, e: print "**** panic! AppLoader.registerAllApps() threw this Exception:" print e for index, app in enumerate(AppLoader.apps): # Redirect / to the first app in the list if (index == 0): urlpatterns += patterns( '', (r'^$', 'django.views.generic.simple.redirect_to', {'url': '/'+app.name}),) urlpatterns += patterns( '', (r'^'+app.name+'/?$', 'sdncon.coreui.views.show_application_tabs', {'app':app.name}) ) urlpatterns += patterns( '', (r'^'+app.name+'/', include(app.name+'.urls')), ) for t in app.tabs: urlpatterns += patterns(app.name+'.views', (r'^'+app.name+'/'+t["id"]+'/?$', t["view"]) )
def bsc_app_init(): # By default, App Name is the same as directory name. Change if needed. APP_NAME = os.path.dirname(__file__).split("/")[-1] # Create the App. Parameters are # - Name: the id, lowercase letters only # - Label: Human readable discription for the menu to the left # - Priority: determines ranking the menu to the left), One-line description # - Description: One line description of the app app = AppLister(APP_NAME, "Controller Stats", 5, "Controller Stats") # Add Tabs. Parameters are: # - Name: the id, lowercase letters only # - Label: Human readable discription for the menu to the left # - View: name of the python function that contains the django view (see below) app.addTab("openflow_graphs", "OpenFlow Graphs", flow_graphs_view) app.addTab("system_graphs", "System Graphs", system_stats_graph_view) AppLoader.addApp(app)
def show_application_tabs(request, app): clusterlist = [] cus = CustomerUser.objects.all() for cu in cus: if cu.user.username == request.user.username: for cluster in cu.customer.cluster_set.all(): clusterlist.append({ 'customer': cluster.customer.customername, 'clustername': cluster.clustername, 'clusterid': unicode(cluster) }) return render_to_response( 'coreui/templates/showapp.html', { 'apps': [x for x in AppLoader.getApps() if not hasattr(x, 'invisible')], 'currentapp': app, 'tabs': AppLoader.getApp(app).tabs, 'clusterlist': clusterlist, 'isCloudBuild': isCloudBuild() }, context_instance=RequestContext(request))
def show_application_tabs(request, app): clusterlist = [] cus = CustomerUser.objects.all() for cu in cus: if cu.user.username == request.user.username: for cluster in cu.customer.cluster_set.all(): clusterlist.append({'customer': cluster.customer.customername, 'clustername': cluster.clustername, 'clusterid': unicode(cluster)}) return render_to_response('coreui/templates/showapp.html', {'apps':[x for x in AppLoader.getApps() if not hasattr(x,'invisible')],'currentapp':app,'tabs':AppLoader.getApp(app).tabs,'clusterlist':clusterlist, 'isCloudBuild': isCloudBuild()}, context_instance=RequestContext(request))
def bsc_app_init(): # Check if logging is enabled, else do not start the app if not log_collection_enabled(): return # By default, App Name is the same as directory name. Change if needed. APP_NAME = os.path.dirname(__file__).split("/")[-1] # Create the App. Parameters are # - Name: the id, lowercase letters only # - Label: Human readable discription for the menu to the left # - Priority: determines ranking the menu to the left), One-line description # - Description: One line description of the app app = AppLister(APP_NAME, "Logs", 5, "Controller Logs") # Add Tabs. Parameters are: # - Name: the id, lowercase letters only # - Label: Human readable discription for the menu to the left # - View: name of the python function that contains the django view (see below) app.addTab("controllerlogs", "Controller Logs", controller) app.addTab("dblogs", "Database Logs", db) app.addTab("sdnconlogs", "SDNCon Logs", sdncon) app.addTab("alllogs", "All Logs", all) AppLoader.addApp(app)