Repository: kestra-io/kestra
Issue: Copy Flow button is not working anymore
Labels: bug
enhancement
frontend

### Expected Behavior

When I hit the Copy button on the flow page, a new flow with the same content should be created

### Actual Behaviour

The "default" flow is created with the following content: 

```
id: hello-world
namespace: dev
tasks:
  - id: hello
    type: io.kestra.core.tasks.log.Log
    message: Kestra team wishes you a great day! 👋
```

### Steps To Reproduce

1. Go to the editor of an existing flow
2. Click on Actions -> Copy

### Environment Information

- Kestra Version: 0.10.0
- Operating System (OS / Docker / Kubernetes):
- Java Version (If not docker):


### Example flow

_No response_

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/ui/src/components/flows/FlowCreate.vue b/ui/src/components/flows/FlowCreate.vue
index a12306fc95..c1883446af 100644
--- a/ui/src/components/flows/FlowCreate.vue
+++ b/ui/src/components/flows/FlowCreate.vue
@@ -9,7 +9,7 @@
             :total="total"
             :guided-properties="guidedProperties"
             :flow-error="flowError"
-            :flow="flowWithSource"
+            :flow="sourceWrapper"
         />
     </div>
     <div id="guided-right" />
@@ -19,38 +19,36 @@
     import EditorView from "../inputs/EditorView.vue";
     import {mapGetters, mapState} from "vuex";
     import RouteContext from "../../mixins/routeContext";
-    import YamlUtils from "../../utils/yamlUtils";
 
     export default {
         mixins: [RouteContext],
         components: {
             EditorView
         },
-        data() {
-            return {
-                defaultFlowTemplate: {
-                    id: "hello-world",
-                    namespace: "dev",
-                    tasks: [{
-                        id: "hello",
-                        type: "io.kestra.core.tasks.log.Log",
-                        message: "Kestra team wishes you a great day! 👋"
-                    }]
-                }
-            }
-        },
         beforeUnmount() {
             this.$store.commit("flow/setFlowError", undefined);
         },
         computed: {
-            flowWithSource() {
-                return {source: YamlUtils.stringify(this.defaultFlowTemplate)};
+            sourceWrapper() {
+                return {source: this.defaultFlowTemplate};
+            },
+            defaultFlowTemplate() {
+                if(this.$route.query.copy && this.flow){
+                    return this.flow.source;
+                }
+
+                return `id: hello-world
+namespace: dev
+tasks:
+  - id: hello
+    type: io.kestra.core.tasks.log.Log
+    message: Kestra team wishes you a great day! 👋`;
             },
             ...mapState("flow", ["flowGraph", "total"]),
             ...mapState("auth", ["user"]),
             ...mapState("plugin", ["pluginSingleList", "pluginsDocumentation"]),
             ...mapGetters("core", ["guidedProperties"]),
-            ...mapGetters("flow", ["flowError"]),
+            ...mapGetters("flow", ["flow", "flowError"]),
             routeInfo() {
                 return {
                     title: this.$t("flows")
diff --git a/ui/src/components/inputs/EditorView.vue b/ui/src/components/inputs/EditorView.vue
index b9a51e9955..90db63297b 100644
--- a/ui/src/components/inputs/EditorView.vue
+++ b/ui/src/components/inputs/EditorView.vue
@@ -74,10 +74,6 @@
             type: Boolean,
             default: false
         },
-        sourceCopy: {
-            type: String,
-            default: null
-        },
         total: {
             type: Number,
             default: null


Test patch: