Skip to content

Commit

Permalink
feat: allow user to view their profile again
Browse files Browse the repository at this point in the history
  • Loading branch information
erik_ritter committed Nov 27, 2020
1 parent 13c51d5 commit 5c9a6af
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
12 changes: 10 additions & 2 deletions superset-frontend/src/components/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ interface NavBarProps {
user_info_url: string;
user_login_url: string;
user_logout_url: string;
user_profile_url: string | null;
locale: string;
}

Expand Down Expand Up @@ -195,8 +196,15 @@ export function Menu({
{!navbarRight.user_is_anonymous && [
<DropdownMenu.Divider key="user-divider" />,
<DropdownMenu.ItemGroup key="user-section" title={t('User')}>
<DropdownMenu.Item key="profile">
<a href={navbarRight.user_info_url}>{t('Profile')}</a>
{navbarRight.user_profile_url && (
<DropdownMenu.Item key="profile">
<a href={navbarRight.user_profile_url}>
{t('Profile')}
</a>
</DropdownMenu.Item>
)}
<DropdownMenu.Item key="info">
<a href={navbarRight.user_info_url}>{t('Info')}</a>
</DropdownMenu.Item>
<DropdownMenu.Item key="logout">
<a href={navbarRight.user_logout_url}>{t('Logout')}</a>
Expand Down
3 changes: 2 additions & 1 deletion superset/templates/appbuilder/navbar_right.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
<i class="fa fa-user"></i>&nbsp;<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="{{appbuilder.get_url_for_userinfo}}"><span class="fa fa-fw fa-user"></span>{{_("Profile")}}</a></li>
<li><a href="/superset/profile/{{g.user.username}}"><span class="fa fa-fw fa-user"></span>{{_("Profile")}}</a></li>
<li><a href="{{appbuilder.get_url_for_userinfo}}"><span class="fa fa-fw fa-user"></span>{{_("Info")}}</a></li>
<li><a href="{{appbuilder.get_url_for_logout}}"><span class="fa fa-fw fa-sign-out"></span>{{_("Logout")}}</a></li>
{% if version_string or version_sha %}
<li class="fineprint">
Expand Down
3 changes: 3 additions & 0 deletions superset/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ def menu_data() -> Dict[str, Any]:
"user_info_url": appbuilder.get_url_for_userinfo,
"user_logout_url": appbuilder.get_url_for_logout,
"user_login_url": appbuilder.get_url_for_login,
"user_profile_url": None
if g.user.is_anonymous
else f"/superset/profile/{g.user.username}",
"locale": session.get("locale", "en"),
},
}
Expand Down

0 comments on commit 5c9a6af

Please sign in to comment.