Repository navigation
fix(overview): count only device-type entries for table rows - #987
deepin-bot[bot] merged 1 commit into
Conversation
Reviewer's GuideImplementationCollect 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.
TestsUpdate existing row-count expectations and add regression coverage for auxiliary and unmatched keys not contributing to the table row count.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
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>|
|
||
| // 表格行数 = 实际条目数 + 1(预留一行给展开/收起按钮,条目较少时该行隐藏)。 | ||
| // 不能用 map.size() 推算,否则会多出空行且提前显示"显示更多"。 | ||
| mp_Overview->setColumnAndRow(entries.size() + 1); |
There was a problem hiding this comment.
🟡 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
efb82af to
bb18f7e
Compare
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/forcemerge |
|
This pr force merged! (status: unstable) |
问题
概况首页表格尾部多一个空行,且条目未超限时提前显示"显示更多"按钮。
根因
eb6004e 将
setColumnAndRow(row - 1)改为setColumnAndRow(row + 1),但概况 map(getDeviceOverview())中除设备类型条目外还包含"Overview"/"OS"两个辅助键(供setLabel使用),不占用表格行: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: