freeipa / freeipa-webui

FreeIPA Web UI
GNU General Public License v3.0
22 stars 10 forks source link

[UI] Pass the adding method directly to the 'AddUser' component #97

Open carma12 opened 1 year ago

carma12 commented 1 year ago

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.

github-actions[bot] commented 8 months ago

This issue has not received any attention in 120 days.