freeipa-webui
freeipa-webui copied to clipboard
[UI] Pass the adding method directly to the 'AddUser' component
The AddUser
component receives the following props:
export interface PropsToAddUser {
show: boolean;
from: "active-users" | "stage-users" | "preserved-users";
handleModalToggle: () => void;
}
But these props can be enhanced. For example, the from
prop is used only when a specific user is about to be added. And, depending on that, a different 'add' function is used (addActiveUser
, addStageUser
, or addPreservedUser
).
if (props.from === "active-users") {
dispatch(addActiveUser(userData));
} else if (props.from === "stage-users") {
dispatch(addStageUser(userData));
} else if (props.from === "preserved-users") {
dispatch(addPreservedUser(userData));
}
RFE: Instead of passing the from
string to determine which 'add' operation to take, it would be better to pass the 'add' function directly to the AddUser
component.
This issue has not received any attention in 120 days.