mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -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"`
|
||||
LoginBoxBackground *string `json:"loginBoxBackground,omitempty"`
|
||||
LoadingLogo *string `json:"loadingLogo,omitempty"`
|
||||
HideEdition *bool `json:"hideEdition,omitempty"`
|
||||
PublicDashboardFooter *FrontendSettingsPublicDashboardFooterConfigDTO `json:"publicDashboardFooter,omitempty"` // PR TODO: type this properly
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ export class Branding {
|
||||
static LoginBoxBackground = LoginBoxBackground;
|
||||
static AppTitle = 'Grafana';
|
||||
static LoginTitle = 'Welcome to Grafana';
|
||||
static HideEdition = false;
|
||||
static GetLoginSubTitle = (): null | string => {
|
||||
return null;
|
||||
};
|
||||
|
@ -12,5 +12,6 @@ export interface BrandingSettings {
|
||||
menuLogo?: string;
|
||||
favIcon?: string;
|
||||
loadingLogo?: string;
|
||||
hideEdition?: boolean;
|
||||
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 links: FooterLink[] = [];
|
||||
const stateInfo = licenseInfo.stateInfo ? ` (${licenseInfo.stateInfo})` : '';
|
||||
|
||||
links.push({
|
||||
target: '_blank',
|
||||
id: 'license',
|
||||
text: `${buildInfo.edition}${stateInfo}`,
|
||||
url: licenseInfo.licenseUrl,
|
||||
});
|
||||
if (!hideEdition) {
|
||||
links.push({
|
||||
target: '_blank',
|
||||
id: 'license',
|
||||
text: `${buildInfo.edition}${stateInfo}`,
|
||||
url: licenseInfo.licenseUrl,
|
||||
});
|
||||
}
|
||||
|
||||
if (buildInfo.hideVersion) {
|
||||
return links;
|
||||
@ -93,10 +95,11 @@ export function setFooterLinksFn(fn: typeof getFooterLinks) {
|
||||
export interface Props {
|
||||
/** Link overrides to show specific links in the UI */
|
||||
customLinks?: FooterLink[] | null;
|
||||
hideEdition?: boolean;
|
||||
}
|
||||
|
||||
export const Footer = React.memo(({ customLinks }: Props) => {
|
||||
const links = (customLinks || getFooterLinks()).concat(getVersionLinks());
|
||||
export const Footer = React.memo(({ customLinks, hideEdition }: Props) => {
|
||||
const links = (customLinks || getFooterLinks()).concat(getVersionLinks(hideEdition));
|
||||
|
||||
return (
|
||||
<footer className="footer">
|
||||
|
@ -29,6 +29,7 @@ export const LoginLayout = ({ children, branding, isChangingPassword }: React.Pr
|
||||
const loginTitle = branding?.loginTitle ?? Branding.LoginTitle;
|
||||
const loginBoxBackground = branding?.loginBoxBackground || Branding.LoginBoxBackground();
|
||||
const loginLogo = branding?.loginLogo;
|
||||
const hideEdition = branding?.hideEdition ?? Branding.HideEdition;
|
||||
|
||||
useEffect(() => setStartAnim(true), []);
|
||||
|
||||
@ -54,7 +55,7 @@ export const LoginLayout = ({ children, branding, isChangingPassword }: React.Pr
|
||||
<div className={loginStyles.loginOuterBox}>{children}</div>
|
||||
</div>
|
||||
</div>
|
||||
{branding?.hideFooter ? <></> : <Footer customLinks={branding?.footerLinks} />}
|
||||
{branding?.hideFooter ? <></> : <Footer hideEdition={hideEdition} customLinks={branding?.footerLinks} />}
|
||||
</Branding.LoginBackground>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user