mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Page: Remove footer from new page layout (#63455)
* Page: Option to hide footer, enabled by default for PluginPage * Remove footer from new page layout
This commit is contained in:
parent
89b3663a23
commit
f64b7fe8a7
@ -35,15 +35,8 @@ export function TopNavBarMenu({ node: nodePlain }: TopNavBarMenuProps) {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
{node.children?.map((item) => {
|
{node.children?.map((item) => {
|
||||||
const showExternalLinkIcon = /^https?:\/\//.test(item.url || '');
|
|
||||||
return item.url ? (
|
return item.url ? (
|
||||||
<MenuItem
|
<MenuItem url={item.url} label={item.text} icon={item.icon} target={item.target} key={item.id} />
|
||||||
url={item.url}
|
|
||||||
label={item.text}
|
|
||||||
icon={showExternalLinkIcon ? 'external-link-alt' : undefined}
|
|
||||||
target={item.target}
|
|
||||||
key={item.id}
|
|
||||||
/>
|
|
||||||
) : (
|
) : (
|
||||||
<MenuItem icon={item.icon} onClick={item.onClick} label={item.text} key={item.id} />
|
<MenuItem icon={item.icon} onClick={item.onClick} label={item.text} key={item.id} />
|
||||||
);
|
);
|
||||||
|
@ -48,7 +48,7 @@ export function getVersionMeta(version: string) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export let getVersionLinks = (): FooterLink[] => {
|
export function getVersionLinks(): FooterLink[] {
|
||||||
const { buildInfo, licenseInfo } = config;
|
const { buildInfo, licenseInfo } = config;
|
||||||
const links: FooterLink[] = [];
|
const links: FooterLink[] = [];
|
||||||
const stateInfo = licenseInfo.stateInfo ? ` (${licenseInfo.stateInfo})` : '';
|
const stateInfo = licenseInfo.stateInfo ? ` (${licenseInfo.stateInfo})` : '';
|
||||||
@ -84,16 +84,12 @@ export let getVersionLinks = (): FooterLink[] => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return links;
|
return links;
|
||||||
};
|
}
|
||||||
|
|
||||||
export function setFooterLinksFn(fn: typeof getFooterLinks) {
|
export function setFooterLinksFn(fn: typeof getFooterLinks) {
|
||||||
getFooterLinks = fn;
|
getFooterLinks = fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setVersionLinkFn(fn: typeof getFooterLinks) {
|
|
||||||
getVersionLinks = fn;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
/** Link overrides to show specific links in the UI */
|
/** Link overrides to show specific links in the UI */
|
||||||
customLinks?: FooterLink[] | null;
|
customLinks?: FooterLink[] | null;
|
||||||
|
@ -54,6 +54,7 @@ export const enrichConfigItems = (items: NavModelItem[], location: Location<unkn
|
|||||||
link.children = [
|
link.children = [
|
||||||
...menuItems,
|
...menuItems,
|
||||||
...getFooterLinks(),
|
...getFooterLinks(),
|
||||||
|
...getEditionAndUpdateLinks(),
|
||||||
{
|
{
|
||||||
id: 'keyboard-shortcuts',
|
id: 'keyboard-shortcuts',
|
||||||
text: t('nav.help/keyboard-shortcuts', 'Keyboard shortcuts'),
|
text: t('nav.help/keyboard-shortcuts', 'Keyboard shortcuts'),
|
||||||
@ -170,3 +171,29 @@ export const isSearchActive = (location: Location<unknown>) => {
|
|||||||
export function getNavModelItemKey(item: NavModelItem) {
|
export function getNavModelItemKey(item: NavModelItem) {
|
||||||
return item.id ?? item.text;
|
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;
|
||||||
|
}
|
||||||
|
@ -6,7 +6,6 @@ import { GrafanaTheme2, PageLayoutType } from '@grafana/data';
|
|||||||
import { CustomScrollbar, useStyles2 } from '@grafana/ui';
|
import { CustomScrollbar, useStyles2 } from '@grafana/ui';
|
||||||
import { useGrafana } from 'app/core/context/GrafanaContext';
|
import { useGrafana } from 'app/core/context/GrafanaContext';
|
||||||
|
|
||||||
import { Footer } from '../Footer/Footer';
|
|
||||||
import { PageType } from '../Page/types';
|
import { PageType } from '../Page/types';
|
||||||
import { usePageNav } from '../Page/usePageNav';
|
import { usePageNav } from '../Page/usePageNav';
|
||||||
import { usePageTitle } from '../Page/usePageTitle';
|
import { usePageTitle } from '../Page/usePageTitle';
|
||||||
@ -69,7 +68,6 @@ export const Page: PageType = ({
|
|||||||
{pageNav && pageNav.children && <PageTabs navItem={pageNav} />}
|
{pageNav && pageNav.children && <PageTabs navItem={pageNav} />}
|
||||||
<div className={styles.pageContent}>{children}</div>
|
<div className={styles.pageContent}>{children}</div>
|
||||||
</div>
|
</div>
|
||||||
<Footer />
|
|
||||||
</CustomScrollbar>
|
</CustomScrollbar>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user