feat(site): add new filter to audit logs#7878
Conversation
| value, | ||
| id: "owner", | ||
| getSelectedOption: async () => { | ||
| const usersRes = await getUsers({ q: value, limit: 1 }) |
There was a problem hiding this comment.
We call getUsers here, and also on line 48. Curious why we can't just make one call to grab all users and then filter on the user we want for getSelectedOption.
There was a problem hiding this comment.
Good question, let's say we have a user called Wesley, Wesley is probably one of the last users to be queried in the database, so when we display the autocomplete options for the users, maybe Wesley is not shown because we only show the first 25 results. So making a separate query to get the selected value, in this case Wesley, is safer and we can be sure we are going to find it.
There was a problem hiding this comment.
Gotcha, thanks for explaining!
|
|
||
| if (type === "workspace_build") { | ||
| label = "Workspace Build" | ||
| } |
There was a problem hiding this comment.
This is fine! We could probably shorten with a map if we wanted to, but not a blocker.
There was a problem hiding this comment.
Yeah, I just went to what Copilot suggested to me 😆 since this is not complex code I think it is ok to let to refactor this if we need to extract it into a function to be reused anywhere else.
Screen.Recording.2023-06-06.at.15.46.06.mov