Skip to content

Commit

Permalink
Issue 171 - Minor cleanup around setting show table rows and refresh
Browse files Browse the repository at this point in the history
The refresh function no longer takes a parameter, and AddUsers does not need
to set showTabelRows anymore

fixes: freeipa#171

signed-off: Mark Reynolds <[email protected]>
  • Loading branch information
mreynolds389 committed Oct 31, 2023
1 parent 677658f commit 10a3682
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
13 changes: 2 additions & 11 deletions src/components/modals/AddUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export interface PropsToAddUser {
// NOTE: 'onRefresh' is handled as { (User) => void | undefined } as a temporal solution
// until the C.L. is adapted in 'stage-' and 'preserved users' (otherwise
// the operation will fail for those components)
onRefresh?: (newUserData: User) => void;
onRefresh?: () => void;
}

const AddUser = (props: PropsToAddUser) => {
Expand Down Expand Up @@ -577,11 +577,6 @@ const AddUser = (props: PropsToAddUser) => {

// Add user data
const addUserData = async () => {
// Hide table elements
if (props.setShowTableRows !== undefined) {
props.setShowTableRows(false);
}

// If 'userLogin' is not provided, use empty array
const usLogin = userLogin !== "" ? [userLogin] : [];

Expand Down Expand Up @@ -619,7 +614,7 @@ const AddUser = (props: PropsToAddUser) => {
isAdditionSuccess = true;
// Refresh data
if (props.onRefresh !== undefined) {
props.onRefresh(updatedUsersList);
props.onRefresh();
}

// Set alert: success
Expand All @@ -631,10 +626,6 @@ const AddUser = (props: PropsToAddUser) => {
handleAPIError(error);
}
}
// Show table elements
if (props.setShowTableRows !== undefined) {
props.setShowTableRows(true);
}
});
};

Expand Down
1 change: 0 additions & 1 deletion src/pages/ActiveUsers/ActiveUsers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,6 @@ const ActiveUsers = () => {
<AddUser
show={showAddModal}
from="active-users"
setShowTableRows={setShowTableRows}
handleModalToggle={onAddModalToggle}
onOpenAddModal={onAddClickHandler}
onCloseAddModal={onCloseAddModal}
Expand Down

0 comments on commit 10a3682

Please sign in to comment.