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


##########
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:
   ```suggestion
                       return supportedKeys.includes(entry[0]) && 
Array.isArray(entry[1]);
   ```
   
   Thoughts on relaxing this condition? With it as-is, someone could export an 
empty flow definition and be rejected when pasting calling it an `incompatible 
format`.



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