mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Navigation: add a link to starred dashboards in the megamenu (#62685)
add a link to starred dashboards in the megamenu
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user