Skip to content

feat(system/client): 添加双token认证配置#85

Open
luoqiz wants to merge 1 commit into
continew-org:devfrom
luoqiz:feat-refresh-token
Open

feat(system/client): 添加双token认证配置#85
luoqiz wants to merge 1 commit into
continew-org:devfrom
luoqiz:feat-refresh-token

Conversation

@luoqiz
Copy link
Copy Markdown
Contributor

@luoqiz luoqiz commented Apr 24, 2026

PR 类型

  • 新 feature
  • Bug 修复
  • 功能增强
  • 文档变更
  • 代码样式变更
  • 重构
  • 性能改进
  • 单元测试
  • CI/CD
  • 其他

PR 目的

解决方案

PR 测试

Changelog

模块 Changelog Related issues

其他信息

提交前确认

  • PR 代码经过了完整测试,并且通过了代码规范检查
  • 已经完整填写 Changelog,并链接到了相关 issues
  • PR 代码将要提交到 dev 分支

Summary by CodeRabbit

发布说明

  • 新功能
    • 新增客户端刷新令牌配置功能,支持启用或禁用刷新令牌。
    • 新增刷新令牌有效期配置项。
    • 客户端列表和详情视图现可展示刷新令牌配置信息。

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 24, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

📝 Walkthrough

Walkthrough

此PR向客户端配置系统添加了刷新令牌功能支持,包括类型定义扩展、表单字段添加、详情页面显示和列表列配置更新。

Changes

Cohort / File(s) Summary
API类型定义
src/apis/system/type.ts
扩展 ClientRespClientDetailResp 接口,添加 isEnableRefreshToken 布尔字段和 refreshTokenTimeout 数字字段。
客户端配置表单
src/views/system/config/client/AddModal.vue
向表单添加两个新字段:isEnableRefreshToken 开关(默认值 false)和 refreshTokenTimeout 数字输入框(默认值 2592000)、包含验证和辅助提示。
显示组件
src/views/system/config/client/DetailDrawer.vue, src/views/system/config/client/index.vue
在详情抽屉中显示刷新令牌配置信息,在列表中新增两列:刷新令牌启用状态(是/否)和有效期(秒数);调整表格最小宽度从1400增至1760。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 刷新令牌功能来,
表单字段齐上阵,
类型结构已扩展,
列表详情都闪耀,
配置管理更完善!✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed PR标题准确反映了变更的主要内容,即为客户端系统添加双token认证配置功能,包括isEnableRefreshToken和refreshTokenTimeout两个新字段。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
src/views/system/config/client/DetailDrawer.vue (2)

17-17: 建议为 refreshTokenTimeout 补充单位并处理特殊值语义。

  • 同一字段在 index.vue 表格列中以 ${refreshTokenTimeout} 秒 形式渲染(见 src/views/system/config/client/index.vue Line 153),此处直接输出数字会造成跨页面展示格式不一致。
  • AddModal.vue 的 tooltip 明确写到 “小于0,则和 Token 有效期相同”(Line 138)。若后端可能持久化负值,直接显示 -1 等原始数字对用户不友好,建议与录入端语义保持一致。
♻️ 建议修改
-      <a-descriptions-item label="Refresh Token 有效期">{{ dataDetail?.refreshTokenTimeout }}</a-descriptions-item>
+      <a-descriptions-item label="Refresh Token 有效期">
+        {{ (dataDetail?.refreshTokenTimeout ?? 0) < 0 ? '与 Token 有效期一致' : `${dataDetail?.refreshTokenTimeout} 秒` }}
+      </a-descriptions-item>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/views/system/config/client/DetailDrawer.vue` at line 17, The
DetailDrawer.vue currently renders refreshTokenTimeout as a raw number; make it
consistent with index.vue and AddModal.vue by appending the unit ("秒") when the
value is non-negative and mapping special/negative values to the same semantic
text used in AddModal (e.g., display "与 Token 有效期相同" or an equivalent label when
refreshTokenTimeout < 0). Update the rendering logic in DetailDrawer.vue (the
a-descriptions-item for refreshTokenTimeout) to check
dataDetail?.refreshTokenTimeout, format non-negative numbers as `${value} 秒`,
and render the semantic string for negative values to match AddModal.vue and
index.vue behavior.

16-16: 文案一致性建议。

AddModal.vue 中对应表单项 label 为 “是否启用Refresh Token”(Line 124),而此处及 index.vue 列标题为 “启用Refresh Token”。三处展示同一字段,建议统一措辞以减少认知负担。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/views/system/config/client/DetailDrawer.vue` at line 16, The labels for
the same field are inconsistent across components: update the label in
DetailDrawer.vue's a-descriptions-item (currently "启用Refresh Token") to match
AddModal.vue's "是否启用Refresh Token" and also update the corresponding column
title in index.vue so all three places use the identical phrasing; locate the
template element <a-descriptions-item label="启用Refresh Token"> in
DetailDrawer.vue and the column definition in index.vue and replace their
label/title text with "是否启用Refresh Token" to ensure consistent wording.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/views/system/config/client/AddModal.vue`:
- Around line 123-155: The refreshTokenTimeout field must be tied to the
isEnableRefreshToken switch and have proper value validation: add disabled: ()
=> !formModel.isEnableRefreshToken (same pattern as replacedRange/maxLoginCount)
so the input is readonly/disabled when isEnableRefreshToken is false, and update
its rules to include a validator (like maxLoginCount's validator) that enforces
an integer value and disallows 0 (allow negatives per the tooltip for "less than
0 means same as Token timeout") and set props.min to -Infinity or a sensible min
(e.g. -1) to prevent invalid positives; also ensure the submit path
(addClient/updateClient) does not send refreshTokenTimeout when
isEnableRefreshToken is false (clear or omit the field before sending).

In `@src/views/system/config/client/index.vue`:
- Around line 152-153: Update the two column render functions for
isEnableRefreshToken and refreshTokenTimeout: for the isEnableRefreshToken
column (render for record.isEnableRefreshToken) return the boolean ternary
directly (record.isEnableRefreshToken ? '是' : '否') instead of wrapping in a
template string; for the refreshTokenTimeout column, if
record.isEnableRefreshToken is false return an empty string or a placeholder
(e.g. '-') and otherwise render a semantic label when record.refreshTokenTimeout
< 0 (e.g. '与 Token 有效期一致') instead of showing raw '-1 秒', otherwise render
`${record.refreshTokenTimeout} 秒`; ensure these changes are applied to the
column render functions in index.vue and align them with the AddModal.vue
semantics.

---

Nitpick comments:
In `@src/views/system/config/client/DetailDrawer.vue`:
- Line 17: The DetailDrawer.vue currently renders refreshTokenTimeout as a raw
number; make it consistent with index.vue and AddModal.vue by appending the unit
("秒") when the value is non-negative and mapping special/negative values to the
same semantic text used in AddModal (e.g., display "与 Token 有效期相同" or an
equivalent label when refreshTokenTimeout < 0). Update the rendering logic in
DetailDrawer.vue (the a-descriptions-item for refreshTokenTimeout) to check
dataDetail?.refreshTokenTimeout, format non-negative numbers as `${value} 秒`,
and render the semantic string for negative values to match AddModal.vue and
index.vue behavior.
- Line 16: The labels for the same field are inconsistent across components:
update the label in DetailDrawer.vue's a-descriptions-item (currently "启用Refresh
Token") to match AddModal.vue's "是否启用Refresh Token" and also update the
corresponding column title in index.vue so all three places use the identical
phrasing; locate the template element <a-descriptions-item label="启用Refresh
Token"> in DetailDrawer.vue and the column definition in index.vue and replace
their label/title text with "是否启用Refresh Token" to ensure consistent wording.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3bbff9a4-9c91-41f3-a809-cfd060fcdab8

📥 Commits

Reviewing files that changed from the base of the PR and between c81be19 and 5f065bf.

📒 Files selected for processing (4)
  • src/apis/system/type.ts
  • src/views/system/config/client/AddModal.vue
  • src/views/system/config/client/DetailDrawer.vue
  • src/views/system/config/client/index.vue

Comment thread src/views/system/config/client/AddModal.vue
Comment thread src/views/system/config/client/index.vue
@luoqiz luoqiz force-pushed the feat-refresh-token branch from 5f065bf to 2861b5d Compare April 24, 2026 03:10
@luoqiz luoqiz force-pushed the feat-refresh-token branch from 2861b5d to c4440b3 Compare April 24, 2026 03:21
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.

2 participants