[fix] Support APP_ICON_WIDTH configuration parameter in SPA menu (#9666)
* Expose additional APP_ICON_WIDTH python config variable to ui via app bootstrap for use in Menu * Update base.py to inclue APP_ICON_WIDTH via bracket notation instead of .get and adjust Menu proptypes to be required. Co-authored-by: Natalie Ruhe <nruhe@nruhe.attlocal.net> Co-authored-by: Natalie Ruhe <natalie@preset.io>
This commit is contained in:
parent
a52cfcd234
commit
9d755bc1ad
|
|
@ -75,6 +75,7 @@ const defaultProps = {
|
||||||
path: '/superset/profile/admin/',
|
path: '/superset/profile/admin/',
|
||||||
icon: '/static/assets/images/superset-logo@2x.png',
|
icon: '/static/assets/images/superset-logo@2x.png',
|
||||||
alt: 'Superset',
|
alt: 'Superset',
|
||||||
|
width: '126',
|
||||||
},
|
},
|
||||||
navbar_right: {
|
navbar_right: {
|
||||||
bug_report_url: null,
|
bug_report_url: null,
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ const propTypes = {
|
||||||
path: PropTypes.string.isRequired,
|
path: PropTypes.string.isRequired,
|
||||||
icon: PropTypes.string.isRequired,
|
icon: PropTypes.string.isRequired,
|
||||||
alt: PropTypes.string.isRequired,
|
alt: PropTypes.string.isRequired,
|
||||||
|
width: PropTypes.string.isRequired,
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
navbar_right: PropTypes.shape({
|
navbar_right: PropTypes.shape({
|
||||||
bug_report_url: PropTypes.string,
|
bug_report_url: PropTypes.string,
|
||||||
|
|
@ -59,7 +60,7 @@ export default function Menu({
|
||||||
<Navbar.Header>
|
<Navbar.Header>
|
||||||
<Navbar.Brand>
|
<Navbar.Brand>
|
||||||
<a className="navbar-brand" href={brand.path}>
|
<a className="navbar-brand" href={brand.path}>
|
||||||
<img width="126" src={brand.icon} alt={brand.alt} />
|
<img width={brand.width} src={brand.icon} alt={brand.alt} />
|
||||||
</a>
|
</a>
|
||||||
</Navbar.Brand>
|
</Navbar.Brand>
|
||||||
<Navbar.Toggle />
|
<Navbar.Toggle />
|
||||||
|
|
|
||||||
|
|
@ -241,6 +241,7 @@ def menu_data():
|
||||||
"path": root_path,
|
"path": root_path,
|
||||||
"icon": appbuilder.app_icon,
|
"icon": appbuilder.app_icon,
|
||||||
"alt": appbuilder.app_name,
|
"alt": appbuilder.app_name,
|
||||||
|
"width": appbuilder.app.config["APP_ICON_WIDTH"],
|
||||||
},
|
},
|
||||||
"navbar_right": {
|
"navbar_right": {
|
||||||
"bug_report_url": appbuilder.app.config.get("BUG_REPORT_URL"),
|
"bug_report_url": appbuilder.app.config.get("BUG_REPORT_URL"),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue