-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Add description fields to interface parameters #4189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,13 @@ | |
| </span> | ||
| </template> | ||
| </el-table-column> | ||
| <el-table-column prop="desc" :label="$t('views.application.form.appDescription.label')"> | ||
| <template #default="{ row }"> | ||
| <span class="ellipsis-1" :title="row.desc"> | ||
| {{ row.desc }} | ||
| </span> | ||
| </template> | ||
| </el-table-column> | ||
| <el-table-column prop="default_value" :label="$t('dynamicsForm.default.label')"> | ||
| <template #default="{ row }"> | ||
| <span class="ellipsis-1" :title="row.default_value"> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code you've provided looks generally correct, but there are a few areas that could be improved:
If everything seems fine except for performance concerns related to long strings, consider using the Here's an updated version of the code with some suggested improvements: <el-table-column prop="desc" :label="$t('views.application.form.appDescription.label')" align="left">
<template #default="{ row }">
<span class="ellipsis-content" style="white-space: nowrap; max-width: 100%; overflow-x: hidden;">
{{ trimEllipsis(row.desc, 100) }}
</span>
</template>
</el-table-column>
<!-- Add this function at the top or define it outside the component -->
function trimEllipsis(text, maxLength = 150) {
return text.length > maxLength ? text.slice(0, maxLength - 3) + '...' : text;
}This way, you encapsulate the logic for trimming text into a reusable function, keeping your HTML cleaner and easier to maintain. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There doesn't appear to be any major irregularities or issues with the code provided. However, there are a few minor optimizations and updates that might improve its readability and performance:
Remove Unnecessary Template Literals: The
messageandtriggerproperties use template literals within another string, which is redundant unless you need dynamic interpolation. You could simplify these by directly concatenating strings if necessary.Add a Space before Inline Comments: Adding spaces before inline comments can make the code more readable, especially if they follow other elements like form items.
Here's an updated version of the code incorporating these suggestions:
Key Changes:
Removed Redundant Template Literals:
$t(...).slice(0, -7)with a direct+': Application Description'.Added a Space Before Inline Comment: Added a space between the comment text and the preceding element.
Renamed Variable for Description Field: Changed the
variableproperty back tonamesince the form item was renamed in the Vue component.These changes should improve the code’s clarity and maintainability while ensuring it functions correctly.