-
Notifications
You must be signed in to change notification settings - Fork 18
fix(web): role filter #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds a guard in getAllUser to skip undefined filter entries and an ESLint disable for continue. Updates info-tab.vue fetchData to normalize filters: pass arrays as-is; for objects, spread and map role to filters.roleIds. No exported signatures changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant V as info-tab.vue (fetchData)
participant A as getAllUser (api/user.ts)
participant B as Backend
U->>V: Trigger data fetch
Note over V: Normalize filters<br/>- If Array: use as-is<br/>- If Object: {...filters, role: filters.roleIds}
V->>A: getAllUser(normalizedFilters)
Note over A: Iterate filters<br/>Skip entries where value is undefined
A->>B: Request users with processed filters
B-->>A: Users data
A-->>V: Users data
V-->>U: Render results
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
template/tinyvue/src/api/user.ts (1)
62-65: Skip nullish filters and remove ESLint suppression (no-continue)
Current guard only handles undefined and requires disabling no-continue. Recommend handling both null/undefined and restructuring to avoid continue and the linter disable.- if (value === undefined) { - // eslint-disable-next-line no-continue - continue; - } - if (value.type === 'enum') { + // Skip nullish filter entries + if (value == null) { + // do nothing + } else if (value.type === 'enum') { if (Array.isArray(value.value) && value.value.length) { params.set(key, value.value.toString()); } } - if (value.type === 'input' && !Array.isArray(value.value)) { + if (value && value.type === 'input' && !Array.isArray(value.value)) { let sql = `${value.value.relation === 'contains' ? '%' : ''}${value.value.text}${value.value.relation === 'startwith' || value.value.relation === 'contains' ? '%' : ''}`; params.set(key, sql); }Also applies to: 66-75
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
template/tinyvue/src/api/user.ts(1 hunks)template/tinyvue/src/views/userManager/info/components/info-tab.vue(1 hunks)
🔇 Additional comments (1)
template/tinyvue/src/views/userManager/info/components/info-tab.vue (1)
546-549: RenameroleIdstorolevia key mapping
UseObject.fromEntries(Object.entries(filters ?? {}).map(([k,v]) => [k==='roleIds'?'role':k, v]))to droproleIdsand emit onlyrole. Confirm the request URL containsrole=…and noroleIds.
* style: remove console.log (#57) * feat: change the style of the home page and menu page (#51) * feat: change the style of the home page and menu page * feat: revise inspection comments * feat: Optimize the query table page, add corresponding functions, and modify the overall margin layout of Pro (#50) * feat: 优化查询表格页面,增加相应功能,修改pro整体边距布局 * feat: 优化数据算法 * fix: 根据意见修改页面查询表格、用户管理、国际化管理页面 (#59) * fix: 根据意见修改页面查询表格、用户管理、国际化管理页面 * fix: 统一分页pageSizes配置 * fix:修复刷新后表单数据丢失导致校验报错 (#58) * fix:表单校验以及分页条目修改 (#61) * feat: 监控页样式修改和解决初始化问题 (#60) * feat: change the style of the home page and menu page * feat: revise inspection comments * feat: 监控页样式修改和解决初始化问题 * feat: 修改表格pageSizes格式 * fix: 表格和弹出框优化 (#62) * fix: 表格和弹出框优化 * fix: 增加国际化 * feat: 解决查看菜单下级不能展开的问题 (#63) * fix:i18n (#70) * fix(web): data struct (#76) * fix(web): select change (#81) * fix(web): select change * feat: uncomment search-box style * fix(tiny-vue): user-manageer info-tab role id select * fix(tiny-pro): if role id is undefined will send empty array not [null] (#83) * fix(nestJS): added lost permissions (#89) * fix(web): if not batch-remove should not display i18n or user batch-remove button (#90) * chore: add `--no-frozen-lockfile` (#91) * chore: release v1.3.0 (#95) * fix:历史记录功能恢复 (#98) * fix: fix tabs style (#100) * fix(web): role table pager (#97) * fix(web): role table pager * chore: change default page-size to `10` * fix(web): role filter (#99) * feat: 支持初始化低代码设计器 --------- Co-authored-by: GaoNeng <31283122+GaoNeng-wWw@users.noreply.github.com> Co-authored-by: wuyiping <42107997+wuyiping0628@users.noreply.github.com> Co-authored-by: chenxi-20 <2465950588@qq.com> Co-authored-by: liukun <953831480@qq.com> Co-authored-by: Kagol <kagol@sina.com>
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
后端根据角色筛选的时候需要的是role而不是roleIds
Issue Number: N/A
What is the new behavior?
将,roleIds改为role
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit