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
27 changes: 21 additions & 6 deletions ui/src/views/operate-log/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,20 @@
</el-table-column>
<el-table-column prop="operate" :label="$t('views.operateLog.table.operate.detail')">
<template #default="{ row }">
{{
row.operate +
(row.operation_object && row.operation_object.name
? `【${row.operation_object.name}】`
: '')
}}
<el-tooltip
:content="
row.operate + (row.operation_object?.name ? `【${row.operation_object.name}】` : '')
"
effect="dark"
placement="top"
>
<span class="text-ellipsis">
{{
row.operate +
(row.operation_object?.name ? `【${row.operation_object.name}】` : '')
}}
</span>
</el-tooltip>
</template>
</el-table-column>
<el-table-column
Expand Down Expand Up @@ -342,4 +350,11 @@ onMounted(() => {
.text-button {
font-size: 14px;
}
.text-ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
display: block;
}
</style>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The provided code appears to be well-structured and does not contain significant errors or issues at first glance. However, here are some recommendations for optimizing the HTML and styling:

HTML Improvements:

  • Ensure there is no trailing newline in the template slot content after closing </template> tag.

Styling Suggestions:

  1. Ellipsis Text: Add the .text-ellipsis class to truncate long content within <el-table-cell>. This ensures that cell contents do not exceed their width and are readable without scrolling.

    <div v-for="item in list" :key="item.value">{{ item.label }}<br /></div>
  2. Tooltip Display Duration: Adjust the tooltip's duration if you want it to appear for longer or shorter periods before hiding automatically.

  3. Button Styling Enhancement: Consider refining the button styles (class="btn btn-secondary"), ensuring clarity and consistency. Example can include border-radius, padding, etc.

  4. Responsive Design: If this table displays data dynamically based on window size, consider implementing responsive design techniques such as column resizing or using CSS media queries to adjust layout accordingly.

Here's an example of how your stylesheet might look with improved text truncation:

/* ... other styles */
.text-ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}

.button-style--small {
  /* Small sized buttons style properties... */
}

These suggestions aim to improve overall performance and user experience by making sure UI components work seamlessly across different devices and resolutions.