import { css } from '@emotion/css'; import React, { FC } from 'react'; import { GrafanaTheme } from '@grafana/data'; import { Alert, useStyles } from '@grafana/ui'; interface WarningProps { title: string; subTitle: JSX.Element; severity: 'info' | 'error'; onButtonClick?: () => void; buttonText?: string; } const Warning: FC = ({ title, subTitle, severity, onButtonClick, buttonText }) => { const styles = useStyles(getStyles); return (
{subTitle}
); }; interface LicensingLinkProps { isLicensingReader: boolean; } export const LicensingLink: FC = ({ isLicensingReader, children }) => { if (isLicensingReader) { return {children}; } return ( {children} ); }; interface HasExpiredProps { isLicensingReader: boolean; } export const HasExpired: FC = ({ isLicensingReader }) => { return ( Some features have been disabled. } severity="error" /> ); }; interface IsInvalidProps { isLicensingReader: boolean; } export const IsInvalid: FC = ({ isLicensingReader }) => { return ( Some features have been disabled. } severity="error" /> ); }; interface ExpiresSoonProps { days: number; onCloseWarning?(): void; isLicensingReader: boolean; } export const ExpiresSoon: FC = ({ days, onCloseWarning, isLicensingReader }) => { return ( {days} days remaining, after which{' '} Enterprise features will be disabled. } severity="info" buttonText="Dismiss" /> ); }; interface TokenExpiresSoonProps { days: number; onCloseWarning?(): void; isLicensingReader: boolean; } export const TokenExpiresSoon: FC = ({ days, onCloseWarning, isLicensingReader }) => { return ( Your license token has {days} days remaining, after which{' '} Enterprise features will be disabled. } severity="info" buttonText="Dismiss" /> ); }; interface MaxUsersReachedProps { activeUsers: number; maxUsers: number; onRefreshWarning?: () => void; slug?: string; } export const MaxUsersReached: FC = ({ activeUsers, maxUsers, slug, onRefreshWarning }) => { return ( Your Grafana Enterprise license includes {maxUsers} active users; you currently have {activeUsers} active users. Please{' '} {slug ? ( upgrade your license. ) : ( 'upgrade your license.' )} } severity="error" buttonText="Refresh" /> ); }; export const getStyles = (theme: GrafanaTheme) => { return { container: css` position: absolute; bottom: 0; width: 100%; display: flex; flex-direction: column; justify-content: center; z-index: 3; `, }; };