You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/05/04 13:44:09 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #15574: #12401 - Duplicating connections from UI

uranusjr commented on a change in pull request #15574:
URL: https://github.com/apache/airflow/pull/15574#discussion_r625793649



##########
File path: airflow/www/views.py
##########
@@ -3012,6 +3015,57 @@ def action_muldelete(self, items):
         self.update_redirect()
         return redirect(self.get_redirect())
 
+    @action(
+        'mulduplicate',
+        'Duplicate',
+        'Are you sure you want to duplicate the selected connections?',
+        single=False,
+    )
+    @provide_session
+    @auth.has_access(
+        [
+            (permissions.ACTION_CAN_CREATE, permissions.RESOURCE_CONNECTION),
+        ]
+    )
+    def action_mulduplicate(self, connections, session=None):
+        """Duplicate Multiple connections"""
+        for selected_conn in connections:
+            new_conn_id = selected_conn.conn_id
+            matches = re.findall(r"_Copy\((\d+)\)", selected_conn.conn_id)

Review comment:
       Is it intended to find `_CopyX` *anywhere*? Since the logic below only always adds a suffix, I would expect this to only check for a suffix as well.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org