Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Is a member of][User groups] 'Add' button functionality #298

Merged
merged 1 commit into from
Mar 12, 2024

Conversation

carma12
Copy link
Collaborator

@carma12 carma12 commented Feb 28, 2024

The 'Add' button functionality allows associating any user group's member to a given user.

To ensure that an Alert component will be displayed after a new addition, a new interface AlertObject has been created to refer to a given alert (const alerts = useAlerts()) passed through props to a children component.

This PR depends on this one to be merged: #297

@carma12 carma12 force-pushed the user-groups-add-button-2 branch 2 times, most recently from 4dd7c04 to 0338952 Compare March 7, 2024 12:49
src/components/MemberOf/MemberOfUserGroups.tsx Outdated Show resolved Hide resolved
src/services/rpc.ts Outdated Show resolved Hide resolved
src/components/MemberOf/MemberOfUserGroups.tsx Outdated Show resolved Hide resolved
@carma12
Copy link
Collaborator Author

carma12 commented Mar 8, 2024

@pvoborni - The code has been corrected based on your feedback.

@carma12 carma12 force-pushed the user-groups-add-button-2 branch 2 times, most recently from 4e8b00b to 36d34ea Compare March 11, 2024 12:58
Copy link
Member

@pvoborni pvoborni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next round of review finished.

src/utils/utils.tsx Outdated Show resolved Hide resolved
src/services/rpc.ts Outdated Show resolved Hide resolved
@mreynolds389
Copy link
Collaborator

Besides @pvoborni comments, LGTM

@carma12
Copy link
Collaborator Author

carma12 commented Mar 12, 2024

@pvoborni - There is one comment of yours that refers to outdated code in rpc.ts file and for some reason, I can't add more comments in that thread. Just a heads-up/FYI: I already changed that and now the endpoints look like this:

addToGroups: build.mutation<BatchRPCResponse, [string, string, string[]]>({
      query: (payload) => {
        const toId = payload[0];
        const type = payload[1];
        const listOfMembers = payload[2];
        const membersToAdd: Command[] = [];
        listOfMembers.map((member) => {
          const payloadItem = {
            method: "group_add_member",
            params: [[member], { [type]: toId }],
          } as Command;
          membersToAdd.push(payloadItem);
        });
        return getBatchCommand(membersToAdd, API_VERSION_BACKUP);
      },
    }),

Basically, I added a third parameter that refers to the type, so it would be adapted to the entity provided. WDYT?

@carma12 carma12 force-pushed the user-groups-add-button-2 branch 2 times, most recently from dd7195f to 00dabd5 Compare March 12, 2024 12:51
@pvoborni
Copy link
Member

@pvoborni - There is one comment of yours that refers to outdated code in rpc.ts file and for some reason, I can't add more comments in that thread. Just a heads-up/FYI: I already changed that and now the endpoints look like this:

Basically, I added a third parameter that refers to the type, so it would be adapted to the entity provided. WDYT?

The comment might have been attached to outdate code (not sure why), but it was about this implementation and still applies fully.

The 'Add' button functionality allows
to associate any user group's member
to a given user.

Signed-off-by: Carla Martinez <[email protected]>
@carma12 carma12 force-pushed the user-groups-add-button-2 branch from 00dabd5 to 321b371 Compare March 12, 2024 15:48
@carma12
Copy link
Collaborator Author

carma12 commented Mar 12, 2024

@pvoborni - There is one comment of yours that refers to outdated code in rpc.ts file and for some reason, I can't add more comments in that thread. Just a heads-up/FYI: I already changed that and now the endpoints look like this:
Basically, I added a third parameter that refers to the type, so it would be adapted to the entity provided. WDYT?

The comment might have been attached to outdate code (not sure why), but it was about this implementation and still applies fully.

Understood. I have already corrected the code.

Copy link
Member

@pvoborni pvoborni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@carma12 carma12 merged commit df48d66 into freeipa:main Mar 12, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants