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


##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/canvas.component.ts:
##########
@@ -759,10 +760,45 @@ export class Canvas implements OnInit, OnDestroy {
                 return copyResponse;
             }
 
-            // attempting to paste something other than CopyResponseEntity
+            // check to see if this is a FlowDefinition
+            const maybeFlowDefinition: any = JSON.parse(json);
+            const isFlowDefinition = 
this.nifiCommon.isDefinedAndNotNull(maybeFlowDefinition.flowContents);
+            if (isFlowDefinition) {
+                // make sure the flow has some components
+                const flowHasCopiedContent = 
Object.entries(maybeFlowDefinition.flowContents).some((entry) => {
+                    return supportedKeys.includes(entry[0]) && 
Array.isArray(entry[1]) && entry[1].length > 0;

Review Comment:
   Yeah, i did consider that originally but decided against it just to be 
consistent with the logic for verifying the CopyResponseEntity. However, these 
are a bit different use cases so I can make that change.



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