dpgaspar commented on a change in pull request #8289: react menu
URL:
https://github.com/apache/incubator-superset/pull/8289#discussion_r332091887
##########
File path: superset/views/base.py
##########
@@ -170,16 +170,61 @@ def json_response(self, obj, status=200):
mimetype="application/json",
)
+ def menu_data(self):
+ menu = appbuilder.menu.get_data()
+ root_path = "#"
+ if not g.user.is_anonymous:
+ try:
+ logo_target_path = appbuilder.app.config.get(
+ "LOGO_TARGET_PATH"
+ ) or "/profile/{}/".format(g.user.username)
+ if logo_target_path.startswith("/"):
+ root_path = "/superset{}".format(logo_target_path)
+ else:
+ root_path = logo_target_path
+ except NameError as e:
+ logging.exception(e)
+
+ languages = {}
+ for lang in appbuilder.languages:
+ languages[lang] = {
+ **appbuilder.languages[lang],
+ "url": appbuilder.get_url_for_locale(lang),
+ }
+ return {
+ "menu": menu,
+ "brand": {
+ "path": root_path,
+ "icon": appbuilder.app_icon,
+ "alt": appbuilder.app_name,
+ },
+ "navbar_right": {
+ "bug_report_url": appbuilder.app.config.get("BUG_REPORT_URL"),
+ "documentation_url":
appbuilder.app.config.get("DOCUMENTATION_URL"),
+ "languages": languages,
+ "show_language_picker": appbuilder.app.config.get(
+ "SHOW_TRANSLATION_PICKER", True
+ ),
+ "user_is_anonymous": g.user.is_anonymous,
+ "user_info_url": appbuilder.get_url_for_userinfo,
Review comment:
Agree it's weird, I'm planning to change these appbuilder properties on FAB
3, since this would force a breaking change.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]