|
|
|
@ -5,7 +5,7 @@ import { useParams } from 'react-router-dom-v5-compat'; |
|
|
|
|
|
|
|
|
|
import { GrafanaTheme2 } from '@grafana/data'; |
|
|
|
|
import { config, locationService } from '@grafana/runtime'; |
|
|
|
|
import { Button, ConfirmModal, CustomScrollbar, Spinner, Stack, useStyles2 } from '@grafana/ui'; |
|
|
|
|
import { Button, ConfirmModal, Spinner, Stack, useStyles2 } from '@grafana/ui'; |
|
|
|
|
import { AppChromeUpdate } from 'app/core/components/AppChrome/AppChromeUpdate'; |
|
|
|
|
import { useAppNotification } from 'app/core/copy/appNotification'; |
|
|
|
|
import { contextSrv } from 'app/core/core'; |
|
|
|
@ -285,38 +285,36 @@ export const AlertRuleForm = ({ existing, prefill }: Props) => { |
|
|
|
|
<form onSubmit={(e) => e.preventDefault()} className={styles.form}> |
|
|
|
|
<div className={styles.contentOuter}> |
|
|
|
|
{isPaused && <InfoPausedRule />} |
|
|
|
|
<CustomScrollbar autoHeightMin="100%" hideHorizontalTrack={true}> |
|
|
|
|
<Stack direction="column" gap={3}> |
|
|
|
|
{/* Step 1 */} |
|
|
|
|
<AlertRuleNameAndMetric /> |
|
|
|
|
{/* Step 2 */} |
|
|
|
|
<QueryAndExpressionsStep editingExistingRule={!!existing} onDataChange={checkAlertCondition} /> |
|
|
|
|
{/* Step 3-4-5 */} |
|
|
|
|
{showDataSourceDependantStep && ( |
|
|
|
|
<> |
|
|
|
|
{/* Step 3 */} |
|
|
|
|
{isGrafanaManagedRuleByType(type) && ( |
|
|
|
|
<GrafanaEvaluationBehavior |
|
|
|
|
evaluateEvery={evaluateEvery} |
|
|
|
|
setEvaluateEvery={setEvaluateEvery} |
|
|
|
|
existing={Boolean(existing)} |
|
|
|
|
enableProvisionedGroups={false} |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
{type === RuleFormType.cloudAlerting && <CloudEvaluationBehavior />} |
|
|
|
|
|
|
|
|
|
{type === RuleFormType.cloudRecording && <RecordingRulesNameSpaceAndGroupStep />} |
|
|
|
|
|
|
|
|
|
{/* Step 4 & 5 */} |
|
|
|
|
{/* Notifications step*/} |
|
|
|
|
<NotificationsStep alertUid={uidFromParams} /> |
|
|
|
|
{/* Annotations only for cloud and Grafana */} |
|
|
|
|
{!isRecordingRuleByType(type) && <AnnotationsStep />} |
|
|
|
|
</> |
|
|
|
|
)} |
|
|
|
|
</Stack> |
|
|
|
|
</CustomScrollbar> |
|
|
|
|
<Stack direction="column" gap={3}> |
|
|
|
|
{/* Step 1 */} |
|
|
|
|
<AlertRuleNameAndMetric /> |
|
|
|
|
{/* Step 2 */} |
|
|
|
|
<QueryAndExpressionsStep editingExistingRule={!!existing} onDataChange={checkAlertCondition} /> |
|
|
|
|
{/* Step 3-4-5 */} |
|
|
|
|
{showDataSourceDependantStep && ( |
|
|
|
|
<> |
|
|
|
|
{/* Step 3 */} |
|
|
|
|
{isGrafanaManagedRuleByType(type) && ( |
|
|
|
|
<GrafanaEvaluationBehavior |
|
|
|
|
evaluateEvery={evaluateEvery} |
|
|
|
|
setEvaluateEvery={setEvaluateEvery} |
|
|
|
|
existing={Boolean(existing)} |
|
|
|
|
enableProvisionedGroups={false} |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
{type === RuleFormType.cloudAlerting && <CloudEvaluationBehavior />} |
|
|
|
|
|
|
|
|
|
{type === RuleFormType.cloudRecording && <RecordingRulesNameSpaceAndGroupStep />} |
|
|
|
|
|
|
|
|
|
{/* Step 4 & 5 */} |
|
|
|
|
{/* Notifications step*/} |
|
|
|
|
<NotificationsStep alertUid={uidFromParams} /> |
|
|
|
|
{/* Annotations only for cloud and Grafana */} |
|
|
|
|
{!isRecordingRuleByType(type) && <AnnotationsStep />} |
|
|
|
|
</> |
|
|
|
|
)} |
|
|
|
|
</Stack> |
|
|
|
|
</div> |
|
|
|
|
</form> |
|
|
|
|
{showDeleteModal ? ( |
|
|
|
|