feedback-to-code/mozzarella huggingface dataset:
Repository: kestra-io/kestra
Issue: Change Download link in output with proper button
Labels: enhancement
frontend

### Feature description

Related to #1767 , use a proper button for the Download link in output tab

![image](https://github.com/kestra-io/kestra/assets/46634684/a292065f-c6f6-4617-a6cf-70859abdc73c)


Issue comments:

Pull request review comments:
Already did the same somewhere and Ludo told me not to and let the default html link behaviour (meaning you encapsulate with `<a>` your button for eg.)
Not needed anymore

Patch that resolved the issue:
diff --git a/ui/src/components/executions/VarValue.vue b/ui/src/components/executions/VarValue.vue
index 5c320c8eac..4bc283155e 100644
--- a/ui/src/components/executions/VarValue.vue
+++ b/ui/src/components/executions/VarValue.vue
@@ -1,14 +1,11 @@
 <template>
-    <el-link
-        v-if="isFile(value)"
-        :icon="Download"
-        target="_blank"
-        type="primary"
-        :href="itemUrl(value)"
-    >
+    <a class="el-button el-button--primary mt-2 mb-2 " v-if="isFile(value)" :href="itemUrl(value)" target="_blank">
+        <Download />
+        &nbsp;
         {{ $t('download') }}
+        &nbsp;
         <span v-if="humanSize">({{ humanSize }})</span>
-    </el-link>
+    </a>
     <span v-else>
         {{ value }}
     </span>
@@ -34,8 +31,7 @@
             },
             itemUrl(value) {
                 return `${apiRoot}executions/${this.execution.id}/file?path=${value}`;
-            },
-
+            }
         },
         created() {
             if (this.isFile(this.value)) {


Test patch:
Repository: kestra-io/kestra
Issue: Blueprints with tasks not in Kestra instance have empty plugins' icons
Labels: bug
enhancement

### Expected Behavior

_No response_

### Actual Behaviour

We should fetch icons from both the Kestra instance (for custom plugins) and the Kestra's API (for non-installed plugins)
![image](https://github.com/kestra-io/kestra/assets/37618489/7848597d-b348-4694-b099-20c8397be284)


### Steps To Reproduce

_No response_

### Environment Information

- Kestra Version:
- 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/stores/api.js b/ui/src/stores/api.js
index 87fcaccf7d..2c60405d5f 100644
--- a/ui/src/stores/api.js
+++ b/ui/src/stores/api.js
@@ -42,6 +42,9 @@ export default {
                     counter: counter++,
                 }
             });
+        },
+        pluginIcons(_, __) {
+            return axios.get(API_URL + "/v1/plugins/icons", {})
         }
     },
     mutations: {
diff --git a/ui/src/stores/plugins.js b/ui/src/stores/plugins.js
index fc2f08d1cd..3879176b52 100644
--- a/ui/src/stores/plugins.js
+++ b/ui/src/stores/plugins.js
@@ -1,3 +1,5 @@
+import _merge from "lodash/merge";
+
 export default {
     namespaced: true,
     state: {
@@ -25,7 +27,7 @@ export default {
             }
 
             return this.$http.get(`/api/v1/plugins/${options.cls}`, {params: options}).then(response => {
-                if(options.all === true) {
+                if (options.all === true) {
                     commit("setPluginAllProps", response.data)
                 } else {
                     commit("setPlugin", response.data)
@@ -34,11 +36,15 @@ export default {
             })
         },
         icons({commit}) {
-            return this.$http.get("/api/v1/plugins/icons", {}).then(response => {
-                commit("setIcons", response.data)
+            return Promise.all([
+                this.$http.get("/api/v1/plugins/icons", {}),
+                this.dispatch("api/pluginIcons")
+            ]).then(responses => {
+                const icons = _merge(responses[0].data, responses[1].data);
+                commit("setIcons", icons);
 
-                return response.data;
-            })
+                return icons;
+            });
         },
         loadInputsType({commit}) {
             return this.$http.get(`/api/v1/plugins/inputs`, {}).then(response => {


Test patch:
Repository: kestra-io/kestra
Issue: Add index on execution labels


Issue comments:

Pull request review comments:
```suggestion
create index executions_labels ON executions USING GIN(value -> 'labels');
```
The first couple of parenthesis is for declaring the columns of the index, the second couple is the special way to define a column as a JSON Path. So both are needed.
:+1: 

Patch that resolved the issue:
diff --git a/jdbc-postgres/src/main/resources/migrations/postgres/V19__index_execution-labels.sql b/jdbc-postgres/src/main/resources/migrations/postgres/V19__index_execution-labels.sql
new file mode 100644
index 0000000000..b95bf43880
--- /dev/null
+++ b/jdbc-postgres/src/main/resources/migrations/postgres/V19__index_execution-labels.sql
@@ -0,0 +1,1 @@
+create index executions_labels ON executions USING GIN((value -> 'labels'));
\ No newline at end of file


Test patch:
Repository: kestra-io/kestra
Issue: UI: Timeout exceeded
Labels: bug

### Issue description

![image](https://github.com/kestra-io/kestra/assets/86264395/80b22006-a33a-45f8-a86c-93f40a5d435a)

![image](https://github.com/kestra-io/kestra/assets/86264395/22d9a756-0d32-4ad7-8e91-faa87a21b6e2)

![image](https://github.com/kestra-io/kestra/assets/86264395/2d1b84f3-c7af-447d-9325-39fe1ee120ef)

jump dumping it all as I have no idea what can be helpful here 😅 

Issue comments:
As we can see the /logs/search is causing the timeout, I guess it has to do with what we talked about this morning @loicmathieu with index on Postgres. Still I don't know why it has loaded on Blueprint page, did you come from another page before ?
yup, it's very likely that I came there from another page 👍 

Pull request review comments:

Patch that resolved the issue:
diff --git a/jdbc-h2/src/main/resources/migrations/h2/V18_index_logs.sql b/jdbc-h2/src/main/resources/migrations/h2/V18_index_logs.sql
new file mode 100644
index 0000000000..670d66af69
--- /dev/null
+++ b/jdbc-h2/src/main/resources/migrations/h2/V18_index_logs.sql
@@ -0,0 +1,3 @@
+DROP INDEX logs_namespace;
+DROP INDEX logs_timestamp;
+CREATE INDEX logs_namespace_flow ON logs (deleted, timestamp, level, namespace, flow_id);
\ No newline at end of file
diff --git a/jdbc-mysql/src/main/resources/migrations/mysql/V16_index_logs.sql b/jdbc-mysql/src/main/resources/migrations/mysql/V16_index_logs.sql
new file mode 100644
index 0000000000..7d7c3d5427
--- /dev/null
+++ b/jdbc-mysql/src/main/resources/migrations/mysql/V16_index_logs.sql
@@ -0,0 +1,3 @@
+DROP INDEX ix_namespace ON logs;
+DROP INDEX ix_timestamp ON logs;
+CREATE INDEX ix_namespace_flow ON logs (deleted, timestamp, level, namespace, flow_id);
\ No newline at end of file
diff --git a/jdbc-postgres/src/main/resources/migrations/postgres/V21_index_logs.sql b/jdbc-postgres/src/main/resources/migrations/postgres/V21_index_logs.sql
new file mode 100644
index 0000000000..670d66af69
--- /dev/null
+++ b/jdbc-postgres/src/main/resources/migrations/postgres/V21_index_logs.sql
@@ -0,0 +1,3 @@
+DROP INDEX logs_namespace;
+DROP INDEX logs_timestamp;
+CREATE INDEX logs_namespace_flow ON logs (deleted, timestamp, level, namespace, flow_id);
\ No newline at end of file


Test patch:
Repository: kestra-io/kestra
Issue: Add vertical alignment to the Topology view in the editor
Labels: bug

### Expected Behavior

The button to switch between vertical/horizontal (as it used to be) would be the best solution. 

if not possible to bring it back, make vertical view to be the default 

### Actual Behaviour

the horizontal display is the default 

![image](https://github.com/kestra-io/kestra/assets/86264395/ab22d9f5-4143-47b5-a841-e7858cf5820c)
 the 

### Steps To Reproduce

_No response_

### Environment Information

- Kestra Version: develop full image



### Example flow

_No response_

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/ui/src/components/inputs/LowCodeEditor.vue b/ui/src/components/inputs/LowCodeEditor.vue
index 8923583025..ff587c3674 100644
--- a/ui/src/components/inputs/LowCodeEditor.vue
+++ b/ui/src/components/inputs/LowCodeEditor.vue
@@ -109,6 +109,12 @@
         generateGraph();
     })
 
+    watch(() => props.viewType, () => {
+        isHorizontal.value = props.viewType === "source-topology" ? false :
+            (props.viewType?.indexOf("blueprint") !== -1 ? true : localStorage.getItem("topology-orientation") === "1")
+        generateGraph();
+    })
+
     // Event listeners & Watchers
     const observeWidth = () => {
         const resizeObserver = new ResizeObserver(function () {
@@ -549,7 +555,7 @@
 
 <template>
     <div ref="vueFlow" class="vueflow">
-        <slot name="top-bar"/>
+        <slot name="top-bar" />
         <VueFlow
             v-model="elements"
             :default-marker-color="cssVariable('--bs-cyan')"


Test patch:
Repository: kestra-io/kestra
Issue: Table : "Select All" is bugged
Labels: bug

### Expected Behavior

When i use the button "Select All" All flows don't have the checkmark selected.

<img width="1714" alt="Capture d’écran 2023-08-14 à 10 18 14" src="https://github.com/kestra-io/kestra/assets/125994028/ac5f9cba-2cd6-4468-a9cb-91bafa93b1a4">






### Actual Behaviour

_No response_

### Steps To Reproduce

On the demo with my kestra's account

### Environment Information

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


### Example flow

_No response_

Issue comments:
@brian-mulier-p visually, it should select all rows on the same

Pull request review comments:

Patch that resolved the issue:
diff --git a/ui/src/mixins/selectTableActions.js b/ui/src/mixins/selectTableActions.js
index 6b4bf5e096..1b83eddffa 100644
--- a/ui/src/mixins/selectTableActions.js
+++ b/ui/src/mixins/selectTableActions.js
@@ -24,6 +24,7 @@ export default {
             } else {
                 this.queryBulkAction = false;
             }
+            this.elTable.toggleAllSelection()
         },
         selectionMapper(element) {
             return element;


Test patch:
Repository: kestra-io/kestra
Issue: Cannot read properties of null on $el (missing event unregister from new SelectTable)
Labels: bug
enhancement

### Expected Behavior

_No response_

### Actual Behaviour

Uncaught TypeError: Cannot read properties of null (reading '$el')
    at Proxy.computeHeaderSize (index-afe23b22.js:1086:286666)

The resize event triggers on the SelectTable component even if we switched tab / page.
Must unregister the resize event handle on unmount

### Steps To Reproduce

Execution list -> detailed execution -> resize window

### Environment Information

- Kestra Version:
- 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/layout/SelectTable.vue b/ui/src/components/layout/SelectTable.vue
index efa3a9cec3..cf056a2235 100644
--- a/ui/src/components/layout/SelectTable.vue
+++ b/ui/src/components/layout/SelectTable.vue
@@ -26,7 +26,10 @@
             }
         },
         mounted() {
-            window.onresize = this.computeHeaderSize;
+            window.addEventListener("resize", this.computeHeaderSize);
+        },
+        unmounted() {
+            window.removeEventListener("resize", this.computeHeaderSize);
         },
         updated() {
             this.computeHeaderSize();


Test patch:
Repository: kestra-io/kestra
Issue: New bulk select header overflows when the window is too small to display the whole table header
Labels: bug
enhancement

### Expected Behavior

_No response_

### Actual Behaviour

![image](https://github.com/kestra-io/kestra/assets/37618489/4336be2d-69bc-4e27-85a8-b8598461fab0)


### Steps To Reproduce

_No response_

### Environment Information

- Kestra Version:
- 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/layout/SelectTable.vue b/ui/src/components/layout/SelectTable.vue
index efa3a9cec3..d505ff72b6 100644
--- a/ui/src/components/layout/SelectTable.vue
+++ b/ui/src/components/layout/SelectTable.vue
@@ -11,9 +11,9 @@
                 this.$emit("selection-change", selection);
             },
             computeHeaderSize() {
-                const tableHead = this.$refs.table.$el.querySelector('thead');
-                this.$el.style.setProperty("--table-header-width", `${tableHead.clientWidth}px`);
-                this.$el.style.setProperty("--table-header-height", `${tableHead.clientHeight}px`);
+                const tableElement = this.$refs.table.$el;
+                this.$el.style.setProperty("--table-header-width", `${tableElement.clientWidth}px`);
+                this.$el.style.setProperty("--table-header-height", `${tableElement.querySelector('thead').clientHeight}px`);
             }
         },
         props: {


Test patch:
Repository: kestra-io/kestra
Issue: Mass action selection is not working
Labels: bug
frontend

### Expected Behavior

_No response_

### Actual Behaviour


https://github.com/kestra-io/kestra/assets/46634684/10ebe95c-b61d-4ffc-9743-bfff8baf4390



### Steps To Reproduce

_No response_

### Environment Information

- Kestra Version: 0.11.0 SNAPSHOT
- Operating System (OS / Docker / Kubernetes): Docker
- 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/layout/BulkSelect.vue b/ui/src/components/layout/BulkSelect.vue
index 539c2b49e3..cf9060dce0 100644
--- a/ui/src/components/layout/BulkSelect.vue
+++ b/ui/src/components/layout/BulkSelect.vue
@@ -32,7 +32,7 @@
                     this.$emit("unselect");
                 }
             },
-            toggleAll(value) {
+            toggleAll() {
                 this.$emit("update:selectAll", !this.selectAll);
             }
         },
diff --git a/ui/src/mixins/dataTableActions.js b/ui/src/mixins/dataTableActions.js
index efb996bb1c..b4b23553bf 100644
--- a/ui/src/mixins/dataTableActions.js
+++ b/ui/src/mixins/dataTableActions.js
@@ -4,8 +4,8 @@ import _isEqual from "lodash/isEqual";
 
 export default {
     created() {
-        this.internalPageSize = this.pageSize;
-        this.internalPageNumber = this.pageNumber;
+        this.internalPageSize = this.pageSize ?? this.$route.query.size ?? 25;
+        this.internalPageNumber = this.pageNumber ?? this.$route.query.page ?? 1;
 
         // @TODO: ugly hack from restoreUrl
         if (this.loadInit) {
@@ -29,12 +29,10 @@ export default {
             default: () => {}
         },
         pageSize: {
-            type: Number,
-            default: 25
+            type: Number
         },
         pageNumber: {
-            type: Number,
-            default: 1
+            type: Number
         },
     },
     watch: {
diff --git a/ui/src/mixins/selectTableActions.js b/ui/src/mixins/selectTableActions.js
index 1b83eddffa..73648cd4e2 100644
--- a/ui/src/mixins/selectTableActions.js
+++ b/ui/src/mixins/selectTableActions.js
@@ -17,14 +17,11 @@ export default {
         toggleAllUnselected() {
             this.elTable.clearSelection()
         },
-        toggleAllSelection(active) {
-            // only some are selected, we should set queryBulkAction to true because it will select all
-            if (active && this.elTable.getSelectionRows().length > 0 && !this.queryBulkAction) {
-                this.queryBulkAction = true;
-            } else {
-                this.queryBulkAction = false;
+        toggleAllSelection() {
+            if (this.elTable.getSelectionRows().length < this.elTable.data.length) {
+                this.elTable.toggleAllSelection()
             }
-            this.elTable.toggleAllSelection()
+            this.queryBulkAction = true;
         },
         selectionMapper(element) {
             return element;


Test patch:
Repository: kestra-io/kestra
Issue: Exposing metrics without tags is not working
Labels: bug

### Expected Behavior

_No response_

### Actual Behaviour

See https://demo.kestra.io/ui/blueprints/community/86 which is not working

### Steps To Reproduce

_No response_

### Environment Information

- Kestra Version:
- 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/core/src/main/java/io/kestra/core/models/executions/AbstractMetricEntry.java b/core/src/main/java/io/kestra/core/models/executions/AbstractMetricEntry.java
index c7647246b9..181bcf2a6d 100644
--- a/core/src/main/java/io/kestra/core/models/executions/AbstractMetricEntry.java
+++ b/core/src/main/java/io/kestra/core/models/executions/AbstractMetricEntry.java
@@ -13,7 +13,9 @@
 import lombok.ToString;
 
 import java.time.Instant;
+import java.util.Collection;
 import java.util.Map;
+import java.util.Optional;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import javax.validation.constraints.NotNull;
@@ -63,9 +65,9 @@ private static Map<String, String> tagsAsMap(String... keyValues) {
 
     protected String[] tagsAsArray(Map<String, String> others) {
         return Stream.concat(
-            this.tags.entrySet().stream(),
-            others.entrySet().stream()
-        )
+                Optional.ofNullable(this.tags).map(Map::entrySet).stream().flatMap(Collection::stream),
+                others.entrySet().stream()
+            )
             .flatMap(e -> Stream.of(e.getKey(), e.getValue()))
             .collect(Collectors.toList())
             .toArray(String[]::new);


Test patch:
Repository: kestra-io/kestra
Issue: Add support for a map of `labels` in the flow validator
Labels: enhancement

### Feature description

We want to support both options for the definition of `labels`.

1. A list of key-value pairs:

```yaml
id: myflow
namespace: dev
labels:
  - key: team
    value: data
  - key: project
    value: dwh
```

2. A map of labels:

```yaml
id: myflow
namespace: dev
labels:
  team: data
  project: dwh
```

Initially, option 2 was the default. 
Now, option 1 is the default and the validator complains when using the Map syntax. 

Both work, but the validator currently only accepts the first option.

Both options are valid. This issue is to bring back support for the Map of labels on the schema for both web validator and VS Code extension.

Issue comments:
We can support both but in this case the validator will not be aware of the `Label` type anymore so it will validate any arrays.

Using a map will works
```
labels:
  key: value
```

Using a list of labels will work
```
labels:
  - key: key
    value: value1
```

The following will validate but create an invalid label in the database (not that it will not crash even at validation time)
```
labels:
  - toto: titi
```



Pull request review comments:

Patch that resolved the issue:
diff --git a/core/src/main/java/io/kestra/core/models/flows/Flow.java b/core/src/main/java/io/kestra/core/models/flows/Flow.java
index bde1b57026..f1d3a59b12 100644
--- a/core/src/main/java/io/kestra/core/models/flows/Flow.java
+++ b/core/src/main/java/io/kestra/core/models/flows/Flow.java
@@ -10,6 +10,7 @@
 import io.kestra.core.exceptions.InternalException;
 import io.kestra.core.models.DeletedInterface;
 import io.kestra.core.models.Label;
+import io.kestra.core.models.annotations.PluginProperty;
 import io.kestra.core.models.executions.Execution;
 import io.kestra.core.models.listeners.Listener;
 import io.kestra.core.models.tasks.FlowableTask;
@@ -22,6 +23,7 @@
 import io.kestra.core.services.FlowService;
 import io.kestra.core.validations.FlowValidation;
 import io.micronaut.core.annotation.Introspected;
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;
 import lombok.experimental.SuperBuilder;
 import org.slf4j.Logger;
@@ -70,6 +72,7 @@ public boolean hasIgnoreMarker(final AnnotatedMember m) {
 
     @JsonSerialize(using = ListOrMapOfLabelSerializer.class)
     @JsonDeserialize(using = ListOrMapOfLabelDeserializer.class)
+    @Schema(implementation = Object.class, anyOf = {List.class, Map.class})
     List<Label> labels;
 
 


Test patch:
Repository: kestra-io/kestra
Issue: Return task with empty "format" property will fail
Labels: bug
backend

### Expected Behavior

_No response_

### Actual Behaviour

Failing due to length check for metrics, needs a null guard

### Steps To Reproduce

_No response_

### Environment Information

- Kestra Version:
- 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/core/src/main/java/io/kestra/core/tasks/debugs/Return.java b/core/src/main/java/io/kestra/core/tasks/debugs/Return.java
index 532986dca3..279d3af677 100644
--- a/core/src/main/java/io/kestra/core/tasks/debugs/Return.java
+++ b/core/src/main/java/io/kestra/core/tasks/debugs/Return.java
@@ -15,6 +15,7 @@
 import org.slf4j.Logger;
 
 import java.time.Duration;
+import java.util.Optional;
 
 @SuperBuilder
 @ToString
@@ -56,7 +57,7 @@ public Return.Output run(RunContext runContext) throws Exception {
         long end = System.nanoTime();
 
         runContext
-            .metric(Counter.of("length", render.length(), "format", format))
+            .metric(Counter.of("length", Optional.ofNullable(render).map(String::length).orElse(0), "format", format))
             .metric(Timer.of("duration", Duration.ofNanos(end - start), "format", format));
 
         return Output.builder()


Test patch:
Repository: kestra-io/kestra
Issue: Selecting all flow with a filter should only select all flow in the filtered list
Labels: bug

### Expected Behavior

When clicking on "select all" or just selecting the displayed list in the UI, it should only select all the flow return with the differents filters

### Actual Behaviour

When clicking on "select all" or checking the select list select more than what it should and apply the action on all flows

### Steps To Reproduce

_No response_

### Environment Information

- Kestra Version: 0.11.0


### Example flow

_No response_

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/ui/src/stores/flow.js b/ui/src/stores/flow.js
index d47fc77613..ae7e2ce15b 100644
--- a/ui/src/stores/flow.js
+++ b/ui/src/stores/flow.js
@@ -226,7 +226,7 @@ export default {
             return this.$http.delete("/api/v1/flows/delete/by-ids", {data: options.ids})
         },
         deleteFlowByQuery(_, options) {
-            return this.$http.delete("/api/v1/flows/delete/by-query", options, {params: options})
+            return this.$http.delete("/api/v1/flows/delete/by-query", {params: options})
         },
         validateFlow({commit}, options) {
             return axios.post(`${apiRoot}flows/validate`, options.flow, textYamlHeader)


Test patch: