Skip to content

Commit 4c1f341

Browse files
author
Apple\Apple
committed
🐛 fix(table): add rowExpandable to prevent empty rows from expanding
The Table component in LogsTable.js was previously showing expand icons for all rows, even those without any expandable content. This led to a confusing UX where users could click to expand rows but would see empty content. This commit adds the `rowExpandable` property to the Table configuration to ensure that only rows with actual expandable content show the expand icon and can be expanded. The function checks if each record has corresponding data in the expandData object before allowing it to be expanded.
1 parent 3721ac1 commit 4c1f341

File tree

1 file changed

+40
-39
lines changed

1 file changed

+40
-39
lines changed

web/src/components/table/LogsTable.js

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ const LogsTable = () => {
197197
if (!modelMapped) {
198198
return renderModelTag(record.model_name, {
199199
onClick: (event) => {
200-
copyText(event, record.model_name).then((r) => {});
200+
copyText(event, record.model_name).then((r) => { });
201201
},
202202
});
203203
} else {
@@ -214,7 +214,7 @@ const LogsTable = () => {
214214
</Text>
215215
{renderModelTag(record.model_name, {
216216
onClick: (event) => {
217-
copyText(event, record.model_name).then((r) => {});
217+
copyText(event, record.model_name).then((r) => { });
218218
},
219219
})}
220220
</div>
@@ -225,7 +225,7 @@ const LogsTable = () => {
225225
{renderModelTag(other.upstream_model_name, {
226226
onClick: (event) => {
227227
copyText(event, other.upstream_model_name).then(
228-
(r) => {},
228+
(r) => { },
229229
);
230230
},
231231
})}
@@ -236,7 +236,7 @@ const LogsTable = () => {
236236
>
237237
{renderModelTag(record.model_name, {
238238
onClick: (event) => {
239-
copyText(event, record.model_name).then((r) => {});
239+
copyText(event, record.model_name).then((r) => { });
240240
},
241241
suffixIcon: (
242242
<IconForward
@@ -603,21 +603,21 @@ const LogsTable = () => {
603603
}
604604
let content = other?.claude
605605
? renderClaudeModelPriceSimple(
606-
other.model_ratio,
607-
other.model_price,
608-
other.group_ratio,
609-
other.cache_tokens || 0,
610-
other.cache_ratio || 1.0,
611-
other.cache_creation_tokens || 0,
612-
other.cache_creation_ratio || 1.0,
613-
)
606+
other.model_ratio,
607+
other.model_price,
608+
other.group_ratio,
609+
other.cache_tokens || 0,
610+
other.cache_ratio || 1.0,
611+
other.cache_creation_tokens || 0,
612+
other.cache_creation_ratio || 1.0,
613+
)
614614
: renderModelPriceSimple(
615-
other.model_ratio,
616-
other.model_price,
617-
other.group_ratio,
618-
other.cache_tokens || 0,
619-
other.cache_ratio || 1.0,
620-
);
615+
other.model_ratio,
616+
other.model_price,
617+
other.group_ratio,
618+
other.cache_tokens || 0,
619+
other.cache_ratio || 1.0,
620+
);
621621
return (
622622
<Paragraph
623623
ellipsis={{
@@ -907,27 +907,27 @@ const LogsTable = () => {
907907
key: t('日志详情'),
908908
value: other?.claude
909909
? renderClaudeLogContent(
910-
other?.model_ratio,
911-
other.completion_ratio,
912-
other.model_price,
913-
other.group_ratio,
914-
other.cache_ratio || 1.0,
915-
other.cache_creation_ratio || 1.0,
916-
)
910+
other?.model_ratio,
911+
other.completion_ratio,
912+
other.model_price,
913+
other.group_ratio,
914+
other.cache_ratio || 1.0,
915+
other.cache_creation_ratio || 1.0,
916+
)
917917
: renderLogContent(
918-
other?.model_ratio,
919-
other.completion_ratio,
920-
other.model_price,
921-
other.group_ratio,
922-
other?.user_group_ratio,
923-
false,
924-
1.0,
925-
undefined,
926-
other.web_search || false,
927-
other.web_search_call_count || 0,
928-
other.file_search || false,
929-
other.file_search_call_count || 0,
930-
),
918+
other?.model_ratio,
919+
other.completion_ratio,
920+
other.model_price,
921+
other.group_ratio,
922+
other?.user_group_ratio,
923+
false,
924+
1.0,
925+
undefined,
926+
other.web_search || false,
927+
other.web_search_call_count || 0,
928+
other.file_search || false,
929+
other.file_search_call_count || 0,
930+
),
931931
});
932932
}
933933
if (logs[i].type === 2) {
@@ -1045,7 +1045,7 @@ const LogsTable = () => {
10451045

10461046
const handlePageChange = (page) => {
10471047
setActivePage(page);
1048-
loadLogs(page, pageSize, logType).then((r) => {});
1048+
loadLogs(page, pageSize, logType).then((r) => { });
10491049
};
10501050

10511051
const handlePageSizeChange = async (size) => {
@@ -1268,6 +1268,7 @@ const LogsTable = () => {
12681268
{...(hasExpandableRows() && {
12691269
expandedRowRender: expandRowRender,
12701270
expandRowByClick: true,
1271+
rowExpandable: (record) => expandData[record.key] && expandData[record.key].length > 0
12711272
})}
12721273
dataSource={logs}
12731274
rowKey='key'

0 commit comments

Comments
 (0)