mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Whitelabeling: Add a config option to hide the Grafana edition from the footer (#73412)
This commit is contained in:
parent
1976ac0695
commit
3bb23d6be7
@ -111,6 +111,7 @@ type FrontendSettingsWhitelabelingDTO struct {
|
|||||||
LoginSubtitle *string `json:"loginSubtitle,omitempty"`
|
LoginSubtitle *string `json:"loginSubtitle,omitempty"`
|
||||||
LoginBoxBackground *string `json:"loginBoxBackground,omitempty"`
|
LoginBoxBackground *string `json:"loginBoxBackground,omitempty"`
|
||||||
LoadingLogo *string `json:"loadingLogo,omitempty"`
|
LoadingLogo *string `json:"loadingLogo,omitempty"`
|
||||||
|
HideEdition *bool `json:"hideEdition,omitempty"`
|
||||||
PublicDashboardFooter *FrontendSettingsPublicDashboardFooterConfigDTO `json:"publicDashboardFooter,omitempty"` // PR TODO: type this properly
|
PublicDashboardFooter *FrontendSettingsPublicDashboardFooterConfigDTO `json:"publicDashboardFooter,omitempty"` // PR TODO: type this properly
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ export class Branding {
|
|||||||
static LoginBoxBackground = LoginBoxBackground;
|
static LoginBoxBackground = LoginBoxBackground;
|
||||||
static AppTitle = 'Grafana';
|
static AppTitle = 'Grafana';
|
||||||
static LoginTitle = 'Welcome to Grafana';
|
static LoginTitle = 'Welcome to Grafana';
|
||||||
|
static HideEdition = false;
|
||||||
static GetLoginSubTitle = (): null | string => {
|
static GetLoginSubTitle = (): null | string => {
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
@ -12,5 +12,6 @@ export interface BrandingSettings {
|
|||||||
menuLogo?: string;
|
menuLogo?: string;
|
||||||
favIcon?: string;
|
favIcon?: string;
|
||||||
loadingLogo?: string;
|
loadingLogo?: string;
|
||||||
|
hideEdition?: boolean;
|
||||||
appleTouchIcon?: string;
|
appleTouchIcon?: string;
|
||||||
}
|
}
|
||||||
|
@ -48,17 +48,19 @@ export function getVersionMeta(version: string) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getVersionLinks(): FooterLink[] {
|
export function getVersionLinks(hideEdition?: boolean): 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})` : '';
|
||||||
|
|
||||||
links.push({
|
if (!hideEdition) {
|
||||||
target: '_blank',
|
links.push({
|
||||||
id: 'license',
|
target: '_blank',
|
||||||
text: `${buildInfo.edition}${stateInfo}`,
|
id: 'license',
|
||||||
url: licenseInfo.licenseUrl,
|
text: `${buildInfo.edition}${stateInfo}`,
|
||||||
});
|
url: licenseInfo.licenseUrl,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (buildInfo.hideVersion) {
|
if (buildInfo.hideVersion) {
|
||||||
return links;
|
return links;
|
||||||
@ -93,10 +95,11 @@ export function setFooterLinksFn(fn: typeof getFooterLinks) {
|
|||||||
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;
|
||||||
|
hideEdition?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Footer = React.memo(({ customLinks }: Props) => {
|
export const Footer = React.memo(({ customLinks, hideEdition }: Props) => {
|
||||||
const links = (customLinks || getFooterLinks()).concat(getVersionLinks());
|
const links = (customLinks || getFooterLinks()).concat(getVersionLinks(hideEdition));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<footer className="footer">
|
<footer className="footer">
|
||||||
|
@ -29,6 +29,7 @@ export const LoginLayout = ({ children, branding, isChangingPassword }: React.Pr
|
|||||||
const loginTitle = branding?.loginTitle ?? Branding.LoginTitle;
|
const loginTitle = branding?.loginTitle ?? Branding.LoginTitle;
|
||||||
const loginBoxBackground = branding?.loginBoxBackground || Branding.LoginBoxBackground();
|
const loginBoxBackground = branding?.loginBoxBackground || Branding.LoginBoxBackground();
|
||||||
const loginLogo = branding?.loginLogo;
|
const loginLogo = branding?.loginLogo;
|
||||||
|
const hideEdition = branding?.hideEdition ?? Branding.HideEdition;
|
||||||
|
|
||||||
useEffect(() => setStartAnim(true), []);
|
useEffect(() => setStartAnim(true), []);
|
||||||
|
|
||||||
@ -54,7 +55,7 @@ export const LoginLayout = ({ children, branding, isChangingPassword }: React.Pr
|
|||||||
<div className={loginStyles.loginOuterBox}>{children}</div>
|
<div className={loginStyles.loginOuterBox}>{children}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{branding?.hideFooter ? <></> : <Footer customLinks={branding?.footerLinks} />}
|
{branding?.hideFooter ? <></> : <Footer hideEdition={hideEdition} customLinks={branding?.footerLinks} />}
|
||||||
</Branding.LoginBackground>
|
</Branding.LoginBackground>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user