Navigation: add a link to starred dashboards in the megamenu (#62685)

add a link to starred dashboards in the megamenu
pull/63112/head
Ashley Harrison 2 years ago committed by GitHub
parent 225c8dbba7
commit fc2f7f90f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      pkg/services/navtree/navtreeimpl/navtree.go
  2. 2
      public/app/core/components/MegaMenu/NavBarMenuItemWrapper.tsx
  3. 5
      public/app/core/components/NavBar/utils.test.ts
  4. 2
      public/app/core/components/NavBar/utils.ts

@ -92,6 +92,7 @@ func (s *ServiceImpl) GetNavTree(c *contextmodel.ReqContext, hasEditPerm bool, p
Section: navtree.NavSectionCore,
Children: starredItemsLinks,
EmptyMessageId: "starred-empty",
Url: s.cfg.AppSubURL + "/dashboards?starred",
})
}

@ -22,7 +22,7 @@ export function NavBarMenuItemWrapper({
if (link.emptyMessage && !linkHasChildren(link)) {
return (
<NavBarMenuSection link={link}>
<NavBarMenuSection onClose={onClose} link={link} activeItem={activeItem}>
<ul className={styles.children}>
<div className={styles.emptyMessage}>{link.emptyMessage}</div>
</ul>

@ -163,6 +163,11 @@ describe('getActiveItem', () => {
text: 'Base',
url: '/',
},
{
text: 'Starred',
url: '/dashboards?starred',
id: 'starred',
},
{
text: 'Dashboards',
url: '/dashboards',

@ -129,7 +129,7 @@ export const getActiveItem = (
for (const link of navTree) {
const linkWithoutParams = stripQueryParams(link.url);
const linkPathname = locationUtil.stripBaseFromUrl(linkWithoutParams);
if (linkPathname) {
if (linkPathname && link.id !== 'starred') {
if (linkPathname === pathname) {
// exact match
currentBestMatch = link;

Loading…
Cancel
Save