Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ui/src/views/tool/component/FieldFormDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@
<el-option v-for="item in typeOptions" :key="item" :label="item" :value="item" />
</el-select>
</el-form-item>
<el-form-item :label="$t('views.tool.form.toolDescription.label')">
<el-input
v-model="form.desc"
type="textarea"
:placeholder="$t('components.folder.descriptionPlaceholder')"
maxlength="128"
show-word-limit
:autosize="{ minRows: 3 }"
@blur="form.desc = form.desc?.trim()"
/>
</el-form-item>
<el-form-item :label="$t('views.tool.form.source.label')">
<el-select v-model="form.source">
<el-option :label="$t('views.tool.form.source.reference')" value="reference" />
Expand Down Expand Up @@ -64,6 +75,7 @@ const isEdit = ref(false)
const form = ref<any>({
name: '',
type: typeOptions[0],
desc: '',
source: 'reference',
is_required: true,
})
Expand All @@ -85,6 +97,7 @@ watch(dialogVisible, (bool) => {
form.value = {
name: '',
type: typeOptions[0],
desc: '',
source: 'reference',
is_required: true,
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code has no major irregularities or significant potential issues. However, there are some minor aspects to consider:

  1. Empty Value Check for Description: The @blur event handler currently trims the description only if it's defined (form.desc?.trim()). This might cause an error if someone tries to trim a non-string value.
// Ensure that form.desc is not null before trimming
if (form.desc) {
  form.desc = form.desc.trim();
}
  1. Autosize Configuration Update: The autosize configuration for the textarea seems outdated. You can use { maxRows: 5 } instead of { minRows: 3 } for better flexibility and readability.
// Updated autosize configuration:
@autosize="{ maxRows: 5 }"

These improvements will help improve user experience and prevent runtime errors when dealing with empty values in the description field.

Expand Down
Loading