mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Public Dashboards: Extracting config of Public Dashboard (#57788)
Co-authored-by: juanicabanas <juan.cabanas@grafana.com>
This commit is contained in:
@@ -4,20 +4,38 @@ import React from 'react';
|
|||||||
import { GrafanaTheme2, colorManipulator } from '@grafana/data';
|
import { GrafanaTheme2, colorManipulator } from '@grafana/data';
|
||||||
import { useStyles2 } from '@grafana/ui';
|
import { useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
|
export interface PublicDashboardFooter {
|
||||||
|
hide: boolean;
|
||||||
|
text: string;
|
||||||
|
logo: string;
|
||||||
|
link: string;
|
||||||
|
}
|
||||||
|
|
||||||
export const PubdashFooter = function () {
|
export const PubdashFooter = function () {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
|
const conf = getPubdashFooterConfig();
|
||||||
|
|
||||||
return (
|
return conf.hide ? null : (
|
||||||
<div className={styles.footer}>
|
<div className={styles.footer}>
|
||||||
<span className={styles.logoText}>
|
<span className={styles.logoText}>
|
||||||
<a href="https://grafana.com/" target="_blank" rel="noreferrer noopener">
|
<a href={conf.link} target="_blank" rel="noreferrer noopener">
|
||||||
powered by Grafana <img className={styles.logoImg} alt="" src="public/img/grafana_icon.svg"></img>
|
{conf.text} <img className={styles.logoImg} alt="" src={conf.logo}></img>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</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) => ({
|
const getStyles = (theme: GrafanaTheme2) => ({
|
||||||
footer: css`
|
footer: css`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
Reference in New Issue
Block a user