fix: correct alert-rules API paths and remove audit ACL plugin
- Frontend alert-rules paths changed from /monitoring/alert-rules to /monitor/alerts/rules to match backend routes - Removed Kong ACL plugin on audit-routes (JWT auth is sufficient) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e98cf26587
commit
f393a07092
|
|
@ -276,7 +276,7 @@ export default function AlertRuleDetailPage() {
|
|||
error,
|
||||
} = useQuery<AlertRuleDetail>({
|
||||
queryKey: [...queryKeys.alerts.rules(), id],
|
||||
queryFn: () => apiClient<AlertRuleDetail>(`/api/v1/monitor/alert-rules/${id}`),
|
||||
queryFn: () => apiClient<AlertRuleDetail>(`/api/v1/monitor/alerts/rules/${id}`),
|
||||
enabled: !!id,
|
||||
});
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ export default function AlertRuleDetailPage() {
|
|||
queryKey: [...queryKeys.alerts.rules(), id, 'events'],
|
||||
queryFn: () =>
|
||||
apiClient<AlertEventsResponse>(
|
||||
`/api/v1/monitor/alert-rules/${id}/events?limit=20`,
|
||||
`/api/v1/monitor/alerts/rules/${id}/events?limit=20`,
|
||||
),
|
||||
enabled: !!id,
|
||||
});
|
||||
|
|
@ -294,7 +294,7 @@ export default function AlertRuleDetailPage() {
|
|||
// Mutations ------------------------------------------------------------
|
||||
const updateMutation = useMutation({
|
||||
mutationFn: (body: Record<string, unknown>) =>
|
||||
apiClient<AlertRuleDetail>(`/api/v1/monitor/alert-rules/${id}`, {
|
||||
apiClient<AlertRuleDetail>(`/api/v1/monitor/alerts/rules/${id}`, {
|
||||
method: 'PUT',
|
||||
body,
|
||||
}),
|
||||
|
|
@ -307,7 +307,7 @@ export default function AlertRuleDetailPage() {
|
|||
|
||||
const deleteMutation = useMutation({
|
||||
mutationFn: () =>
|
||||
apiClient<void>(`/api/v1/monitor/alert-rules/${id}`, { method: 'DELETE' }),
|
||||
apiClient<void>(`/api/v1/monitor/alerts/rules/${id}`, { method: 'DELETE' }),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.alerts.rules() });
|
||||
router.push('/monitoring/alert-rules');
|
||||
|
|
@ -316,7 +316,7 @@ export default function AlertRuleDetailPage() {
|
|||
|
||||
const toggleMutation = useMutation({
|
||||
mutationFn: (enabled: boolean) =>
|
||||
apiClient<AlertRuleDetail>(`/api/v1/monitor/alert-rules/${id}`, {
|
||||
apiClient<AlertRuleDetail>(`/api/v1/monitor/alerts/rules/${id}`, {
|
||||
method: 'PATCH',
|
||||
body: { enabled },
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -452,7 +452,7 @@ export default function AlertRulesPage() {
|
|||
// Queries --------------------------------------------------------------
|
||||
const { data, isLoading, error } = useQuery({
|
||||
queryKey: queryKeys.alerts.rules(),
|
||||
queryFn: () => apiClient<AlertRulesResponse>('/api/v1/monitor/alert-rules'),
|
||||
queryFn: () => apiClient<AlertRulesResponse>('/api/v1/monitor/alerts/rules'),
|
||||
});
|
||||
|
||||
const rules = data?.data ?? [];
|
||||
|
|
@ -460,7 +460,7 @@ export default function AlertRulesPage() {
|
|||
// Mutations ------------------------------------------------------------
|
||||
const createMutation = useMutation({
|
||||
mutationFn: (body: Record<string, unknown>) =>
|
||||
apiClient<AlertRule>('/api/v1/monitor/alert-rules', { method: 'POST', body }),
|
||||
apiClient<AlertRule>('/api/v1/monitor/alerts/rules', { method: 'POST', body }),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.alerts.rules() });
|
||||
closeDialog();
|
||||
|
|
@ -469,7 +469,7 @@ export default function AlertRulesPage() {
|
|||
|
||||
const updateMutation = useMutation({
|
||||
mutationFn: ({ id, body }: { id: string; body: Record<string, unknown> }) =>
|
||||
apiClient<AlertRule>(`/api/v1/monitor/alert-rules/${id}`, { method: 'PUT', body }),
|
||||
apiClient<AlertRule>(`/api/v1/monitor/alerts/rules/${id}`, { method: 'PUT', body }),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.alerts.rules() });
|
||||
closeDialog();
|
||||
|
|
@ -478,7 +478,7 @@ export default function AlertRulesPage() {
|
|||
|
||||
const deleteMutation = useMutation({
|
||||
mutationFn: (id: string) =>
|
||||
apiClient<void>(`/api/v1/monitor/alert-rules/${id}`, { method: 'DELETE' }),
|
||||
apiClient<void>(`/api/v1/monitor/alerts/rules/${id}`, { method: 'DELETE' }),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.alerts.rules() });
|
||||
setDeleteTarget(null);
|
||||
|
|
@ -487,7 +487,7 @@ export default function AlertRulesPage() {
|
|||
|
||||
const toggleMutation = useMutation({
|
||||
mutationFn: ({ id, enabled }: { id: string; enabled: boolean }) =>
|
||||
apiClient<AlertRule>(`/api/v1/monitor/alert-rules/${id}`, {
|
||||
apiClient<AlertRule>(`/api/v1/monitor/alerts/rules/${id}`, {
|
||||
method: 'PATCH',
|
||||
body: { enabled },
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -4,27 +4,27 @@ import type { AlertRule } from '@/domain/entities/alert-rule';
|
|||
export async function createAlertRule(
|
||||
rule: Omit<AlertRule, 'id' | 'createdAt' | 'updatedAt'>,
|
||||
): Promise<AlertRule> {
|
||||
return apiClient<AlertRule>('/api/v1/monitoring/alert-rules', {
|
||||
return apiClient<AlertRule>('/api/v1/monitor/alerts/rules', {
|
||||
method: 'POST',
|
||||
body: rule,
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateAlertRule(id: string, data: Partial<AlertRule>): Promise<AlertRule> {
|
||||
return apiClient<AlertRule>(`/api/v1/monitoring/alert-rules/${id}`, {
|
||||
return apiClient<AlertRule>(`/api/v1/monitor/alerts/rules/${id}`, {
|
||||
method: 'PUT',
|
||||
body: data,
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteAlertRule(id: string): Promise<void> {
|
||||
await apiClient(`/api/v1/monitoring/alert-rules/${id}`, {
|
||||
await apiClient(`/api/v1/monitor/alerts/rules/${id}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
export async function toggleAlertRule(id: string, enabled: boolean): Promise<void> {
|
||||
await apiClient(`/api/v1/monitoring/alert-rules/${id}/toggle`, {
|
||||
await apiClient(`/api/v1/monitor/alerts/rules/${id}/toggle`, {
|
||||
method: 'PATCH',
|
||||
body: { enabled },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,35 +4,35 @@ import type { AlertRule, AlertEvent } from '@/domain/entities/alert-rule';
|
|||
|
||||
export const apiAlertRuleRepository: AlertRuleRepository = {
|
||||
async listRules() {
|
||||
return apiClient<AlertRule[]>('/api/v1/monitoring/alert-rules');
|
||||
return apiClient<AlertRule[]>('/api/v1/monitor/alerts/rules');
|
||||
},
|
||||
|
||||
async getRuleById(id) {
|
||||
return apiClient<AlertRule>(`/api/v1/monitoring/alert-rules/${id}`);
|
||||
return apiClient<AlertRule>(`/api/v1/monitor/alerts/rules/${id}`);
|
||||
},
|
||||
|
||||
async createRule(rule) {
|
||||
return apiClient<AlertRule>('/api/v1/monitoring/alert-rules', {
|
||||
return apiClient<AlertRule>('/api/v1/monitor/alerts/rules', {
|
||||
method: 'POST',
|
||||
body: rule,
|
||||
});
|
||||
},
|
||||
|
||||
async updateRule(id, data) {
|
||||
return apiClient<AlertRule>(`/api/v1/monitoring/alert-rules/${id}`, {
|
||||
return apiClient<AlertRule>(`/api/v1/monitor/alerts/rules/${id}`, {
|
||||
method: 'PUT',
|
||||
body: data,
|
||||
});
|
||||
},
|
||||
|
||||
async removeRule(id) {
|
||||
await apiClient(`/api/v1/monitoring/alert-rules/${id}`, {
|
||||
await apiClient(`/api/v1/monitor/alerts/rules/${id}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
},
|
||||
|
||||
async toggleRule(id, enabled) {
|
||||
await apiClient(`/api/v1/monitoring/alert-rules/${id}/toggle`, {
|
||||
await apiClient(`/api/v1/monitor/alerts/rules/${id}/toggle`, {
|
||||
method: 'PATCH',
|
||||
body: { enabled },
|
||||
});
|
||||
|
|
@ -40,11 +40,11 @@ export const apiAlertRuleRepository: AlertRuleRepository = {
|
|||
|
||||
async listEvents(params) {
|
||||
const query = params ? '?' + new URLSearchParams(params).toString() : '';
|
||||
return apiClient<AlertEvent[]>(`/api/v1/monitoring/alert-events${query}`);
|
||||
return apiClient<AlertEvent[]>(`/api/v1/monitor/alerts/events${query}`);
|
||||
},
|
||||
|
||||
async acknowledgeEvent(id) {
|
||||
await apiClient(`/api/v1/monitoring/alert-events/${id}/acknowledge`, {
|
||||
await apiClient(`/api/v1/monitor/alerts/events/${id}/acknowledge`, {
|
||||
method: 'POST',
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -203,8 +203,3 @@ plugins:
|
|||
policy: redis
|
||||
redis_host: redis
|
||||
|
||||
- name: acl
|
||||
route: audit-routes
|
||||
config:
|
||||
allow:
|
||||
- admin
|
||||
|
|
|
|||
Loading…
Reference in New Issue