[v9.4.x] Navigation: add a link to starred dashboards in the megamenu (#63106)

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

add a link to starred dashboards in the megamenu

(cherry picked from commit fc2f7f90f8)

Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2023-02-08 15:41:10 +00:00
committed by GitHub
co-authored by Ashley Harrison
parent 8a8180c44d
commit 45dd9f9a9f
4 changed files with 8 additions and 2 deletions
@@ -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',
+1 -1
View File
@@ -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;