diff --git a/public/app/core/components/sidemenu/BottomSection.test.tsx b/public/app/core/components/sidemenu/BottomSection.test.tsx
index e0dca14ef2c..891c59b4937 100644
--- a/public/app/core/components/sidemenu/BottomSection.test.tsx
+++ b/public/app/core/components/sidemenu/BottomSection.test.tsx
@@ -1,11 +1,15 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
+import { BrowserRouter } from 'react-router-dom';
import { ShowModalReactEvent } from '../../../types/events';
import { HelpModal } from '../help/HelpModal';
import appEvents from '../../app_events';
import BottomSection from './BottomSection';
+jest.mock('./utils', () => ({
+ getForcedLoginUrl: () => '/mockForcedLoginUrl',
+}));
jest.mock('../../app_events', () => ({
publish: jest.fn(),
}));
@@ -44,13 +48,21 @@ jest.mock('app/core/services/context_srv', () => ({
describe('BottomSection', () => {
it('should render the correct children', () => {
- render();
+ render(
+
+
+
+ );
expect(screen.getByTestId('bottom-section-items').children.length).toBe(3);
});
it('creates the correct children for the help link', () => {
- render();
+ render(
+
+
+
+ );
const documentation = screen.getByRole('link', { name: 'Documentation' });
const support = screen.getByRole('link', { name: 'Support' });
@@ -63,7 +75,11 @@ describe('BottomSection', () => {
});
it('clicking the keyboard shortcuts button shows the modal', () => {
- render();
+ render(
+
+
+
+ );
const keyboardShortcuts = screen.getByText('Keyboard shortcuts');
expect(keyboardShortcuts).toBeInTheDocument();
@@ -73,7 +89,11 @@ describe('BottomSection', () => {
});
it('shows the current organization and organization switcher if showOrgSwitcher is true', () => {
- render();
+ render(
+
+
+
+ );
const currentOrg = screen.getByText(new RegExp('Grafana', 'i'));
const orgSwitcher = screen.getByText('Switch organization');
diff --git a/public/app/core/components/sidemenu/BottomSection.tsx b/public/app/core/components/sidemenu/BottomSection.tsx
index 5677d5d670b..d094df99b4b 100644
--- a/public/app/core/components/sidemenu/BottomSection.tsx
+++ b/public/app/core/components/sidemenu/BottomSection.tsx
@@ -3,7 +3,7 @@ import { cloneDeep } from 'lodash';
import { NavModelItem } from '@grafana/data';
import { Icon, IconName } from '@grafana/ui';
import appEvents from '../../app_events';
-import { SignIn } from './SignIn';
+import { useLocation } from 'react-router-dom';
import SideMenuItem from './SideMenuItem';
import { ShowModalReactEvent } from '../../../types/events';
import { contextSrv } from 'app/core/services/context_srv';
@@ -11,11 +11,14 @@ import { OrgSwitcher } from '../OrgSwitcher';
import { getFooterLinks } from '../Footer/Footer';
import { HelpModal } from '../help/HelpModal';
import config from '../../config';
+import { getForcedLoginUrl } from './utils';
export default function BottomSection() {
const navTree: NavModelItem[] = cloneDeep(config.bootData.navTree);
const bottomNav = navTree.filter((item) => item.hideFromMenu);
const isSignedIn = contextSrv.isSignedIn;
+ const location = useLocation();
+ const forcedLoginUrl = getForcedLoginUrl(location.pathname + location.search);
const user = contextSrv.user;
const [showSwitcherModal, setShowSwitcherModal] = useState(false);
@@ -37,7 +40,11 @@ export default function BottomSection() {
return (
- {!isSignedIn &&
}
+ {!isSignedIn && (
+
+
+
+ )}
{bottomNav.map((link, index) => {
let menuItems = link.children || [];
diff --git a/public/app/core/components/sidemenu/SideMenuDropDown.tsx b/public/app/core/components/sidemenu/SideMenuDropDown.tsx
index bec8ecac45f..a7371b58bc6 100644
--- a/public/app/core/components/sidemenu/SideMenuDropDown.tsx
+++ b/public/app/core/components/sidemenu/SideMenuDropDown.tsx
@@ -2,7 +2,7 @@ import React from 'react';
import DropDownChild from './DropDownChild';
import { NavModelItem } from '@grafana/data';
import { IconName, Link } from '@grafana/ui';
-import { css, cx } from '@emotion/css';
+import { css } from '@emotion/css';
interface Props {
headerText: string;
@@ -21,17 +21,13 @@ const SideMenuDropDown = ({
reverseDirection = false,
subtitleText,
}: Props) => {
- const resetButtonStyles = css`
- background-color: transparent;
- font-size: inherit;
- `;
const headerContent =
{headerText};
const header = headerUrl ? (
{headerContent}
) : (
-