Skip to content

Commit

Permalink
fix(nav): make doc and bug buttons customizable (#22682)
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed Jan 11, 2023
1 parent f3696ce commit 7b15e6e
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 144 deletions.
4 changes: 4 additions & 0 deletions superset-frontend/src/types/bootstrapTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,14 @@ export interface BrandProps {
export interface NavBarProps {
show_watermark: boolean;
bug_report_url?: string;
bug_report_text?: string;
bug_report_icon?: string;
version_string?: string;
version_sha?: string;
build_number?: string;
documentation_url?: string;
documentation_text?: string;
documentation_icon?: string;
languages: Languages;
show_language_picker: boolean;
user_is_anonymous: boolean;
Expand Down
47 changes: 30 additions & 17 deletions superset-frontend/src/views/components/RightMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -539,25 +539,38 @@ const RightMenu = ({
)}
</Menu>
{navbarRight.documentation_url && (
<StyledAnchor
href={navbarRight.documentation_url}
target="_blank"
rel="noreferrer"
title={t('Documentation')}
>
<i className="fa fa-question" />
&nbsp;
</StyledAnchor>
<>
<StyledAnchor
href={navbarRight.documentation_url}
target="_blank"
rel="noreferrer"
title={navbarRight.documentation_text || t('Documentation')}
>
{navbarRight.documentation_icon ? (
<i className={navbarRight.documentation_icon} />
) : (
<i className="fa fa-question" />
)}
</StyledAnchor>
<span>&nbsp;</span>
</>
)}
{navbarRight.bug_report_url && (
<StyledAnchor
href={navbarRight.bug_report_url}
target="_blank"
rel="noreferrer"
title={t('Report a bug')}
>
<i className="fa fa-bug" />
</StyledAnchor>
<>
<StyledAnchor
href={navbarRight.bug_report_url}
target="_blank"
rel="noreferrer"
title={navbarRight.bug_report_text || t('Report a bug')}
>
{navbarRight.bug_report_icon ? (
<i className={navbarRight.bug_report_icon} />
) : (
<i className="fa fa-bug" />
)}
</StyledAnchor>
<span>&nbsp;</span>
</>
)}
{navbarRight.user_is_anonymous && (
<StyledAnchor href={navbarRight.user_login_url}>
Expand Down
2 changes: 2 additions & 0 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,8 @@ def EMAIL_HEADER_MUTATOR( # pylint: disable=invalid-name,unused-argument

# Send user to a link where they can report bugs
BUG_REPORT_URL = None
BUG_REPORT_TEXT = "Report a bug"
BUG_REPORT_ICON = None # Recommended size: 16x16

# Send user to a link where they can read more about Superset
DOCUMENTATION_URL = None
Expand Down
127 changes: 0 additions & 127 deletions superset/templates/appbuilder/navbar_right.html

This file was deleted.

4 changes: 4 additions & 0 deletions superset/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,11 @@ def menu_data(user: User) -> Dict[str, Any]:
# show the watermark if the default app icon has been overriden
"show_watermark": ("superset-logo-horiz" not in appbuilder.app_icon),
"bug_report_url": appbuilder.app.config["BUG_REPORT_URL"],
"bug_report_icon": appbuilder.app.config["BUG_REPORT_ICON"],
"bug_report_text": appbuilder.app.config["BUG_REPORT_TEXT"],
"documentation_url": appbuilder.app.config["DOCUMENTATION_URL"],
"documentation_icon": appbuilder.app.config["DOCUMENTATION_ICON"],
"documentation_text": appbuilder.app.config["DOCUMENTATION_TEXT"],
"version_string": appbuilder.app.config["VERSION_STRING"],
"version_sha": appbuilder.app.config["VERSION_SHA"],
"build_number": build_number,
Expand Down

0 comments on commit 7b15e6e

Please sign in to comment.