Skip to content

Commit

Permalink
feat(ui): multiple improvements of no code editor (#7146)
Browse files Browse the repository at this point in the history
* refactor(ui): prevent multiple warning in console by adding inheritAttrs properly

* chore(ui): make plugin selector field not clearable

* feat(ui): allow re-ordering of array items

* fix(ui): remove concurrency when limit set to 0
  • Loading branch information
MilosPaunovic committed Feb 3, 2025
1 parent fcfee51 commit a3a8863
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 10 deletions.
2 changes: 2 additions & 0 deletions ui/src/components/code/components/inputs/InputText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<script setup lang="ts">
import {ref, watch} from "vue";
defineOptions({inheritAttrs: false});
const emits = defineEmits(["update:modelValue"]);
const props = defineProps({
modelValue: {type: [String, Number, Boolean], default: undefined},
Expand Down
6 changes: 4 additions & 2 deletions ui/src/components/code/styles/code.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ $code-font-sm: var(--el-font-size-small);
font-size: $code-font-sm;
}

.delete {
.delete,
.reorder {
cursor: pointer;
padding-left: 0;
color: $code-gray-700;
Expand All @@ -64,7 +65,8 @@ $code-font-sm: var(--el-font-size-small);
:deep(*) {
--el-disabled-text-color: #{$code-gray-700};

.el-input__inner {
.el-input__inner,
.el-textarea__inner {
color: $code-gray-700;
font-size: $code-font-sm;
}
Expand Down
1 change: 1 addition & 0 deletions ui/src/components/flows/TaskEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import {SECTIONS} from "../../utils/constants.js";
export default {
inheritAttrs: false,
computed: {
...mapGetters("flow", ["taskError"]),
},
Expand Down
30 changes: 27 additions & 3 deletions ui/src/components/flows/tasks/TaskArray.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
v-for="(element, index) in items"
:key="'array-' + index"
:gutter="10"
class="w-100 mb-2"
class="w-100"
>
<el-col :span="22">
<el-col :span="2" class="d-flex flex-column mt-1 mb-2 reorder">
<ChevronUp @click.prevent.stop="moveItem(index, 'up')" />
<ChevronDown @click.prevent.stop="moveItem(index, 'down')" />
</el-col>
<el-col :span="20">
<InputText
:model-value="element"
@update:model-value="(v) => handleInput(v, index)"
Expand All @@ -23,11 +27,13 @@
<script setup lang="ts">
import {ref} from "vue";
import {DeleteOutline} from "../../code/utils/icons";
import {DeleteOutline, ChevronUp, ChevronDown} from "../../code/utils/icons";
import InputText from "../../code/components/inputs/InputText.vue";
import Add from "../../code/components/Add.vue";
defineOptions({inheritAttrs: false});
const emits = defineEmits(["update:modelValue"]);
const props = defineProps({modelValue: {type: Array, default: undefined}});
Expand All @@ -48,4 +54,22 @@
items.value.splice(index, 1);
emits("update:modelValue", items.value);
};
const moveItem = (index: number, direction: "up" | "down") => {
if (direction === "up" && index > 0) {
[items.value[index - 1], items.value[index]] = [
items.value[index],
items.value[index - 1],
];
} else if (direction === "down" && index < items.value.length - 1) {
[items.value[index + 1], items.value[index]] = [
items.value[index],
items.value[index + 1],
];
}
emits("update:modelValue", items.value);
};
</script>

<style scoped lang="scss">
@import "../../code/styles/code.scss";
</style>
6 changes: 2 additions & 4 deletions ui/src/components/inputs/EditorView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -940,15 +940,13 @@
};
const onUpdateMetadata = (event, shouldSave) => {
metadata.value = event;
if(shouldSave) {
metadata.value = {...metadata.value, ...event};
metadata.value = {...metadata.value, ...(event.concurrency.limit === 0 ? {concurrency: null} : event)};
onSaveMetadata();
validateFlow(flowYaml.value)
} else {
metadata.value = event;
metadata.value = event.concurrency.limit === 0 ? {concurrency: null} : event;
}
};
Expand Down
1 change: 0 additions & 1 deletion ui/src/components/plugins/PluginSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
:model-value="modelValue"
:placeholder="$t('no_code.creation.select', {section: section.toLowerCase().slice(0, -1)})"
filterable
clearable
@update:model-value="onInput"
>
<el-option
Expand Down

0 comments on commit a3a8863

Please sign in to comment.