You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/10/23 07:31:03 UTC

[GitHub] [airflow] turbaszek commented on a change in pull request #11742: Fix: add support for no-menu plugin views (#10788)

turbaszek commented on a change in pull request #11742:
URL: https://github.com/apache/airflow/pull/11742#discussion_r510689113



##########
File path: airflow/www/extensions/init_views.py
##########
@@ -73,8 +73,14 @@ def init_plugins(app):
     appbuilder = app.appbuilder
 
     for view in plugins_manager.flask_appbuilder_views:
-        log.debug("Adding view %s", view["name"])
-        appbuilder.add_view(view["view"], view["name"], category=view["category"])
+        try:
+            log.debug("Adding view %s with menu", view["name"])
+            appbuilder.add_view(view["view"], view["name"], category=view["category"])
+        except KeyError as e:
+            if e.args[0] == 'name':

Review comment:
       How about:
   ```py
   name = view.get("name")
   if name:
       log.debug("Adding view %s with menu", name)
       appbuilder.add_view(view["view"], name, category=view["category"])
   else:
       # if 'name' key is missing, intent is to add view without menu
       log.debug("Adding view %s without menu", str(type(view["view"])))
       appbuilder.add_view_no_menu(view["view"])
   
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org