mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Use verbose mutation from RTKQ for better IDE experience
This commit is contained in:
parent
28572102cf
commit
30471c340a
@ -6,14 +6,12 @@ import { alertRuleApi } from 'app/features/alerting/unified/api/alertRuleApi';
|
||||
import { isGrafanaRulerRule, isGrafanaRulerRulePaused } from 'app/features/alerting/unified/utils/rules';
|
||||
import { CombinedRule } from 'app/types/unified-alerting';
|
||||
|
||||
const { useUpdateRuleMutation } = alertRuleApi;
|
||||
|
||||
interface Props {
|
||||
rule: CombinedRule;
|
||||
/**
|
||||
* Method invoked after the request to change the paused state has completed
|
||||
*/
|
||||
onPauseChange?: () => {};
|
||||
onPauseChange?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -22,7 +20,7 @@ interface Props {
|
||||
*/
|
||||
const MenuItemPauseRule = ({ rule, onPauseChange }: Props) => {
|
||||
const { group } = rule;
|
||||
const [updateRule] = useUpdateRuleMutation();
|
||||
const [updateRule] = alertRuleApi.endpoints.updateRule.useMutation();
|
||||
const isPaused = isGrafanaRulerRule(rule.rulerRule) && isGrafanaRulerRulePaused(rule.rulerRule);
|
||||
const icon = isPaused ? 'play' : 'pause';
|
||||
const title = isPaused ? 'Resume alert evaluation' : 'Pause alert evaluation';
|
||||
|
Loading…
Reference in New Issue
Block a user