mirror of https://github.com/apache/superset.git
chore: Add home link to navbar (#11851)
* Add Home link to Navbar * Change test text for rendering elements in the main navbar * Display Home link only when Logo Target Path is set
This commit is contained in:
parent
84e0606a90
commit
44e80e0175
|
@ -24,10 +24,17 @@ import NavDropdown from 'src/components/NavDropdown';
|
|||
import { supersetTheme, ThemeProvider } from '@superset-ui/core';
|
||||
|
||||
import { Menu } from 'src/components/Menu/Menu';
|
||||
import MenuObject from 'src/components/Menu/MenuObject';
|
||||
|
||||
const defaultProps = {
|
||||
data: {
|
||||
menu: [
|
||||
{
|
||||
name: 'Home',
|
||||
icon: '',
|
||||
label: 'Home',
|
||||
url: '/superset/welcome',
|
||||
},
|
||||
{
|
||||
name: 'Sources',
|
||||
icon: 'fa-table',
|
||||
|
@ -130,6 +137,10 @@ describe('Menu', () => {
|
|||
expect(wrapper.find(Nav)).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('renders 4 elements in main Menu Nav for every user', () => {
|
||||
expect(wrapper.find(MenuObject)).toHaveLength(4);
|
||||
});
|
||||
|
||||
it('renders a logged out view', () => {
|
||||
const loggedOutWrapper = getWrapper({
|
||||
data: {
|
||||
|
|
|
@ -163,7 +163,7 @@ export function Menu({
|
|||
</Navbar.Brand>
|
||||
<Navbar.Toggle />
|
||||
</Navbar.Header>
|
||||
<Nav>
|
||||
<Nav data-test="navbar-top">
|
||||
{menu.map((item, index) => (
|
||||
<MenuObject {...item} key={item.label} index={index + 1} />
|
||||
))}
|
||||
|
|
|
@ -214,6 +214,10 @@ class SupersetAppInitializer:
|
|||
#
|
||||
# Setup regular views
|
||||
#
|
||||
if appbuilder.app.config["LOGO_TARGET_PATH"]:
|
||||
appbuilder.add_link(
|
||||
"Home", label=__("Home"), href="/superset/welcome",
|
||||
)
|
||||
appbuilder.add_view(
|
||||
AnnotationLayerModelView,
|
||||
"Annotation Layers",
|
||||
|
|
Loading…
Reference in New Issue