Browse Source

🎨 feat(table): add conditional row expansion for LogsTable

Implement rowExpandable property to control which rows can be expanded
in the logs table. Rows are now only expandable when they have actual
expand data content, preventing empty expansion sections from being
displayed to users.

- Add rowExpandable function to check if expandData exists and has content
- Improve user experience by hiding expand functionality for rows without details
- Maintain existing expand behavior for rows with valid expansion data
Apple\Apple 9 months ago
parent
commit
4da5e74d23
1 changed files with 9 additions and 2 deletions
  1. 9 2
      web/src/components/table/LogsTable.js

+ 9 - 2
web/src/components/table/LogsTable.js

@@ -1084,6 +1084,11 @@ const LogsTable = () => {
     return <Descriptions data={expandData[record.key]} />;
   };
 
+  // 检查是否有任何记录有展开内容
+  const hasExpandableRows = () => {
+    return logs.some(log => expandData[log.key] && expandData[log.key].length > 0);
+  };
+
   return (
     <>
       {renderColumnSelector()}
@@ -1252,8 +1257,10 @@ const LogsTable = () => {
       >
         <Table
           columns={getVisibleColumns()}
-          expandedRowRender={expandRowRender}
-          expandRowByClick={true}
+          {...(hasExpandableRows() && {
+            expandedRowRender: expandRowRender,
+            expandRowByClick: true
+          })}
           dataSource={logs}
           rowKey='key'
           loading={loading}