Public Dashboards: Extracting config of Public Dashboard (#57788)

Co-authored-by: juanicabanas <juan.cabanas@grafana.com>
This commit is contained in:
lean.dev
2022-11-02 14:32:29 -03:00
committed by GitHub
parent 7954ac3948
commit d5a92e8f42

View File

@@ -4,20 +4,38 @@ import React from 'react';
import { GrafanaTheme2, colorManipulator } from '@grafana/data';
import { useStyles2 } from '@grafana/ui';
export interface PublicDashboardFooter {
hide: boolean;
text: string;
logo: string;
link: string;
}
export const PubdashFooter = function () {
const styles = useStyles2(getStyles);
const conf = getPubdashFooterConfig();
return (
return conf.hide ? null : (
<div className={styles.footer}>
<span className={styles.logoText}>
<a href="https://grafana.com/" target="_blank" rel="noreferrer noopener">
powered by Grafana <img className={styles.logoImg} alt="" src="public/img/grafana_icon.svg"></img>
<a href={conf.link} target="_blank" rel="noreferrer noopener">
{conf.text} <img className={styles.logoImg} alt="" src={conf.logo}></img>
</a>
</span>
</div>
);
};
export function setPubdashFooterConfigFn(fn: typeof getPubdashFooterConfig) {
getPubdashFooterConfig = fn;
}
export let getPubdashFooterConfig = (): PublicDashboardFooter => ({
hide: false,
text: 'powered by Grafana',
logo: 'public/img/grafana_icon.svg',
link: 'https://grafana.com/',
});
const getStyles = (theme: GrafanaTheme2) => ({
footer: css`
position: absolute;