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,
|
error,
|
||||||
} = useQuery<AlertRuleDetail>({
|
} = useQuery<AlertRuleDetail>({
|
||||||
queryKey: [...queryKeys.alerts.rules(), id],
|
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,
|
enabled: !!id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -284,7 +284,7 @@ export default function AlertRuleDetailPage() {
|
||||||
queryKey: [...queryKeys.alerts.rules(), id, 'events'],
|
queryKey: [...queryKeys.alerts.rules(), id, 'events'],
|
||||||
queryFn: () =>
|
queryFn: () =>
|
||||||
apiClient<AlertEventsResponse>(
|
apiClient<AlertEventsResponse>(
|
||||||
`/api/v1/monitor/alert-rules/${id}/events?limit=20`,
|
`/api/v1/monitor/alerts/rules/${id}/events?limit=20`,
|
||||||
),
|
),
|
||||||
enabled: !!id,
|
enabled: !!id,
|
||||||
});
|
});
|
||||||
|
|
@ -294,7 +294,7 @@ export default function AlertRuleDetailPage() {
|
||||||
// Mutations ------------------------------------------------------------
|
// Mutations ------------------------------------------------------------
|
||||||
const updateMutation = useMutation({
|
const updateMutation = useMutation({
|
||||||
mutationFn: (body: Record<string, unknown>) =>
|
mutationFn: (body: Record<string, unknown>) =>
|
||||||
apiClient<AlertRuleDetail>(`/api/v1/monitor/alert-rules/${id}`, {
|
apiClient<AlertRuleDetail>(`/api/v1/monitor/alerts/rules/${id}`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body,
|
body,
|
||||||
}),
|
}),
|
||||||
|
|
@ -307,7 +307,7 @@ export default function AlertRuleDetailPage() {
|
||||||
|
|
||||||
const deleteMutation = useMutation({
|
const deleteMutation = useMutation({
|
||||||
mutationFn: () =>
|
mutationFn: () =>
|
||||||
apiClient<void>(`/api/v1/monitor/alert-rules/${id}`, { method: 'DELETE' }),
|
apiClient<void>(`/api/v1/monitor/alerts/rules/${id}`, { method: 'DELETE' }),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
queryClient.invalidateQueries({ queryKey: queryKeys.alerts.rules() });
|
queryClient.invalidateQueries({ queryKey: queryKeys.alerts.rules() });
|
||||||
router.push('/monitoring/alert-rules');
|
router.push('/monitoring/alert-rules');
|
||||||
|
|
@ -316,7 +316,7 @@ export default function AlertRuleDetailPage() {
|
||||||
|
|
||||||
const toggleMutation = useMutation({
|
const toggleMutation = useMutation({
|
||||||
mutationFn: (enabled: boolean) =>
|
mutationFn: (enabled: boolean) =>
|
||||||
apiClient<AlertRuleDetail>(`/api/v1/monitor/alert-rules/${id}`, {
|
apiClient<AlertRuleDetail>(`/api/v1/monitor/alerts/rules/${id}`, {
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
body: { enabled },
|
body: { enabled },
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -452,7 +452,7 @@ export default function AlertRulesPage() {
|
||||||
// Queries --------------------------------------------------------------
|
// Queries --------------------------------------------------------------
|
||||||
const { data, isLoading, error } = useQuery({
|
const { data, isLoading, error } = useQuery({
|
||||||
queryKey: queryKeys.alerts.rules(),
|
queryKey: queryKeys.alerts.rules(),
|
||||||
queryFn: () => apiClient<AlertRulesResponse>('/api/v1/monitor/alert-rules'),
|
queryFn: () => apiClient<AlertRulesResponse>('/api/v1/monitor/alerts/rules'),
|
||||||
});
|
});
|
||||||
|
|
||||||
const rules = data?.data ?? [];
|
const rules = data?.data ?? [];
|
||||||
|
|
@ -460,7 +460,7 @@ export default function AlertRulesPage() {
|
||||||
// Mutations ------------------------------------------------------------
|
// Mutations ------------------------------------------------------------
|
||||||
const createMutation = useMutation({
|
const createMutation = useMutation({
|
||||||
mutationFn: (body: Record<string, unknown>) =>
|
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: () => {
|
onSuccess: () => {
|
||||||
queryClient.invalidateQueries({ queryKey: queryKeys.alerts.rules() });
|
queryClient.invalidateQueries({ queryKey: queryKeys.alerts.rules() });
|
||||||
closeDialog();
|
closeDialog();
|
||||||
|
|
@ -469,7 +469,7 @@ export default function AlertRulesPage() {
|
||||||
|
|
||||||
const updateMutation = useMutation({
|
const updateMutation = useMutation({
|
||||||
mutationFn: ({ id, body }: { id: string; body: Record<string, unknown> }) =>
|
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: () => {
|
onSuccess: () => {
|
||||||
queryClient.invalidateQueries({ queryKey: queryKeys.alerts.rules() });
|
queryClient.invalidateQueries({ queryKey: queryKeys.alerts.rules() });
|
||||||
closeDialog();
|
closeDialog();
|
||||||
|
|
@ -478,7 +478,7 @@ export default function AlertRulesPage() {
|
||||||
|
|
||||||
const deleteMutation = useMutation({
|
const deleteMutation = useMutation({
|
||||||
mutationFn: (id: string) =>
|
mutationFn: (id: string) =>
|
||||||
apiClient<void>(`/api/v1/monitor/alert-rules/${id}`, { method: 'DELETE' }),
|
apiClient<void>(`/api/v1/monitor/alerts/rules/${id}`, { method: 'DELETE' }),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
queryClient.invalidateQueries({ queryKey: queryKeys.alerts.rules() });
|
queryClient.invalidateQueries({ queryKey: queryKeys.alerts.rules() });
|
||||||
setDeleteTarget(null);
|
setDeleteTarget(null);
|
||||||
|
|
@ -487,7 +487,7 @@ export default function AlertRulesPage() {
|
||||||
|
|
||||||
const toggleMutation = useMutation({
|
const toggleMutation = useMutation({
|
||||||
mutationFn: ({ id, enabled }: { id: string; enabled: boolean }) =>
|
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',
|
method: 'PATCH',
|
||||||
body: { enabled },
|
body: { enabled },
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -4,27 +4,27 @@ import type { AlertRule } from '@/domain/entities/alert-rule';
|
||||||
export async function createAlertRule(
|
export async function createAlertRule(
|
||||||
rule: Omit<AlertRule, 'id' | 'createdAt' | 'updatedAt'>,
|
rule: Omit<AlertRule, 'id' | 'createdAt' | 'updatedAt'>,
|
||||||
): Promise<AlertRule> {
|
): Promise<AlertRule> {
|
||||||
return apiClient<AlertRule>('/api/v1/monitoring/alert-rules', {
|
return apiClient<AlertRule>('/api/v1/monitor/alerts/rules', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: rule,
|
body: rule,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateAlertRule(id: string, data: Partial<AlertRule>): Promise<AlertRule> {
|
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',
|
method: 'PUT',
|
||||||
body: data,
|
body: data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteAlertRule(id: string): Promise<void> {
|
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',
|
method: 'DELETE',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function toggleAlertRule(id: string, enabled: boolean): Promise<void> {
|
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',
|
method: 'PATCH',
|
||||||
body: { enabled },
|
body: { enabled },
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -4,35 +4,35 @@ import type { AlertRule, AlertEvent } from '@/domain/entities/alert-rule';
|
||||||
|
|
||||||
export const apiAlertRuleRepository: AlertRuleRepository = {
|
export const apiAlertRuleRepository: AlertRuleRepository = {
|
||||||
async listRules() {
|
async listRules() {
|
||||||
return apiClient<AlertRule[]>('/api/v1/monitoring/alert-rules');
|
return apiClient<AlertRule[]>('/api/v1/monitor/alerts/rules');
|
||||||
},
|
},
|
||||||
|
|
||||||
async getRuleById(id) {
|
async getRuleById(id) {
|
||||||
return apiClient<AlertRule>(`/api/v1/monitoring/alert-rules/${id}`);
|
return apiClient<AlertRule>(`/api/v1/monitor/alerts/rules/${id}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
async createRule(rule) {
|
async createRule(rule) {
|
||||||
return apiClient<AlertRule>('/api/v1/monitoring/alert-rules', {
|
return apiClient<AlertRule>('/api/v1/monitor/alerts/rules', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: rule,
|
body: rule,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
async updateRule(id, data) {
|
async updateRule(id, data) {
|
||||||
return apiClient<AlertRule>(`/api/v1/monitoring/alert-rules/${id}`, {
|
return apiClient<AlertRule>(`/api/v1/monitor/alerts/rules/${id}`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: data,
|
body: data,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
async removeRule(id) {
|
async removeRule(id) {
|
||||||
await apiClient(`/api/v1/monitoring/alert-rules/${id}`, {
|
await apiClient(`/api/v1/monitor/alerts/rules/${id}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
async toggleRule(id, enabled) {
|
async toggleRule(id, enabled) {
|
||||||
await apiClient(`/api/v1/monitoring/alert-rules/${id}/toggle`, {
|
await apiClient(`/api/v1/monitor/alerts/rules/${id}/toggle`, {
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
body: { enabled },
|
body: { enabled },
|
||||||
});
|
});
|
||||||
|
|
@ -40,11 +40,11 @@ export const apiAlertRuleRepository: AlertRuleRepository = {
|
||||||
|
|
||||||
async listEvents(params) {
|
async listEvents(params) {
|
||||||
const query = params ? '?' + new URLSearchParams(params).toString() : '';
|
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) {
|
async acknowledgeEvent(id) {
|
||||||
await apiClient(`/api/v1/monitoring/alert-events/${id}/acknowledge`, {
|
await apiClient(`/api/v1/monitor/alerts/events/${id}/acknowledge`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -203,8 +203,3 @@ plugins:
|
||||||
policy: redis
|
policy: redis
|
||||||
redis_host: redis
|
redis_host: redis
|
||||||
|
|
||||||
- name: acl
|
|
||||||
route: audit-routes
|
|
||||||
config:
|
|
||||||
allow:
|
|
||||||
- admin
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue