NIFI-9543: Add bring-to-front functionality to labels#5765
NIFI-9543: Add bring-to-front functionality to labels#5765mcgilman merged 8 commits intoapache:mainfrom
Conversation
|
Reviewing... |
| // update | ||
| var updated = selection.merge(entered); | ||
| updated.call(updateLabels).call(nfCanvasUtils.position, transition); | ||
| updated.call(updateLabels).call(nfCanvasUtils.position, transition).call(sort); |
There was a problem hiding this comment.
We also need to introduce a call to sort in add. When a new Label is created, it's z-index will be 0. If it is placed directly on top of another Label that already has an established z-index we need to ensure this is rendered below. By default, it will render on top because it was added to the DOM later. If you try this out, you'll see it renders on top until the canvas polls which triggers a call to update that will re-sort and move the new Label below.
There was a problem hiding this comment.
Thanks for pointing this out. Unfortunately, I still see the behavior your describing even after updating add at line 484 from
// update
updateLabels(selection.merge(entered));
to
// update
var updated = selection.merge(entered);
updated.call(updateLabels).call(nfCanvasUtils.position, transition).call(sort);
Does anything look off to you about that block of code?
There was a problem hiding this comment.
@sardell At first glance, this looks ok. Have you verified that the value of the zIndex coming back in the creation response? I wonder if it could be comparing undefined with some number. Setting a break point in sort should help steer in the right direction.
There was a problem hiding this comment.
@mcgilman Turned out that transition wasn't defined in add. This should now be functioning correctly.
mcgilman
left a comment
There was a problem hiding this comment.
Thanks @sardell! Changes look good to me. Verified the zIndex are persisted and restored when NiFi restarts. Also verified the presence of the zIndex in the flow downloaded through the UI. Also verified the UI honored the zIndex when navigating throughout the flow.
I would appreciate a quick review from @markap14 to verify that all the necessary places are updated to include the new field.
|
Thanks @mcgilman . I haven't had a chance to completely review/test this yet. One thing that I think we need to address, though, is something that I just noticed the other day with the 'retry' fields that were recently added. I had to make a small update: https://github.com/apache/nifi/pull/5809/files#diff-fcc9a36983c80e3ddfb13c77ac2db46d83346e6f55f84f44cedfc7a33bf43e02R67-R177 The issue here was related to the fact that we add a new field to a component. So in this case, zIndex is added to label. If you've pushed your flow to Registry using 1.15.3 or earlier, and now you startup with this version, we end up seeing a "Local Change" to each of those labels. And you can't revert the change. As a result, you won't be able to change to a later version. So we need to make a similar update here: If there's a flow difference that changes the zIndex from |
* NIFI-9543: add bring-to-front functionality to labels * NIFI-9543: update zIndex changes to persist after shutdown * NIFI-9543: remove commented code * NIFI-9543: update flow comparator and snippet to account for zIndex * NIFI-9543: changed add function to sort labels when a new label is added * NIFI-9543: remove unnecessary call to position * NIFI-9543: only register difference if zIndex is not default value * NIFI-9543: add null checks to prevent primitive Long This closes apache#5765
* NIFI-9543: add bring-to-front functionality to labels * NIFI-9543: update zIndex changes to persist after shutdown * NIFI-9543: remove commented code * NIFI-9543: update flow comparator and snippet to account for zIndex * NIFI-9543: changed add function to sort labels when a new label is added * NIFI-9543: remove unnecessary call to position * NIFI-9543: only register difference if zIndex is not default value * NIFI-9543: add null checks to prevent primitive Long This closes apache#5765
Thank you for submitting a contribution to Apache NiFi.
Please provide a short description of the PR here:
Link to Jira: https://issues.apache.org/jira/browse/NIFI-9543
This PR adds bring-to-front functionality to labels on the canvas. To test, add multiple overlapping labels on the canvas, right click on a label below the others to open the context menu and choose
Bring to Front. The label should now be at the top of the other overlapping labels. This label that's now at the front should be persisted even after shutting down and restarting NiFi.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
squashor use--forcewhen pushing to allow for clean monitoring of changes.For code changes:
mvn -Pcontrib-check clean installat the rootnififolder?LICENSEfile, including the mainLICENSEfile undernifi-assembly?NOTICEfile, including the mainNOTICEfile found undernifi-assembly?.displayNamein addition to .name (programmatic access) for each of the new properties?For documentation related changes:
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.