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-9628: Added a uiOnly flag when requesting Controller Service det… #5712

Merged
merged 3 commits into from
Feb 3, 2022

Conversation

markap14
Copy link
Contributor

…ails and the list of Controller Services. This allows us to return much less data when retrieving these resources.

Thank you for submitting a contribution to Apache NiFi.

Please provide a short description of the PR here:

Description of PR

Enables X functionality; fixes bug NIFI-YYYY.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced
    in the commit message?

  • Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.

  • Has your PR been rebased against the latest commit within the target branch (typically main)?

  • Is your initial contribution a single, squashed commit? Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not squash or use --force when pushing to allow for clean monitoring of changes.

For code changes:

  • Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
  • Have you written or updated unit tests to verify your changes?
  • Have you verified that the full build is successful on JDK 8?
  • Have you verified that the full build is successful on JDK 11?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?
  • If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
  • If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

Note:

Please ensure that once the PR is submitted, you check GitHub Actions CI for build issues and submit an update to your PR as soon as possible.

…ails and the list of Controller Services. This allows us to return much less data when retrieving these resources.
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 PR @markap14! Considering the motivation for this PR, I think you could also consider adding the uiOnly flag to PUT /nifi-api/controller-services/{id}/references and PUT /nifi-api/controller-services/{id}/run-status. Currently when enabling or disabling a Controller Service we invoke these APIs and it is still returning the referencing component descriptors and properties.

dataType: 'json'
dataType: 'json',
data: {
uiOnly: true
Copy link
Contributor

Choose a reason for hiding this comment

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

The parameter contexts endpoint does not support the uiOnly parameter. Was this added inadvertently?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, good catch. That was definitely inadvertently

@@ -1015,4 +1018,33 @@ private void normalizeCoordinates(Collection<? extends ComponentDTO> components)
}
}

public static void stripNonUiRelevantFields(final ControllerServiceEntity serviceEntity) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What was the motivation for adding these methods to SnippetUtils?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's referenced from a few different places. So I wanted to extract the logic into some sort of utility class that could be easily referenced from all of the resources that needed it. We could create a separate util class - ControllerServiceUtils or something like that maybe? Didn't feel like that warranted its own util class, and i figured one could argue that this deals with a snippet of the flow. Though I suppose this util class is actually intended for interacting with Snippets with a capital S, the specific components. I could move it into its own util class if you prefer.

Copy link
Contributor

Choose a reason for hiding this comment

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

SnippetUtils is intended for interacting with Snippets with a capital S. We could do another class or we could even put it in the ApplicationResource. I believe all the calling code is in a class that extends ApplicationResource.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah fair. Could definitely put it in ApplicationResource.

@markap14
Copy link
Contributor Author

markap14 commented Feb 1, 2022

Thanks for reviewing @mcgilman . I pushed a new commit that I believe addresses all of the above.

@mcgilman mcgilman self-requested a review February 3, 2022 20:52
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.

@markap14 thanks for the updates! +1 looks great.

@mcgilman mcgilman merged commit 230ed9c into apache:main Feb 3, 2022
krisztina-zsihovszki pushed a commit to krisztina-zsihovszki/nifi that referenced this pull request Jun 28, 2022
apache#5712)

* NIFI-9628: Added a uiOnly flag when requesting Controller Service details and the list of Controller Services. This allows us to return much less data when retrieving these resources.

* NIFI-9628: Addressed review feedback; added uiOnly flag for controller service run-status and references also

* NIFI-9628: Fixed checkstyle issues by removing unused imports

This closes apache#5712
Lehel44 pushed a commit to Lehel44/nifi that referenced this pull request Jul 1, 2022
apache#5712)

* NIFI-9628: Added a uiOnly flag when requesting Controller Service details and the list of Controller Services. This allows us to return much less data when retrieving these resources.

* NIFI-9628: Addressed review feedback; added uiOnly flag for controller service run-status and references also

* NIFI-9628: Fixed checkstyle issues by removing unused imports

This closes apache#5712
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