mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Style nits for the simple query mode (#93930)
* Style nits for the simple query mode * update translations * update text * update translations * update disable word to deactivate * update preview text when not advanced options * update text * update text
This commit is contained in:
parent
52f208d3ac
commit
cebcb38df2
@ -2089,8 +2089,7 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "2"],
|
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "2"],
|
||||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "3"],
|
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "3"],
|
||||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "4"],
|
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "4"],
|
||||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "5"],
|
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "5"]
|
||||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "6"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/SmartAlertTypeDetector.tsx:5381": [
|
"public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/SmartAlertTypeDetector.tsx:5381": [
|
||||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "0"],
|
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "0"],
|
||||||
|
@ -45,6 +45,7 @@ export const RuleEditorSection = ({
|
|||||||
label="Advanced options"
|
label="Advanced options"
|
||||||
showLabel
|
showLabel
|
||||||
transparent
|
transparent
|
||||||
|
className={styles.reverse}
|
||||||
/>
|
/>
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
@ -74,4 +75,8 @@ const getStyles = (theme: GrafanaTheme2) => ({
|
|||||||
fullWidth: css({
|
fullWidth: css({
|
||||||
width: '100%',
|
width: '100%',
|
||||||
}),
|
}),
|
||||||
|
reverse: css({
|
||||||
|
flexDirection: 'row-reverse',
|
||||||
|
gap: theme.spacing(1),
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
@ -20,6 +20,7 @@ import {
|
|||||||
useStyles2,
|
useStyles2,
|
||||||
} from '@grafana/ui';
|
} from '@grafana/ui';
|
||||||
import { Text } from '@grafana/ui/src/components/Text/Text';
|
import { Text } from '@grafana/ui/src/components/Text/Text';
|
||||||
|
import { t, Trans } from 'app/core/internationalization';
|
||||||
import { EvalFunction } from 'app/features/alerting/state/alertDef';
|
import { EvalFunction } from 'app/features/alerting/state/alertDef';
|
||||||
import { isExpressionQuery } from 'app/features/expressions/guards';
|
import { isExpressionQuery } from 'app/features/expressions/guards';
|
||||||
import {
|
import {
|
||||||
@ -655,7 +656,9 @@ export const QueryAndExpressionsStep = ({ editingExistingRule, onDataChange }: P
|
|||||||
onClick={() => runQueriesPreview()}
|
onClick={() => runQueriesPreview()}
|
||||||
disabled={emptyQueries}
|
disabled={emptyQueries}
|
||||||
>
|
>
|
||||||
Preview
|
{isAdvancedMode
|
||||||
|
? t('alerting.queryAndExpressionsStep.preview', 'Preview')
|
||||||
|
: t('alerting.queryAndExpressionsStep.previewCondition', 'Preview alert rule condition')}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
@ -673,9 +676,19 @@ export const QueryAndExpressionsStep = ({ editingExistingRule, onDataChange }: P
|
|||||||
|
|
||||||
<ConfirmModal
|
<ConfirmModal
|
||||||
isOpen={showResetModeModal}
|
isOpen={showResetModeModal}
|
||||||
title="Switching to simple mode"
|
title="Deactivate advanced options"
|
||||||
body="The selected queries and expressions cannot be converted to simple mode. Switching will remove them. Do you want to proceed?"
|
body={
|
||||||
confirmText="Yes"
|
<div>
|
||||||
|
<Text element="p">
|
||||||
|
<Trans i18nKey="alerting.queryAndExpressionsStep.disableAdvancedOptions.text">
|
||||||
|
The selected queries and expressions cannot be converted to default. If you deactivate advanced options,
|
||||||
|
your query and condition will be reset to default settings.
|
||||||
|
</Trans>
|
||||||
|
</Text>
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
confirmText="Deactivate"
|
||||||
icon="exclamation-triangle"
|
icon="exclamation-triangle"
|
||||||
onConfirm={() => {
|
onConfirm={() => {
|
||||||
setValue('editorSettings', { simplifiedQueryEditor: true });
|
setValue('editorSettings', { simplifiedQueryEditor: true });
|
||||||
|
@ -103,7 +103,7 @@ export const SimpleConditionEditor = ({
|
|||||||
<Trans i18nKey="alerting.simpleCondition.alertCondition">Alert condition</Trans>
|
<Trans i18nKey="alerting.simpleCondition.alertCondition">Alert condition</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
</header>
|
</header>
|
||||||
<InlineFieldRow>
|
<InlineFieldRow className={styles.condition.container}>
|
||||||
<InlineField label="WHEN">
|
<InlineField label="WHEN">
|
||||||
<Select
|
<Select
|
||||||
options={reducerTypes}
|
options={reducerTypes}
|
||||||
@ -114,7 +114,12 @@ export const SimpleConditionEditor = ({
|
|||||||
</InlineField>
|
</InlineField>
|
||||||
<InlineField label="OF QUERY">
|
<InlineField label="OF QUERY">
|
||||||
<Stack direction="row" gap={1} alignItems="center">
|
<Stack direction="row" gap={1} alignItems="center">
|
||||||
<ButtonSelect options={thresholdFunctions} onChange={onEvalFunctionChange} value={thresholdFunction} />
|
<ButtonSelect
|
||||||
|
className={styles.buttonSelectText}
|
||||||
|
options={thresholdFunctions}
|
||||||
|
onChange={onEvalFunctionChange}
|
||||||
|
value={thresholdFunction}
|
||||||
|
/>
|
||||||
{isRange ? (
|
{isRange ? (
|
||||||
<>
|
<>
|
||||||
<Input
|
<Input
|
||||||
@ -123,7 +128,7 @@ export const SimpleConditionEditor = ({
|
|||||||
value={simpleCondition.evaluator.params[0]}
|
value={simpleCondition.evaluator.params[0]}
|
||||||
onChange={(event) => onEvaluateValueChange(event, 0)}
|
onChange={(event) => onEvaluateValueChange(event, 0)}
|
||||||
/>
|
/>
|
||||||
<div>
|
<div className={styles.condition.button}>
|
||||||
<Trans i18nKey="alerting.simpleCondition.ofQuery.To">TO</Trans>
|
<Trans i18nKey="alerting.simpleCondition.ofQuery.To">TO</Trans>
|
||||||
</div>
|
</div>
|
||||||
<Input
|
<Input
|
||||||
@ -223,6 +228,12 @@ export function getSimpleConditionFromExpressions(expressions: Array<AlertQuery<
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaTheme2) => ({
|
const getStyles = (theme: GrafanaTheme2) => ({
|
||||||
|
buttonSelectText: css({
|
||||||
|
color: theme.colors.primary.text,
|
||||||
|
fontSize: theme.typography.bodySmall.fontSize,
|
||||||
|
textTransform: 'uppercase',
|
||||||
|
padding: `0 ${theme.spacing(1)}`,
|
||||||
|
}),
|
||||||
condition: {
|
condition: {
|
||||||
wrapper: css({
|
wrapper: css({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -231,11 +242,32 @@ const getStyles = (theme: GrafanaTheme2) => ({
|
|||||||
height: 'fit-content',
|
height: 'fit-content',
|
||||||
borderRadius: theme.shape.radius.default,
|
borderRadius: theme.shape.radius.default,
|
||||||
}),
|
}),
|
||||||
|
container: css({
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'row',
|
||||||
|
padding: theme.spacing(1),
|
||||||
|
flex: 1,
|
||||||
|
width: '100%',
|
||||||
|
}),
|
||||||
header: css({
|
header: css({
|
||||||
background: theme.colors.background.secondary,
|
background: theme.colors.background.secondary,
|
||||||
padding: `${theme.spacing(0.5)} ${theme.spacing(1)}`,
|
padding: `${theme.spacing(0.5)} ${theme.spacing(1)}`,
|
||||||
borderBottom: `solid 1px ${theme.colors.border.weak}`,
|
borderBottom: `solid 1px ${theme.colors.border.weak}`,
|
||||||
flex: 1,
|
flex: 1,
|
||||||
}),
|
}),
|
||||||
|
button: css({
|
||||||
|
height: '32px',
|
||||||
|
color: theme.colors.primary.text,
|
||||||
|
fontSize: theme.typography.bodySmall.fontSize,
|
||||||
|
textTransform: 'uppercase',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
borderRadius: theme.shape.radius.default,
|
||||||
|
fontWeight: theme.typography.fontWeightBold,
|
||||||
|
border: `1px solid ${theme.colors.border.medium}`,
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
padding: `0 ${theme.spacing(1)}`,
|
||||||
|
backgroundColor: theme.colors.background.primary,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -216,6 +216,13 @@
|
|||||||
"badge-tooltip-provenance": "This resource has been provisioned via {{provenance}} and cannot be edited through the UI",
|
"badge-tooltip-provenance": "This resource has been provisioned via {{provenance}} and cannot be edited through the UI",
|
||||||
"badge-tooltip-standard": "This resource has been provisioned and cannot be edited through the UI"
|
"badge-tooltip-standard": "This resource has been provisioned and cannot be edited through the UI"
|
||||||
},
|
},
|
||||||
|
"queryAndExpressionsStep": {
|
||||||
|
"disableAdvancedOptions": {
|
||||||
|
"text": "The selected queries and expressions cannot be converted to default. If you deactivate advanced options, your query and condition will be reset to default settings."
|
||||||
|
},
|
||||||
|
"preview": "Preview",
|
||||||
|
"previewCondition": "Preview alert rule condition"
|
||||||
|
},
|
||||||
"rule-groups": {
|
"rule-groups": {
|
||||||
"delete": {
|
"delete": {
|
||||||
"success": "Successfully deleted rule group"
|
"success": "Successfully deleted rule group"
|
||||||
|
@ -216,6 +216,13 @@
|
|||||||
"badge-tooltip-provenance": "Ŧĥįş řęşőūřčę ĥäş þęęʼn přővįşįőʼnęđ vįä {{provenance}} äʼnđ čäʼnʼnőŧ þę ęđįŧęđ ŧĥřőūģĥ ŧĥę ŮĨ",
|
"badge-tooltip-provenance": "Ŧĥįş řęşőūřčę ĥäş þęęʼn přővįşįőʼnęđ vįä {{provenance}} äʼnđ čäʼnʼnőŧ þę ęđįŧęđ ŧĥřőūģĥ ŧĥę ŮĨ",
|
||||||
"badge-tooltip-standard": "Ŧĥįş řęşőūřčę ĥäş þęęʼn přővįşįőʼnęđ äʼnđ čäʼnʼnőŧ þę ęđįŧęđ ŧĥřőūģĥ ŧĥę ŮĨ"
|
"badge-tooltip-standard": "Ŧĥįş řęşőūřčę ĥäş þęęʼn přővįşįőʼnęđ äʼnđ čäʼnʼnőŧ þę ęđįŧęđ ŧĥřőūģĥ ŧĥę ŮĨ"
|
||||||
},
|
},
|
||||||
|
"queryAndExpressionsStep": {
|
||||||
|
"disableAdvancedOptions": {
|
||||||
|
"text": "Ŧĥę şęľęčŧęđ qūęřįęş äʼnđ ęχpřęşşįőʼnş čäʼnʼnőŧ þę čőʼnvęřŧęđ ŧő đęƒäūľŧ. Ĩƒ yőū đęäčŧįväŧę äđväʼnčęđ őpŧįőʼnş, yőūř qūęřy äʼnđ čőʼnđįŧįőʼn ŵįľľ þę řęşęŧ ŧő đęƒäūľŧ şęŧŧįʼnģş."
|
||||||
|
},
|
||||||
|
"preview": "Přęvįęŵ",
|
||||||
|
"previewCondition": "Přęvįęŵ äľęřŧ řūľę čőʼnđįŧįőʼn"
|
||||||
|
},
|
||||||
"rule-groups": {
|
"rule-groups": {
|
||||||
"delete": {
|
"delete": {
|
||||||
"success": "Ŝūččęşşƒūľľy đęľęŧęđ řūľę ģřőūp"
|
"success": "Ŝūččęşşƒūľľy đęľęŧęđ řūľę ģřőūp"
|
||||||
|
Loading…
Reference in New Issue
Block a user