import { DateTimeInput, GrafanaTheme } from '@grafana/data'; import { stylesFactory, useStyles } from '@grafana/ui'; import { OptionsPaneCategory } from 'app/features/dashboard/components/PanelEditor/OptionsPaneCategory'; import { PanelModel } from 'app/features/dashboard/state'; import { css } from 'emotion'; import React from 'react'; interface Props { panel: PanelModel & Required>; formatDate?: (dateString: DateTimeInput, format?: string) => string; } export const LibraryPanelInformation: React.FC = ({ panel, formatDate }) => { const styles = useStyles(getStyles); return ( {panel.libraryPanel.uid && (

{`Used on ${panel.libraryPanel.meta.connectedDashboards} `} {panel.libraryPanel.meta.connectedDashboards === 1 ? 'dashboard' : 'dashboards'}
Last edited on {formatDate?.(panel.libraryPanel.meta.updated, 'L') ?? panel.libraryPanel.meta.updated} by {panel.libraryPanel.meta.updatedBy.avatarUrl && ( {`Avatar )} {panel.libraryPanel.meta.updatedBy.name}

)}
); }; const getStyles = stylesFactory((theme: GrafanaTheme) => { return { libraryPanelInfo: css` color: ${theme.colors.textSemiWeak}; font-size: ${theme.typography.size.sm}; `, userAvatar: css` border-radius: 50%; box-sizing: content-box; width: 22px; height: 22px; padding-left: ${theme.spacing.sm}; padding-right: ${theme.spacing.sm}; `, }; });