TheThingsNetwork/lorawan-stack

Use the SearchAccount entity's collaborator complement when adding collaborators via the Console

nicholaspcr opened this issue · 1 comments

Summary

References #6908

Currently when adding a new collaborator via the Console we search for accounts within the Stack and list them to the user. This has the problem of showing accounts that are already collaborators of the entity.

Therefore we need to update the Console to add the newly introduced complement_collaborators field to the SearchAccounts request, which removes the entity's collaborators from the results, making it impossible to select one of the entity's collaborators when adding a new one.

Current Situation

  1. After pressing the Add collaborator button you are shown the following section
    image

  2. When the user starts typing we perform a call to /api/v3/search/accounts?query=<field_content>&only_users=false.

  3. This occurs in all the entities with collaborators and lists all the accounts, instead of the ones not already present in the collaborator list of the entity.

Why do we need this? Who uses it, and when?

The user uses it when adding a new collaborator and changing it would stop accounts that are already a collaborator to shown in the list of accounts to add in the entity list of collaborators.

Proposed Implementation

  1. Update the select-account: [action, store/middleware, service] to include the new complement_collaborators field to be added to the request.
  2. Update ConsoleCollaboratorsForm usage in different views to include the complement_collaborators as true, making it the result of the SearchAccount request to exclude the entity's collaborators.

There might be some more changes but I believe the main logic behind the change it is encapsulated in the two steps.

Contributing

  • I can help by doing more research.
  • I can help by implementing the feature after the proposal above is approved.
  • I can help by testing the feature before it's released.

Code of Conduct

Thanks for the issue @nicholaspcr. @PavelJankoski can pick this up for v3.30.0.