mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: fix "no permissions" alert flashing (#59300)
This commit is contained in:
parent
f5c41ea497
commit
49f91721ec
@ -19,9 +19,21 @@ interface ExistingRuleEditorProps {
|
||||
|
||||
export function ExistingRuleEditor({ identifier }: ExistingRuleEditorProps) {
|
||||
useCleanup((state) => (state.unifiedAlerting.ruleForm.existingRule = initialAsyncRequestState));
|
||||
const { loading, result, error, dispatched } = useUnifiedAlertingSelector((state) => state.ruleForm.existingRule);
|
||||
|
||||
const {
|
||||
loading: loadingAlertRule,
|
||||
result,
|
||||
error,
|
||||
dispatched,
|
||||
} = useUnifiedAlertingSelector((state) => state.ruleForm.existingRule);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const { isEditable } = useIsRuleEditable(ruleId.ruleIdentifierToRuleSourceName(identifier), result?.rule);
|
||||
const { isEditable, loading: loadingEditable } = useIsRuleEditable(
|
||||
ruleId.ruleIdentifierToRuleSourceName(identifier),
|
||||
result?.rule
|
||||
);
|
||||
|
||||
const loading = loadingAlertRule || loadingEditable;
|
||||
|
||||
useEffect(() => {
|
||||
if (!dispatched) {
|
||||
|
@ -18,7 +18,6 @@ export function useIsRuleEditable(rulesSourceName: string, rule?: RulerRuleDTO):
|
||||
const folderUID = rule && isGrafanaRulerRule(rule) ? rule.grafana_alert.namespace_uid : undefined;
|
||||
|
||||
const rulePermission = getRulesPermissions(rulesSourceName);
|
||||
|
||||
const { folder, loading } = useFolder(folderUID);
|
||||
|
||||
if (!rule) {
|
||||
|
Loading…
Reference in New Issue
Block a user