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


##########
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:
   Wouldn't it be more "correct" to just check to see if the dataum has 
bulletins here rather than rely on the css class being applied? If that class 
name changes or there is a bug in setting it in the future, it could throw off 
this logic, no?



-- 
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