Alerting: Center "need help" icons (#87981)

This commit is contained in:
Tom Ratcliffe 2024-05-21 12:04:10 +01:00 committed by GitHub
parent 059e412344
commit dbf258b837
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 12 additions and 22 deletions

View File

@ -37,7 +37,7 @@ export const MatcherFilter = ({ onFilterChange, defaultQueryString }: Props) =>
error={inputInvalid ? 'Query must use valid matcher syntax. See the examples in the help tooltip.' : null} error={inputInvalid ? 'Query must use valid matcher syntax. See the examples in the help tooltip.' : null}
label={ label={
<Label> <Label>
<Stack gap={0.5}> <Stack gap={0.5} alignItems="center">
<span>Search by label</span> <span>Search by label</span>
<Tooltip <Tooltip
content={ content={

View File

@ -90,7 +90,7 @@ const AnnotationsStep = () => {
function getAnnotationsSectionDescription() { function getAnnotationsSectionDescription() {
return ( return (
<Stack direction="row" gap={0.5} alignItems="baseline"> <Stack direction="row" gap={0.5} alignItems="center">
<Text variant="bodySmall" color="secondary"> <Text variant="bodySmall" color="secondary">
Add more context in your notification messages. Add more context in your notification messages.
</Text> </Text>

View File

@ -208,7 +208,7 @@ function getDescription() {
const docsLink = 'https://grafana.com/docs/grafana/latest/alerting/fundamentals/alert-rules/rule-evaluation/'; const docsLink = 'https://grafana.com/docs/grafana/latest/alerting/fundamentals/alert-rules/rule-evaluation/';
return ( return (
<Stack direction="row" gap={0.5} alignItems="baseline"> <Stack direction="row" gap={0.5} alignItems="center">
<Text variant="bodySmall" color="secondary"> <Text variant="bodySmall" color="secondary">
Define how the alert rule is evaluated. Define how the alert rule is evaluated.
</Text> </Text>

View File

@ -17,7 +17,7 @@ export function NeedHelpInfo({ contentText, externalLink, linkText, title = 'Nee
<Toggletip <Toggletip
content={<div className={styles.mutedText}>{contentText}</div>} content={<div className={styles.mutedText}>{contentText}</div>}
title={ title={
<Stack gap={1} direction="row"> <Stack gap={0.5} direction="row" alignItems="center">
<Icon name="question-circle" /> <Icon name="question-circle" />
{title} {title}
</Stack> </Stack>

View File

@ -54,7 +54,7 @@ export const NotificationsStep = ({ alertUid }: NotificationsStepProps) => {
stepNo={4} stepNo={4}
title={type === RuleFormType.cloudRecording ? 'Add labels' : 'Configure labels and notifications'} title={type === RuleFormType.cloudRecording ? 'Add labels' : 'Configure labels and notifications'}
description={ description={
<Stack direction="row" gap={0.5} alignItems="baseline"> <Stack direction="row" gap={0.5} alignItems="center">
{type === RuleFormType.cloudRecording ? ( {type === RuleFormType.cloudRecording ? (
<Text variant="bodySmall" color="secondary"> <Text variant="bodySmall" color="secondary">
Add labels to help you better manage your recording rules Add labels to help you better manage your recording rules
@ -122,7 +122,7 @@ function ManualAndAutomaticRouting({ alertUid }: { alertUid?: string }) {
}; };
return ( return (
<Stack direction="column"> <Stack direction="column" gap={2}>
<Stack direction="column"> <Stack direction="column">
<RadioButtonGroup <RadioButtonGroup
options={routingOptions} options={routingOptions}
@ -243,35 +243,25 @@ interface NotificationsStepDescriptionProps {
} }
export const RoutingOptionDescription = ({ manualRouting }: NotificationsStepDescriptionProps) => { export const RoutingOptionDescription = ({ manualRouting }: NotificationsStepDescriptionProps) => {
const styles = useStyles2(getStyles);
return ( return (
<div className={styles.notificationsOptionDescription}> <Stack alignItems="center">
<Text variant="bodySmall" color="secondary"> <Text variant="bodySmall" color="secondary">
{manualRouting {manualRouting
? 'Notifications for firing alerts are routed to a selected contact point.' ? 'Notifications for firing alerts are routed to a selected contact point.'
: 'Notifications for firing alerts are routed to contact points based on matching labels and the notification policy tree.'} : 'Notifications for firing alerts are routed to contact points based on matching labels and the notification policy tree.'}
</Text> </Text>
{manualRouting ? <NeedHelpInfoForContactpoint /> : <NeedHelpInfoForNotificationPolicy />} {manualRouting ? <NeedHelpInfoForContactpoint /> : <NeedHelpInfoForNotificationPolicy />}
</div> </Stack>
); );
}; };
const getStyles = (theme: GrafanaTheme2) => ({ const getStyles = (theme: GrafanaTheme2) => ({
routingOptions: css({ routingOptions: css({
marginTop: theme.spacing(2),
width: 'fit-content', width: 'fit-content',
}), }),
configureNotifications: css({ configureNotifications: css({
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
gap: theme.spacing(1),
marginTop: theme.spacing(2), marginTop: theme.spacing(2),
}), }),
notificationsOptionDescription: css({
marginTop: theme.spacing(1),
display: 'flex',
flexDirection: 'row',
alignItems: 'baseline',
gap: theme.spacing(0.5),
}),
}); });

View File

@ -98,7 +98,7 @@ export function SmartAlertTypeDetector({
<Stack direction="column" gap={1} alignItems="flex-start"> <Stack direction="column" gap={1} alignItems="flex-start">
<Stack direction="column" gap={0}> <Stack direction="column" gap={0}>
<Text variant="h5">Rule type</Text> <Text variant="h5">Rule type</Text>
<Stack direction="row" gap={0.5} alignItems="baseline"> <Stack direction="row" gap={0.5} alignItems="center">
<Text variant="bodySmall" color="secondary"> <Text variant="bodySmall" color="secondary">
Select where the alert rule will be managed. Select where the alert rule will be managed.
</Text> </Text>

View File

@ -148,7 +148,7 @@ const RulesFilter = ({ onFilterCleared = () => undefined }: RulesFilerProps) =>
className={styles.dsPickerContainer} className={styles.dsPickerContainer}
label={ label={
<Label htmlFor="data-source-picker"> <Label htmlFor="data-source-picker">
<Stack gap={0.5}> <Stack gap={0.5} alignItems="center">
<span>Search by data sources</span> <span>Search by data sources</span>
<Tooltip <Tooltip
content={ content={
@ -249,7 +249,7 @@ const RulesFilter = ({ onFilterCleared = () => undefined }: RulesFilerProps) =>
<Field <Field
label={ label={
<Label htmlFor="rulesSearchInput"> <Label htmlFor="rulesSearchInput">
<Stack gap={0.5}> <Stack gap={0.5} alignItems="center">
<span>Search</span> <span>Search</span>
<HoverCard content={<SearchQueryHelp />}> <HoverCard content={<SearchQueryHelp />}>
<Icon name="info-circle" size="sm" tabIndex={0} title="Search help" /> <Icon name="info-circle" size="sm" tabIndex={0} title="Search help" />

View File

@ -82,7 +82,7 @@ const StateHistory = ({ alertId }: Props) => {
<Field <Field
label={ label={
<Label> <Label>
<Stack gap={0.5}> <Stack gap={0.5} alignItems="center">
<span>Filter group</span> <span>Filter group</span>
<Tooltip <Tooltip
content={ content={