Skip to content

Commit

Permalink
Add 'Refresh' button functionality
Browse files Browse the repository at this point in the history
The 'Refresh' button should refetch the
data related to the Sudo rules of a given
user.

Signed-off-by: Carla Martinez <[email protected]>
  • Loading branch information
carma12 committed May 21, 2024
1 parent 5e52776 commit ecc3941
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/MemberOf/MemberOfSudoRules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ const MemberOfSudoRules = (props: MemberOfSudoRulesProps) => {
const someItemSelected = sudoRulesSelected.length > 0;
const showTableRows = sudoRules.length > 0;

// Buttons functionality
// - Refresh
const isRefreshButtonEnabled =
!fullSudoRulesQuery.isFetching && !props.isUserDataLoading;

return (
<>
<alerts.ManagedAlerts />
Expand All @@ -111,7 +116,7 @@ const MemberOfSudoRules = (props: MemberOfSudoRulesProps) => {
onSearchTextChange={setSearchValue}
// eslint-disable-next-line @typescript-eslint/no-empty-function
onSearch={() => {}}
refreshButtonEnabled={true}
refreshButtonEnabled={isRefreshButtonEnabled}
onRefreshButtonClick={props.onRefreshUserData}
deleteButtonEnabled={someItemSelected}
// eslint-disable-next-line @typescript-eslint/no-empty-function
Expand Down

0 comments on commit ecc3941

Please sign in to comment.