Skip to content

Commit

Permalink
feat(ui): display input error (#5919)
Browse files Browse the repository at this point in the history
close #5515
  • Loading branch information
Skraye authored Nov 14, 2024
1 parent cf615e8 commit fb34f7b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ui/src/components/flows/ValidationError.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{{ $t("error detected") }}
</span>
</el-header>
<el-main>{{ errors.join("\n") }}</el-main>
<el-main v-for="error in errors" :key="error">{{ error }}</el-main>
</el-container>
</template>
<el-button v-bind="$attrs" :link="link" :size="size" type="default" class="error">
Expand Down
11 changes: 10 additions & 1 deletion ui/src/components/inputs/InputsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,16 @@
</template>
</template>
</el-form-item>
<ValidationError :errors="inputErrors" />
</template>

<el-alert type="info" :show-icon="true" :closable="false" v-else>
{{ $t("no inputs") }}
</el-alert>
</template>

<script setup>
import ValidationError from "../flows/ValidationError.vue";
</script>
<script>
import Editor from "../../components/inputs/Editor.vue";
import Markdown from "../layout/Markdown.vue";
Expand All @@ -192,6 +196,11 @@
YamlUtils() {
return YamlUtils
},
inputErrors() {
return this.inputsList.filter(it => it.errors && it.errors.length > 0).length > 0 ?
this.inputsList.filter(it => it.errors && it.errors.length > 0).flatMap(it => it.errors?.flatMap(err => err.message)) :
null
}
},
components: {Editor, Markdown, DurationPicker},
props: {
Expand Down

0 comments on commit fb34f7b

Please sign in to comment.