mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* add FGAC actions for silences table * redirect users without permissions * add permissions checks to routes * add fgac to notifications and contact points * fgac for notification policies * fix mute timing authorization * use consistent naming for checking grafana alertmanager * tests for fgac in contact points and notification policies * bump up timeout on rule editor test * use new permissions util * break out route evaluation into util * Remove test timeout * Change permissions for the alert-notifiers endpoint * Use signed in handler for alert-notifiers when unified alerting enabled Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
73 lines
1.7 KiB
TypeScript
73 lines
1.7 KiB
TypeScript
import React, { ButtonHTMLAttributes, FC } from 'react';
|
|
import { css } from '@emotion/css';
|
|
import { GrafanaTheme } from '@grafana/data';
|
|
import { Button, ButtonVariant, IconName, LinkButton, useStyles } from '@grafana/ui';
|
|
import { EmptyArea } from './EmptyArea';
|
|
|
|
export interface EmptyAreaWithCTAProps {
|
|
buttonLabel: string;
|
|
href?: string;
|
|
onButtonClick?: ButtonHTMLAttributes<HTMLButtonElement>['onClick'];
|
|
text: string;
|
|
|
|
buttonIcon?: IconName;
|
|
buttonSize?: 'xs' | 'sm' | 'md' | 'lg';
|
|
buttonVariant?: ButtonVariant;
|
|
showButton?: boolean;
|
|
}
|
|
|
|
export const EmptyAreaWithCTA: FC<EmptyAreaWithCTAProps> = ({
|
|
buttonIcon,
|
|
buttonLabel,
|
|
buttonSize = 'lg',
|
|
buttonVariant = 'primary',
|
|
onButtonClick,
|
|
text,
|
|
href,
|
|
showButton = true,
|
|
}) => {
|
|
const styles = useStyles(getStyles);
|
|
|
|
const commonProps = {
|
|
className: styles.button,
|
|
icon: buttonIcon,
|
|
size: buttonSize,
|
|
variant: buttonVariant,
|
|
};
|
|
|
|
return (
|
|
<EmptyArea>
|
|
<>
|
|
<p className={styles.text}>{text}</p>
|
|
{showButton &&
|
|
(href ? (
|
|
<LinkButton href={href} type="button" {...commonProps}>
|
|
{buttonLabel}
|
|
</LinkButton>
|
|
) : (
|
|
<Button onClick={onButtonClick} type="button" {...commonProps}>
|
|
{buttonLabel}
|
|
</Button>
|
|
))}
|
|
</>
|
|
</EmptyArea>
|
|
);
|
|
};
|
|
|
|
const getStyles = (theme: GrafanaTheme) => {
|
|
return {
|
|
container: css`
|
|
background-color: ${theme.colors.bg2};
|
|
color: ${theme.colors.textSemiWeak};
|
|
padding: ${theme.spacing.xl};
|
|
text-align: center;
|
|
`,
|
|
text: css`
|
|
margin-bottom: ${theme.spacing.md};
|
|
`,
|
|
button: css`
|
|
margin: ${theme.spacing.md} 0 ${theme.spacing.sm};
|
|
`,
|
|
};
|
|
};
|