mcgilman commented on code in PR #10409:
URL: https://github.com/apache/nifi/pull/10409#discussion_r2453436720


##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-actions.service.ts:
##########
@@ -535,6 +538,102 @@ export class CanvasActionsService {
                     })
                 );
             }
+        },
+        clearBulletins: {
+            id: 'clearBulletins',
+            condition: (selection: d3.Selection<any, any, any, any>) => {
+                // Empty selection means user is opening context menu for 
current process group
+                if (selection.empty()) {
+                    // Use d3 to select components with has-bulletins class
+                    // If this selection is non-empty, clear bulletins action 
should be available
+                    const componentsWithBulletins = 
d3.selectAll('g.component.has-bulletins');
+                    return !componentsWithBulletins.empty();
+                }
+
+                // Show clear bulletins option only when there are bulletins 
to clear
+                if (selection.size() === 1) {
+                    const d = selection.datum();
+
+                    // For individual components (not process groups), check 
write permissions
+                    if (d.type !== ComponentType.ProcessGroup) {
+                        if (!d.permissions.canWrite) {
+                            return false;
+                        }
+                    }
+
+                    // Check if the component has the has-bulletins class
+                    return selection.classed('has-bulletins');

Review Comment:
   Thanks for the initial review! In this same method we rely on 
`has-bulletins` when the selection is empty (context is the current group). 
When processing the bulletins for any component on the canvas, we use the same 
logic to label the component with the `has-bulletins` class. We could instead 
check the presence of bulletins here, but since the component is already 
labeled with `has-bulletins` for the empty selection case, I thought check the 
same here was appropriate. If you feel strongly though, I'm happy to update.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to