浏览代码

🎨 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 11 月之前
父节点
当前提交
4da5e74d23
共有 1 个文件被更改,包括 9 次插入2 次删除
  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]} />;
     return <Descriptions data={expandData[record.key]} />;
   };
   };
 
 
+  // 检查是否有任何记录有展开内容
+  const hasExpandableRows = () => {
+    return logs.some(log => expandData[log.key] && expandData[log.key].length > 0);
+  };
+
   return (
   return (
     <>
     <>
       {renderColumnSelector()}
       {renderColumnSelector()}
@@ -1252,8 +1257,10 @@ const LogsTable = () => {
       >
       >
         <Table
         <Table
           columns={getVisibleColumns()}
           columns={getVisibleColumns()}
-          expandedRowRender={expandRowRender}
-          expandRowByClick={true}
+          {...(hasExpandableRows() && {
+            expandedRowRender: expandRowRender,
+            expandRowByClick: true
+          })}
           dataSource={logs}
           dataSource={logs}
           rowKey='key'
           rowKey='key'
           loading={loading}
           loading={loading}