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

NIFI-11461 Improve User and Group Tenants Search #7181

Merged
merged 2 commits into from
Apr 19, 2023

Conversation

exceptionfactory
Copy link
Contributor

Summary

NIFI-11461 Improves the performance of the User and Group Tenants Search REST Resource method with the addition of a searchTenants method to the NiFiServiceFacade.

The previous implementation called getUsers() and getUserGroups() in the Tenants Resource, which requires retrieving all users and all group members before evaluating the query.

The new implementation passes the query string to the NiFiServiceFacade.searchTenants() method and applies the filtering criteria prior to additional object creation. This approach reduces the number of method calls significantly for large numbers of users and groups.

Additional changes include adjusting the user interface autocomplete delay from the default 300 ms to 500 ms, minimizing the number of HTTP requests in some scenarios.

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using mvn clean install -P contrib-check
    • JDK 11
    • JDK 17

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

- Added searchTenants method to NiFiServiceFacade and removed unnecessary object creation
- Updated TenantsResource to use delegated NiFiServiceFacade.searchTenants method
- Changed autocomplete delay from default 300 ms to 500 ms
@mcgilman
Copy link
Contributor

Will review...

@mcgilman mcgilman self-requested a review April 17, 2023 20:54
Copy link
Contributor

@mcgilman mcgilman left a comment

Choose a reason for hiding this comment

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

Thanks @exceptionfactory! Looks great... I verified the new behavior but did notice a minor thing we may want to update prior to merging.

return createTenantEntity(tenant, permissions);
}

private TenantEntity createTenantEntity(final Group userGroup, final PermissionsDTO permissions) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Our EntityFactory already contains methods for creating a TenantEntity given a tenant, revision, and permissions. Can we use that in favor of these new methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointer to EntityFactory, I pushed an update removing the private methods and adjusting the stream function to make use of EntityFactory.createTenantEntity().

Copy link
Contributor

@mcgilman mcgilman left a comment

Choose a reason for hiding this comment

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

Thanks for the update @exceptionfactory. Nice work! +1

@mcgilman mcgilman merged commit bdff3ab into apache:main Apr 19, 2023
exceptionfactory added a commit that referenced this pull request Apr 19, 2023
* NIFI-11461 Improved User and Group Tenants Search

- Added searchTenants method to NiFiServiceFacade and removed unnecessary object creation
- Updated TenantsResource to use delegated NiFiServiceFacade.searchTenants method
- Changed autocomplete delay from default 300 ms to 500 ms

* NIFI-11461 Adjusted implementation to use EntityFactory.createTenantEntity

This closes #7181

(cherry picked from commit bdff3ab)
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.

2 participants