Add tag invalidation to updateRule mutation
...so the alert detail view updates appropriately
This commit is contained in:
committed by
Tom Ratcliffe
parent
9ca2f7bece
commit
b037236b9c
@@ -180,6 +180,7 @@ export const alertRuleApi = alertingApi.injectEndpoints({
|
|||||||
transformResponse: (response: PromRulesResponse, _, args): RuleNamespace[] => {
|
transformResponse: (response: PromRulesResponse, _, args): RuleNamespace[] => {
|
||||||
return groupRulesByFileName(response.data.groups, args.ruleSourceName);
|
return groupRulesByFileName(response.data.groups, args.ruleSourceName);
|
||||||
},
|
},
|
||||||
|
providesTags: ['AlertRulerRule'],
|
||||||
}),
|
}),
|
||||||
|
|
||||||
rulerRules: build.query<
|
rulerRules: build.query<
|
||||||
@@ -190,6 +191,7 @@ export const alertRuleApi = alertingApi.injectEndpoints({
|
|||||||
const { path, params } = rulerUrlBuilder(rulerConfig).rules(filter);
|
const { path, params } = rulerUrlBuilder(rulerConfig).rules(filter);
|
||||||
return { url: path, params };
|
return { url: path, params };
|
||||||
},
|
},
|
||||||
|
providesTags: ['AlertRulerRule'],
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// TODO This should be probably a separate ruler API file
|
// TODO This should be probably a separate ruler API file
|
||||||
@@ -201,6 +203,7 @@ export const alertRuleApi = alertingApi.injectEndpoints({
|
|||||||
const { path, params } = rulerUrlBuilder(rulerConfig).namespaceGroup(namespace, group);
|
const { path, params } = rulerUrlBuilder(rulerConfig).namespaceGroup(namespace, group);
|
||||||
return { url: path, params };
|
return { url: path, params };
|
||||||
},
|
},
|
||||||
|
providesTags: ['AlertRulerRule'],
|
||||||
}),
|
}),
|
||||||
|
|
||||||
exportRules: build.query<string, ExportRulesParams>({
|
exportRules: build.query<string, ExportRulesParams>({
|
||||||
@@ -270,6 +273,7 @@ export const alertRuleApi = alertingApi.injectEndpoints({
|
|||||||
data: payload,
|
data: payload,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
}),
|
}),
|
||||||
|
invalidatesTags: ['AlertRulerRule'],
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ export const alertingApi = createApi({
|
|||||||
'OnCallIntegrations',
|
'OnCallIntegrations',
|
||||||
'OrgMigrationState',
|
'OrgMigrationState',
|
||||||
'DataSourceSettings',
|
'DataSourceSettings',
|
||||||
|
'AlertRulerRule',
|
||||||
],
|
],
|
||||||
endpoints: () => ({}),
|
endpoints: () => ({}),
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user