Alerting: Remove rule type switch for modified export mode (#102287)
This commit is contained in:
+1
-1
@@ -320,7 +320,7 @@ export const AlertRuleForm = ({ existing, prefill, isManualRestore }: Props) =>
|
|||||||
{/* Step 1 */}
|
{/* Step 1 */}
|
||||||
<AlertRuleNameAndMetric />
|
<AlertRuleNameAndMetric />
|
||||||
{/* Step 2 */}
|
{/* Step 2 */}
|
||||||
<QueryAndExpressionsStep editingExistingRule={!!existing} onDataChange={checkAlertCondition} />
|
<QueryAndExpressionsStep editingExistingRule={!!existing} onDataChange={checkAlertCondition} mode="edit" />
|
||||||
{/* Step 3-4-5 */}
|
{/* Step 3-4-5 */}
|
||||||
{showDataSourceDependantStep && (
|
{showDataSourceDependantStep && (
|
||||||
<>
|
<>
|
||||||
|
|||||||
+1
-1
@@ -100,7 +100,7 @@ export function ModifyExportRuleForm({ ruleForm, alertUid }: ModifyExportRuleFor
|
|||||||
{/* Step 1 */}
|
{/* Step 1 */}
|
||||||
<AlertRuleNameAndMetric />
|
<AlertRuleNameAndMetric />
|
||||||
{/* Step 2 */}
|
{/* Step 2 */}
|
||||||
<QueryAndExpressionsStep editingExistingRule={existing} onDataChange={checkAlertCondition} />
|
<QueryAndExpressionsStep editingExistingRule={existing} onDataChange={checkAlertCondition} mode="draft" />
|
||||||
{/* Step 3-4-5 */}
|
{/* Step 3-4-5 */}
|
||||||
<GrafanaFolderAndLabelsStep />
|
<GrafanaFolderAndLabelsStep />
|
||||||
|
|
||||||
|
|||||||
+16
-8
@@ -77,9 +77,15 @@ import { useAlertQueryRunner } from './useAlertQueryRunner';
|
|||||||
interface Props {
|
interface Props {
|
||||||
editingExistingRule: boolean;
|
editingExistingRule: boolean;
|
||||||
onDataChange: (error: string) => void;
|
onDataChange: (error: string) => void;
|
||||||
|
/**
|
||||||
|
* The mode of the rule editor.
|
||||||
|
* - 'edit' standard rule editor mode
|
||||||
|
* - 'draft' non-saveable form mode used for exporting to provisioning formats
|
||||||
|
*/
|
||||||
|
mode: 'edit' | 'draft';
|
||||||
}
|
}
|
||||||
|
|
||||||
export const QueryAndExpressionsStep = ({ editingExistingRule, onDataChange }: Props) => {
|
export const QueryAndExpressionsStep = ({ editingExistingRule, onDataChange, mode }: Props) => {
|
||||||
const {
|
const {
|
||||||
setValue,
|
setValue,
|
||||||
getValues,
|
getValues,
|
||||||
@@ -515,12 +521,14 @@ export const QueryAndExpressionsStep = ({ editingExistingRule, onDataChange }: P
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
<SmartAlertTypeDetector
|
{mode === 'edit' && (
|
||||||
editingExistingRule={editingExistingRule}
|
<SmartAlertTypeDetector
|
||||||
queries={queries}
|
editingExistingRule={editingExistingRule}
|
||||||
rulesSourcesWithRuler={rulesSourcesWithRuler}
|
queries={queries}
|
||||||
onClickSwitch={onClickSwitch}
|
rulesSourcesWithRuler={rulesSourcesWithRuler}
|
||||||
/>
|
onClickSwitch={onClickSwitch}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -555,7 +563,7 @@ export const QueryAndExpressionsStep = ({ editingExistingRule, onDataChange }: P
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
{/* We only show Switch for Grafana managed alerts */}
|
{/* We only show Switch for Grafana managed alerts */}
|
||||||
{isGrafanaAlertingType && !simplifiedQueryStep && (
|
{isGrafanaAlertingType && !simplifiedQueryStep && mode === 'edit' && (
|
||||||
<SmartAlertTypeDetector
|
<SmartAlertTypeDetector
|
||||||
editingExistingRule={editingExistingRule}
|
editingExistingRule={editingExistingRule}
|
||||||
rulesSourcesWithRuler={rulesSourcesWithRuler}
|
rulesSourcesWithRuler={rulesSourcesWithRuler}
|
||||||
|
|||||||
Reference in New Issue
Block a user