feat(usage): fix Resource Events filters — real event types, name search, no user filter

- Event type: trim the dropdown to the four types that are actually emitted
  (Created / Started / Stopped / Deleted) — updated/attached/detached were
  never recorded — and actually send the selection (event_types) to the API,
  which previously dropped it so the filter did nothing.
- Add a resource-name text filter (debounced, case-insensitive substring).
- Remove the "filter by user" select: the events list has no User column.
  Scope still applies (members see only their own events).
This commit is contained in:
michelia
2026-06-09 11:54:28 +08:00
committed by michela feng
parent 620045d7a3
commit feccc81c5f
7 changed files with 109 additions and 80 deletions
+7 -2
View File
@@ -399,6 +399,7 @@ export async function queryResourceEvents(
scope?: 'self' | 'all';
filters?: ResourceUsageFilters;
resource_types?: string[];
resource_name?: string;
event_types?: string[];
page?: number;
perPage?: number;
@@ -412,9 +413,13 @@ export async function queryResourceEvents(
end_date: data.end_date,
scope: data.scope ?? 'all',
resource_type: data.resource_types?.[0],
// GET endpoints take creator_ids as a CSV string (avoids axios array
// serialization quirks); the server splits it back into a list.
// GET endpoints take list params as CSV strings (avoids axios array
// serialization quirks); the server splits them back into lists.
...(creatorIds?.length ? { creator_ids: creatorIds.join(',') } : {}),
...(data.event_types?.length
? { event_types: data.event_types.join(',') }
: {}),
...(data.resource_name ? { resource_name: data.resource_name } : {}),
page: data.page ?? 1,
perPage: data.perPage ?? 50
},