Repository: kestra-io/kestra (java)

Issue:
New flow first save do not route to the edit flow tab
### Describe the issue

https://jam.dev/c/85fb29b2-4389-4999-b7c8-b84896e60cd9

What it should have looked like :
![Image](https://github.com/user-attachments/assets/5ab1a9f6-d379-4772-8ec1-e4e9c966b0f6)

What it look like after the first save : 
![Image](https://github.com/user-attachments/assets/e7f36569-3437-4bf0-9e39-9801a5ce62b6)

### Environment

- Kestra Version: develop

![Image](https://github.com/user-attachments/assets/b0c0463a-b77e-4f9b-a582-dc781fa5f9fc)

Pull request:
fix(ui): set isCreating to false when opening flow edit mode
closes #8530


Patch:
diff --git a/core/src/main/java/io/kestra/plugin/core/dashboard/chart/TimeSeries.java b/core/src/main/java/io/kestra/plugin/core/dashboard/chart/TimeSeries.java
index 610780d30..4df3883e8 100644
--- a/core/src/main/java/io/kestra/plugin/core/dashboard/chart/TimeSeries.java
+++ b/core/src/main/java/io/kestra/plugin/core/dashboard/chart/TimeSeries.java
@@ -34,7 +34,7 @@ import lombok.experimental.SuperBuilder;
                   "- id: executions_timeseries\n" +
                     "type: io.kestra.plugin.core.dashboard.chart.TimeSeries\n" +
                     "chartOptions:\n" +
-                        "displayName: Executions\n" +
+                        "displayName: Total Executions\n" +
                         "description: Executions last week\n" +
                         "legend:\n" +
                             "enabled: true\n" +
diff --git a/ui/src/components/dashboard/components/DashboardCreate.vue b/ui/src/components/dashboard/components/DashboardCreate.vue
index c91f33f30..04600e463 100644
--- a/ui/src/components/dashboard/components/DashboardCreate.vue
+++ b/ui/src/components/dashboard/components/DashboardCreate.vue
@@ -36,7 +36,7 @@ charts:
   - id: executions_timeseries
     type: io.kestra.plugin.core.dashboard.chart.TimeSeries
     chartOptions:
-      displayName: Executions
+      displayName: Total Executions
       description: Executions duration and count per date
       legend:
         enabled: true
diff --git a/ui/src/components/dashboard/components/charts/executions/Bar.vue b/ui/src/components/dashboard/components/charts/executions/Bar.vue
index b7c71924d..804386d9f 100644
--- a/ui/src/components/dashboard/components/charts/executions/Bar.vue
+++ b/ui/src/components/dashboard/components/charts/executions/Bar.vue
@@ -5,10 +5,7 @@
         >
             <div class="info-block">
                 <p class="m-0 fs-6">
-                    <span class="fw-bold">{{ t("executions") }}</span>
-                    <span class="fw-light small">
-                        {{ t("dashboard.per_day") }}
-                    </span>
+                    <span class="fw-bold">{{ t("dashboard.total_executions") }}</span>
                 </p>
                 <p class="m-0 fs-2">
                     <el-skeleton v-if="loading" :rows="0" />
diff --git a/ui/src/components/flows/FlowRoot.vue b/ui/src/components/flows/FlowRoot.vue
index bcfea998f..2675d5a7c 100644
--- a/ui/src/components/flows/FlowRoot.vue
+++ b/ui/src/components/flows/FlowRoot.vue
@@ -71,6 +71,12 @@
                 const tab = localStorage.getItem("flowDefaultTab") || undefined;
                 this.$router.replace({name: "flows/update", params: {...this.$route.params, tab}});
             }
+            // since this component is only used in edition
+            // we need to set the flag as editing in the store.
+            // Specifically, it would be a problem when saving a new flow
+            // and moving to edit mode.
+            // NOTE: Flow creation component is ./FlowCreate.vue
+            this.$store.commit("flow/setIsCreating", false);
 
             this.load();
         },
diff --git a/webserver/src/main/java/io/kestra/webserver/controllers/api/ExecutionController.java b/webserver/src/main/java/io/kestra/webserver/controllers/api/ExecutionController.java
index 86dbc33be..af1276900 100644
--- a/webserver/src/main/java/io/kestra/webserver/controllers/api/ExecutionController.java
+++ b/webserver/src/main/java/io/kestra/webserver/controllers/api/ExecutionController.java
@@ -209,7 +209,7 @@ public class ExecutionController {
                 query,
                 namespace,
                 flowId,
-                triggerExecutionId,
+                null,
                 null,
                 startDate,
                 endDate,
@@ -218,10 +218,9 @@ public class ExecutionController {
                 timeRange,
                 childFilter,
                 state,
-                null);
+                null,
+                triggerExecutionId);
         }
-        final ZonedDateTime now = ZonedDateTime.now();
-
         TimeLineSearch timeLineSearch = TimeLineSearch.extractFrom(filters);
         validateTimeline(timeLineSearch.getStartDate(), timeLineSearch.getEndDate());
 
diff --git a/webserver/src/main/java/io/kestra/webserver/controllers/api/FlowController.java b/webserver/src/main/java/io/kestra/webserver/controllers/api/FlowController.java
index 7c7060c54..3cc9a2f57 100644
--- a/webserver/src/main/java/io/kestra/webserver/controllers/api/FlowController.java
+++ b/webserver/src/main/java/io/kestra/webserver/controllers/api/FlowController.java
@@ -253,6 +253,7 @@ public class FlowController {
                 null,
                 null,
                 null,
+                null,
                 null);
         }
 
diff --git a/webserver/src/main/java/io/kestra/webserver/controllers/api/LogController.java b/webserver/src/main/java/io/kestra/webserver/controllers/api/LogController.java
index 234922fab..1f5e297c0 100644
--- a/webserver/src/main/java/io/kestra/webserver/controllers/api/LogController.java
+++ b/webserver/src/main/java/io/kestra/webserver/controllers/api/LogController.java
@@ -88,10 +88,9 @@ public class LogController {
                 null,
                 null,
                 null,
+                null,
                 null);
         }
-        final ZonedDateTime now = ZonedDateTime.now();
-
         TimeLineSearch timeLineSearch = TimeLineSearch.extractFrom(filters);
         validateTimeline(timeLineSearch.getStartDate(), timeLineSearch.getEndDate());
 
diff --git a/webserver/src/main/java/io/kestra/webserver/controllers/api/TaskRunController.java b/webserver/src/main/java/io/kestra/webserver/controllers/api/TaskRunController.java
index 41bce480c..2e8f23a87 100644
--- a/webserver/src/main/java/io/kestra/webserver/controllers/api/TaskRunController.java
+++ b/webserver/src/main/java/io/kestra/webserver/controllers/api/TaskRunController.java
@@ -72,7 +72,7 @@ public class TaskRunController {
                 query,
                 namespace,
                 flowId,
-                triggerExecutionId,
+                null,
                 null,
                 startDate,
                 endDate,
@@ -81,7 +81,8 @@ public class TaskRunController {
                 timeRange,
                 childFilter,
                 state,
-                null);
+                null,
+                triggerExecutionId);
         }
         final ZonedDateTime now = ZonedDateTime.now();
 
diff --git a/webserver/src/main/java/io/kestra/webserver/controllers/api/TriggerController.java b/webserver/src/main/java/io/kestra/webserver/controllers/api/TriggerController.java
index d25e3871b..6e727dcb9 100644
--- a/webserver/src/main/java/io/kestra/webserver/controllers/api/TriggerController.java
+++ b/webserver/src/main/java/io/kestra/webserver/controllers/api/TriggerController.java
@@ -101,7 +101,8 @@ public class TriggerController {
                 null,
                 null,
                 null,
-                workerId);
+                workerId,
+                null);
         }
         ArrayListTotal<Trigger> triggerContexts = triggerRepository.find(
             PageableUtils.from(page, size, sort, triggerRepository.sortMapping()),
diff --git a/webserver/src/main/java/io/kestra/webserver/utils/RequestUtils.java b/webserver/src/main/java/io/kestra/webserver/utils/RequestUtils.java
index d2bb18270..d7147f100 100644
--- a/webserver/src/main/java/io/kestra/webserver/utils/RequestUtils.java
+++ b/webserver/src/main/java/io/kestra/webserver/utils/RequestUtils.java
@@ -1,6 +1,7 @@
 package io.kestra.webserver.utils;
 
 import io.kestra.core.models.QueryFilter;
+import io.kestra.core.models.QueryFilter.Field;
 import io.kestra.core.models.flows.FlowScope;
 import io.kestra.core.models.flows.State;
 import io.kestra.core.repositories.ExecutionRepositoryInterface;
@@ -48,7 +49,8 @@ public class RequestUtils {
         Duration timeRange,
         ExecutionRepositoryInterface.ChildFilter childFilter,
         List<State.Type> state,
-        String workerId
+        String workerId,
+        String triggerExecutionId
     ) {
 
         List<QueryFilter> filters = new ArrayList<>();
@@ -150,6 +152,13 @@ public class RequestUtils {
                 .value(workerId)
                 .build());
         }
+        if (triggerExecutionId != null) {
+            filters.add(QueryFilter.builder()
+                .field(Field.TRIGGER_EXECUTION_ID)
+                .operation(QueryFilter.Op.EQUALS)
+                .value(triggerExecutionId)
+                .build());
+        }
 
         return filters;
     }


Test patch:
diff --git a/webserver/src/test/java/io/kestra/webserver/controllers/api/ExecutionControllerTest.java b/webserver/src/test/java/io/kestra/webserver/controllers/api/ExecutionControllerTest.java
index bc71f350b..904f421cf 100644
--- a/webserver/src/test/java/io/kestra/webserver/controllers/api/ExecutionControllerTest.java
+++ b/webserver/src/test/java/io/kestra/webserver/controllers/api/ExecutionControllerTest.java
@@ -373,6 +373,10 @@ class ExecutionControllerTest {
         MutableHttpRequest<Object> searchRequest_oldParameters = HttpRequest
             .GET("/api/v1/executions/search?labels=project:foo,bar");
         assertThat(client.toBlocking().retrieve(searchRequest_oldParameters, PagedResults.class).getTotal()).isEqualTo(2L);
+
+        MutableHttpRequest<Object> searchRequest_triggerExecution = HttpRequest
+            .GET("/api/v1/executions/search?triggerExecutionId=test");
+        assertThat(client.toBlocking().retrieve(searchRequest_triggerExecution, PagedResults.class).getTotal()).isEqualTo(0L);
     }
 
     @Test
diff --git a/webserver/src/test/java/io/kestra/webserver/utils/RequestUtilsTest.java b/webserver/src/test/java/io/kestra/webserver/utils/RequestUtilsTest.java
index c5bd6078f..3f4e5cc45 100644
--- a/webserver/src/test/java/io/kestra/webserver/utils/RequestUtilsTest.java
+++ b/webserver/src/test/java/io/kestra/webserver/utils/RequestUtilsTest.java
@@ -1,6 +1,7 @@
 package io.kestra.webserver.utils;
 
 import io.kestra.core.models.QueryFilter;
+import io.kestra.core.models.QueryFilter.Field;
 import io.kestra.core.models.flows.FlowScope;
 import io.kestra.core.models.flows.State;
 import io.kestra.core.repositories.ExecutionRepositoryInterface;
@@ -44,7 +45,8 @@ class RequestUtilsTest {
             timeRange,
             ExecutionRepositoryInterface.ChildFilter.MAIN,
             state,
-            "worker-1"
+            "worker-1",
+            "test_trigger_id"
         );
 
         assertTrue(filters.stream().anyMatch(f -> f.field() == QueryFilter.Field.QUERY && f.value().equals("test-query")));
@@ -55,12 +57,13 @@ class RequestUtilsTest {
         assertTrue(filters.stream().anyMatch(f -> f.field() == QueryFilter.Field.END_DATE && f.value().equals(endDate.toString())));
         assertTrue(filters.stream().anyMatch(f -> f.field() == QueryFilter.Field.TIME_RANGE && f.value().equals(timeRange)));
         assertTrue(filters.stream().anyMatch(f -> f.field() == QueryFilter.Field.STATE && f.value().equals(state)));
+        assertTrue(filters.stream().anyMatch(f -> f.field() == Field.TRIGGER_EXECUTION_ID && f.value().equals("test_trigger_id")));
     }
 
     @Test
     void testMapLegacyParamsToFiltersHandlesNulls() {
         List<QueryFilter> filters = RequestUtils.mapLegacyParamsToFilters(
-            null, null, null, null, null, null, null, null, null, null, null, null, null
+            null, null, null, null, null, null, null, null, null, null, null, null, null, null
         );
 
         assertTrue(filters.isEmpty(), "Filters should be empty when all inputs are null.");