mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Add mutation method to update a rule
This commit is contained in:
parent
cad8190a91
commit
e5a6dff801
@ -81,6 +81,14 @@ export interface ModifyExportPayload {
|
||||
source_tenants?: string[] | undefined;
|
||||
}
|
||||
|
||||
export interface AlertRuleUpdated {
|
||||
message: string;
|
||||
/**
|
||||
* UIDs of rules updated from this request
|
||||
*/
|
||||
updated: string[];
|
||||
}
|
||||
|
||||
export const alertRuleApi = alertingApi.injectEndpoints({
|
||||
endpoints: (build) => ({
|
||||
preview: build.mutation<
|
||||
@ -255,5 +263,13 @@ export const alertRuleApi = alertingApi.injectEndpoints({
|
||||
}),
|
||||
keepUnusedDataFor: 0,
|
||||
}),
|
||||
|
||||
updateRule: build.mutation<AlertRuleUpdated, { nameSpaceUID: string; payload: ModifyExportPayload }>({
|
||||
query: ({ payload, nameSpaceUID }) => ({
|
||||
url: `/api/ruler/grafana/api/v1/rules/${nameSpaceUID}/`,
|
||||
data: payload,
|
||||
method: 'POST',
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user