Skip to content

fix(overview): count only device-type entries for table rows - #987

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:fix-task-398635-overview-extra-blank-row
Nov 23, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:fix-task-398635-overview-extra-blank-row

Conversation

@add-uos

@add-uos add-uos commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

问题

概况首页表格尾部多一个空行,且条目未超限时提前显示"显示更多"按钮。

根因

eb6004e 将 setColumnAndRow(row - 1) 改为 setColumnAndRow(row + 1),但概况 map(getDeviceOverview())中除设备类型条目外还包含 "Overview" / "OS" 两个辅助键(供 setLabel 使用),不占用表格行:

  • 实际填充 N 行,map.size() = N + 2,row + 1 = N + 3 → 多出 2 行,hideRow 只隐藏最后一行,尾部残留空行
  • "显示更多"弹出条件 N + 3 > limit + 1 → N ≥ 10 即弹出(正确阈值应为 N > 11)

修复

先按类型表收集实际匹配的条目,再按 条目数 + 1(预留展开/收起按钮行)设置表格行数,辅助键不再影响行数计算。

验证

  • 新增回归用例 updateInfo_auxKeys_rowCountUsesFilledEntries(含辅助键时行数 = 条目数+1 而非 map.size()+1)、updateInfo_unmatchedKeys_notCounted(map 独有键不计数)
  • UT_PageOverview.* 19/19 通过;全量套件除存量环境问题(UT_LogTreeView 段错误、UT_SingleDeviceManager 构造挂起,基线同样复现)外 2445/2445 通过

PMS: TASK-398635

Summary by Sourcery

修正概况表格的行数计算,使其基于实际设备条目并预留展开/收起按钮行。

Bug Fixes:

  • 修正概况表格行数统计,仅按实际匹配的设备类型条目计数,避免辅助键和未匹配键导致尾部空行及提前显示“显示更多”。

Tests:

  • 新增回归测试,覆盖辅助键和未匹配键不计入表格行数的场景。

@sourcery-ai

sourcery-ai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Collect the device-type entries that will actually populate the table and size it to those entries plus one reserved control row, so auxiliary map keys do not create blank rows or trigger “show more” early.

  • deepin-devicemanager/src/Page/PageOverview.cpp L96-110 (+3 small edits)

Tests

Update existing row-count expectations and add regression coverage for auxiliary and unmatched keys not contributing to the table row count.

  • test/deepin-devicemanager/src/Page/ut_pageoverview.cpp L287-327 (+5 small edits)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="deepin-devicemanager/src/Page/PageOverview.cpp" line_range="103" />
<code_context>
+
+    // 表格行数 = 实际条目数 + 1(预留一行给展开/收起按钮,条目较少时该行隐藏)。
+    // 不能用 map.size() 推算,否则会多出空行且提前显示"显示更多"。
+    mp_Overview->setColumnAndRow(entries.size() + 1);
+
+    int i = 0;
</code_context>
<issue_to_address>
**New overview entries stay hidden**

When a subsequent overview update increases the matched-entry count by one while the table remains within its row limit, `setColumnAndRow` hides the spare last row, but does not unhide rows hidden by an earlier update; when the entry count increases by one, the former spare row becomes an entry row and remains hidden, so the overview omits that entry.

Reset row visibility when rebuilding the table, before populating entries, while preserving the intended hidden spare row and any expansion state.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨


// 表格行数 = 实际条目数 + 1(预留一行给展开/收起按钮,条目较少时该行隐藏)。
// 不能用 map.size() 推算,否则会多出空行且提前显示"显示更多"。
mp_Overview->setColumnAndRow(entries.size() + 1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · New overview entries stay hidden

When a subsequent overview update increases the matched-entry count by one while the table remains within its row limit, setColumnAndRow hides the spare last row, but does not unhide rows hidden by an earlier update; when the entry count increases by one, the former spare row becomes an entry row and remains hidden, so the overview omits that entry.

Reset row visibility when rebuilding the table, before populating entries, while preserving the intended hidden spare row and any expansion state.

Prompt for AI agents
In `deepin-devicemanager/src/Page/PageOverview.cpp` at line 103:

**New overview entries stay hidden**

When a subsequent overview update increases the matched-entry count by one while the table remains within its row limit, `setColumnAndRow` hides the spare last row, but does not unhide rows hidden by an earlier update; when the entry count increases by one, the former spare row becomes an entry row and remains hidden, so the overview omits that entry.

Reset row visibility when rebuilding the table, before populating entries, while preserving the intended hidden spare row and any expansion state.

1. Root cause: updateInfo derived the table row count from map.size(),
   but the overview map also carries auxiliary keys "Overview" and "OS"
   (used by setLabel) that are not table entries; setColumnAndRow(row + 1)
   therefore allocated two extra rows beyond the actual entries, leaving
   a blank row at the tail and showing the "More" expand button early
2. Fix: collect matched device-type entries first, then allocate
   entries.size() + 1 rows (one spare row for the expand/collapse
   button), so auxiliary keys never affect the row count
3. Impact: overview table no longer shows trailing blank rows; the
   expand button appears only when entries exceed the display limit

Influence:
1. 概况页条目较少时表格不再出现尾部空行
2. 仅当条目数超过显示上限时才出现"显示更多"按钮
3. 概况信息导出/复制内容不变

Log: 修复概况页表格尾部多余空行及提前显示"显示更多"的问题
PMS: TASK-398635
@add-uos
add-uos force-pushed the fix-task-398635-overview-extra-blank-row branch from efb82af to bb18f7e Compare November 23, 2026 08:29
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos, lzwind

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@add-uos

add-uos commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: unstable)

@deepin-bot
deepin-bot Bot merged commit 62a2c1d into linuxdeepin:master Nov 23, 2026
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants