diff --git a/public/app/core/components/AppChrome/TopBar/TopNavBarMenu.tsx b/public/app/core/components/AppChrome/TopBar/TopNavBarMenu.tsx index 476251a9207..b04e2a062a3 100644 --- a/public/app/core/components/AppChrome/TopBar/TopNavBarMenu.tsx +++ b/public/app/core/components/AppChrome/TopBar/TopNavBarMenu.tsx @@ -35,15 +35,8 @@ export function TopNavBarMenu({ node: nodePlain }: TopNavBarMenuProps) { } > {node.children?.map((item) => { - const showExternalLinkIcon = /^https?:\/\//.test(item.url || ''); return item.url ? ( - + ) : ( ); diff --git a/public/app/core/components/Footer/Footer.tsx b/public/app/core/components/Footer/Footer.tsx index c73c2ea53d1..0b9e873d351 100644 --- a/public/app/core/components/Footer/Footer.tsx +++ b/public/app/core/components/Footer/Footer.tsx @@ -48,7 +48,7 @@ export function getVersionMeta(version: string) { }; } -export let getVersionLinks = (): FooterLink[] => { +export function getVersionLinks(): FooterLink[] { const { buildInfo, licenseInfo } = config; const links: FooterLink[] = []; const stateInfo = licenseInfo.stateInfo ? ` (${licenseInfo.stateInfo})` : ''; @@ -84,16 +84,12 @@ export let getVersionLinks = (): FooterLink[] => { } return links; -}; +} export function setFooterLinksFn(fn: typeof getFooterLinks) { getFooterLinks = fn; } -export function setVersionLinkFn(fn: typeof getFooterLinks) { - getVersionLinks = fn; -} - export interface Props { /** Link overrides to show specific links in the UI */ customLinks?: FooterLink[] | null; diff --git a/public/app/core/components/NavBar/utils.ts b/public/app/core/components/NavBar/utils.ts index ca7eb890ee5..92cc50e577e 100644 --- a/public/app/core/components/NavBar/utils.ts +++ b/public/app/core/components/NavBar/utils.ts @@ -54,6 +54,7 @@ export const enrichConfigItems = (items: NavModelItem[], location: Location) => { export function getNavModelItemKey(item: NavModelItem) { return item.id ?? item.text; } + +export function getEditionAndUpdateLinks(): NavModelItem[] { + const { buildInfo, licenseInfo } = config; + const stateInfo = licenseInfo.stateInfo ? ` (${licenseInfo.stateInfo})` : ''; + const links: NavModelItem[] = []; + + links.push({ + target: '_blank', + id: 'version', + text: `${buildInfo.edition}${stateInfo}`, + url: licenseInfo.licenseUrl, + icon: 'external-link-alt', + }); + + if (buildInfo.hasUpdate) { + links.push({ + target: '_blank', + id: 'updateVersion', + text: `New version available!`, + icon: 'download-alt', + url: 'https://grafana.com/grafana/download?utm_source=grafana_footer', + }); + } + + return links; +} diff --git a/public/app/core/components/PageNew/Page.tsx b/public/app/core/components/PageNew/Page.tsx index 0368161babe..6d9fe53dce3 100644 --- a/public/app/core/components/PageNew/Page.tsx +++ b/public/app/core/components/PageNew/Page.tsx @@ -6,7 +6,6 @@ import { GrafanaTheme2, PageLayoutType } from '@grafana/data'; import { CustomScrollbar, useStyles2 } from '@grafana/ui'; import { useGrafana } from 'app/core/context/GrafanaContext'; -import { Footer } from '../Footer/Footer'; import { PageType } from '../Page/types'; import { usePageNav } from '../Page/usePageNav'; import { usePageTitle } from '../Page/usePageTitle'; @@ -69,7 +68,6 @@ export const Page: PageType = ({ {pageNav && pageNav.children && }
{children}
-