({
value,
onChange,
}: Pick<UseFilterMenuOptions, "value" | "onChange">)
| 86 | }; |
| 87 | |
| 88 | export const useActionFilterMenu = ({ |
| 89 | value, |
| 90 | onChange, |
| 91 | }: Pick<UseFilterMenuOptions, "value" | "onChange">) => { |
| 92 | const actionOptions: SelectFilterOption[] = AuditActions |
| 93 | // TODO(ethanndickson): Logs with these action types are no longer produced. |
| 94 | // Until we remove them from the database and API, we shouldn't suggest them |
| 95 | // in the filter dropdown. |
| 96 | .filter( |
| 97 | (action) => !["connect", "disconnect", "open", "close"].includes(action), |
| 98 | ) |
| 99 | .map((action) => ({ |
| 100 | value: action, |
| 101 | label: capitalize(action), |
| 102 | })); |
| 103 | return useFilterMenu({ |
| 104 | onChange, |
| 105 | value, |
| 106 | id: "status", |
| 107 | getSelectedOption: async () => |
| 108 | actionOptions.find((option) => option.value === value) ?? null, |
| 109 | getOptions: async () => actionOptions, |
| 110 | }); |
| 111 | }; |
| 112 | |
| 113 | type ActionFilterMenu = ReturnType<typeof useActionFilterMenu>; |
| 114 |
no test coverage detected